Make navbar scrim taskbar background if taskbar is enabled.

This ensures the navbar buttons are visible on large screens where All
Apps or Widgets picker are bottom sheets.

Test: Scrim is taskbar background color on devices with taskbar.
Bug: 264463659
Change-Id: I37890c0f542db625f9aeae7648bbaed064c4d240
This commit is contained in:
Brian Isganitis
2023-03-31 16:40:49 -04:00
parent d48a6fb4b7
commit 13e672aa76
3 changed files with 32 additions and 3 deletions

View File

@@ -37,6 +37,7 @@ import androidx.annotation.Px;
import androidx.core.view.ViewCompat;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.DeviceProfile.OnDeviceProfileChangeListener;
import com.android.launcher3.DragSource;
import com.android.launcher3.DropTarget.DragObject;
import com.android.launcher3.Insettable;
@@ -60,7 +61,7 @@ import com.android.launcher3.views.ArrowTipView;
*/
public abstract class BaseWidgetSheet extends AbstractSlideInView<Launcher>
implements OnClickListener, OnLongClickListener, DragSource,
PopupDataProvider.PopupDataChangeListener, Insettable {
PopupDataProvider.PopupDataChangeListener, Insettable, OnDeviceProfileChangeListener {
/** The default number of cells that can fit horizontally in a widget sheet. */
public static final int DEFAULT_MAX_HORIZONTAL_SPANS = 4;
@@ -84,7 +85,7 @@ public abstract class BaseWidgetSheet extends AbstractSlideInView<Launcher>
mWidgetCellHorizontalPadding = getResources().getDimensionPixelSize(
R.dimen.widget_cell_horizontal_padding);
mNavBarScrimPaint = new Paint();
mNavBarScrimPaint.setColor(Themes.getAttrColor(context, R.attr.allAppsNavBarScrimColor));
mNavBarScrimPaint.setColor(Themes.getNavBarScrimColor(mActivityContext));
}
protected int getScrimColor(Context context) {
@@ -98,12 +99,23 @@ public abstract class BaseWidgetSheet extends AbstractSlideInView<Launcher>
.normalizeWindowInsets(getContext(), getRootWindowInsets(), new Rect());
mNavBarScrimHeight = getNavBarScrimHeight(windowInsets);
mActivityContext.getPopupDataProvider().setChangeListener(this);
mActivityContext.addOnDeviceProfileChangeListener(this);
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
mActivityContext.getPopupDataProvider().setChangeListener(null);
mActivityContext.removeOnDeviceProfileChangeListener(this);
}
@Override
public void onDeviceProfileChanged(DeviceProfile dp) {
int navBarScrimColor = Themes.getNavBarScrimColor(mActivityContext);
if (mNavBarScrimPaint.getColor() != navBarScrimColor) {
mNavBarScrimPaint.setColor(navBarScrimColor);
invalidate();
}
}
@Override