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

Commit e25a1795 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add show/hide launcher icon menu for debug"

parents f9b772ac 94fc11af
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -80,5 +80,9 @@
           android:title="@string/menu_inspect"
           android:visible="false"
           app:showAsAction="never"/>
        <item
            android:id="@+id/option_menu_launcher"
            android:visible="false"
            app:showAsAction="never"/>
    </group>
</menu>
+16 −0
Original line number Diff line number Diff line
@@ -21,9 +21,11 @@ import static com.android.documentsui.base.DocumentInfo.getCursorString;
import static com.android.documentsui.base.SharedMinimal.DEBUG;

import android.app.PendingIntent;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.IntentSender;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.database.Cursor;
import android.net.Uri;
@@ -452,6 +454,20 @@ public abstract class AbstractActionHandler<T extends FragmentActivity & CommonA
        mActivity.getWindow().setStatusBarColor(colors[1]);
    }

    @Override
    public void switchLauncherIcon() {
        PackageManager pm = mActivity.getPackageManager();
        if (pm != null) {
            final boolean enalbled = Shared.isLauncherEnabled(mActivity);
            ComponentName component = new ComponentName(
                    mActivity.getPackageName(), Shared.LAUNCHER_TARGET_CLASS);
            pm.setComponentEnabledSetting(component, enalbled
                    ? PackageManager.COMPONENT_ENABLED_STATE_DISABLED
                    : PackageManager.COMPONENT_ENABLED_STATE_ENABLED,
                    PackageManager.DONT_KILL_APP);
        }
    }

    @Override
    public void cutToClipboard() {
        throw new UnsupportedOperationException("Cut not supported!");
+5 −0
Original line number Diff line number Diff line
@@ -173,6 +173,11 @@ public interface ActionHandler {

    void showSortDialog();

    /**
     * Switch launch icon show/hide status.
     */
    void switchLauncherIcon();

    /**
     * Allow action handler to be initialized in a new scope.
     * @return this
+4 −0
Original line number Diff line number Diff line
@@ -477,6 +477,10 @@ public abstract class BaseActivity
                getInjector().actions.showSortDialog();
                return true;

            case R.id.option_menu_launcher:
                getInjector().actions.switchLauncherIcon();
                return true;

            case R.id.sub_menu_grid:
                setViewMode(State.MODE_GRID);
                return true;
+5 −0
Original line number Diff line number Diff line
@@ -96,6 +96,7 @@ public abstract class MenuManager {
        updateDebug(mOptionMenu.findItem(R.id.option_menu_debug));
        updateInspect(mOptionMenu.findItem(R.id.option_menu_inspect));
        updateSort(mOptionMenu.findItem(R.id.option_menu_sort));
        updateLauncher(mOptionMenu.findItem(R.id.option_menu_launcher));

        Menus.disableHiddenItems(mOptionMenu);
        mSearchManager.updateMenu();
@@ -364,6 +365,10 @@ public abstract class MenuManager {
        open.setVisible(false);
    }

    protected void updateLauncher(MenuItem launcher) {
        launcher.setVisible(false);
    }

    protected abstract void updateSelectAll(MenuItem selectAll);
    protected abstract void updateSelectAll(MenuItem selectAll, SelectionDetails selectionDetails);
    protected abstract void updateDeselectAll(
Loading