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

Commit ea84c3c3 authored by Danesh M's avatar Danesh M Committed by Gerrit Code Review
Browse files

Framework : Lockscreen - Customizable shortcuts

Patchset 1 : Initial port
Patchset 2 : Disable magneticTargets
Patchset 3 : Disable firstOffset
Patchset 4-5 : Cherry pick 10.0 commits

---------------- Squashed Commits ------------------

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

CM10 port
---------
Patchset 1-8: Initial port
Patchset 9  : Revert to CM9 drawables
Patchset 10 : Rebase

Change-Id: I9b163efeef8f47b1d21f7f61552ebe424049cfeb

Fix all upscaled lockscreen drawables and add a few

Several of the original CM9 drawables were upscaled
from a lower quality source. I rescaled some from the
originals and recreated the missing ones in vector
format plus added some new ones.

Change-Id: I112c35cf087daf0679a12bdad89258121dedeb0c

Lockscreen : Update camera availability check
Make the default availability of the target dependant on the
availability of a camera rather than the presense of a predefined resource.

Also update .Camera to .CameraLauncher since that is what we default too.

Change-Id: Ib3f06cc76fb7f7df20ec632051d5dbe754a9c69e

LockscreenShortcuts : Fix minor bugs

Fixes :

      - Inability to have contacts/direct dials..etc on lockscreen (http://goo.gl/BKEJs)
      - Multiple activities of same type on stack.

Change-Id: I6c2c3e1c87239267601d78eb38778d0388f4a41c

Lockscreen : Fix blank target highlight

Mismatched file/image.

Change-Id: I7cd898646124114a855d0fc1589251cbc6fc72fa

----------------------------------------------------

Change-Id: I9b163efeef8f47b1d21f7f61552ebe424049cfeb
parent 8339e085
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -2463,6 +2463,12 @@ public final class Settings {
         */
        public static final String LOCKSCREEN_DISABLED = "lockscreen.disabled";

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

        /**
         * @deprecated Use {@link android.provider.Settings.Global#LOW_BATTERY_SOUND}
         * instead
+63 −2
Original line number Diff line number Diff line
@@ -62,6 +62,40 @@ public class GlowPadView extends View {
    private static final int STATE_SNAP = 4;
    private static final int STATE_FINISH = 5;

    //Lockscreen targets
    /**
     * @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;

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

    // Animation properties.
    private static final float SNAP_MARGIN_DEFAULT = 20.0f; // distance to ring before we snap to it

@@ -122,6 +156,7 @@ public class GlowPadView extends View {
    private boolean mMagneticTargets = false;
    private boolean mDragging;
    private int mNewTargetResources;
    private ArrayList<TargetDrawable> mNewTargetDrawables;

    private class AnimationBundle extends ArrayList<Tweener> {
        private static final long serialVersionUID = 0xA84D78726F127468L;
@@ -187,6 +222,10 @@ public class GlowPadView extends View {
                internalSetTargetResources(mNewTargetResources);
                mNewTargetResources = 0;
                hideTargets(false, false);
            } else if (mNewTargetDrawables != null) {
                internalSetTargetResources(mNewTargetDrawables);
                mNewTargetDrawables = null;
                hideTargets(false, false);
            }
            mAnimatingTargets = false;
        }
@@ -466,6 +505,7 @@ public class GlowPadView extends View {
                // Force ring and targets to finish animation to final expanded state
                mTargetAnimations.stop();
            }
            hideTargets(false, false);
        } else {
            // Animate handle back to the center based on current state.
            hideGlow(HIDE_ANIMATION_DURATION, 0, 0.0f, mResetListenerWithPing);
@@ -605,6 +645,14 @@ public class GlowPadView extends View {
        }
    }

    private void internalSetTargetResources(ArrayList<TargetDrawable> drawList) {
        mTargetResourceId = 0;
        mTargetDrawables = drawList;
        updateTargetPositions(mWaveCenterX, mWaveCenterY);
        updatePointCloudPosition(mWaveCenterX, mWaveCenterY);
        hideTargets(false, false);
    }

    /**
     * Loads an array of drawables from the given resourceId.
     *
@@ -619,10 +667,23 @@ public class GlowPadView 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);
        }
    }

    public int getTargetResourceId() {
        return mTargetResourceId;
    }

    public ArrayList<TargetDrawable> getTargetDrawables() {
        return mTargetDrawables;
    }

    /**
     * Sets the resource id specifying the target descriptions for accessibility.
     *
@@ -1245,7 +1306,7 @@ public class GlowPadView 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"
@@ -1257,7 +1318,7 @@ public class GlowPadView 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"
+10 −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_active,
                android.R.attr.state_focused };
@@ -91,6 +91,14 @@ public class TargetDrawable {
        setState(STATE_INACTIVE);
    }

    public TargetDrawable(Resources res, Drawable drawable) {
        mResourceId = 0;
        // Mutate the drawable so we can animate shared drawable properties.
        mDrawable = drawable != null ? drawable.mutate() : null;
        resizeDrawables();
        setState(STATE_INACTIVE);
    }

    public TargetDrawable(TargetDrawable other) {
        mResourceId = other.mResourceId;
        // Mutate the drawable so we can animate shared drawable properties.
+7.69 KiB
Loading image diff...
+2.38 KiB
Loading image diff...
Loading