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:
@@ -184,7 +184,7 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext>
|
||||
this, mActivityContext.getStatsLogManager());
|
||||
mAH = Arrays.asList(null, null, null);
|
||||
mNavBarScrimPaint = new Paint();
|
||||
mNavBarScrimPaint.setColor(Themes.getAttrColor(context, R.attr.allAppsNavBarScrimColor));
|
||||
mNavBarScrimPaint.setColor(Themes.getNavBarScrimColor(mActivityContext));
|
||||
|
||||
AllAppsStore.OnUpdateListener onAppsUpdated = this::onAppsUpdated;
|
||||
if (TestProtocol.sDebugTracing) {
|
||||
@@ -810,6 +810,12 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext>
|
||||
}
|
||||
}
|
||||
updateBackground(dp);
|
||||
|
||||
int navBarScrimColor = Themes.getNavBarScrimColor(mActivityContext);
|
||||
if (mNavBarScrimPaint.getColor() != navBarScrimColor) {
|
||||
mNavBarScrimPaint.setColor(navBarScrimColor);
|
||||
invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
protected void updateBackground(DeviceProfile deviceProfile) {
|
||||
|
||||
@@ -32,10 +32,13 @@ import android.util.AttributeSet;
|
||||
import android.util.SparseArray;
|
||||
import android.util.TypedValue;
|
||||
|
||||
import androidx.annotation.ColorInt;
|
||||
|
||||
import com.android.launcher3.LauncherPrefs;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.icons.GraphicsUtils;
|
||||
import com.android.launcher3.views.ActivityContext;
|
||||
|
||||
/**
|
||||
* Various utility methods associated with theming.
|
||||
@@ -198,4 +201,12 @@ public class Themes {
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/** Returns the desired navigation bar scrim color depending on the {@code DeviceProfile}. */
|
||||
@ColorInt
|
||||
public static <T extends Context & ActivityContext> int getNavBarScrimColor(T context) {
|
||||
return context.getDeviceProfile().isTaskbarPresent
|
||||
? context.getColor(R.color.taskbar_background)
|
||||
: Themes.getAttrColor(context, R.attr.allAppsNavBarScrimColor);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user