Fix appcompat
This commit is contained in:
parent
7c2745d4c1
commit
cd6801f554
40 changed files with 211 additions and 211 deletions
|
@ -14,7 +14,7 @@
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<android.support.v7.internal.view.renamemenu.ActionMenuItemView
|
<androidv7.rmenu.ActionMenuItemView
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<android.support.v7.internal.view.renamemenu.ExpandedMenuView
|
<androidv7.rmenu.ExpandedMenuView
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:id="@+id/expanded_menu"
|
android:id="@+id/expanded_menu"
|
||||||
android:layout_width="?attr/panelMenuListWidth"
|
android:layout_width="?attr/panelMenuListWidth"
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<android.support.v7.internal.view.renamemenu.ListMenuItemView
|
<androidv7.rmenu.ListMenuItemView
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="?attr/listPreferredItemHeightSmall">
|
android:layout_height="?attr/listPreferredItemHeightSmall">
|
||||||
|
@ -57,4 +57,4 @@
|
||||||
|
|
||||||
<!-- Checkbox, and/or radio button will be inserted here. -->
|
<!-- Checkbox, and/or radio button will be inserted here. -->
|
||||||
|
|
||||||
</android.support.v7.internal.view.renamemenu.ListMenuItemView>
|
</androidv7.rmenu.ListMenuItemView>
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<android.support.v7.internal.view.renamemenu.ListMenuItemView
|
<androidv7.rmenu.ListMenuItemView
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="?attr/dropdownListPreferredItemHeight"
|
android:layout_height="?attr/dropdownListPreferredItemHeight"
|
||||||
|
@ -58,4 +58,4 @@
|
||||||
|
|
||||||
<!-- Checkbox, and/or radio button will be inserted here. -->
|
<!-- Checkbox, and/or radio button will be inserted here. -->
|
||||||
|
|
||||||
</android.support.v7.internal.view.renamemenu.ListMenuItemView>
|
</androidv7.rmenu.ListMenuItemView>
|
||||||
|
|
|
@ -26,7 +26,6 @@ import android.os.Bundle;
|
||||||
import android.support.v7.appcompat.R;
|
import android.support.v7.appcompat.R;
|
||||||
import android.support.v7.internal.view.SupportMenuInflater;
|
import android.support.v7.internal.view.SupportMenuInflater;
|
||||||
import android.support.v7.internal.view.WindowCallbackWrapper;
|
import android.support.v7.internal.view.WindowCallbackWrapper;
|
||||||
import android.support.v7.internal.view.renamemenu.MenuBuilder;
|
|
||||||
import android.support.v7.internal.widget.TintTypedArray;
|
import android.support.v7.internal.widget.TintTypedArray;
|
||||||
import android.support.v7.view.ActionMode;
|
import android.support.v7.view.ActionMode;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
|
@ -34,6 +33,7 @@ import android.view.Menu;
|
||||||
import android.view.MenuInflater;
|
import android.view.MenuInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.Window;
|
import android.view.Window;
|
||||||
|
import androidv7.rmenu.MBuilder;
|
||||||
|
|
||||||
abstract class AppCompatDelegateImplBase extends AppCompatDelegate {
|
abstract class AppCompatDelegateImplBase extends AppCompatDelegate {
|
||||||
|
|
||||||
|
@ -243,7 +243,7 @@ abstract class AppCompatDelegateImplBase extends AppCompatDelegate {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCreatePanelMenu(int featureId, Menu menu) {
|
public boolean onCreatePanelMenu(int featureId, Menu menu) {
|
||||||
if (featureId == Window.FEATURE_OPTIONS_PANEL && !(menu instanceof MenuBuilder)) {
|
if (featureId == Window.FEATURE_OPTIONS_PANEL && !(menu instanceof MBuilder)) {
|
||||||
// If this is an options menu but it's not an AppCompat menu, we eat the event
|
// If this is an options menu but it's not an AppCompat menu, we eat the event
|
||||||
// and return false
|
// and return false
|
||||||
return false;
|
return false;
|
||||||
|
@ -253,7 +253,7 @@ abstract class AppCompatDelegateImplBase extends AppCompatDelegate {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onPreparePanel(int featureId, View view, Menu menu) {
|
public boolean onPreparePanel(int featureId, View view, Menu menu) {
|
||||||
if (featureId == Window.FEATURE_OPTIONS_PANEL && !(menu instanceof MenuBuilder)) {
|
if (featureId == Window.FEATURE_OPTIONS_PANEL && !(menu instanceof MBuilder)) {
|
||||||
// If this is an options menu but it's not an AppCompat menu, we eat the event
|
// If this is an options menu but it's not an AppCompat menu, we eat the event
|
||||||
// and return false
|
// and return false
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -43,10 +43,6 @@ import android.support.v7.internal.app.ToolbarActionBar;
|
||||||
import android.support.v7.internal.app.WindowDecorActionBar;
|
import android.support.v7.internal.app.WindowDecorActionBar;
|
||||||
import android.support.v7.internal.view.ContextThemeWrapper;
|
import android.support.v7.internal.view.ContextThemeWrapper;
|
||||||
import android.support.v7.internal.view.StandaloneActionMode;
|
import android.support.v7.internal.view.StandaloneActionMode;
|
||||||
import android.support.v7.internal.view.renamemenu.ListMenuPresenter;
|
|
||||||
import android.support.v7.internal.view.renamemenu.MenuBuilder;
|
|
||||||
import android.support.v7.internal.view.renamemenu.MenuPresenter;
|
|
||||||
import android.support.v7.internal.view.renamemenu.MenuView;
|
|
||||||
import android.support.v7.internal.widget.ActionBarContextView;
|
import android.support.v7.internal.widget.ActionBarContextView;
|
||||||
import android.support.v7.internal.widget.DecorContentParent;
|
import android.support.v7.internal.widget.DecorContentParent;
|
||||||
import android.support.v7.internal.widget.FitWindowsViewGroup;
|
import android.support.v7.internal.widget.FitWindowsViewGroup;
|
||||||
|
@ -78,6 +74,10 @@ import android.view.accessibility.AccessibilityEvent;
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
import android.widget.PopupWindow;
|
import android.widget.PopupWindow;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
import androidv7.rmenu.ListMenuPresenter;
|
||||||
|
import androidv7.rmenu.MBuilder;
|
||||||
|
import androidv7.rmenu.MenuPresenter;
|
||||||
|
import androidv7.rmenu.MenuView;
|
||||||
import static android.support.v4.view.WindowCompat.FEATURE_ACTION_BAR;
|
import static android.support.v4.view.WindowCompat.FEATURE_ACTION_BAR;
|
||||||
import static android.support.v4.view.WindowCompat.FEATURE_ACTION_BAR_OVERLAY;
|
import static android.support.v4.view.WindowCompat.FEATURE_ACTION_BAR_OVERLAY;
|
||||||
import static android.support.v4.view.WindowCompat.FEATURE_ACTION_MODE_OVERLAY;
|
import static android.support.v4.view.WindowCompat.FEATURE_ACTION_MODE_OVERLAY;
|
||||||
|
@ -86,7 +86,7 @@ import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
|
||||||
import static android.view.Window.FEATURE_OPTIONS_PANEL;
|
import static android.view.Window.FEATURE_OPTIONS_PANEL;
|
||||||
|
|
||||||
class AppCompatDelegateImplV7 extends AppCompatDelegateImplBase
|
class AppCompatDelegateImplV7 extends AppCompatDelegateImplBase
|
||||||
implements MenuBuilder.Callback, LayoutInflaterFactory {
|
implements MBuilder.Callback, LayoutInflaterFactory {
|
||||||
|
|
||||||
private DecorContentParent mDecorContentParent;
|
private DecorContentParent mDecorContentParent;
|
||||||
private ActionMenuPresenterCallback mActionMenuPresenterCallback;
|
private ActionMenuPresenterCallback mActionMenuPresenterCallback;
|
||||||
|
@ -545,7 +545,7 @@ class AppCompatDelegateImplV7 extends AppCompatDelegateImplBase
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onMenuItemSelected(MenuBuilder menu, MenuItem item) {
|
public boolean onMenuItemSelected(MBuilder menu, MenuItem item) {
|
||||||
final Window.Callback cb = getWindowCallback();
|
final Window.Callback cb = getWindowCallback();
|
||||||
if (cb != null && !isDestroyed()) {
|
if (cb != null && !isDestroyed()) {
|
||||||
final PanelFeatureState panel = findMenuPanel(menu.getRootMenu());
|
final PanelFeatureState panel = findMenuPanel(menu.getRootMenu());
|
||||||
|
@ -557,7 +557,7 @@ class AppCompatDelegateImplV7 extends AppCompatDelegateImplBase
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onMenuModeChange(MenuBuilder menu) {
|
public void onMenuModeChange(MBuilder menu) {
|
||||||
reopenMenu(menu, true);
|
reopenMenu(menu, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -927,7 +927,7 @@ class AppCompatDelegateImplV7 extends AppCompatDelegateImplBase
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void reopenMenu(MenuBuilder menu, boolean toggleMenuMode) {
|
private void reopenMenu(MBuilder menu, boolean toggleMenuMode) {
|
||||||
if (mDecorContentParent != null && mDecorContentParent.canShowOverflowMenu() &&
|
if (mDecorContentParent != null && mDecorContentParent.canShowOverflowMenu() &&
|
||||||
(!ViewConfigurationCompat.hasPermanentMenuKey(ViewConfiguration.get(mContext)) ||
|
(!ViewConfigurationCompat.hasPermanentMenuKey(ViewConfiguration.get(mContext)) ||
|
||||||
mDecorContentParent.isOverflowMenuShowPending())) {
|
mDecorContentParent.isOverflowMenuShowPending())) {
|
||||||
|
@ -1007,7 +1007,7 @@ class AppCompatDelegateImplV7 extends AppCompatDelegateImplBase
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final MenuBuilder menu = new MenuBuilder(context);
|
final MBuilder menu = new MBuilder(context);
|
||||||
menu.setCallback(this);
|
menu.setCallback(this);
|
||||||
st.setMenu(menu);
|
st.setMenu(menu);
|
||||||
|
|
||||||
|
@ -1137,7 +1137,7 @@ class AppCompatDelegateImplV7 extends AppCompatDelegateImplBase
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkCloseActionMenu(MenuBuilder menu) {
|
private void checkCloseActionMenu(MBuilder menu) {
|
||||||
if (mClosingActionMenu) {
|
if (mClosingActionMenu) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1506,7 +1506,7 @@ class AppCompatDelegateImplV7 extends AppCompatDelegateImplBase
|
||||||
|
|
||||||
private final class PanelMenuPresenterCallback implements MenuPresenter.Callback {
|
private final class PanelMenuPresenterCallback implements MenuPresenter.Callback {
|
||||||
@Override
|
@Override
|
||||||
public void onCloseMenu(MenuBuilder menu, boolean allMenusAreClosing) {
|
public void onCloseMenu(MBuilder menu, boolean allMenusAreClosing) {
|
||||||
final Menu parentMenu = menu.getRootMenu();
|
final Menu parentMenu = menu.getRootMenu();
|
||||||
final boolean isSubMenu = parentMenu != menu;
|
final boolean isSubMenu = parentMenu != menu;
|
||||||
final PanelFeatureState panel = findMenuPanel(isSubMenu ? parentMenu : menu);
|
final PanelFeatureState panel = findMenuPanel(isSubMenu ? parentMenu : menu);
|
||||||
|
@ -1523,7 +1523,7 @@ class AppCompatDelegateImplV7 extends AppCompatDelegateImplBase
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOpenSubMenu(MenuBuilder subMenu) {
|
public boolean onOpenSubMenu(MBuilder subMenu) {
|
||||||
if (subMenu == null && mHasActionBar) {
|
if (subMenu == null && mHasActionBar) {
|
||||||
Window.Callback cb = getWindowCallback();
|
Window.Callback cb = getWindowCallback();
|
||||||
if (cb != null && !isDestroyed()) {
|
if (cb != null && !isDestroyed()) {
|
||||||
|
@ -1536,7 +1536,7 @@ class AppCompatDelegateImplV7 extends AppCompatDelegateImplBase
|
||||||
|
|
||||||
private final class ActionMenuPresenterCallback implements MenuPresenter.Callback {
|
private final class ActionMenuPresenterCallback implements MenuPresenter.Callback {
|
||||||
@Override
|
@Override
|
||||||
public boolean onOpenSubMenu(MenuBuilder subMenu) {
|
public boolean onOpenSubMenu(MBuilder subMenu) {
|
||||||
Window.Callback cb = getWindowCallback();
|
Window.Callback cb = getWindowCallback();
|
||||||
if (cb != null) {
|
if (cb != null) {
|
||||||
cb.onMenuOpened(FEATURE_ACTION_BAR, subMenu);
|
cb.onMenuOpened(FEATURE_ACTION_BAR, subMenu);
|
||||||
|
@ -1545,7 +1545,7 @@ class AppCompatDelegateImplV7 extends AppCompatDelegateImplBase
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCloseMenu(MenuBuilder menu, boolean allMenusAreClosing) {
|
public void onCloseMenu(MBuilder menu, boolean allMenusAreClosing) {
|
||||||
checkCloseActionMenu(menu);
|
checkCloseActionMenu(menu);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1575,7 +1575,7 @@ class AppCompatDelegateImplV7 extends AppCompatDelegateImplBase
|
||||||
View createdPanelView;
|
View createdPanelView;
|
||||||
|
|
||||||
/** Use {@link #setMenu} to set this. */
|
/** Use {@link #setMenu} to set this. */
|
||||||
MenuBuilder menu;
|
MBuilder menu;
|
||||||
|
|
||||||
ListMenuPresenter listMenuPresenter;
|
ListMenuPresenter listMenuPresenter;
|
||||||
|
|
||||||
|
@ -1670,7 +1670,7 @@ class AppCompatDelegateImplV7 extends AppCompatDelegateImplBase
|
||||||
a.recycle();
|
a.recycle();
|
||||||
}
|
}
|
||||||
|
|
||||||
void setMenu(MenuBuilder menu) {
|
void setMenu(MBuilder menu) {
|
||||||
if (menu == this.menu) return;
|
if (menu == this.menu) return;
|
||||||
|
|
||||||
if (this.menu != null) {
|
if (this.menu != null) {
|
||||||
|
|
|
@ -26,9 +26,6 @@ import android.support.v4.view.WindowCompat;
|
||||||
import android.support.v7.app.ActionBar;
|
import android.support.v7.app.ActionBar;
|
||||||
import android.support.v7.internal.view.WindowCallbackWrapper;
|
import android.support.v7.internal.view.WindowCallbackWrapper;
|
||||||
import android.support.v7.appcompat.R;
|
import android.support.v7.appcompat.R;
|
||||||
import android.support.v7.internal.view.renamemenu.ListMenuPresenter;
|
|
||||||
import android.support.v7.internal.view.renamemenu.MenuBuilder;
|
|
||||||
import android.support.v7.internal.view.renamemenu.MenuPresenter;
|
|
||||||
import android.support.v7.internal.widget.DecorToolbar;
|
import android.support.v7.internal.widget.DecorToolbar;
|
||||||
import android.support.v7.internal.widget.ToolbarWidgetWrapper;
|
import android.support.v7.internal.widget.ToolbarWidgetWrapper;
|
||||||
import android.support.v7.widget.Toolbar;
|
import android.support.v7.widget.Toolbar;
|
||||||
|
@ -41,6 +38,9 @@ import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.Window;
|
import android.view.Window;
|
||||||
import android.widget.SpinnerAdapter;
|
import android.widget.SpinnerAdapter;
|
||||||
|
import androidv7.rmenu.ListMenuPresenter;
|
||||||
|
import androidv7.rmenu.MBuilder;
|
||||||
|
import androidv7.rmenu.MenuPresenter;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
@ -440,7 +440,7 @@ public class ToolbarActionBar extends ActionBar {
|
||||||
|
|
||||||
void populateOptionsMenu() {
|
void populateOptionsMenu() {
|
||||||
final Menu menu = getMenu();
|
final Menu menu = getMenu();
|
||||||
final MenuBuilder mb = menu instanceof MenuBuilder ? (MenuBuilder) menu : null;
|
final MBuilder mb = menu instanceof MBuilder ? (MBuilder) menu : null;
|
||||||
if (mb != null) {
|
if (mb != null) {
|
||||||
mb.stopDispatchingItemsChanged();
|
mb.stopDispatchingItemsChanged();
|
||||||
}
|
}
|
||||||
|
@ -505,8 +505,8 @@ public class ToolbarActionBar extends ActionBar {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ensureListMenuPresenter(Menu menu) {
|
private void ensureListMenuPresenter(Menu menu) {
|
||||||
if (mListMenuPresenter == null && (menu instanceof MenuBuilder)) {
|
if (mListMenuPresenter == null && (menu instanceof MBuilder)) {
|
||||||
MenuBuilder mb = (MenuBuilder) menu;
|
MBuilder mb = (MBuilder) menu;
|
||||||
|
|
||||||
Context context = mDecorToolbar.getContext();
|
Context context = mDecorToolbar.getContext();
|
||||||
final TypedValue outValue = new TypedValue();
|
final TypedValue outValue = new TypedValue();
|
||||||
|
@ -573,7 +573,7 @@ public class ToolbarActionBar extends ActionBar {
|
||||||
private boolean mClosingActionMenu;
|
private boolean mClosingActionMenu;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOpenSubMenu(MenuBuilder subMenu) {
|
public boolean onOpenSubMenu(MBuilder subMenu) {
|
||||||
if (mWindowCallback != null) {
|
if (mWindowCallback != null) {
|
||||||
mWindowCallback.onMenuOpened(WindowCompat.FEATURE_ACTION_BAR, subMenu);
|
mWindowCallback.onMenuOpened(WindowCompat.FEATURE_ACTION_BAR, subMenu);
|
||||||
return true;
|
return true;
|
||||||
|
@ -582,7 +582,7 @@ public class ToolbarActionBar extends ActionBar {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCloseMenu(MenuBuilder menu, boolean allMenusAreClosing) {
|
public void onCloseMenu(MBuilder menu, boolean allMenusAreClosing) {
|
||||||
if (mClosingActionMenu) {
|
if (mClosingActionMenu) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -598,14 +598,14 @@ public class ToolbarActionBar extends ActionBar {
|
||||||
|
|
||||||
private final class PanelMenuPresenterCallback implements MenuPresenter.Callback {
|
private final class PanelMenuPresenterCallback implements MenuPresenter.Callback {
|
||||||
@Override
|
@Override
|
||||||
public void onCloseMenu(MenuBuilder menu, boolean allMenusAreClosing) {
|
public void onCloseMenu(MBuilder menu, boolean allMenusAreClosing) {
|
||||||
if (mWindowCallback != null) {
|
if (mWindowCallback != null) {
|
||||||
mWindowCallback.onPanelClosed(Window.FEATURE_OPTIONS_PANEL, menu);
|
mWindowCallback.onPanelClosed(Window.FEATURE_OPTIONS_PANEL, menu);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOpenSubMenu(MenuBuilder subMenu) {
|
public boolean onOpenSubMenu(MBuilder subMenu) {
|
||||||
if (subMenu == null && mWindowCallback != null) {
|
if (subMenu == null && mWindowCallback != null) {
|
||||||
mWindowCallback.onMenuOpened(Window.FEATURE_OPTIONS_PANEL, subMenu);
|
mWindowCallback.onMenuOpened(Window.FEATURE_OPTIONS_PANEL, subMenu);
|
||||||
}
|
}
|
||||||
|
@ -613,15 +613,15 @@ public class ToolbarActionBar extends ActionBar {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private final class MenuBuilderCallback implements MenuBuilder.Callback {
|
private final class MenuBuilderCallback implements MBuilder.Callback {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onMenuItemSelected(MenuBuilder menu, MenuItem item) {
|
public boolean onMenuItemSelected(MBuilder menu, MenuItem item) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onMenuModeChange(MenuBuilder menu) {
|
public void onMenuModeChange(MBuilder menu) {
|
||||||
if (mWindowCallback != null) {
|
if (mWindowCallback != null) {
|
||||||
if (mDecorToolbar.isOverflowMenuShowing()) {
|
if (mDecorToolbar.isOverflowMenuShowing()) {
|
||||||
mWindowCallback.onPanelClosed(WindowCompat.FEATURE_ACTION_BAR, menu);
|
mWindowCallback.onPanelClosed(WindowCompat.FEATURE_ACTION_BAR, menu);
|
||||||
|
|
|
@ -36,9 +36,6 @@ import android.support.v7.appcompat.R;
|
||||||
import android.support.v7.internal.view.ActionBarPolicy;
|
import android.support.v7.internal.view.ActionBarPolicy;
|
||||||
import android.support.v7.internal.view.ViewPropertyAnimatorCompatSet;
|
import android.support.v7.internal.view.ViewPropertyAnimatorCompatSet;
|
||||||
import android.support.v7.internal.view.SupportMenuInflater;
|
import android.support.v7.internal.view.SupportMenuInflater;
|
||||||
import android.support.v7.internal.view.renamemenu.MenuBuilder;
|
|
||||||
import android.support.v7.internal.view.renamemenu.MenuPopupHelper;
|
|
||||||
import android.support.v7.internal.view.renamemenu.SubMenuBuilder;
|
|
||||||
import android.support.v7.internal.widget.ActionBarContainer;
|
import android.support.v7.internal.widget.ActionBarContainer;
|
||||||
import android.support.v7.internal.widget.ActionBarContextView;
|
import android.support.v7.internal.widget.ActionBarContextView;
|
||||||
import android.support.v7.internal.widget.ActionBarOverlayLayout;
|
import android.support.v7.internal.widget.ActionBarOverlayLayout;
|
||||||
|
@ -59,6 +56,9 @@ import android.view.Window;
|
||||||
import android.view.accessibility.AccessibilityEvent;
|
import android.view.accessibility.AccessibilityEvent;
|
||||||
import android.view.animation.AnimationUtils;
|
import android.view.animation.AnimationUtils;
|
||||||
import android.widget.SpinnerAdapter;
|
import android.widget.SpinnerAdapter;
|
||||||
|
import androidv7.rmenu.MBuilder;
|
||||||
|
import androidv7.rmenu.MenuPopupHelper;
|
||||||
|
import androidv7.rmenu.SubMenuBuilder;
|
||||||
|
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -949,9 +949,9 @@ public class WindowDecorActionBar extends ActionBar implements
|
||||||
/**
|
/**
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public class ActionModeImpl extends ActionMode implements MenuBuilder.Callback {
|
public class ActionModeImpl extends ActionMode implements MBuilder.Callback {
|
||||||
private final Context mActionModeContext;
|
private final Context mActionModeContext;
|
||||||
private final MenuBuilder mMenu;
|
private final MBuilder mMenu;
|
||||||
|
|
||||||
private ActionMode.Callback mCallback;
|
private ActionMode.Callback mCallback;
|
||||||
private WeakReference<View> mCustomView;
|
private WeakReference<View> mCustomView;
|
||||||
|
@ -959,7 +959,7 @@ public class WindowDecorActionBar extends ActionBar implements
|
||||||
public ActionModeImpl(Context context, ActionMode.Callback callback) {
|
public ActionModeImpl(Context context, ActionMode.Callback callback) {
|
||||||
mActionModeContext = context;
|
mActionModeContext = context;
|
||||||
mCallback = callback;
|
mCallback = callback;
|
||||||
mMenu = new MenuBuilder(context)
|
mMenu = new MBuilder(context)
|
||||||
.setDefaultShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
|
.setDefaultShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
|
||||||
mMenu.setCallback(this);
|
mMenu.setCallback(this);
|
||||||
}
|
}
|
||||||
|
@ -1083,7 +1083,7 @@ public class WindowDecorActionBar extends ActionBar implements
|
||||||
return mCustomView != null ? mCustomView.get() : null;
|
return mCustomView != null ? mCustomView.get() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean onMenuItemSelected(MenuBuilder menu, MenuItem item) {
|
public boolean onMenuItemSelected(MBuilder menu, MenuItem item) {
|
||||||
if (mCallback != null) {
|
if (mCallback != null) {
|
||||||
return mCallback.onActionItemClicked(this, item);
|
return mCallback.onActionItemClicked(this, item);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1091,7 +1091,7 @@ public class WindowDecorActionBar extends ActionBar implements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onCloseMenu(MenuBuilder menu, boolean allMenusAreClosing) {
|
public void onCloseMenu(MBuilder menu, boolean allMenusAreClosing) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean onSubMenuSelected(SubMenuBuilder subMenu) {
|
public boolean onSubMenuSelected(SubMenuBuilder subMenu) {
|
||||||
|
@ -1110,7 +1110,7 @@ public class WindowDecorActionBar extends ActionBar implements
|
||||||
public void onCloseSubMenu(SubMenuBuilder menu) {
|
public void onCloseSubMenu(SubMenuBuilder menu) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onMenuModeChange(MenuBuilder menu) {
|
public void onMenuModeChange(MBuilder menu) {
|
||||||
if (mCallback == null) {
|
if (mCallback == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,9 +18,6 @@ package android.support.v7.internal.view;
|
||||||
import android.annotation.TargetApi;
|
import android.annotation.TargetApi;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.support.v7.internal.view.renamemenu.MenuBuilder;
|
|
||||||
import android.support.v7.internal.view.renamemenu.MenuPopupHelper;
|
|
||||||
import android.support.v7.internal.view.renamemenu.SubMenuBuilder;
|
|
||||||
import android.support.v7.internal.widget.ActionBarContextView;
|
import android.support.v7.internal.widget.ActionBarContextView;
|
||||||
import android.support.v7.view.ActionMode;
|
import android.support.v7.view.ActionMode;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
|
@ -28,13 +25,16 @@ import android.view.MenuInflater;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.accessibility.AccessibilityEvent;
|
import android.view.accessibility.AccessibilityEvent;
|
||||||
|
import androidv7.rmenu.MBuilder;
|
||||||
|
import androidv7.rmenu.MenuPopupHelper;
|
||||||
|
import androidv7.rmenu.SubMenuBuilder;
|
||||||
|
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public class StandaloneActionMode extends ActionMode implements MenuBuilder.Callback {
|
public class StandaloneActionMode extends ActionMode implements MBuilder.Callback {
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
private ActionBarContextView mContextView;
|
private ActionBarContextView mContextView;
|
||||||
private ActionMode.Callback mCallback;
|
private ActionMode.Callback mCallback;
|
||||||
|
@ -42,7 +42,7 @@ public class StandaloneActionMode extends ActionMode implements MenuBuilder.Call
|
||||||
private boolean mFinished;
|
private boolean mFinished;
|
||||||
private boolean mFocusable;
|
private boolean mFocusable;
|
||||||
|
|
||||||
private MenuBuilder mMenu;
|
private MBuilder mMenu;
|
||||||
|
|
||||||
public StandaloneActionMode(Context context, ActionBarContextView view,
|
public StandaloneActionMode(Context context, ActionBarContextView view,
|
||||||
ActionMode.Callback callback, boolean isFocusable) {
|
ActionMode.Callback callback, boolean isFocusable) {
|
||||||
|
@ -50,7 +50,7 @@ public class StandaloneActionMode extends ActionMode implements MenuBuilder.Call
|
||||||
mContextView = view;
|
mContextView = view;
|
||||||
mCallback = callback;
|
mCallback = callback;
|
||||||
|
|
||||||
mMenu = new MenuBuilder(context).setDefaultShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
|
mMenu = new MBuilder(context).setDefaultShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
|
||||||
mMenu.setCallback(this);
|
mMenu.setCallback(this);
|
||||||
mFocusable = isFocusable;
|
mFocusable = isFocusable;
|
||||||
}
|
}
|
||||||
|
@ -133,11 +133,11 @@ public class StandaloneActionMode extends ActionMode implements MenuBuilder.Call
|
||||||
return new MenuInflater(mContext);
|
return new MenuInflater(mContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean onMenuItemSelected(MenuBuilder menu, MenuItem item) {
|
public boolean onMenuItemSelected(MBuilder menu, MenuItem item) {
|
||||||
return mCallback.onActionItemClicked(this, item);
|
return mCallback.onActionItemClicked(this, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onCloseMenu(MenuBuilder menu, boolean allMenusAreClosing) {
|
public void onCloseMenu(MBuilder menu, boolean allMenusAreClosing) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean onSubMenuSelected(SubMenuBuilder subMenu) {
|
public boolean onSubMenuSelected(SubMenuBuilder subMenu) {
|
||||||
|
@ -152,7 +152,7 @@ public class StandaloneActionMode extends ActionMode implements MenuBuilder.Call
|
||||||
public void onCloseSubMenu(SubMenuBuilder menu) {
|
public void onCloseSubMenu(SubMenuBuilder menu) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onMenuModeChange(MenuBuilder menu) {
|
public void onMenuModeChange(MBuilder menu) {
|
||||||
invalidate();
|
invalidate();
|
||||||
mContextView.showOverflowMenu();
|
mContextView.showOverflowMenu();
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,11 +22,11 @@ import android.os.Build;
|
||||||
import android.support.v4.internal.view.SupportMenu;
|
import android.support.v4.internal.view.SupportMenu;
|
||||||
import android.support.v4.internal.view.SupportMenuItem;
|
import android.support.v4.internal.view.SupportMenuItem;
|
||||||
import android.support.v4.util.SimpleArrayMap;
|
import android.support.v4.util.SimpleArrayMap;
|
||||||
import android.support.v7.internal.view.renamemenu.MenuWrapperFactory;
|
|
||||||
import android.view.ActionMode;
|
import android.view.ActionMode;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuInflater;
|
import android.view.MenuInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import androidv7.rmenu.MenuWrapperFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wraps a support {@link android.support.v7.view.ActionMode} as a framework
|
* Wraps a support {@link android.support.v7.view.ActionMode} as a framework
|
||||||
|
|
|
@ -28,8 +28,6 @@ import android.support.v4.internal.view.SupportMenu;
|
||||||
import android.support.v4.view.ActionProvider;
|
import android.support.v4.view.ActionProvider;
|
||||||
import android.support.v4.view.MenuItemCompat;
|
import android.support.v4.view.MenuItemCompat;
|
||||||
import android.support.v7.appcompat.R;
|
import android.support.v7.appcompat.R;
|
||||||
import android.support.v7.internal.view.renamemenu.MenuItemImpl;
|
|
||||||
import android.support.v7.internal.view.renamemenu.MenuItemWrapperICS;
|
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.util.Xml;
|
import android.util.Xml;
|
||||||
|
@ -39,6 +37,8 @@ import android.view.MenuInflater;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.SubMenu;
|
import android.view.SubMenu;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import androidv7.rmenu.MenuItemImpl;
|
||||||
|
import androidv7.rmenu.MenuItemWrapperICS;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
|
|
|
@ -28,7 +28,6 @@ import android.support.v7.internal.view.ViewPropertyAnimatorCompatSet;
|
||||||
import android.support.v7.view.ActionMode;
|
import android.support.v7.view.ActionMode;
|
||||||
import android.support.v7.widget.ActionMenuPresenter;
|
import android.support.v7.widget.ActionMenuPresenter;
|
||||||
import android.support.v7.widget.ActionMenuView;
|
import android.support.v7.widget.ActionMenuView;
|
||||||
import android.support.v7.internal.view.renamemenu.MenuBuilder;
|
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
@ -38,6 +37,7 @@ import android.view.accessibility.AccessibilityEvent;
|
||||||
import android.view.animation.DecelerateInterpolator;
|
import android.view.animation.DecelerateInterpolator;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
import androidv7.rmenu.MBuilder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @hide
|
* @hide
|
||||||
|
@ -222,7 +222,7 @@ public class ActionBarContextView extends AbsActionBarView implements ViewProper
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
final MenuBuilder menu = (MenuBuilder) mode.getMenu();
|
final MBuilder menu = (MBuilder) mode.getMenu();
|
||||||
if (mActionMenuPresenter != null) {
|
if (mActionMenuPresenter != null) {
|
||||||
mActionMenuPresenter.dismissPopupMenus();
|
mActionMenuPresenter.dismissPopupMenus();
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,6 @@ import android.support.v4.view.ViewPropertyAnimatorListenerAdapter;
|
||||||
import android.support.v4.widget.ScrollerCompat;
|
import android.support.v4.widget.ScrollerCompat;
|
||||||
import android.support.v7.appcompat.R;
|
import android.support.v7.appcompat.R;
|
||||||
import android.support.v7.internal.VersionUtils;
|
import android.support.v7.internal.VersionUtils;
|
||||||
import android.support.v7.internal.view.renamemenu.MenuPresenter;
|
|
||||||
import android.support.v7.widget.Toolbar;
|
import android.support.v7.widget.Toolbar;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.util.SparseArray;
|
import android.util.SparseArray;
|
||||||
|
@ -39,6 +38,7 @@ import android.view.Menu;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.Window;
|
import android.view.Window;
|
||||||
|
import androidv7.rmenu.MenuPresenter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Special layout for the containing of an overlay action bar (and its content) to correctly handle
|
* Special layout for the containing of an overlay action bar (and its content) to correctly handle
|
||||||
|
|
|
@ -19,10 +19,10 @@ package android.support.v7.internal.widget;
|
||||||
|
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
import android.support.v7.internal.view.renamemenu.MenuPresenter;
|
|
||||||
import android.util.SparseArray;
|
import android.util.SparseArray;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.Window;
|
import android.view.Window;
|
||||||
|
import androidv7.rmenu.MenuPresenter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implemented by the top-level decor layout for a window. DecorContentParent offers
|
* Implemented by the top-level decor layout for a window. DecorContentParent offers
|
||||||
|
|
|
@ -20,14 +20,14 @@ package android.support.v7.internal.widget;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
import android.support.v7.internal.view.renamemenu.MenuBuilder;
|
|
||||||
import android.support.v7.internal.view.renamemenu.MenuPresenter;
|
|
||||||
import android.util.SparseArray;
|
import android.util.SparseArray;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.Window;
|
import android.view.Window;
|
||||||
import android.widget.SpinnerAdapter;
|
import android.widget.SpinnerAdapter;
|
||||||
|
import androidv7.rmenu.MBuilder;
|
||||||
|
import androidv7.rmenu.MenuPresenter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Common interface for a toolbar that sits as part of the window decor.
|
* Common interface for a toolbar that sits as part of the window decor.
|
||||||
|
@ -98,7 +98,7 @@ public interface DecorToolbar {
|
||||||
void setVisibility(int visible);
|
void setVisibility(int visible);
|
||||||
int getVisibility();
|
int getVisibility();
|
||||||
void setMenuCallbacks(MenuPresenter.Callback presenterCallback,
|
void setMenuCallbacks(MenuPresenter.Callback presenterCallback,
|
||||||
MenuBuilder.Callback menuBuilderCallback);
|
MBuilder.Callback menuBuilderCallback);
|
||||||
Menu getMenu();
|
Menu getMenu();
|
||||||
int getPopupTheme();
|
int getPopupTheme();
|
||||||
}
|
}
|
|
@ -24,9 +24,6 @@ import android.os.Parcelable;
|
||||||
import android.support.v4.view.ViewCompat;
|
import android.support.v4.view.ViewCompat;
|
||||||
import android.support.v4.view.ViewPropertyAnimatorListenerAdapter;
|
import android.support.v4.view.ViewPropertyAnimatorListenerAdapter;
|
||||||
import android.support.v7.appcompat.R;
|
import android.support.v7.appcompat.R;
|
||||||
import android.support.v7.internal.view.renamemenu.ActionMenuItem;
|
|
||||||
import android.support.v7.internal.view.renamemenu.MenuBuilder;
|
|
||||||
import android.support.v7.internal.view.renamemenu.MenuPresenter;
|
|
||||||
import android.support.v7.widget.ActionMenuPresenter;
|
import android.support.v7.widget.ActionMenuPresenter;
|
||||||
import android.support.v7.widget.Toolbar;
|
import android.support.v7.widget.Toolbar;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
@ -39,6 +36,9 @@ import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.Window;
|
import android.view.Window;
|
||||||
import android.widget.SpinnerAdapter;
|
import android.widget.SpinnerAdapter;
|
||||||
|
import androidv7.rmenu.ActionMenuItem;
|
||||||
|
import androidv7.rmenu.MBuilder;
|
||||||
|
import androidv7.rmenu.MenuPresenter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Internal class used to interact with the Toolbar widget without
|
* Internal class used to interact with the Toolbar widget without
|
||||||
|
@ -411,7 +411,7 @@ public class ToolbarWidgetWrapper implements DecorToolbar {
|
||||||
mActionMenuPresenter.setId(R.id.action_menu_presenter);
|
mActionMenuPresenter.setId(R.id.action_menu_presenter);
|
||||||
}
|
}
|
||||||
mActionMenuPresenter.setCallback(cb);
|
mActionMenuPresenter.setCallback(cb);
|
||||||
mToolbar.setMenu((MenuBuilder) menu, mActionMenuPresenter);
|
mToolbar.setMenu((MBuilder) menu, mActionMenuPresenter);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -699,7 +699,7 @@ public class ToolbarWidgetWrapper implements DecorToolbar {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setMenuCallbacks(MenuPresenter.Callback actionMenuPresenterCallback,
|
public void setMenuCallbacks(MenuPresenter.Callback actionMenuPresenterCallback,
|
||||||
MenuBuilder.Callback menuBuilderCallback) {
|
MBuilder.Callback menuBuilderCallback) {
|
||||||
mToolbar.setMenuCallbacks(actionMenuPresenterCallback, menuBuilderCallback);
|
mToolbar.setMenuCallbacks(actionMenuPresenterCallback, menuBuilderCallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,13 +28,6 @@ import android.support.v4.view.GravityCompat;
|
||||||
import android.support.v7.appcompat.R;
|
import android.support.v7.appcompat.R;
|
||||||
import android.support.v7.internal.transition.ActionBarTransition;
|
import android.support.v7.internal.transition.ActionBarTransition;
|
||||||
import android.support.v7.internal.view.ActionBarPolicy;
|
import android.support.v7.internal.view.ActionBarPolicy;
|
||||||
import android.support.v7.internal.view.renamemenu.ActionMenuItemView;
|
|
||||||
import android.support.v7.internal.view.renamemenu.BaseMenuPresenter;
|
|
||||||
import android.support.v7.internal.view.renamemenu.MenuBuilder;
|
|
||||||
import android.support.v7.internal.view.renamemenu.MenuItemImpl;
|
|
||||||
import android.support.v7.internal.view.renamemenu.MenuPopupHelper;
|
|
||||||
import android.support.v7.internal.view.renamemenu.MenuView;
|
|
||||||
import android.support.v7.internal.view.renamemenu.SubMenuBuilder;
|
|
||||||
import android.support.v7.internal.widget.TintImageView;
|
import android.support.v7.internal.widget.TintImageView;
|
||||||
import android.util.SparseBooleanArray;
|
import android.util.SparseBooleanArray;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
|
@ -42,6 +35,13 @@ import android.view.SoundEffectConstants;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.View.MeasureSpec;
|
import android.view.View.MeasureSpec;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import androidv7.rmenu.ActionMenuItemView;
|
||||||
|
import androidv7.rmenu.BaseMenuPresenter;
|
||||||
|
import androidv7.rmenu.MBuilder;
|
||||||
|
import androidv7.rmenu.MenuItemImpl;
|
||||||
|
import androidv7.rmenu.MenuPopupHelper;
|
||||||
|
import androidv7.rmenu.MenuView;
|
||||||
|
import androidv7.rmenu.SubMenuBuilder;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ public class ActionMenuPresenter extends BaseMenuPresenter
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initForMenu(Context context, MenuBuilder menu) {
|
public void initForMenu(Context context, MBuilder menu) {
|
||||||
super.initForMenu(context, menu);
|
super.initForMenu(context, menu);
|
||||||
|
|
||||||
final Resources res = context.getResources();
|
final Resources res = context.getResources();
|
||||||
|
@ -510,7 +510,7 @@ public class ActionMenuPresenter extends BaseMenuPresenter
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCloseMenu(MenuBuilder menu, boolean allMenusAreClosing) {
|
public void onCloseMenu(MBuilder menu, boolean allMenusAreClosing) {
|
||||||
dismissPopupMenus();
|
dismissPopupMenus();
|
||||||
super.onCloseMenu(menu, allMenusAreClosing);
|
super.onCloseMenu(menu, allMenusAreClosing);
|
||||||
}
|
}
|
||||||
|
@ -669,7 +669,7 @@ public class ActionMenuPresenter extends BaseMenuPresenter
|
||||||
|
|
||||||
private class OverflowPopup extends MenuPopupHelper {
|
private class OverflowPopup extends MenuPopupHelper {
|
||||||
|
|
||||||
public OverflowPopup(Context context, MenuBuilder menu, View anchorView,
|
public OverflowPopup(Context context, MBuilder menu, View anchorView,
|
||||||
boolean overflowOnly) {
|
boolean overflowOnly) {
|
||||||
super(context, menu, anchorView, overflowOnly, R.attr.actionOverflowMenuStyle);
|
super(context, menu, anchorView, overflowOnly, R.attr.actionOverflowMenuStyle);
|
||||||
setGravity(GravityCompat.END);
|
setGravity(GravityCompat.END);
|
||||||
|
@ -723,7 +723,7 @@ public class ActionMenuPresenter extends BaseMenuPresenter
|
||||||
private class PopupPresenterCallback implements Callback {
|
private class PopupPresenterCallback implements Callback {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOpenSubMenu(MenuBuilder subMenu) {
|
public boolean onOpenSubMenu(MBuilder subMenu) {
|
||||||
if (subMenu == null) return false;
|
if (subMenu == null) return false;
|
||||||
|
|
||||||
mOpenSubMenuId = ((SubMenuBuilder) subMenu).getItem().getItemId();
|
mOpenSubMenuId = ((SubMenuBuilder) subMenu).getItem().getItemId();
|
||||||
|
@ -732,7 +732,7 @@ public class ActionMenuPresenter extends BaseMenuPresenter
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCloseMenu(MenuBuilder menu, boolean allMenusAreClosing) {
|
public void onCloseMenu(MBuilder menu, boolean allMenusAreClosing) {
|
||||||
if (menu instanceof SubMenuBuilder) {
|
if (menu instanceof SubMenuBuilder) {
|
||||||
((SubMenuBuilder) menu).getRootMenu().close(false);
|
((SubMenuBuilder) menu).getRootMenu().close(false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,11 +18,6 @@ package android.support.v7.widget;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.support.v7.internal.view.renamemenu.ActionMenuItemView;
|
|
||||||
import android.support.v7.internal.view.renamemenu.MenuBuilder;
|
|
||||||
import android.support.v7.internal.view.renamemenu.MenuItemImpl;
|
|
||||||
import android.support.v7.internal.view.renamemenu.MenuPresenter;
|
|
||||||
import android.support.v7.internal.view.renamemenu.MenuView;
|
|
||||||
import android.support.v7.internal.widget.ViewUtils;
|
import android.support.v7.internal.widget.ViewUtils;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.view.ContextThemeWrapper;
|
import android.view.ContextThemeWrapper;
|
||||||
|
@ -33,6 +28,11 @@ import android.view.View;
|
||||||
import android.view.ViewDebug;
|
import android.view.ViewDebug;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.accessibility.AccessibilityEvent;
|
import android.view.accessibility.AccessibilityEvent;
|
||||||
|
import androidv7.rmenu.ActionMenuItemView;
|
||||||
|
import androidv7.rmenu.MBuilder;
|
||||||
|
import androidv7.rmenu.MenuItemImpl;
|
||||||
|
import androidv7.rmenu.MenuPresenter;
|
||||||
|
import androidv7.rmenu.MenuView;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ActionMenuView is a presentation of a series of menu options as a View. It provides
|
* ActionMenuView is a presentation of a series of menu options as a View. It provides
|
||||||
|
@ -40,7 +40,7 @@ import android.view.accessibility.AccessibilityEvent;
|
||||||
* items in an overflow menu. This allows applications to present packs of actions inline with
|
* items in an overflow menu. This allows applications to present packs of actions inline with
|
||||||
* specific or repeating content.
|
* specific or repeating content.
|
||||||
*/
|
*/
|
||||||
public class ActionMenuView extends LinearLayoutCompat implements MenuBuilder.ItemInvoker,
|
public class ActionMenuView extends LinearLayoutCompat implements MBuilder.ItemInvoker,
|
||||||
MenuView {
|
MenuView {
|
||||||
|
|
||||||
private static final String TAG = "ActionMenuView";
|
private static final String TAG = "ActionMenuView";
|
||||||
|
@ -48,7 +48,7 @@ public class ActionMenuView extends LinearLayoutCompat implements MenuBuilder.It
|
||||||
static final int MIN_CELL_SIZE = 56; // dips
|
static final int MIN_CELL_SIZE = 56; // dips
|
||||||
static final int GENERATED_ITEM_PADDING = 4; // dips
|
static final int GENERATED_ITEM_PADDING = 4; // dips
|
||||||
|
|
||||||
private MenuBuilder mMenu;
|
private MBuilder mMenu;
|
||||||
|
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ public class ActionMenuView extends LinearLayoutCompat implements MenuBuilder.It
|
||||||
private boolean mReserveOverflow;
|
private boolean mReserveOverflow;
|
||||||
private ActionMenuPresenter mPresenter;
|
private ActionMenuPresenter mPresenter;
|
||||||
private MenuPresenter.Callback mActionMenuPresenterCallback;
|
private MenuPresenter.Callback mActionMenuPresenterCallback;
|
||||||
private MenuBuilder.Callback mMenuBuilderCallback;
|
private MBuilder.Callback mMenuBuilderCallback;
|
||||||
private boolean mFormatItems;
|
private boolean mFormatItems;
|
||||||
private int mFormatItemsWidth;
|
private int mFormatItemsWidth;
|
||||||
private int mMinCellSize;
|
private int mMinCellSize;
|
||||||
|
@ -604,7 +604,7 @@ public class ActionMenuView extends LinearLayoutCompat implements MenuBuilder.It
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
public void initialize(MenuBuilder menu) {
|
public void initialize(MBuilder menu) {
|
||||||
mMenu = menu;
|
mMenu = menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -619,7 +619,7 @@ public class ActionMenuView extends LinearLayoutCompat implements MenuBuilder.It
|
||||||
public Menu getMenu() {
|
public Menu getMenu() {
|
||||||
if (mMenu == null) {
|
if (mMenu == null) {
|
||||||
final Context context = getContext();
|
final Context context = getContext();
|
||||||
mMenu = new MenuBuilder(context);
|
mMenu = new MBuilder(context);
|
||||||
mMenu.setCallback(new MenuBuilderCallback());
|
mMenu.setCallback(new MenuBuilderCallback());
|
||||||
mPresenter = new ActionMenuPresenter(context);
|
mPresenter = new ActionMenuPresenter(context);
|
||||||
mPresenter.setReserveOverflow(true);
|
mPresenter.setReserveOverflow(true);
|
||||||
|
@ -636,7 +636,7 @@ public class ActionMenuView extends LinearLayoutCompat implements MenuBuilder.It
|
||||||
* Must be called before the first call to getMenu()
|
* Must be called before the first call to getMenu()
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public void setMenuCallbacks(MenuPresenter.Callback pcb, MenuBuilder.Callback mcb) {
|
public void setMenuCallbacks(MenuPresenter.Callback pcb, MBuilder.Callback mcb) {
|
||||||
mActionMenuPresenterCallback = pcb;
|
mActionMenuPresenterCallback = pcb;
|
||||||
mMenuBuilderCallback = mcb;
|
mMenuBuilderCallback = mcb;
|
||||||
}
|
}
|
||||||
|
@ -645,7 +645,7 @@ public class ActionMenuView extends LinearLayoutCompat implements MenuBuilder.It
|
||||||
* Returns the current menu or null if one has not yet been configured.
|
* Returns the current menu or null if one has not yet been configured.
|
||||||
* @hide Internal use only for action bar integration
|
* @hide Internal use only for action bar integration
|
||||||
*/
|
*/
|
||||||
public MenuBuilder peekMenu() {
|
public MBuilder peekMenu() {
|
||||||
return mMenu;
|
return mMenu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -734,15 +734,15 @@ public class ActionMenuView extends LinearLayoutCompat implements MenuBuilder.It
|
||||||
public boolean onMenuItemClick(MenuItem item);
|
public boolean onMenuItemClick(MenuItem item);
|
||||||
}
|
}
|
||||||
|
|
||||||
private class MenuBuilderCallback implements MenuBuilder.Callback {
|
private class MenuBuilderCallback implements MBuilder.Callback {
|
||||||
@Override
|
@Override
|
||||||
public boolean onMenuItemSelected(MenuBuilder menu, MenuItem item) {
|
public boolean onMenuItemSelected(MBuilder menu, MenuItem item) {
|
||||||
return mOnMenuItemClickListener != null &&
|
return mOnMenuItemClickListener != null &&
|
||||||
mOnMenuItemClickListener.onMenuItemClick(item);
|
mOnMenuItemClickListener.onMenuItemClick(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onMenuModeChange(MenuBuilder menu) {
|
public void onMenuModeChange(MBuilder menu) {
|
||||||
if (mMenuBuilderCallback != null) {
|
if (mMenuBuilderCallback != null) {
|
||||||
mMenuBuilderCallback.onMenuModeChange(menu);
|
mMenuBuilderCallback.onMenuModeChange(menu);
|
||||||
}
|
}
|
||||||
|
@ -751,11 +751,11 @@ public class ActionMenuView extends LinearLayoutCompat implements MenuBuilder.It
|
||||||
|
|
||||||
private class ActionMenuPresenterCallback implements ActionMenuPresenter.Callback {
|
private class ActionMenuPresenterCallback implements ActionMenuPresenter.Callback {
|
||||||
@Override
|
@Override
|
||||||
public void onCloseMenu(MenuBuilder menu, boolean allMenusAreClosing) {
|
public void onCloseMenu(MBuilder menu, boolean allMenusAreClosing) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOpenSubMenu(MenuBuilder subMenu) {
|
public boolean onOpenSubMenu(MBuilder subMenu) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,15 +21,15 @@ import android.content.Context;
|
||||||
import android.support.annotation.MenuRes;
|
import android.support.annotation.MenuRes;
|
||||||
import android.support.v7.appcompat.R;
|
import android.support.v7.appcompat.R;
|
||||||
import android.support.v7.internal.view.SupportMenuInflater;
|
import android.support.v7.internal.view.SupportMenuInflater;
|
||||||
import android.support.v7.internal.view.renamemenu.MenuBuilder;
|
|
||||||
import android.support.v7.internal.view.renamemenu.MenuPopupHelper;
|
|
||||||
import android.support.v7.internal.view.renamemenu.MenuPresenter;
|
|
||||||
import android.support.v7.internal.view.renamemenu.SubMenuBuilder;
|
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuInflater;
|
import android.view.MenuInflater;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import androidv7.rmenu.MBuilder;
|
||||||
|
import androidv7.rmenu.MenuPopupHelper;
|
||||||
|
import androidv7.rmenu.MenuPresenter;
|
||||||
|
import androidv7.rmenu.SubMenuBuilder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Static library support version of the framework's {@link android.widget.PopupMenu}.
|
* Static library support version of the framework's {@link android.widget.PopupMenu}.
|
||||||
|
@ -38,9 +38,9 @@ import android.view.View;
|
||||||
* to switch to the framework's implementation. See the framework SDK
|
* to switch to the framework's implementation. See the framework SDK
|
||||||
* documentation for a class overview.
|
* documentation for a class overview.
|
||||||
*/
|
*/
|
||||||
public class PopupMenu implements MenuBuilder.Callback, MenuPresenter.Callback {
|
public class PopupMenu implements MBuilder.Callback, MenuPresenter.Callback {
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
private MenuBuilder mMenu;
|
private MBuilder mMenu;
|
||||||
private View mAnchor;
|
private View mAnchor;
|
||||||
private MenuPopupHelper mPopup;
|
private MenuPopupHelper mPopup;
|
||||||
private OnMenuItemClickListener mMenuItemClickListener;
|
private OnMenuItemClickListener mMenuItemClickListener;
|
||||||
|
@ -105,7 +105,7 @@ public class PopupMenu implements MenuBuilder.Callback, MenuPresenter.Callback {
|
||||||
public PopupMenu(Context context, View anchor, int gravity, int popupStyleAttr,
|
public PopupMenu(Context context, View anchor, int gravity, int popupStyleAttr,
|
||||||
int popupStyleRes) {
|
int popupStyleRes) {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
mMenu = new MenuBuilder(context);
|
mMenu = new MBuilder(context);
|
||||||
mMenu.setCallback(this);
|
mMenu.setCallback(this);
|
||||||
mAnchor = anchor;
|
mAnchor = anchor;
|
||||||
mPopup = new MenuPopupHelper(context, mMenu, anchor, false, popupStyleAttr, popupStyleRes);
|
mPopup = new MenuPopupHelper(context, mMenu, anchor, false, popupStyleAttr, popupStyleRes);
|
||||||
|
@ -222,7 +222,7 @@ public class PopupMenu implements MenuBuilder.Callback, MenuPresenter.Callback {
|
||||||
/**
|
/**
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public boolean onMenuItemSelected(MenuBuilder menu, MenuItem item) {
|
public boolean onMenuItemSelected(MBuilder menu, MenuItem item) {
|
||||||
if (mMenuItemClickListener != null) {
|
if (mMenuItemClickListener != null) {
|
||||||
return mMenuItemClickListener.onMenuItemClick(item);
|
return mMenuItemClickListener.onMenuItemClick(item);
|
||||||
}
|
}
|
||||||
|
@ -232,7 +232,7 @@ public class PopupMenu implements MenuBuilder.Callback, MenuPresenter.Callback {
|
||||||
/**
|
/**
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public void onCloseMenu(MenuBuilder menu, boolean allMenusAreClosing) {
|
public void onCloseMenu(MBuilder menu, boolean allMenusAreClosing) {
|
||||||
if (mDismissListener != null) {
|
if (mDismissListener != null) {
|
||||||
mDismissListener.onDismiss(this);
|
mDismissListener.onDismiss(this);
|
||||||
}
|
}
|
||||||
|
@ -241,7 +241,7 @@ public class PopupMenu implements MenuBuilder.Callback, MenuPresenter.Callback {
|
||||||
/**
|
/**
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public boolean onOpenSubMenu(MenuBuilder subMenu) {
|
public boolean onOpenSubMenu(MBuilder subMenu) {
|
||||||
if (subMenu == null) return false;
|
if (subMenu == null) return false;
|
||||||
|
|
||||||
if (!subMenu.hasVisibleItems()) {
|
if (!subMenu.hasVisibleItems()) {
|
||||||
|
@ -262,7 +262,7 @@ public class PopupMenu implements MenuBuilder.Callback, MenuPresenter.Callback {
|
||||||
/**
|
/**
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public void onMenuModeChange(MenuBuilder menu) {
|
public void onMenuModeChange(MBuilder menu) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -31,11 +31,6 @@ import android.support.v4.view.ViewCompat;
|
||||||
import android.support.v7.app.ActionBar;
|
import android.support.v7.app.ActionBar;
|
||||||
import android.support.v7.appcompat.R;
|
import android.support.v7.appcompat.R;
|
||||||
import android.support.v7.internal.view.SupportMenuInflater;
|
import android.support.v7.internal.view.SupportMenuInflater;
|
||||||
import android.support.v7.internal.view.renamemenu.MenuBuilder;
|
|
||||||
import android.support.v7.internal.view.renamemenu.MenuItemImpl;
|
|
||||||
import android.support.v7.internal.view.renamemenu.MenuPresenter;
|
|
||||||
import android.support.v7.internal.view.renamemenu.MenuView;
|
|
||||||
import android.support.v7.internal.view.renamemenu.SubMenuBuilder;
|
|
||||||
import android.support.v7.internal.widget.DecorToolbar;
|
import android.support.v7.internal.widget.DecorToolbar;
|
||||||
import android.support.v7.internal.widget.RtlSpacingHelper;
|
import android.support.v7.internal.widget.RtlSpacingHelper;
|
||||||
import android.support.v7.internal.widget.TintManager;
|
import android.support.v7.internal.widget.TintManager;
|
||||||
|
@ -57,6 +52,11 @@ import android.view.ViewGroup;
|
||||||
import android.widget.ImageButton;
|
import android.widget.ImageButton;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
import androidv7.rmenu.MBuilder;
|
||||||
|
import androidv7.rmenu.MenuItemImpl;
|
||||||
|
import androidv7.rmenu.MenuPresenter;
|
||||||
|
import androidv7.rmenu.MenuView;
|
||||||
|
import androidv7.rmenu.SubMenuBuilder;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -171,7 +171,7 @@ public class Toolbar extends ViewGroup {
|
||||||
private ActionMenuPresenter mOuterActionMenuPresenter;
|
private ActionMenuPresenter mOuterActionMenuPresenter;
|
||||||
private ExpandedActionViewMenuPresenter mExpandedMenuPresenter;
|
private ExpandedActionViewMenuPresenter mExpandedMenuPresenter;
|
||||||
private MenuPresenter.Callback mActionMenuPresenterCallback;
|
private MenuPresenter.Callback mActionMenuPresenterCallback;
|
||||||
private MenuBuilder.Callback mMenuBuilderCallback;
|
private MBuilder.Callback mMenuBuilderCallback;
|
||||||
|
|
||||||
private boolean mCollapsible;
|
private boolean mCollapsible;
|
||||||
private int mMinHeight;
|
private int mMinHeight;
|
||||||
|
@ -369,13 +369,13 @@ public class Toolbar extends ViewGroup {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
public void setMenu(MenuBuilder menu, ActionMenuPresenter outerPresenter) {
|
public void setMenu(MBuilder menu, ActionMenuPresenter outerPresenter) {
|
||||||
if (menu == null && mMenuView == null) {
|
if (menu == null && mMenuView == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ensureMenuView();
|
ensureMenuView();
|
||||||
final MenuBuilder oldMenu = mMenuView.peekMenu();
|
final MBuilder oldMenu = mMenuView.peekMenu();
|
||||||
if (oldMenu == menu) {
|
if (oldMenu == menu) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -825,7 +825,7 @@ public class Toolbar extends ViewGroup {
|
||||||
ensureMenuView();
|
ensureMenuView();
|
||||||
if (mMenuView.peekMenu() == null) {
|
if (mMenuView.peekMenu() == null) {
|
||||||
// Initialize a new menu for the first time.
|
// Initialize a new menu for the first time.
|
||||||
final MenuBuilder menu = (MenuBuilder) mMenuView.getMenu();
|
final MBuilder menu = (MBuilder) mMenuView.getMenu();
|
||||||
if (mExpandedMenuPresenter == null) {
|
if (mExpandedMenuPresenter == null) {
|
||||||
mExpandedMenuPresenter = new ExpandedActionViewMenuPresenter();
|
mExpandedMenuPresenter = new ExpandedActionViewMenuPresenter();
|
||||||
}
|
}
|
||||||
|
@ -1767,7 +1767,7 @@ public class Toolbar extends ViewGroup {
|
||||||
* Must be called before the menu is accessed
|
* Must be called before the menu is accessed
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public void setMenuCallbacks(MenuPresenter.Callback pcb, MenuBuilder.Callback mcb) {
|
public void setMenuCallbacks(MenuPresenter.Callback pcb, MBuilder.Callback mcb) {
|
||||||
mActionMenuPresenterCallback = pcb;
|
mActionMenuPresenterCallback = pcb;
|
||||||
mMenuBuilderCallback = mcb;
|
mMenuBuilderCallback = mcb;
|
||||||
}
|
}
|
||||||
|
@ -1904,11 +1904,11 @@ public class Toolbar extends ViewGroup {
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ExpandedActionViewMenuPresenter implements MenuPresenter {
|
private class ExpandedActionViewMenuPresenter implements MenuPresenter {
|
||||||
MenuBuilder mMenu;
|
MBuilder mMenu;
|
||||||
MenuItemImpl mCurrentExpandedItem;
|
MenuItemImpl mCurrentExpandedItem;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initForMenu(Context context, MenuBuilder menu) {
|
public void initForMenu(Context context, MBuilder menu) {
|
||||||
// Clear the expanded action view when menus change.
|
// Clear the expanded action view when menus change.
|
||||||
if (mMenu != null && mCurrentExpandedItem != null) {
|
if (mMenu != null && mCurrentExpandedItem != null) {
|
||||||
mMenu.collapseItemActionView(mCurrentExpandedItem);
|
mMenu.collapseItemActionView(mCurrentExpandedItem);
|
||||||
|
@ -1955,7 +1955,7 @@ public class Toolbar extends ViewGroup {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCloseMenu(MenuBuilder menu, boolean allMenusAreClosing) {
|
public void onCloseMenu(MBuilder menu, boolean allMenusAreClosing) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1964,7 +1964,7 @@ public class Toolbar extends ViewGroup {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean expandItemActionView(MenuBuilder menu, MenuItemImpl item) {
|
public boolean expandItemActionView(MBuilder menu, MenuItemImpl item) {
|
||||||
ensureCollapseButtonView();
|
ensureCollapseButtonView();
|
||||||
if (mCollapseButtonView.getParent() != Toolbar.this) {
|
if (mCollapseButtonView.getParent() != Toolbar.this) {
|
||||||
addView(mCollapseButtonView);
|
addView(mCollapseButtonView);
|
||||||
|
@ -1991,7 +1991,7 @@ public class Toolbar extends ViewGroup {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean collapseItemActionView(MenuBuilder menu, MenuItemImpl item) {
|
public boolean collapseItemActionView(MBuilder menu, MenuItemImpl item) {
|
||||||
// Do this before detaching the actionview from the hierarchy, in case
|
// Do this before detaching the actionview from the hierarchy, in case
|
||||||
// it needs to dismiss the soft keyboard, etc.
|
// it needs to dismiss the soft keyboard, etc.
|
||||||
if (mExpandedActionView instanceof CollapsibleActionView) {
|
if (mExpandedActionView instanceof CollapsibleActionView) {
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package android.support.v7.internal.view.renamemenu;
|
package androidv7.rmenu;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package android.support.v7.internal.view.renamemenu;
|
package androidv7.rmenu;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
|
@ -52,7 +52,7 @@ public class ActionMenuItemView extends CompatTextView
|
||||||
private MenuItemImpl mItemData;
|
private MenuItemImpl mItemData;
|
||||||
private CharSequence mTitle;
|
private CharSequence mTitle;
|
||||||
private Drawable mIcon;
|
private Drawable mIcon;
|
||||||
private MenuBuilder.ItemInvoker mItemInvoker;
|
private MBuilder.ItemInvoker mItemInvoker;
|
||||||
private ListPopupWindow.ForwardingListener mForwardingListener;
|
private ListPopupWindow.ForwardingListener mForwardingListener;
|
||||||
private PopupCallback mPopupCallback;
|
private PopupCallback mPopupCallback;
|
||||||
|
|
||||||
|
@ -144,7 +144,7 @@ public class ActionMenuItemView extends CompatTextView
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setItemInvoker(MenuBuilder.ItemInvoker invoker) {
|
public void setItemInvoker(MBuilder.ItemInvoker invoker) {
|
||||||
mItemInvoker = invoker;
|
mItemInvoker = invoker;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package android.support.v7.internal.view.renamemenu;
|
package androidv7.rmenu;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.support.v4.view.ViewCompat;
|
import android.support.v4.view.ViewCompat;
|
||||||
|
@ -35,7 +35,7 @@ public abstract class BaseMenuPresenter implements MenuPresenter {
|
||||||
|
|
||||||
protected Context mSystemContext;
|
protected Context mSystemContext;
|
||||||
protected Context mContext;
|
protected Context mContext;
|
||||||
protected MenuBuilder mMenu;
|
protected MBuilder mMenu;
|
||||||
protected LayoutInflater mSystemInflater;
|
protected LayoutInflater mSystemInflater;
|
||||||
protected LayoutInflater mInflater;
|
protected LayoutInflater mInflater;
|
||||||
private Callback mCallback;
|
private Callback mCallback;
|
||||||
|
@ -62,7 +62,7 @@ public abstract class BaseMenuPresenter implements MenuPresenter {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initForMenu(Context context, MenuBuilder menu) {
|
public void initForMenu(Context context, MBuilder menu) {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
mInflater = LayoutInflater.from(mContext);
|
mInflater = LayoutInflater.from(mContext);
|
||||||
mMenu = menu;
|
mMenu = menu;
|
||||||
|
@ -202,7 +202,7 @@ public abstract class BaseMenuPresenter implements MenuPresenter {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onCloseMenu(MenuBuilder menu, boolean allMenusAreClosing) {
|
public void onCloseMenu(MBuilder menu, boolean allMenusAreClosing) {
|
||||||
if (mCallback != null) {
|
if (mCallback != null) {
|
||||||
mCallback.onCloseMenu(menu, allMenusAreClosing);
|
mCallback.onCloseMenu(menu, allMenusAreClosing);
|
||||||
}
|
}
|
||||||
|
@ -219,11 +219,11 @@ public abstract class BaseMenuPresenter implements MenuPresenter {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean expandItemActionView(MenuBuilder menu, MenuItemImpl item) {
|
public boolean expandItemActionView(MBuilder menu, MenuItemImpl item) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean collapseItemActionView(MenuBuilder menu, MenuItemImpl item) {
|
public boolean collapseItemActionView(MBuilder menu, MenuItemImpl item) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package android.support.v7.internal.view.renamemenu;
|
package androidv7.rmenu;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.support.v4.internal.view.SupportMenuItem;
|
import android.support.v4.internal.view.SupportMenuItem;
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package android.support.v7.internal.view.renamemenu;
|
package androidv7.rmenu;
|
||||||
|
|
||||||
class BaseWrapper<T> {
|
class BaseWrapper<T> {
|
||||||
|
|
|
@ -14,18 +14,18 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package android.support.v7.internal.view.renamemenu;
|
package androidv7.rmenu;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.support.v7.internal.view.renamemenu.MenuBuilder;
|
|
||||||
import android.support.v7.internal.view.renamemenu.MenuView;
|
|
||||||
import android.support.v7.internal.view.renamemenu.MenuBuilder.ItemInvoker;
|
|
||||||
import android.support.v7.internal.widget.TintTypedArray;
|
import android.support.v7.internal.widget.TintTypedArray;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
import android.widget.AdapterView.OnItemClickListener;
|
import android.widget.AdapterView.OnItemClickListener;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
|
import androidv7.rmenu.MBuilder;
|
||||||
|
import androidv7.rmenu.MenuView;
|
||||||
|
import androidv7.rmenu.MBuilder.ItemInvoker;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The expanded menu view is a list-like menu with all of the available menu items. It is opened
|
* The expanded menu view is a list-like menu with all of the available menu items. It is opened
|
||||||
|
@ -41,7 +41,7 @@ public final class ExpandedMenuView extends ListView
|
||||||
android.R.attr.divider
|
android.R.attr.divider
|
||||||
};
|
};
|
||||||
|
|
||||||
private MenuBuilder mMenu;
|
private MBuilder mMenu;
|
||||||
|
|
||||||
/** Default animations for this menu */
|
/** Default animations for this menu */
|
||||||
private int mAnimations;
|
private int mAnimations;
|
||||||
|
@ -66,7 +66,7 @@ public final class ExpandedMenuView extends ListView
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initialize(MenuBuilder menu) {
|
public void initialize(MBuilder menu) {
|
||||||
mMenu = menu;
|
mMenu = menu;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package android.support.v7.internal.view.renamemenu;
|
package androidv7.rmenu;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.TypedArray;
|
import android.content.res.TypedArray;
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package android.support.v7.internal.view.renamemenu;
|
package androidv7.rmenu;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.database.DataSetObserver;
|
import android.database.DataSetObserver;
|
||||||
|
@ -42,7 +42,7 @@ public class ListMenuPresenter implements MenuPresenter, AdapterView.OnItemClick
|
||||||
|
|
||||||
Context mContext;
|
Context mContext;
|
||||||
LayoutInflater mInflater;
|
LayoutInflater mInflater;
|
||||||
MenuBuilder mMenu;
|
MBuilder mMenu;
|
||||||
|
|
||||||
ExpandedMenuView mMenuView;
|
ExpandedMenuView mMenuView;
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ public class ListMenuPresenter implements MenuPresenter, AdapterView.OnItemClick
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initForMenu(Context context, MenuBuilder menu) {
|
public void initForMenu(Context context, MBuilder menu) {
|
||||||
if (mThemeRes != 0) {
|
if (mThemeRes != 0) {
|
||||||
mContext = new ContextThemeWrapper(context, mThemeRes);
|
mContext = new ContextThemeWrapper(context, mThemeRes);
|
||||||
mInflater = LayoutInflater.from(mContext);
|
mInflater = LayoutInflater.from(mContext);
|
||||||
|
@ -147,7 +147,7 @@ public class ListMenuPresenter implements MenuPresenter, AdapterView.OnItemClick
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCloseMenu(MenuBuilder menu, boolean allMenusAreClosing) {
|
public void onCloseMenu(MBuilder menu, boolean allMenusAreClosing) {
|
||||||
if (mCallback != null) {
|
if (mCallback != null) {
|
||||||
mCallback.onCloseMenu(menu, allMenusAreClosing);
|
mCallback.onCloseMenu(menu, allMenusAreClosing);
|
||||||
}
|
}
|
||||||
|
@ -174,11 +174,11 @@ public class ListMenuPresenter implements MenuPresenter, AdapterView.OnItemClick
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean expandItemActionView(MenuBuilder menu, MenuItemImpl item) {
|
public boolean expandItemActionView(MBuilder menu, MenuItemImpl item) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean collapseItemActionView(MenuBuilder menu, MenuItemImpl item) {
|
public boolean collapseItemActionView(MBuilder menu, MenuItemImpl item) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package android.support.v7.internal.view.renamemenu;
|
package androidv7.rmenu;
|
||||||
|
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
@ -51,7 +51,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
*
|
*
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public class MenuBuilder implements SupportMenu {
|
public class MBuilder implements SupportMenu {
|
||||||
|
|
||||||
private static final String TAG = "MenuBuilder";
|
private static final String TAG = "MenuBuilder";
|
||||||
|
|
||||||
|
@ -188,14 +188,14 @@ public class MenuBuilder implements SupportMenu {
|
||||||
* @param item The menu item that is selected
|
* @param item The menu item that is selected
|
||||||
* @return whether the menu item selection was handled
|
* @return whether the menu item selection was handled
|
||||||
*/
|
*/
|
||||||
public boolean onMenuItemSelected(MenuBuilder menu, MenuItem item);
|
public boolean onMenuItemSelected(MBuilder menu, MenuItem item);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the mode of the menu changes (for example, from icon to expanded).
|
* Called when the mode of the menu changes (for example, from icon to expanded).
|
||||||
*
|
*
|
||||||
* @param menu the menu that has changed modes
|
* @param menu the menu that has changed modes
|
||||||
*/
|
*/
|
||||||
public void onMenuModeChange(MenuBuilder menu);
|
public void onMenuModeChange(MBuilder menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -206,7 +206,7 @@ public class MenuBuilder implements SupportMenu {
|
||||||
public boolean invokeItem(MenuItemImpl item);
|
public boolean invokeItem(MenuItemImpl item);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MenuBuilder(Context context) {
|
public MBuilder(Context context) {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
mResources = context.getResources();
|
mResources = context.getResources();
|
||||||
|
|
||||||
|
@ -222,7 +222,7 @@ public class MenuBuilder implements SupportMenu {
|
||||||
setShortcutsVisibleInner(true);
|
setShortcutsVisibleInner(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MenuBuilder setDefaultShowAsAction(int defaultShowAsAction) {
|
public MBuilder setDefaultShowAsAction(int defaultShowAsAction) {
|
||||||
mDefaultShowAsAction = defaultShowAsAction;
|
mDefaultShowAsAction = defaultShowAsAction;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -798,7 +798,7 @@ public class MenuBuilder implements SupportMenu {
|
||||||
return mContext;
|
return mContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean dispatchMenuItemSelected(MenuBuilder menu, MenuItem item) {
|
boolean dispatchMenuItemSelected(MBuilder menu, MenuItem item) {
|
||||||
return mCallback != null && mCallback.onMenuItemSelected(menu, item);
|
return mCallback != null && mCallback.onMenuItemSelected(menu, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -862,7 +862,7 @@ public class MenuBuilder implements SupportMenu {
|
||||||
for (int i = 0; i < N; i++) {
|
for (int i = 0; i < N; i++) {
|
||||||
MenuItemImpl item = mItems.get(i);
|
MenuItemImpl item = mItems.get(i);
|
||||||
if (item.hasSubMenu()) {
|
if (item.hasSubMenu()) {
|
||||||
((MenuBuilder)item.getSubMenu()).findItemsWithShortcutForKey(items, keyCode, event);
|
((MBuilder)item.getSubMenu()).findItemsWithShortcutForKey(items, keyCode, event);
|
||||||
}
|
}
|
||||||
final char shortcutChar = qwerty ? item.getAlphabeticShortcut() : item.getNumericShortcut();
|
final char shortcutChar = qwerty ? item.getAlphabeticShortcut() : item.getNumericShortcut();
|
||||||
if (((metaState & (KeyEvent.META_SHIFT_ON | KeyEvent.META_SYM_ON)) == 0) &&
|
if (((metaState & (KeyEvent.META_SHIFT_ON | KeyEvent.META_SYM_ON)) == 0) &&
|
||||||
|
@ -1208,7 +1208,7 @@ public class MenuBuilder implements SupportMenu {
|
||||||
* @param title The new title.
|
* @param title The new title.
|
||||||
* @return This MenuBuilder so additional setters can be called.
|
* @return This MenuBuilder so additional setters can be called.
|
||||||
*/
|
*/
|
||||||
protected MenuBuilder setHeaderTitleInt(CharSequence title) {
|
protected MBuilder setHeaderTitleInt(CharSequence title) {
|
||||||
setHeaderInternal(0, title, 0, null, null);
|
setHeaderInternal(0, title, 0, null, null);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -1220,7 +1220,7 @@ public class MenuBuilder implements SupportMenu {
|
||||||
* @param titleRes The new title (as a resource ID).
|
* @param titleRes The new title (as a resource ID).
|
||||||
* @return This MenuBuilder so additional setters can be called.
|
* @return This MenuBuilder so additional setters can be called.
|
||||||
*/
|
*/
|
||||||
protected MenuBuilder setHeaderTitleInt(int titleRes) {
|
protected MBuilder setHeaderTitleInt(int titleRes) {
|
||||||
setHeaderInternal(titleRes, null, 0, null, null);
|
setHeaderInternal(titleRes, null, 0, null, null);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -1232,7 +1232,7 @@ public class MenuBuilder implements SupportMenu {
|
||||||
* @param icon The new icon.
|
* @param icon The new icon.
|
||||||
* @return This MenuBuilder so additional setters can be called.
|
* @return This MenuBuilder so additional setters can be called.
|
||||||
*/
|
*/
|
||||||
protected MenuBuilder setHeaderIconInt(Drawable icon) {
|
protected MBuilder setHeaderIconInt(Drawable icon) {
|
||||||
setHeaderInternal(0, null, 0, icon, null);
|
setHeaderInternal(0, null, 0, icon, null);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -1244,7 +1244,7 @@ public class MenuBuilder implements SupportMenu {
|
||||||
* @param iconRes The new icon (as a resource ID).
|
* @param iconRes The new icon (as a resource ID).
|
||||||
* @return This MenuBuilder so additional setters can be called.
|
* @return This MenuBuilder so additional setters can be called.
|
||||||
*/
|
*/
|
||||||
protected MenuBuilder setHeaderIconInt(int iconRes) {
|
protected MBuilder setHeaderIconInt(int iconRes) {
|
||||||
setHeaderInternal(0, null, iconRes, null, null);
|
setHeaderInternal(0, null, iconRes, null, null);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -1256,7 +1256,7 @@ public class MenuBuilder implements SupportMenu {
|
||||||
* @param view The new view.
|
* @param view The new view.
|
||||||
* @return This MenuBuilder so additional setters can be called.
|
* @return This MenuBuilder so additional setters can be called.
|
||||||
*/
|
*/
|
||||||
protected MenuBuilder setHeaderViewInt(View view) {
|
protected MBuilder setHeaderViewInt(View view) {
|
||||||
setHeaderInternal(0, null, 0, null, view);
|
setHeaderInternal(0, null, 0, null, view);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -1278,7 +1278,7 @@ public class MenuBuilder implements SupportMenu {
|
||||||
*
|
*
|
||||||
* @return The root menu.
|
* @return The root menu.
|
||||||
*/
|
*/
|
||||||
public MenuBuilder getRootMenu() {
|
public MBuilder getRootMenu() {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package android.support.v7.internal.view.renamemenu;
|
package androidv7.rmenu;
|
||||||
|
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
|
@ -35,12 +35,12 @@ public class MenuDialogHelper implements DialogInterface.OnKeyListener,
|
||||||
DialogInterface.OnClickListener,
|
DialogInterface.OnClickListener,
|
||||||
DialogInterface.OnDismissListener,
|
DialogInterface.OnDismissListener,
|
||||||
MenuPresenter.Callback {
|
MenuPresenter.Callback {
|
||||||
private MenuBuilder mMenu;
|
private MBuilder mMenu;
|
||||||
private AlertDialog mDialog;
|
private AlertDialog mDialog;
|
||||||
ListMenuPresenter mPresenter;
|
ListMenuPresenter mPresenter;
|
||||||
private MenuPresenter.Callback mPresenterCallback;
|
private MenuPresenter.Callback mPresenterCallback;
|
||||||
|
|
||||||
public MenuDialogHelper(MenuBuilder menu) {
|
public MenuDialogHelper(MBuilder menu) {
|
||||||
mMenu = menu;
|
mMenu = menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ public class MenuDialogHelper implements DialogInterface.OnKeyListener,
|
||||||
*/
|
*/
|
||||||
public void show(IBinder windowToken) {
|
public void show(IBinder windowToken) {
|
||||||
// Many references to mMenu, create local reference
|
// Many references to mMenu, create local reference
|
||||||
final MenuBuilder menu = mMenu;
|
final MBuilder menu = mMenu;
|
||||||
|
|
||||||
// Get the builder for the dialog
|
// Get the builder for the dialog
|
||||||
final AlertDialog.Builder builder = new AlertDialog.Builder(menu.getContext());
|
final AlertDialog.Builder builder = new AlertDialog.Builder(menu.getContext());
|
||||||
|
@ -149,7 +149,7 @@ public class MenuDialogHelper implements DialogInterface.OnKeyListener,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCloseMenu(MenuBuilder menu, boolean allMenusAreClosing) {
|
public void onCloseMenu(MBuilder menu, boolean allMenusAreClosing) {
|
||||||
if (allMenusAreClosing || menu == mMenu) {
|
if (allMenusAreClosing || menu == mMenu) {
|
||||||
dismiss();
|
dismiss();
|
||||||
}
|
}
|
||||||
|
@ -159,7 +159,7 @@ public class MenuDialogHelper implements DialogInterface.OnKeyListener,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOpenSubMenu(MenuBuilder subMenu) {
|
public boolean onOpenSubMenu(MBuilder subMenu) {
|
||||||
if (mPresenterCallback != null) {
|
if (mPresenterCallback != null) {
|
||||||
return mPresenterCallback.onOpenSubMenu(subMenu);
|
return mPresenterCallback.onOpenSubMenu(subMenu);
|
||||||
}
|
}
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package android.support.v7.internal.view.renamemenu;
|
package androidv7.rmenu;
|
||||||
|
|
||||||
import android.content.ActivityNotFoundException;
|
import android.content.ActivityNotFoundException;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
@ -67,7 +67,7 @@ public final class MenuItemImpl implements SupportMenuItem {
|
||||||
private int mIconResId = NO_ICON;
|
private int mIconResId = NO_ICON;
|
||||||
|
|
||||||
/** The menu to which this item belongs */
|
/** The menu to which this item belongs */
|
||||||
private MenuBuilder mMenu;
|
private MBuilder mMenu;
|
||||||
/** If this item should launch a sub menu, this is the sub menu to launch */
|
/** If this item should launch a sub menu, this is the sub menu to launch */
|
||||||
private SubMenuBuilder mSubMenu;
|
private SubMenuBuilder mSubMenu;
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ public final class MenuItemImpl implements SupportMenuItem {
|
||||||
* @param categoryOrder The ordering for this item.
|
* @param categoryOrder The ordering for this item.
|
||||||
* @param title The text to display for the item.
|
* @param title The text to display for the item.
|
||||||
*/
|
*/
|
||||||
MenuItemImpl(MenuBuilder menu, int group, int id, int categoryOrder, int ordering,
|
MenuItemImpl(MBuilder menu, int group, int id, int categoryOrder, int ordering,
|
||||||
CharSequence title, int showAsAction) {
|
CharSequence title, int showAsAction) {
|
||||||
|
|
||||||
/*if (sPrependShortcutLabel == null) {
|
/*if (sPrependShortcutLabel == null) {
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package android.support.v7.internal.view.renamemenu;
|
package androidv7.rmenu;
|
||||||
|
|
||||||
import android.annotation.TargetApi;
|
import android.annotation.TargetApi;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package android.support.v7.internal.view.renamemenu;
|
package androidv7.rmenu;
|
||||||
|
|
||||||
import android.annotation.TargetApi;
|
import android.annotation.TargetApi;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package android.support.v7.internal.view.renamemenu;
|
package androidv7.rmenu;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
|
@ -52,7 +52,7 @@ public class MenuPopupHelper implements AdapterView.OnItemClickListener, View.On
|
||||||
|
|
||||||
private final Context mContext;
|
private final Context mContext;
|
||||||
private final LayoutInflater mInflater;
|
private final LayoutInflater mInflater;
|
||||||
private final MenuBuilder mMenu;
|
private final MBuilder mMenu;
|
||||||
private final MenuAdapter mAdapter;
|
private final MenuAdapter mAdapter;
|
||||||
private final boolean mOverflowOnly;
|
private final boolean mOverflowOnly;
|
||||||
private final int mPopupMaxWidth;
|
private final int mPopupMaxWidth;
|
||||||
|
@ -76,20 +76,20 @@ public class MenuPopupHelper implements AdapterView.OnItemClickListener, View.On
|
||||||
|
|
||||||
private int mDropDownGravity = Gravity.NO_GRAVITY;
|
private int mDropDownGravity = Gravity.NO_GRAVITY;
|
||||||
|
|
||||||
public MenuPopupHelper(Context context, MenuBuilder menu) {
|
public MenuPopupHelper(Context context, MBuilder menu) {
|
||||||
this(context, menu, null, false, R.attr.popupMenuStyle);
|
this(context, menu, null, false, R.attr.popupMenuStyle);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MenuPopupHelper(Context context, MenuBuilder menu, View anchorView) {
|
public MenuPopupHelper(Context context, MBuilder menu, View anchorView) {
|
||||||
this(context, menu, anchorView, false, R.attr.popupMenuStyle);
|
this(context, menu, anchorView, false, R.attr.popupMenuStyle);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MenuPopupHelper(Context context, MenuBuilder menu, View anchorView,
|
public MenuPopupHelper(Context context, MBuilder menu, View anchorView,
|
||||||
boolean overflowOnly, int popupStyleAttr) {
|
boolean overflowOnly, int popupStyleAttr) {
|
||||||
this(context, menu, anchorView, overflowOnly, popupStyleAttr, 0);
|
this(context, menu, anchorView, overflowOnly, popupStyleAttr, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MenuPopupHelper(Context context, MenuBuilder menu, View anchorView,
|
public MenuPopupHelper(Context context, MBuilder menu, View anchorView,
|
||||||
boolean overflowOnly, int popupStyleAttr, int popupStyleRes) {
|
boolean overflowOnly, int popupStyleAttr, int popupStyleRes) {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
mInflater = LayoutInflater.from(context);
|
mInflater = LayoutInflater.from(context);
|
||||||
|
@ -244,7 +244,7 @@ public class MenuPopupHelper implements AdapterView.OnItemClickListener, View.On
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initForMenu(Context context, MenuBuilder menu) {
|
public void initForMenu(Context context, MBuilder menu) {
|
||||||
// Don't need to do anything; we added as a presenter in the constructor.
|
// Don't need to do anything; we added as a presenter in the constructor.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -295,7 +295,7 @@ public class MenuPopupHelper implements AdapterView.OnItemClickListener, View.On
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCloseMenu(MenuBuilder menu, boolean allMenusAreClosing) {
|
public void onCloseMenu(MBuilder menu, boolean allMenusAreClosing) {
|
||||||
// Only care about the (sub)menu we're presenting.
|
// Only care about the (sub)menu we're presenting.
|
||||||
if (menu != mMenu) return;
|
if (menu != mMenu) return;
|
||||||
|
|
||||||
|
@ -310,11 +310,11 @@ public class MenuPopupHelper implements AdapterView.OnItemClickListener, View.On
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean expandItemActionView(MenuBuilder menu, MenuItemImpl item) {
|
public boolean expandItemActionView(MBuilder menu, MenuItemImpl item) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean collapseItemActionView(MenuBuilder menu, MenuItemImpl item) {
|
public boolean collapseItemActionView(MBuilder menu, MenuItemImpl item) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -333,10 +333,10 @@ public class MenuPopupHelper implements AdapterView.OnItemClickListener, View.On
|
||||||
}
|
}
|
||||||
|
|
||||||
private class MenuAdapter extends BaseAdapter {
|
private class MenuAdapter extends BaseAdapter {
|
||||||
private MenuBuilder mAdapterMenu;
|
private MBuilder mAdapterMenu;
|
||||||
private int mExpandedIndex = -1;
|
private int mExpandedIndex = -1;
|
||||||
|
|
||||||
public MenuAdapter(MenuBuilder menu) {
|
public MenuAdapter(MBuilder menu) {
|
||||||
mAdapterMenu = menu;
|
mAdapterMenu = menu;
|
||||||
findExpandedIndex();
|
findExpandedIndex();
|
||||||
}
|
}
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package android.support.v7.internal.view.renamemenu;
|
package androidv7.rmenu;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
|
@ -39,7 +39,7 @@ public interface MenuPresenter {
|
||||||
* @param menu
|
* @param menu
|
||||||
* @param allMenusAreClosing
|
* @param allMenusAreClosing
|
||||||
*/
|
*/
|
||||||
public void onCloseMenu(MenuBuilder menu, boolean allMenusAreClosing);
|
public void onCloseMenu(MBuilder menu, boolean allMenusAreClosing);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a submenu opens. Useful for notifying the application
|
* Called when a submenu opens. Useful for notifying the application
|
||||||
|
@ -50,22 +50,22 @@ public interface MenuPresenter {
|
||||||
* @return true if the Callback will handle presenting the submenu, false if
|
* @return true if the Callback will handle presenting the submenu, false if
|
||||||
* the presenter should attempt to do so.
|
* the presenter should attempt to do so.
|
||||||
*/
|
*/
|
||||||
public boolean onOpenSubMenu(MenuBuilder subMenu);
|
public boolean onOpenSubMenu(MBuilder subMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize this presenter for the given context and menu.
|
* Initialize this presenter for the given context and menu.
|
||||||
* This method is called by MenuBuilder when a presenter is
|
* This method is called by MenuBuilder when a presenter is
|
||||||
* added. See {@link MenuBuilder#addMenuPresenter(MenuPresenter)}
|
* added. See {@link MBuilder#addMenuPresenter(MenuPresenter)}
|
||||||
*
|
*
|
||||||
* @param context Context for this presenter; used for view creation and resource management
|
* @param context Context for this presenter; used for view creation and resource management
|
||||||
* @param menu Menu to host
|
* @param menu Menu to host
|
||||||
*/
|
*/
|
||||||
public void initForMenu(Context context, MenuBuilder menu);
|
public void initForMenu(Context context, MBuilder menu);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve a MenuView to display the menu specified in
|
* Retrieve a MenuView to display the menu specified in
|
||||||
* {@link #initForMenu(Context, MenuBuilder)}.
|
* {@link #initForMenu(Context, MBuilder)}.
|
||||||
*
|
*
|
||||||
* @param root Intended parent of the MenuView.
|
* @param root Intended parent of the MenuView.
|
||||||
* @return A freshly created MenuView.
|
* @return A freshly created MenuView.
|
||||||
|
@ -105,7 +105,7 @@ public interface MenuPresenter {
|
||||||
* @param menu Menu or submenu that is closing.
|
* @param menu Menu or submenu that is closing.
|
||||||
* @param allMenusAreClosing True if all associated menus are closing.
|
* @param allMenusAreClosing True if all associated menus are closing.
|
||||||
*/
|
*/
|
||||||
public void onCloseMenu(MenuBuilder menu, boolean allMenusAreClosing);
|
public void onCloseMenu(MBuilder menu, boolean allMenusAreClosing);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called by Menu implementations to flag items that will be shown as actions.
|
* Called by Menu implementations to flag items that will be shown as actions.
|
||||||
|
@ -120,7 +120,7 @@ public interface MenuPresenter {
|
||||||
* @param item Item to be expanded
|
* @param item Item to be expanded
|
||||||
* @return true if this presenter expanded the action view, false otherwise.
|
* @return true if this presenter expanded the action view, false otherwise.
|
||||||
*/
|
*/
|
||||||
public boolean expandItemActionView(MenuBuilder menu, MenuItemImpl item);
|
public boolean expandItemActionView(MBuilder menu, MenuItemImpl item);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a menu item with a collapsable action view should collapse its action view.
|
* Called when a menu item with a collapsable action view should collapse its action view.
|
||||||
|
@ -129,7 +129,7 @@ public interface MenuPresenter {
|
||||||
* @param item Item to be collapsed
|
* @param item Item to be collapsed
|
||||||
* @return true if this presenter collapsed the action view, false otherwise.
|
* @return true if this presenter collapsed the action view, false otherwise.
|
||||||
*/
|
*/
|
||||||
public boolean collapseItemActionView(MenuBuilder menu, MenuItemImpl item);
|
public boolean collapseItemActionView(MBuilder menu, MenuItemImpl item);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an ID for determining how to save/restore instance state.
|
* Returns an ID for determining how to save/restore instance state.
|
|
@ -14,12 +14,12 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package android.support.v7.internal.view.renamemenu;
|
package androidv7.rmenu;
|
||||||
|
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Minimal interface for a menu view. {@link #initialize(MenuBuilder)} must be called for the
|
* Minimal interface for a menu view. {@link #initialize(MBuilder)} must be called for the
|
||||||
* menu to be functional.
|
* menu to be functional.
|
||||||
*
|
*
|
||||||
* @hide
|
* @hide
|
||||||
|
@ -31,7 +31,7 @@ public interface MenuView {
|
||||||
*
|
*
|
||||||
* @param menu The menu that this MenuView should display.
|
* @param menu The menu that this MenuView should display.
|
||||||
*/
|
*/
|
||||||
public void initialize(MenuBuilder menu);
|
public void initialize(MBuilder menu);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the default animations to be used for this menu when entering/exiting.
|
* Returns the default animations to be used for this menu when entering/exiting.
|
||||||
|
@ -49,8 +49,8 @@ public interface MenuView {
|
||||||
* inflated.
|
* inflated.
|
||||||
* @param itemData The item that this ItemView should display.
|
* @param itemData The item that this ItemView should display.
|
||||||
* @param menuType The type of this menu, one of
|
* @param menuType The type of this menu, one of
|
||||||
* {@link MenuBuilder#TYPE_ICON}, {@link MenuBuilder#TYPE_EXPANDED},
|
* {@link MBuilder#TYPE_ICON}, {@link MBuilder#TYPE_EXPANDED},
|
||||||
* {@link MenuBuilder#TYPE_DIALOG}).
|
* {@link MBuilder#TYPE_DIALOG}).
|
||||||
*/
|
*/
|
||||||
public void initialize(MenuItemImpl itemData, int menuType);
|
public void initialize(MenuItemImpl itemData, int menuType);
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package android.support.v7.internal.view.renamemenu;
|
package androidv7.rmenu;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package android.support.v7.internal.view.renamemenu;
|
package androidv7.rmenu;
|
||||||
|
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package android.support.v7.internal.view.renamemenu;
|
package androidv7.rmenu;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
|
@ -30,11 +30,11 @@ import android.view.View;
|
||||||
*
|
*
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public class SubMenuBuilder extends MenuBuilder implements SubMenu {
|
public class SubMenuBuilder extends MBuilder implements SubMenu {
|
||||||
private MenuBuilder mParentMenu;
|
private MBuilder mParentMenu;
|
||||||
private MenuItemImpl mItem;
|
private MenuItemImpl mItem;
|
||||||
|
|
||||||
public SubMenuBuilder(Context context, MenuBuilder parentMenu, MenuItemImpl item) {
|
public SubMenuBuilder(Context context, MBuilder parentMenu, MenuItemImpl item) {
|
||||||
super(context);
|
super(context);
|
||||||
|
|
||||||
mParentMenu = parentMenu;
|
mParentMenu = parentMenu;
|
||||||
|
@ -75,12 +75,12 @@ public class SubMenuBuilder extends MenuBuilder implements SubMenu {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MenuBuilder getRootMenu() {
|
public MBuilder getRootMenu() {
|
||||||
return mParentMenu;
|
return mParentMenu;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
boolean dispatchMenuItemSelected(MenuBuilder menu, MenuItem item) {
|
boolean dispatchMenuItemSelected(MBuilder menu, MenuItem item) {
|
||||||
return super.dispatchMenuItemSelected(menu, item) ||
|
return super.dispatchMenuItemSelected(menu, item) ||
|
||||||
mParentMenu.dispatchMenuItemSelected(menu, item);
|
mParentMenu.dispatchMenuItemSelected(menu, item);
|
||||||
}
|
}
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package android.support.v7.internal.view.renamemenu;
|
package androidv7.rmenu;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
Loading…
Reference in a new issue