Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cb6713f7 authored by Steve Kondik's avatar Steve Kondik Committed by Gerrit Code Review
Browse files

Merge "LockscreenTarget : Switch to dp from px for insets" into ics

parents 02f3a313 8cb1274a
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -110,7 +110,7 @@ public class LockscreenTargets extends Fragment implements ShortcutPickHelper.On
        mResources = getResources();
        mIsLandscape = mResources.getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE;
        mTargetOffset = mIsLandscape && !mIsScreenLarge ? 2 : 0;
        mTargetInset = mIsScreenLarge ? MultiWaveView.TABLET_TARGET_INSET : MultiWaveView.PHONE_TARGET_INSET;
        mTargetInset = mResources.getDimensionPixelSize(com.android.internal.R.dimen.lockscreen_target_inset);
        mIconPicker = new IconPicker(mActivity, this);
        mPicker = new ShortcutPickHelper(mActivity, this);
        mImageTmp = new File(mActivity.getCacheDir() + "/target.tmp");
@@ -318,11 +318,13 @@ public class LockscreenTargets extends Fragment implements ShortcutPickHelper.On
     */
    private void saveAll() {
        StringBuilder targetLayout = new StringBuilder();
        ArrayList<String> existingImages = new ArrayList<String>();
        final int maxTargets = mIsScreenLarge ? MultiWaveView.MAX_TABLET_TARGETS : MultiWaveView.MAX_PHONE_TARGETS;
        for (int i = mTargetOffset + 1; i <= mTargetOffset + maxTargets; i++) {
            String uri = mTargetStore.get(i).uri;
            String type = mTargetStore.get(i).iconType;
            String source = mTargetStore.get(i).iconSource;
            existingImages.add(source);
            if (!uri.equals(MultiWaveView.EMPTY_TARGET) && type != null) {
                try {
                    Intent in = Intent.parseUri(uri, 0);
@@ -342,6 +344,11 @@ public class LockscreenTargets extends Fragment implements ShortcutPickHelper.On
        }
        targetLayout.deleteCharAt(targetLayout.length() - 1);
        Settings.System.putString(mActivity.getContentResolver(), Settings.System.LOCKSCREEN_TARGETS, targetLayout.toString());
        for (File pic : mActivity.getFilesDir().listFiles()) {
            if (pic.getName().startsWith("lockscreen_") && !existingImages.contains(pic.getName())) {
                pic.delete();
            }
        }
    }

    /**