Merge "Update scrim in widget pickers." into sc-dev am: c599c90eaa am: 2882bf5180
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/14776603 Change-Id: I6e1d10c7dbac9e8e062badad6b68e63dd709bd3e
This commit is contained in:
@@ -59,6 +59,7 @@ import com.android.launcher3.pm.PinRequestHelper;
|
||||
import com.android.launcher3.util.SystemUiController;
|
||||
import com.android.launcher3.views.AbstractSlideInView;
|
||||
import com.android.launcher3.views.BaseDragLayer;
|
||||
import com.android.launcher3.widget.AddItemWidgetsBottomSheet;
|
||||
import com.android.launcher3.widget.LauncherAppWidgetHost;
|
||||
import com.android.launcher3.widget.LauncherAppWidgetProviderInfo;
|
||||
import com.android.launcher3.widget.NavigableAppWidgetHostView;
|
||||
@@ -89,6 +90,7 @@ public class AddItemActivity extends BaseActivity
|
||||
private LauncherAppState mApp;
|
||||
private InvariantDeviceProfile mIdp;
|
||||
private BaseDragLayer<AddItemActivity> mDragLayer;
|
||||
private AddItemWidgetsBottomSheet mSlideInView;
|
||||
|
||||
private WidgetCell mWidgetCell;
|
||||
|
||||
@@ -124,8 +126,6 @@ public class AddItemActivity extends BaseActivity
|
||||
mDragLayer = findViewById(R.id.add_item_drag_layer);
|
||||
mDragLayer.recreateControllers();
|
||||
mDragLayer.setInsets(mDeviceProfile.getInsets());
|
||||
AbstractSlideInView<AddItemActivity> slideInView = findViewById(R.id.add_item_bottom_sheet);
|
||||
slideInView.addOnCloseListener(this);
|
||||
mWidgetCell = findViewById(R.id.widget_cell);
|
||||
|
||||
if (mRequest.getRequestType() == PinItemRequest.REQUEST_TYPE_SHORTCUT) {
|
||||
@@ -151,6 +151,9 @@ public class AddItemActivity extends BaseActivity
|
||||
TextView widgetAppName = findViewById(R.id.widget_appName);
|
||||
widgetAppName.setText(getApplicationInfo().labelRes);
|
||||
|
||||
mSlideInView = findViewById(R.id.add_item_bottom_sheet);
|
||||
mSlideInView.addOnCloseListener(this);
|
||||
mSlideInView.show();
|
||||
setupNavBarColor();
|
||||
}
|
||||
|
||||
@@ -279,7 +282,7 @@ public class AddItemActivity extends BaseActivity
|
||||
*/
|
||||
public void onCancelClick(View v) {
|
||||
logCommand(LAUNCHER_ADD_EXTERNAL_ITEM_CANCELLED);
|
||||
finish();
|
||||
mSlideInView.close(/* animate= */ true);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -290,7 +293,7 @@ public class AddItemActivity extends BaseActivity
|
||||
ItemInstallQueue.INSTANCE.get(this).queueItem(mRequest.getShortcutInfo());
|
||||
logCommand(LAUNCHER_ADD_EXTERNAL_ITEM_PLACED_AUTOMATICALLY);
|
||||
mRequest.accept();
|
||||
finish();
|
||||
mSlideInView.close(/* animate= */ true);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -313,7 +316,7 @@ public class AddItemActivity extends BaseActivity
|
||||
mWidgetOptions.putInt(AppWidgetManager.EXTRA_APPWIDGET_ID, widgetId);
|
||||
mRequest.accept(mWidgetOptions);
|
||||
logCommand(LAUNCHER_ADD_EXTERNAL_ITEM_PLACED_AUTOMATICALLY);
|
||||
finish();
|
||||
mSlideInView.close(/* animate= */ true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -35,8 +35,6 @@ public class WidgetsEduView extends AbstractSlideInView<Launcher> implements Ins
|
||||
|
||||
private static final int DEFAULT_CLOSE_DURATION = 200;
|
||||
|
||||
protected static final int FINAL_SCRIM_BG_COLOR = 0x88000000;
|
||||
|
||||
private Rect mInsets = new Rect();
|
||||
private View mEduView;
|
||||
|
||||
@@ -87,7 +85,7 @@ public class WidgetsEduView extends AbstractSlideInView<Launcher> implements Ins
|
||||
|
||||
@Override
|
||||
protected int getScrimColor(Context context) {
|
||||
return FINAL_SCRIM_BG_COLOR;
|
||||
return context.getResources().getColor(R.color.widgets_picker_scrim);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -23,8 +23,11 @@ import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.Rect;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewParent;
|
||||
|
||||
import com.android.launcher3.Insettable;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.dragndrop.AddItemActivity;
|
||||
import com.android.launcher3.views.AbstractSlideInView;
|
||||
|
||||
@@ -48,6 +51,17 @@ public class AddItemWidgetsBottomSheet extends AbstractSlideInView<AddItemActivi
|
||||
mContent = this;
|
||||
mInsets = new Rect();
|
||||
mCurrentConfiguration = new Configuration(getResources().getConfiguration());
|
||||
}
|
||||
|
||||
/**
|
||||
* Attaches to activity container and animates open the bottom sheet.
|
||||
*/
|
||||
public void show() {
|
||||
ViewParent parent = getParent();
|
||||
if (parent instanceof ViewGroup) {
|
||||
((ViewGroup) parent).removeView(this);
|
||||
}
|
||||
attachToContainer();
|
||||
animateOpen();
|
||||
}
|
||||
|
||||
@@ -95,4 +109,9 @@ public class AddItemWidgetsBottomSheet extends AbstractSlideInView<AddItemActivi
|
||||
}
|
||||
mCurrentConfiguration.updateFrom(newConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getScrimColor(Context context) {
|
||||
return context.getResources().getColor(R.color.widgets_picker_scrim);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
*/
|
||||
package com.android.launcher3.widget;
|
||||
|
||||
import static com.android.launcher3.icons.GraphicsUtils.setColorAlphaBound;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Point;
|
||||
import android.graphics.Rect;
|
||||
@@ -62,8 +60,7 @@ public abstract class BaseWidgetSheet extends AbstractSlideInView<Launcher>
|
||||
}
|
||||
|
||||
protected int getScrimColor(Context context) {
|
||||
int alpha = context.getResources().getInteger(R.integer.extracted_color_gradient_alpha);
|
||||
return setColorAlphaBound(context.getColor(R.color.wallpaper_popup_scrim), alpha);
|
||||
return context.getResources().getColor(R.color.widgets_picker_scrim);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user