mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-04 18:06:48 +00:00
Scale Icon badges for shortcut and widgets
Test: Manual Bug: 141262820 Change-Id: I03edc986e3fe1876b6b7ed179b96864d587cb137
This commit is contained in:
@@ -37,6 +37,7 @@ import com.android.launcher3.SimpleOnStylusPressListener;
|
||||
import com.android.launcher3.StylusEventHelper;
|
||||
import com.android.launcher3.WidgetPreviewLoader;
|
||||
import com.android.launcher3.graphics.DrawableFactory;
|
||||
import com.android.launcher3.icons.BaseIconFactory;
|
||||
import com.android.launcher3.model.WidgetItem;
|
||||
|
||||
/**
|
||||
@@ -80,6 +81,7 @@ public class WidgetCell extends LinearLayout implements OnLayoutChangeListener {
|
||||
private Bitmap mDeferredBitmap;
|
||||
|
||||
protected final BaseActivity mActivity;
|
||||
protected DeviceProfile mDeviceProfile;
|
||||
|
||||
public WidgetCell(Context context) {
|
||||
this(context, null);
|
||||
@@ -93,6 +95,7 @@ public class WidgetCell extends LinearLayout implements OnLayoutChangeListener {
|
||||
super(context, attrs, defStyle);
|
||||
|
||||
mActivity = BaseActivity.fromContext(context);
|
||||
mDeviceProfile = mActivity.getDeviceProfile();
|
||||
mStylusEventHelper = new StylusEventHelper(new SimpleOnStylusPressListener(this), this);
|
||||
|
||||
setContainerWidth();
|
||||
@@ -102,8 +105,7 @@ public class WidgetCell extends LinearLayout implements OnLayoutChangeListener {
|
||||
}
|
||||
|
||||
private void setContainerWidth() {
|
||||
DeviceProfile profile = mActivity.getDeviceProfile();
|
||||
mCellSize = (int) (profile.allAppsCellWidthPx * WIDTH_SCALE);
|
||||
mCellSize = (int) (mDeviceProfile.allAppsCellWidthPx * WIDTH_SCALE);
|
||||
mPresetPreviewSize = (int) (mCellSize * PREVIEW_SCALE);
|
||||
}
|
||||
|
||||
@@ -180,8 +182,10 @@ public class WidgetCell extends LinearLayout implements OnLayoutChangeListener {
|
||||
return;
|
||||
}
|
||||
if (bitmap != null) {
|
||||
mWidgetImage.setBitmap(bitmap, DrawableFactory.INSTANCE.get(getContext())
|
||||
.getBadgeForUser(mItem.user, getContext()));
|
||||
mWidgetImage.setBitmap(bitmap,
|
||||
DrawableFactory.INSTANCE.get(getContext()).getBadgeForUser(mItem.user,
|
||||
getContext(), BaseIconFactory.getBadgeSizeForIconSize(
|
||||
mDeviceProfile.allAppsIconSizePx)));
|
||||
if (mAnimatePreview) {
|
||||
mWidgetImage.setAlpha(0f);
|
||||
ViewPropertyAnimator anim = mWidgetImage.animate();
|
||||
|
||||
Reference in New Issue
Block a user