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

Commit 5d27977f authored by Adam Powell's avatar Adam Powell
Browse files

Action modes without action bar

Change-Id: I0367ab35e598a17980bd373b30828175f6283acc
parent 85d8daa8
Loading
Loading
Loading
Loading
+45 −23
Original line number Diff line number Diff line
@@ -2088,55 +2088,55 @@
 visibility="public"
>
</field>
<field name="actionBarCloseContextDrawable"
<field name="actionButtonPadding"
 type="int"
 transient="false"
 volatile="false"
 value="16843550"
 value="16843547"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="actionBarContextBackground"
<field name="actionButtonStyle"
 type="int"
 transient="false"
 volatile="false"
 value="16843549"
 value="16843545"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="actionButtonPadding"
<field name="actionDropDownStyle"
 type="int"
 transient="false"
 volatile="false"
 value="16843547"
 value="16843544"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="actionButtonStyle"
<field name="actionModeBackground"
 type="int"
 transient="false"
 volatile="false"
 value="16843545"
 value="16843549"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="actionDropDownStyle"
<field name="actionModeCloseDrawable"
 type="int"
 transient="false"
 volatile="false"
 value="16843544"
 value="16843550"
 static="true"
 final="true"
 deprecated="not deprecated"
@@ -10525,6 +10525,17 @@
 visibility="public"
>
</field>
<field name="windowActionModeOverlay"
 type="int"
 transient="false"
 volatile="false"
 value="16843551"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="windowAnimationStyle"
 type="int"
 transient="false"
@@ -21849,6 +21860,19 @@
<parameter name="args" type="android.os.Bundle">
</parameter>
</method>
<method name="startActionMode"
 return="android.view.ActionMode"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="callback" type="android.view.ActionMode.Callback">
</parameter>
</method>
<method name="startActivityForResult"
 return="void"
 abstract="false"
@@ -21913,19 +21937,6 @@
<parameter name="requestCode" type="int">
</parameter>
</method>
<method name="startContextMode"
 return="android.view.ActionMode"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="callback" type="android.view.ActionMode.Callback">
</parameter>
</method>
<method name="startIntentSenderForResult"
 return="void"
 abstract="false"
@@ -194328,6 +194339,17 @@
>
</field>
<field name="FEATURE_ACTION_BAR"
 type="int"
 transient="false"
 volatile="false"
 value="8"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="FEATURE_ACTION_MODE_OVERLAY"
 type="int"
 transient="false"
 volatile="false"
+2 −2
Original line number Diff line number Diff line
@@ -4080,13 +4080,13 @@ public class Activity extends ContextThemeWrapper
     *
     * @see ActionMode
     */
    public ActionMode startContextMode(ActionMode.Callback callback) {
    public ActionMode startActionMode(ActionMode.Callback callback) {
        return mWindow.getDecorView().startActionMode(callback);
    }

    public ActionMode onStartActionMode(ActionMode.Callback callback) {
        if (mActionBar != null) {
            return mActionBar.startContextMode(callback);
            return mActionBar.startActionMode(callback);
        }
        return null;
    }
+4 −0
Original line number Diff line number Diff line
@@ -350,6 +350,10 @@ public class MenuInflater {
                .setShowAsAction(itemShowAsAction);
            
            if (itemListenerMethodName != null) {
                if (mContext.isRestricted()) {
                    throw new IllegalStateException("The android:onClick attribute cannot "
                            + "be used within a restricted context");
                }
                item.setOnMenuItemClickListener(
                        new InflatedOnMenuItemClickListener(mContext, itemListenerMethodName));
            }
+6 −1
Original line number Diff line number Diff line
@@ -62,7 +62,12 @@ public abstract class Window {
     * replaces the title bar and provides an alternate location
     * for an on-screen menu button on some devices.
     */
    public static final int FEATURE_ACTION_BAR = 9;
    public static final int FEATURE_ACTION_BAR = 8;
    /**
     * Flag for specifying the behavior of action modes when an Action Bar is not present.
     * If overlay is enabled, the action mode UI will be allowed to cover existing window content.
     */
    public static final int FEATURE_ACTION_MODE_OVERLAY = 9;
    /** Flag for setting the progress bar's visibility to VISIBLE */
    public static final int PROGRESS_VISIBILITY_ON = -1;
    /** Flag for setting the progress bar's visibility to GONE */
+11 −11
Original line number Diff line number Diff line
@@ -66,7 +66,7 @@ public class ActionBarImpl extends ActionBar {
    private TabImpl mSelectedTab;
    private int mTabSwitchMode = TAB_SWITCH_ADD_REMOVE;
    
    private ActionMode mContextMode;
    private ActionMode mActionMode;
    
    private static final int CONTEXT_DISPLAY_NORMAL = 0;
    private static final int CONTEXT_DISPLAY_SPLIT = 1;
@@ -229,9 +229,9 @@ public class ActionBarImpl extends ActionBar {
        return mActionView.getDisplayOptions();
    }

    public ActionMode startContextMode(ActionMode.Callback callback) {
        if (mContextMode != null) {
            mContextMode.finish();
    public ActionMode startActionMode(ActionMode.Callback callback) {
        if (mActionMode != null) {
            mActionMode.finish();
        }

        // Don't wait for the close context mode animation to finish.
@@ -241,7 +241,7 @@ public class ActionBarImpl extends ActionBar {
            mCloseContext.run();
        }

        ActionMode mode = new ContextModeImpl(callback);
        ActionMode mode = new ActionModeImpl(callback);
        if (callback.onCreateActionMode(mode, mode.getMenu())) {
            mode.invalidate();
            mUpperContextView.initForMode(mode);
@@ -250,7 +250,7 @@ public class ActionBarImpl extends ActionBar {
                // TODO animate this
                mLowerContextView.setVisibility(View.VISIBLE);
            }
            mContextMode = mode;
            mActionMode = mode;
            return mode;
        }
        return null;
@@ -361,12 +361,12 @@ public class ActionBarImpl extends ActionBar {
    /**
     * @hide 
     */
    public class ContextModeImpl extends ActionMode implements MenuBuilder.Callback {
    public class ActionModeImpl extends ActionMode implements MenuBuilder.Callback {
        private ActionMode.Callback mCallback;
        private MenuBuilder mMenu;
        private WeakReference<View> mCustomView;
        
        public ContextModeImpl(ActionMode.Callback callback) {
        public ActionModeImpl(ActionMode.Callback callback) {
            mCallback = callback;
            mMenu = new MenuBuilder(mActionView.getContext());
            mMenu.setCallback(this);
@@ -379,8 +379,8 @@ public class ActionBarImpl extends ActionBar {

        @Override
        public void finish() {
            if (mContextMode != this) {
                // Not the active context mode - no-op
            if (mActionMode != this) {
                // Not the active action mode - no-op
                return;
            }

@@ -395,7 +395,7 @@ public class ActionBarImpl extends ActionBar {
                // TODO Animate this
                mLowerContextView.setVisibility(View.GONE);
            }
            mContextMode = null;
            mActionMode = null;
        }

        @Override
Loading