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

Commit 39aef3c7 authored by Danesh M's avatar Danesh M Committed by Ricardo Cerqueira
Browse files

Lockscreen : Customizable shortcuts

Allow users to choose lockscreen shortcuts / icons :
	Phone - 1-5 targets
	Tablets - 1-8 targets

Patchset 2  : Fix default target reading
Patchset 3  : Switch to resolveActivityInfo
Patchset 4  : Case check for empty target
Patchset 5  : Add index check for targetDescriptions
            : Minor cleanup
Patchset 6  : Custom icons
            : The RSS, Browser, Facebook, Twitter and Podcasts images are
              derivative works by DvTonder made from the from the WPZOOM Developer Icon Pack,
              licensed under Creative Commons Attribution-NonCommercial-ShareAlike, (c) WPZOOM
Patchset 7  : Fix variable reference
Patchset 8  : Change storing method (dynamically get drawable id)
Patchset 9  : Randomz...
Patchset 10 : Icon pack support (Template found at : https://github.com/Danesh/CmIconPicker)
            : Removed stock messaging icon, use ours instead.
Patchset 11 : Code cleanup

Change-Id: I93c842a78fff3517002f7be08555db5b585f6eb8
parent 1fb53b87
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -2265,6 +2265,12 @@ public final class Settings {
         */
        public static final String LOCKSCREEN_QUICK_UNLOCK_CONTROL = "lockscreen_quick_unlock_control";

        /**
         * Stores values for custom lockscreen targets
         * @hide
         */
        public static final String LOCKSCREEN_TARGETS = "lockscreen_targets";

        /**
         * Boolean value whether to link ringtone and notification volumes
         * 
+74 −2
Original line number Diff line number Diff line
@@ -81,6 +81,58 @@ public class MultiWaveView extends View {
    private static final float TAP_RADIUS_SCALE_ACCESSIBILITY_ENABLED = 1.3f;
    private TimeInterpolator mChevronAnimationInterpolator = Ease.Quad.easeOut;

    /**
     * @hide
     */
    public final static String ICON_RESOURCE = "icon_resource";

    /**
     * @hide
     */
    public final static String ICON_PACKAGE = "icon_package";

    /**
     * @hide
     */
    public final static String ICON_FILE = "icon_file";

    /**
     * Number of customizable lockscreen targets for tablets
     * @hide
     */
    public final static int MAX_TABLET_TARGETS = 7;

    /**
     * Number of customizable lockscreen targets for phones
     * @hide
     */
    public final static int MAX_PHONE_TARGETS = 4;

    /**
     * Inset padding for lockscreen targets for tablets
     * @hide
     */
    public final static int TABLET_TARGET_INSET = 30;

    /**
     * Inset padding for lockscreen targets for phones
     * @hide
     */
    public final static int PHONE_TARGET_INSET = 60;

    /**
     * Empty target used to reference unused lockscreen targets
     * @hide
     */
    public final static String EMPTY_TARGET = "empty";

    /**
     * Default stock configuration for lockscreen targets
     * @hide
     */
    public final static String DEFAULT_TARGETS = "empty|empty|empty|#Intent;action=android.intent.action.MAIN;" +
            "category=android.intent.category.LAUNCHER;component=com.android.camera/.Camera;S.icon_resource=ic_lockscreen_camera_normal;end";

    private ArrayList<TargetDrawable> mTargetDrawables = new ArrayList<TargetDrawable>();
    private ArrayList<TargetDrawable> mChevronDrawables = new ArrayList<TargetDrawable>();
    private ArrayList<Tweener> mChevronAnimations = new ArrayList<Tweener>();
@@ -107,6 +159,7 @@ public class MultiWaveView extends View {
    private float mSnapMargin = 0.0f;
    private boolean mDragging;
    private int mNewTargetResources;
    private ArrayList<TargetDrawable> mNewTargetDrawables;

    private AnimatorListener mResetListener = new AnimatorListenerAdapter() {
        public void onAnimationEnd(Animator animator) {
@@ -135,6 +188,10 @@ public class MultiWaveView extends View {
                internalSetTargetResources(mNewTargetResources);
                mNewTargetResources = 0;
                hideTargets(false);
            } else if (mNewTargetDrawables != null) {
                internalSetTargetResources(mNewTargetDrawables);
                mNewTargetDrawables = null;
                hideTargets(false);
            }
            mAnimatingTargets = false;
        }
@@ -542,6 +599,21 @@ public class MultiWaveView extends View {
        }
    }

    public void setTargetResources(ArrayList<TargetDrawable> drawList) {
        if (mAnimatingTargets) {
            // postpone this change until we return to the initial state
            mNewTargetDrawables = drawList;
        } else {
            internalSetTargetResources(drawList);
        }
    }

    private void internalSetTargetResources(ArrayList<TargetDrawable> drawList) {
        mTargetResourceId = 0;
        mTargetDrawables = drawList;
        updateTargetPositions();
    }

    public int getTargetResourceId() {
        return mTargetResourceId;
    }
@@ -927,7 +999,7 @@ public class MultiWaveView extends View {
    }

    private String getTargetDescription(int index) {
        if (mTargetDescriptions == null || mTargetDescriptions.isEmpty()) {
        if (mTargetDescriptions == null || mTargetDescriptions.isEmpty() || index >= mTargetDescriptions.size()) {
            mTargetDescriptions = loadDescriptions(mTargetDescriptionsResourceId);
            if (mTargetDrawables.size() != mTargetDescriptions.size()) {
                Log.w(TAG, "The number of target drawables must be"
@@ -939,7 +1011,7 @@ public class MultiWaveView extends View {
    }

    private String getDirectionDescription(int index) {
        if (mDirectionDescriptions == null || mDirectionDescriptions.isEmpty()) {
        if (mDirectionDescriptions == null || mDirectionDescriptions.isEmpty() || index >= mDirectionDescriptions.size()) {
            mDirectionDescriptions = loadDescriptions(mDirectionDescriptionsResourceId);
            if (mTargetDrawables.size() != mDirectionDescriptions.size()) {
                Log.w(TAG, "The number of target drawables must be"
+2 −2
Original line number Diff line number Diff line
@@ -28,9 +28,9 @@ public class TargetDrawable {
    private static final boolean DEBUG = false;

    public static final int[] STATE_ACTIVE =
            { android.R.attr.state_enabled, android.R.attr.state_active };
            { android.R.attr.state_enabled, android.R.attr.state_active, -android.R.attr.state_focused };
    public static final int[] STATE_INACTIVE =
            { android.R.attr.state_enabled, -android.R.attr.state_active };
            { android.R.attr.state_enabled, -android.R.attr.state_active, -android.R.attr.state_focused };
    public static final int[] STATE_FOCUSED =
            { android.R.attr.state_enabled, android.R.attr.state_focused };

+7.69 KiB
Loading image diff...
+2.38 KiB
Loading image diff...
Loading