mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-04 18:06:48 +00:00
Add predictions row to taskbar all apps.
- We need to listen to DeviceProfile changes in case the number of columns changes in the grid. I made an interface/mixin separate from ActivityContext to avoid polutting the latter with too many things. I also applied this change to existing taskbar A-Z grid. - Added all apps visited count to onboarding preferences for only showing "All Apps" label in place of divider 20 times. Label is also tracked on taskbar side and should be kept in sync. Test: Manual Fix: 216843395 Bug: 174174514 Change-Id: I97aa91397c334123626caf18251f19e17c7104fb
This commit is contained in:
@@ -58,8 +58,11 @@ import androidx.annotation.Nullable;
|
||||
import com.android.launcher3.AbstractFloatingView;
|
||||
import com.android.launcher3.BubbleTextView;
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
import com.android.launcher3.DeviceProfile.DeviceProfileListenable;
|
||||
import com.android.launcher3.DeviceProfile.OnDeviceProfileChangeListener;
|
||||
import com.android.launcher3.LauncherSettings.Favorites;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.dot.DotInfo;
|
||||
import com.android.launcher3.folder.Folder;
|
||||
import com.android.launcher3.folder.FolderIcon;
|
||||
@@ -70,6 +73,7 @@ import com.android.launcher3.model.data.ItemInfo;
|
||||
import com.android.launcher3.model.data.WorkspaceItemInfo;
|
||||
import com.android.launcher3.popup.PopupDataProvider;
|
||||
import com.android.launcher3.touch.ItemClickHandler;
|
||||
import com.android.launcher3.util.OnboardingPrefs;
|
||||
import com.android.launcher3.util.PackageManagerHelper;
|
||||
import com.android.launcher3.util.SettingsCache;
|
||||
import com.android.launcher3.util.Themes;
|
||||
@@ -85,13 +89,16 @@ import com.android.systemui.shared.system.WindowManagerWrapper;
|
||||
import com.android.systemui.unfold.util.ScopedUnfoldTransitionProgressProvider;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The {@link ActivityContext} with which we inflate Taskbar-related Views. This allows UI elements
|
||||
* that are used by both Launcher and Taskbar (such as Folder) to reference a generic
|
||||
* ActivityContext and BaseDragLayer instead of the Launcher activity and its DragLayer.
|
||||
*/
|
||||
public class TaskbarActivityContext extends ContextThemeWrapper implements ActivityContext {
|
||||
public class TaskbarActivityContext extends ContextThemeWrapper implements ActivityContext,
|
||||
DeviceProfileListenable {
|
||||
|
||||
private static final boolean ENABLE_THREE_BUTTON_TASKBAR =
|
||||
SystemProperties.getBoolean("persist.debug.taskbar_three_button", false);
|
||||
@@ -103,6 +110,7 @@ public class TaskbarActivityContext extends ContextThemeWrapper implements Activ
|
||||
private final TaskbarDragLayer mDragLayer;
|
||||
private final TaskbarAllAppsContainerView mAppsView;
|
||||
private final TaskbarControllers mControllers;
|
||||
private final List<OnDeviceProfileChangeListener> mDPChangeListeners = new ArrayList<>();
|
||||
|
||||
private DeviceProfile mDeviceProfile;
|
||||
|
||||
@@ -123,14 +131,17 @@ public class TaskbarActivityContext extends ContextThemeWrapper implements Activ
|
||||
private boolean mIsDestroyed = false;
|
||||
// The flag to know if the window is excluded from magnification region computation.
|
||||
private boolean mIsExcludeFromMagnificationRegion = false;
|
||||
private boolean mBindingItems = false;
|
||||
|
||||
private final TaskbarShortcutMenuAccessibilityDelegate mAccessibilityDelegate;
|
||||
private final OnboardingPrefs<TaskbarActivityContext> mOnboardingPrefs;
|
||||
|
||||
public TaskbarActivityContext(Context windowContext, DeviceProfile dp,
|
||||
TaskbarNavButtonController buttonController, ScopedUnfoldTransitionProgressProvider
|
||||
unfoldTransitionProgressProvider) {
|
||||
super(windowContext, Themes.getActivityThemeRes(windowContext));
|
||||
mDeviceProfile = dp;
|
||||
mOnboardingPrefs = new OnboardingPrefs<>(this, Utilities.getPrefs(this));
|
||||
|
||||
mNavMode = SysUINavigationMode.getMode(windowContext);
|
||||
mIsSafeModeEnabled = TraceHelper.allowIpcs("isSafeMode",
|
||||
@@ -227,6 +238,7 @@ public class TaskbarActivityContext extends ContextThemeWrapper implements Activ
|
||||
public void updateDeviceProfile(DeviceProfile dp) {
|
||||
mDeviceProfile = dp;
|
||||
updateIconSize(getResources());
|
||||
dispatchDeviceProfileChanged();
|
||||
}
|
||||
|
||||
private void updateIconSize(Resources resources) {
|
||||
@@ -298,6 +310,11 @@ public class TaskbarActivityContext extends ContextThemeWrapper implements Activ
|
||||
return mDeviceProfile;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OnDeviceProfileChangeListener> getOnDeviceProfileChangeListeners() {
|
||||
return mDPChangeListeners;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Rect getFolderBoundingBox() {
|
||||
return mControllers.taskbarDragLayerController.getFolderBoundingBox();
|
||||
@@ -388,6 +405,20 @@ public class TaskbarActivityContext extends ContextThemeWrapper implements Activ
|
||||
return mAccessibilityDelegate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OnboardingPrefs<TaskbarActivityContext> getOnboardingPrefs() {
|
||||
return mOnboardingPrefs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBindingItems() {
|
||||
return mBindingItems;
|
||||
}
|
||||
|
||||
public void setBindingItems(boolean bindingItems) {
|
||||
mBindingItems = bindingItems;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a new data-source for this taskbar instance
|
||||
*/
|
||||
@@ -730,6 +761,8 @@ public class TaskbarActivityContext extends ContextThemeWrapper implements Activ
|
||||
"%s\tmIsUserSetupComplete=%b", prefix, mIsUserSetupComplete));
|
||||
pw.println(String.format(
|
||||
"%s\tmWindowLayoutParams.height=%dpx", prefix, mWindowLayoutParams.height));
|
||||
pw.println(String.format(
|
||||
"%s\tmBindInProgress=%b", prefix, mBindingItems));
|
||||
mControllers.dumpLogs(prefix + "\t", pw);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user