Merge "Allow grids to specify if we should start align taskbar in 3 button nav." into tm-qpr-dev am: 65ac592f40

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/22361600

Change-Id: I71c7f33286ccfa770f87b812c8ec27fa4ecb25ed
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
TreeHugger Robot
2023-04-05 22:06:49 +00:00
committed by Automerger Merge Worker
9 changed files with 65 additions and 71 deletions
@@ -57,7 +57,8 @@ import java.util.function.Predicate;
/**
* Hosts the Taskbar content such as Hotseat and Recent Apps. Drawn on top of other apps.
*/
public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconParent, Insettable {
public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconParent, Insettable,
DeviceProfile.OnDeviceProfileChangeListener {
private static final String TAG = TaskbarView.class.getSimpleName();
private static final Rect sTmpRect = new Rect();
@@ -92,7 +93,7 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
private float mTransientTaskbarAllAppsButtonTranslationXOffset;
private final boolean mShouldTryStartAlign;
private boolean mShouldTryStartAlign;
public TaskbarView(@NonNull Context context) {
this(context, null);
@@ -121,8 +122,8 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
resources.getDimension(isTransientTaskbar
? R.dimen.transient_taskbar_all_apps_button_translation_x_offset
: R.dimen.taskbar_all_apps_button_translation_x_offset);
mShouldTryStartAlign = mActivityContext.isThreeButtonNav()
&& resources.getBoolean(R.bool.start_align_taskbar);
onDeviceProfileChanged(mActivityContext.getDeviceProfile());
int actualMargin = resources.getDimensionPixelSize(R.dimen.taskbar_icon_spacing);
int actualIconSize = mActivityContext.getDeviceProfile().taskbarIconSize;
@@ -161,6 +162,23 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
mQsb = LayoutInflater.from(context).inflate(R.layout.search_container_hotseat, this, false);
}
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
mActivityContext.addOnDeviceProfileChangeListener(this);
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
mActivityContext.removeOnDeviceProfileChangeListener(this);
}
@Override
public void onDeviceProfileChanged(DeviceProfile dp) {
mShouldTryStartAlign = mActivityContext.isThreeButtonNav() && dp.startAlignTaskbar;
}
@Override
public boolean performAccessibilityActionInternal(int action, Bundle arguments) {
if (action == AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS) {