Merge "Adding listener support for color extraction changes Changing the apps-search layout to use theme attribute instead of hard coded layout id" into ub-launcher3-dorval-polish
This commit is contained in:
commit
9968ed0932
|
@ -59,13 +59,15 @@
|
||||||
<!-- Fast scroller popup -->
|
<!-- Fast scroller popup -->
|
||||||
<TextView
|
<TextView
|
||||||
style="@style/FastScrollerPopup"
|
style="@style/FastScrollerPopup"
|
||||||
android:layout_below="@+id/search_container"
|
android:layout_alignTop="@+id/apps_list_view"
|
||||||
android:id="@+id/fast_scroller_popup"
|
android:id="@+id/fast_scroller_popup"
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
android:layout_marginEnd="@dimen/container_fastscroll_popup_margin" />
|
android:layout_marginEnd="@dimen/container_fastscroll_popup_margin" />
|
||||||
|
|
||||||
|
<!-- Note: we are reusing/repurposing a system attribute for search layout, because of a
|
||||||
|
platform bug, which prevents using custom attributes in <include> tag -->
|
||||||
<include
|
<include
|
||||||
layout="@layout/all_apps_search_container"
|
layout="?android:attr/keyboardLayout"
|
||||||
android:id="@+id/search_container" />
|
android:id="@+id/search_container" />
|
||||||
|
|
||||||
</com.android.launcher3.allapps.AllAppsRecyclerViewContainerView>
|
</com.android.launcher3.allapps.AllAppsRecyclerViewContainerView>
|
||||||
|
|
|
@ -15,28 +15,28 @@
|
||||||
-->
|
-->
|
||||||
<com.android.launcher3.allapps.search.AppsSearchContainerLayout
|
<com.android.launcher3.allapps.search.AppsSearchContainerLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:id="@+id/search_container"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="@dimen/all_apps_search_bar_height"
|
android:layout_height="@dimen/all_apps_search_bar_height"
|
||||||
android:layout_gravity="center|top"
|
android:layout_gravity="center|top"
|
||||||
android:gravity="center|bottom"
|
android:gravity="center|bottom"
|
||||||
android:id="@+id/search_container"
|
|
||||||
android:saveEnabled="false">
|
android:saveEnabled="false">
|
||||||
|
|
||||||
<com.android.launcher3.ExtendedEditText
|
<com.android.launcher3.ExtendedEditText
|
||||||
android:id="@+id/search_box_input"
|
android:id="@+id/search_box_input"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="@dimen/all_apps_search_bar_field_height"
|
android:layout_height="@dimen/all_apps_search_bar_field_height"
|
||||||
android:background="@android:color/transparent"
|
|
||||||
android:layout_gravity="bottom"
|
android:layout_gravity="bottom"
|
||||||
|
android:background="@android:color/transparent"
|
||||||
android:focusableInTouchMode="true"
|
android:focusableInTouchMode="true"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
|
android:hint="@string/all_apps_search_bar_hint"
|
||||||
android:imeOptions="actionSearch|flagNoExtractUi"
|
android:imeOptions="actionSearch|flagNoExtractUi"
|
||||||
android:inputType="text|textNoSuggestions|textCapWords"
|
android:inputType="text|textNoSuggestions|textCapWords"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:scrollHorizontally="true"
|
android:scrollHorizontally="true"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:textColor="?android:attr/textColorSecondary"
|
android:textColor="?android:attr/textColorSecondary"
|
||||||
android:hint="@string/all_apps_search_bar_hint"
|
|
||||||
android:textColorHint="@drawable/all_apps_search_hint"
|
android:textColorHint="@drawable/all_apps_search_hint"
|
||||||
android:textSize="16sp" />
|
android:textSize="16sp" />
|
||||||
</com.android.launcher3.allapps.search.AppsSearchContainerLayout>
|
</com.android.launcher3.allapps.search.AppsSearchContainerLayout>
|
|
@ -26,6 +26,7 @@
|
||||||
<item name="android:windowNoTitle">true</item>
|
<item name="android:windowNoTitle">true</item>
|
||||||
<item name="android:windowActionModeOverlay">true</item>
|
<item name="android:windowActionModeOverlay">true</item>
|
||||||
<item name="android:colorEdgeEffect">?android:attr/textColorSecondary</item>
|
<item name="android:colorEdgeEffect">?android:attr/textColorSecondary</item>
|
||||||
|
<item name="android:keyboardLayout">@layout/all_apps_search_container</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<!-- Workspace -->
|
<!-- Workspace -->
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
<item name="android:windowShowWallpaper">true</item>
|
<item name="android:windowShowWallpaper">true</item>
|
||||||
<item name="android:windowNoTitle">true</item>
|
<item name="android:windowNoTitle">true</item>
|
||||||
<item name="android:colorEdgeEffect">#FF757575</item>
|
<item name="android:colorEdgeEffect">#FF757575</item>
|
||||||
|
<item name="android:keyboardLayout">@layout/all_apps_search_container</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="LauncherTheme" parent="@style/BaseLauncherTheme"></style>
|
<style name="LauncherTheme" parent="@style/BaseLauncherTheme"></style>
|
||||||
|
|
|
@ -212,6 +212,8 @@ public class Launcher extends BaseActivity
|
||||||
private static int NEW_APPS_ANIMATION_INACTIVE_TIMEOUT_SECONDS = 5;
|
private static int NEW_APPS_ANIMATION_INACTIVE_TIMEOUT_SECONDS = 5;
|
||||||
@Thunk static int NEW_APPS_ANIMATION_DELAY = 500;
|
@Thunk static int NEW_APPS_ANIMATION_DELAY = 500;
|
||||||
|
|
||||||
|
private final ExtractedColors mExtractedColors = new ExtractedColors();
|
||||||
|
|
||||||
@Thunk Workspace mWorkspace;
|
@Thunk Workspace mWorkspace;
|
||||||
private View mLauncherView;
|
private View mLauncherView;
|
||||||
@Thunk DragLayer mDragLayer;
|
@Thunk DragLayer mDragLayer;
|
||||||
|
@ -260,7 +262,6 @@ public class Launcher extends BaseActivity
|
||||||
private LauncherModel mModel;
|
private LauncherModel mModel;
|
||||||
private ModelWriter mModelWriter;
|
private ModelWriter mModelWriter;
|
||||||
private IconCache mIconCache;
|
private IconCache mIconCache;
|
||||||
private ExtractedColors mExtractedColors;
|
|
||||||
private LauncherAccessibilityDelegate mAccessibilityDelegate;
|
private LauncherAccessibilityDelegate mAccessibilityDelegate;
|
||||||
private Handler mHandler = new Handler();
|
private Handler mHandler = new Handler();
|
||||||
private boolean mIsResumeFromActionScreenOff;
|
private boolean mIsResumeFromActionScreenOff;
|
||||||
|
@ -392,11 +393,10 @@ public class Launcher extends BaseActivity
|
||||||
// LauncherModel load.
|
// LauncherModel load.
|
||||||
mPaused = false;
|
mPaused = false;
|
||||||
|
|
||||||
mLauncherView = getLayoutInflater().inflate(R.layout.launcher, null);
|
mLauncherView = LayoutInflater.from(this).inflate(R.layout.launcher, null);
|
||||||
|
|
||||||
setupViews();
|
setupViews();
|
||||||
mDeviceProfile.layout(this, false /* notifyListeners */);
|
mDeviceProfile.layout(this, false /* notifyListeners */);
|
||||||
mExtractedColors = new ExtractedColors();
|
|
||||||
loadExtractedColorsAndColorItems();
|
loadExtractedColorsAndColorItems();
|
||||||
|
|
||||||
mPopupDataProvider = new PopupDataProvider(this);
|
mPopupDataProvider = new PopupDataProvider(this);
|
||||||
|
@ -465,12 +465,7 @@ public class Launcher extends BaseActivity
|
||||||
@Override
|
@Override
|
||||||
public void onExtractedColorsChanged() {
|
public void onExtractedColorsChanged() {
|
||||||
loadExtractedColorsAndColorItems();
|
loadExtractedColorsAndColorItems();
|
||||||
if (mAllAppsController != null) {
|
mExtractedColors.notifyChange();
|
||||||
mAllAppsController.onExtractedColorsChanged();
|
|
||||||
}
|
|
||||||
if (mLauncherCallbacks != null) {
|
|
||||||
mLauncherCallbacks.onExtractedColorsChanged();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ExtractedColors getExtractedColors() {
|
public ExtractedColors getExtractedColors() {
|
||||||
|
|
|
@ -97,6 +97,4 @@ public interface LauncherCallbacks {
|
||||||
int getSearchBarHeight();
|
int getSearchBarHeight();
|
||||||
|
|
||||||
boolean shouldShowDiscoveryBounce();
|
boolean shouldShowDiscoveryBounce();
|
||||||
|
|
||||||
void onExtractedColorsChanged();
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ import com.android.launcher3.util.TouchController;
|
||||||
* closer to top or closer to the page indicator.
|
* closer to top or closer to the page indicator.
|
||||||
*/
|
*/
|
||||||
public class AllAppsTransitionController implements TouchController, VerticalPullDetector.Listener,
|
public class AllAppsTransitionController implements TouchController, VerticalPullDetector.Listener,
|
||||||
View.OnLayoutChangeListener {
|
View.OnLayoutChangeListener, ExtractedColors.OnChangeListener {
|
||||||
|
|
||||||
private static final String TAG = "AllAppsTrans";
|
private static final String TAG = "AllAppsTrans";
|
||||||
private static final boolean DBG = false;
|
private static final boolean DBG = false;
|
||||||
|
@ -107,6 +107,7 @@ public class AllAppsTransitionController implements TouchController, VerticalPul
|
||||||
|
|
||||||
mEvaluator = new ArgbEvaluator();
|
mEvaluator = new ArgbEvaluator();
|
||||||
mAllAppsBackgroundColor = Themes.getAttrColor(l, android.R.attr.colorPrimary);
|
mAllAppsBackgroundColor = Themes.getAttrColor(l, android.R.attr.colorPrimary);
|
||||||
|
mLauncher.getExtractedColors().addOnChangeListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -288,6 +289,7 @@ public class AllAppsTransitionController implements TouchController, VerticalPul
|
||||||
mScrimView.setProgress(progress);
|
mScrimView.setProgress(progress);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void onExtractedColorsChanged() {
|
public void onExtractedColorsChanged() {
|
||||||
if (FeatureFlags.LAUNCHER3_GRADIENT_ALL_APPS) {
|
if (FeatureFlags.LAUNCHER3_GRADIENT_ALL_APPS) {
|
||||||
if (mGradientView != null) {
|
if (mGradientView != null) {
|
||||||
|
|
|
@ -195,6 +195,8 @@ public class AlphabeticalAppsList {
|
||||||
private int mNumPredictedAppsPerRow;
|
private int mNumPredictedAppsPerRow;
|
||||||
private int mNumAppRowsInAdapter;
|
private int mNumAppRowsInAdapter;
|
||||||
|
|
||||||
|
private boolean mHasSearchDivider = true;
|
||||||
|
|
||||||
public AlphabeticalAppsList(Context context) {
|
public AlphabeticalAppsList(Context context) {
|
||||||
mLauncher = Launcher.getLauncher(context);
|
mLauncher = Launcher.getLauncher(context);
|
||||||
mIndexer = new AlphabeticIndexCompat(context);
|
mIndexer = new AlphabeticIndexCompat(context);
|
||||||
|
@ -343,6 +345,10 @@ public class AlphabeticalAppsList {
|
||||||
onAppsUpdated();
|
onAppsUpdated();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void disableSearchDivider() {
|
||||||
|
mHasSearchDivider = false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates internals when the set of apps are updated.
|
* Updates internals when the set of apps are updated.
|
||||||
*/
|
*/
|
||||||
|
@ -429,8 +435,10 @@ public class AlphabeticalAppsList {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the search divider
|
if (mHasSearchDivider) {
|
||||||
mAdapterItems.add(AdapterItem.asSearchDivider(position++));
|
// Add the search divider
|
||||||
|
mAdapterItems.add(AdapterItem.asSearchDivider(position++));
|
||||||
|
}
|
||||||
|
|
||||||
// Process the predicted app components
|
// Process the predicted app components
|
||||||
mPredictedApps.clear();
|
mPredictedApps.clear();
|
||||||
|
|
|
@ -28,6 +28,7 @@ import com.android.launcher3.Utilities;
|
||||||
import com.android.launcher3.config.FeatureFlags;
|
import com.android.launcher3.config.FeatureFlags;
|
||||||
import com.android.launcher3.dynamicui.colorextraction.ColorExtractor;
|
import com.android.launcher3.dynamicui.colorextraction.ColorExtractor;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -82,6 +83,7 @@ public class ExtractedColors {
|
||||||
|
|
||||||
private static final String COLOR_SEPARATOR = ",";
|
private static final String COLOR_SEPARATOR = ",";
|
||||||
|
|
||||||
|
private final ArrayList<OnChangeListener> mListeners = new ArrayList<>();
|
||||||
private final int[] mColors;
|
private final int[] mColors;
|
||||||
|
|
||||||
public ExtractedColors() {
|
public ExtractedColors() {
|
||||||
|
@ -176,4 +178,22 @@ public class ExtractedColors {
|
||||||
setColorAtIndex(ALLAPPS_GRADIENT_SECONDARY_INDEX, Color.WHITE);
|
setColorAtIndex(ALLAPPS_GRADIENT_SECONDARY_INDEX, Color.WHITE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void addOnChangeListener(OnChangeListener listener) {
|
||||||
|
mListeners.add(listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void notifyChange() {
|
||||||
|
for (OnChangeListener listener : mListeners) {
|
||||||
|
listener.onExtractedColorsChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interface for listening for extracted color changes
|
||||||
|
*/
|
||||||
|
public interface OnChangeListener {
|
||||||
|
|
||||||
|
void onExtractedColorsChanged();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -219,8 +219,5 @@ public class LauncherExtension extends Launcher {
|
||||||
public boolean shouldShowDiscoveryBounce() {
|
public boolean shouldShowDiscoveryBounce() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onExtractedColorsChanged() { }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue