Loading src/com/android/settings/cyanogenmod/LockscreenTargets.java +15 −4 Original line number Diff line number Diff line Loading @@ -361,13 +361,22 @@ public class LockscreenTargets extends Fragment implements activeLayer.setDrawableByLayerId(0, new InsetDrawable(activeBack, 0, 0, 0, 0)); } item.defaultIcon = mDialogIcon.getDrawable(); item.defaultIcon = getPickedIconFromDialog(); item.uri = uri; item.iconType = iconType; item.iconSource = iconSource; item.packageName = packageName; } private Drawable getPickedIconFromDialog() { return mDialogIcon.getDrawable().mutate(); } private void setIconForDialog(Drawable icon) { // need to mutate the drawable here to not share drawable state with GlowPadView mDialogIcon.setImageDrawable(icon.getConstantState().newDrawable().mutate()); } @Override public void shortcutPicked(String uri, String friendlyName, boolean isApplication) { try { Loading @@ -376,6 +385,7 @@ public class LockscreenTargets extends Fragment implements mDialogLabel.setText(friendlyName); mDialogLabel.setTag(uri); // this is a fresh drawable, so we can assign it directly mDialogIcon.setImageDrawable(icon); mDialogIcon.setTag(null); } catch (URISyntaxException e) { Loading @@ -394,6 +404,7 @@ public class LockscreenTargets extends Fragment implements mDialogLabel.setText(mEmptyLabel); mDialogLabel.setTag(GlowPadView.EMPTY_TARGET); mDialogIcon.setImageResource(R.drawable.ic_empty); mDialogIcon.setTag(null); } else if (requestCode == IconPicker.REQUEST_PICK_SYSTEM || requestCode == IconPicker.REQUEST_PICK_GALLERY || requestCode == IconPicker.REQUEST_PICK_ICON_PACK) { Loading Loading @@ -432,7 +443,7 @@ public class LockscreenTargets extends Fragment implements String packageName = info != null ? info.packageName : null; int inset = LockscreenTargetUtils.getInsetForIconType(mActivity, type); InsetDrawable drawable = new InsetDrawable(mDialogIcon.getDrawable(), InsetDrawable drawable = new InsetDrawable(getPickedIconFromDialog(), inset, inset, inset, inset); setTarget(mTargetIndex, mDialogLabel.getTag().toString(), drawable, type, source, packageName); Loading Loading @@ -474,7 +485,7 @@ public class LockscreenTargets extends Fragment implements mDialogLabel = (Button) view.findViewById(R.id.label); TargetInfo item = mTargetStore.get(target); mDialogIcon.setImageDrawable(item.defaultIcon); setIconForDialog(item.defaultIcon); TargetInfo icon = new TargetInfo(null); icon.iconType = item.iconType; Loading Loading @@ -538,7 +549,7 @@ public class LockscreenTargets extends Fragment implements if (iconDrawable != null) { mDialogIcon.setTag(icon); mDialogIcon.setImageDrawable(iconDrawable); setIconForDialog(iconDrawable); } else { Log.w(TAG, "Could not fetch icon, keeping old one (type=" + icon.iconType + ", source=" + icon.iconSource + ", package= " + icon.packageName + ")"); Loading Loading
src/com/android/settings/cyanogenmod/LockscreenTargets.java +15 −4 Original line number Diff line number Diff line Loading @@ -361,13 +361,22 @@ public class LockscreenTargets extends Fragment implements activeLayer.setDrawableByLayerId(0, new InsetDrawable(activeBack, 0, 0, 0, 0)); } item.defaultIcon = mDialogIcon.getDrawable(); item.defaultIcon = getPickedIconFromDialog(); item.uri = uri; item.iconType = iconType; item.iconSource = iconSource; item.packageName = packageName; } private Drawable getPickedIconFromDialog() { return mDialogIcon.getDrawable().mutate(); } private void setIconForDialog(Drawable icon) { // need to mutate the drawable here to not share drawable state with GlowPadView mDialogIcon.setImageDrawable(icon.getConstantState().newDrawable().mutate()); } @Override public void shortcutPicked(String uri, String friendlyName, boolean isApplication) { try { Loading @@ -376,6 +385,7 @@ public class LockscreenTargets extends Fragment implements mDialogLabel.setText(friendlyName); mDialogLabel.setTag(uri); // this is a fresh drawable, so we can assign it directly mDialogIcon.setImageDrawable(icon); mDialogIcon.setTag(null); } catch (URISyntaxException e) { Loading @@ -394,6 +404,7 @@ public class LockscreenTargets extends Fragment implements mDialogLabel.setText(mEmptyLabel); mDialogLabel.setTag(GlowPadView.EMPTY_TARGET); mDialogIcon.setImageResource(R.drawable.ic_empty); mDialogIcon.setTag(null); } else if (requestCode == IconPicker.REQUEST_PICK_SYSTEM || requestCode == IconPicker.REQUEST_PICK_GALLERY || requestCode == IconPicker.REQUEST_PICK_ICON_PACK) { Loading Loading @@ -432,7 +443,7 @@ public class LockscreenTargets extends Fragment implements String packageName = info != null ? info.packageName : null; int inset = LockscreenTargetUtils.getInsetForIconType(mActivity, type); InsetDrawable drawable = new InsetDrawable(mDialogIcon.getDrawable(), InsetDrawable drawable = new InsetDrawable(getPickedIconFromDialog(), inset, inset, inset, inset); setTarget(mTargetIndex, mDialogLabel.getTag().toString(), drawable, type, source, packageName); Loading Loading @@ -474,7 +485,7 @@ public class LockscreenTargets extends Fragment implements mDialogLabel = (Button) view.findViewById(R.id.label); TargetInfo item = mTargetStore.get(target); mDialogIcon.setImageDrawable(item.defaultIcon); setIconForDialog(item.defaultIcon); TargetInfo icon = new TargetInfo(null); icon.iconType = item.iconType; Loading Loading @@ -538,7 +549,7 @@ public class LockscreenTargets extends Fragment implements if (iconDrawable != null) { mDialogIcon.setTag(icon); mDialogIcon.setImageDrawable(iconDrawable); setIconForDialog(iconDrawable); } else { Log.w(TAG, "Could not fetch icon, keeping old one (type=" + icon.iconType + ", source=" + icon.iconSource + ", package= " + icon.packageName + ")"); Loading