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

Commit 352f6c8a authored by Shuhao Wu's avatar Shuhao Wu Committed by Steve Kondik
Browse files

Allow no applications in navring, like in cm11

For those of us that do not have Google installed, or otherwise not
wanting the navring, this patch enables "None" to be chosen for the
center of the navring. This was disallowed in lollipop for some
reason.

This does require changing a previous decision to always show the middle
target. I'm not sure if that's done just as a design decision, a Google
CTS requirement, or just simplicity. The previous commit[1] and gerrit
changeset[2] does not reveal this point as far as I can tell.

[1]:
https://github.com/CyanogenMod/android_frameworks_base/commit/b57efee4a97f956c3cf1b1e55a69cff01635d601
[2]: http://review.cyanogenmod.org/#/c/87163/

Change-Id: Ib700d6f5febaaa144af2b4490a81539830c67284
parent 44534f38
Loading
Loading
Loading
Loading
+15 −8
Original line number Diff line number Diff line
@@ -181,6 +181,17 @@ public class SearchPanelView extends FrameLayout implements StatusBarPanel,
        }
    }

    private boolean hasItemsToShow() {
        for (int i = 0; i < mTargetViews.size(); i++) {
            View v = mTargetViews.get(i);
            View parent = (View) v.getParent();
            if (parent.getVisibility() == View.VISIBLE) {
                return true;
            }
        }
        return false;
    }

    public void replaceDrawable(ImageView v, ComponentName component, String name) {
        if (component != null) {
            try {
@@ -224,7 +235,7 @@ public class SearchPanelView extends FrameLayout implements StatusBarPanel,
    }

    public void show(final boolean show, boolean animate) {
        if (show) {
        if (show && (mInEditMode || hasItemsToShow())) {
            if (getVisibility() != View.VISIBLE) {
                setVisibility(View.VISIBLE);
                vibrate();
@@ -414,7 +425,7 @@ public class SearchPanelView extends FrameLayout implements StatusBarPanel,
                mPicker.cleanup();
            } else if (v == mLogo || v == mLogoLeft || v == mLogoRight) {
                mSelectedView = (ImageView) v;
                mPicker.pickShortcut(v != mLogo);
                mPicker.pickShortcut();
            }
        }
    }
@@ -453,11 +464,11 @@ public class SearchPanelView extends FrameLayout implements StatusBarPanel,

    private void updateDrawables() {
        mTargetActivities = NavigationRingHelpers.getTargetActions(mContext);
        boolean assistantAvailable = isAssistantAvailable();
        for (int i = 0; i < NavigationRingHelpers.MAX_ACTIONS; i++) {
            ImageView target = mTargetViews.get(i);
            String action = mTargetActivities[i];

            if (isAssistantAvailable() && ((TextUtils.isEmpty(action) && target == mLogo)
            if (assistantAvailable && ((TextUtils.isEmpty(action) && target == mLogo)
                    || ACTION_ASSIST.equals(action))) {
                maybeSwapSearchIcon(target);
                continue;
@@ -472,10 +483,6 @@ public class SearchPanelView extends FrameLayout implements StatusBarPanel,
    private void updateTargetVisibility() {
        for (int i = 0; i < mTargetViews.size(); i++) {
            View v = mTargetViews.get(i);
            // Special case, middle target never be invisible
            if (v == mLogo) {
                continue;
            }
            View parent = (View) v.getParent();
            String action = mTargetActivities[i];
            boolean visible = mInEditMode
+4 −6
Original line number Diff line number Diff line
@@ -219,7 +219,7 @@ public class ShortcutPickHelper {
        dialog.show();
    }

    public void pickShortcut(boolean showNone) {
    public void pickShortcut() {
        if (mFetchAppsTask == null) {
            mFetchAppsTask = new FetchAppsTask();
            mFetchAppsTask.execute();
@@ -230,11 +230,9 @@ public class ShortcutPickHelper {
            filter.addDataScheme("package");
            mContext.registerReceiver(mReceiver, filter);
        }
        if (showNone) {

        mActions.addAction(ACTION_NONE, R.string.navring_action_none, 0);
        } else {
            mActions.removeAction(ACTION_NONE);
        }

        AlertDialog.Builder builder = new AlertDialog.Builder(mContext)
                .setTitle(mContext.getString(R.string.navbar_dialog_title))
                .setItems(mActions.getEntries(), new DialogInterface.OnClickListener() {