Java 类android.support.v7.widget.ActionMenuPresenter 实例源码

项目:FMTech    文件:AbsActionBarView.java   
protected void onConfigurationChanged(Configuration paramConfiguration)
{
  if (Build.VERSION.SDK_INT >= 8) {
    super.onConfigurationChanged(paramConfiguration);
  }
  TypedArray localTypedArray = getContext().obtainStyledAttributes(null, R.styleable.ActionBar, R.attr.actionBarStyle, 0);
  setContentHeight(localTypedArray.getLayoutDimension(R.styleable.ActionBar_height, 0));
  localTypedArray.recycle();
  if (this.mActionMenuPresenter != null)
  {
    ActionMenuPresenter localActionMenuPresenter = this.mActionMenuPresenter;
    if (!localActionMenuPresenter.mMaxItemsSet) {
      localActionMenuPresenter.mMaxItems = localActionMenuPresenter.mContext.getResources().getInteger(R.integer.abc_max_action_buttons);
    }
    if (localActionMenuPresenter.mMenu != null) {
      localActionMenuPresenter.mMenu.onItemsChanged(true);
    }
  }
}
项目:Infodota    文件:ListHolderActivity.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main_fragment_holder);

    mActionMenuView.setPresenter(new ActionMenuPresenter(this));

    ActionBar bar = getSupportActionBar();
    bar.setDisplayShowTitleEnabled(false);
    bar.setDisplayShowHomeEnabled(false);

    Spinner navSpinner = (Spinner) mToolbar.findViewById(R.id.nav_spinner);
    ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
            R.layout.spinner_item, getResources().getStringArray(R.array.main_menu));
    adapter.setDropDownViewResource(R.layout.spinner_dropdown_item);
    navSpinner.setAdapter(adapter);
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
    int selected = prefs.getInt("mainMenuLastSelected", 0);
    navSpinner.setOnItemSelectedListener(this);
    navSpinner.setSelection(Math.min(selected, adapter.getCount() - 1));

    UpdateUtils.checkNewVersion(this, false);
    //не нужен AppRater.onAppLaunched(this);
}
项目:FMTech    文件:ToolbarWidgetWrapper.java   
public final boolean isOverflowMenuShowPending()
{
  Toolbar localToolbar = this.mToolbar;
  if (localToolbar.mMenuView != null)
  {
    ActionMenuView localActionMenuView = localToolbar.mMenuView;
    int j;
    if (localActionMenuView.mPresenter != null)
    {
      ActionMenuPresenter localActionMenuPresenter = localActionMenuView.mPresenter;
      if ((localActionMenuPresenter.mPostedOpenRunnable != null) || (localActionMenuPresenter.isOverflowMenuShowing()))
      {
        j = 1;
        if (j == 0) {
          break label68;
        }
      }
    }
    label68:
    for (int i = 1;; i = 0)
    {
      if (i == 0) {
        break label73;
      }
      return true;
      j = 0;
      break;
    }
  }
  label73:
  return false;
}
项目:FMTech    文件:ActionBarContextView.java   
public final void initForMode(final ActionMode paramActionMode)
{
  if (this.mClose == null)
  {
    this.mClose = LayoutInflater.from(getContext()).inflate(this.mCloseItemLayout, this, false);
    addView(this.mClose);
  }
  for (;;)
  {
    this.mClose.findViewById(R.id.action_mode_close_button).setOnClickListener(new View.OnClickListener()
    {
      public final void onClick(View paramAnonymousView)
      {
        paramActionMode.finish();
      }
    });
    MenuBuilder localMenuBuilder = (MenuBuilder)paramActionMode.getMenu();
    if (this.mActionMenuPresenter != null) {
      this.mActionMenuPresenter.dismissPopupMenus();
    }
    this.mActionMenuPresenter = new ActionMenuPresenter(getContext());
    this.mActionMenuPresenter.setReserveOverflow$1385ff();
    ViewGroup.LayoutParams localLayoutParams = new ViewGroup.LayoutParams(-2, -1);
    localMenuBuilder.addMenuPresenter(this.mActionMenuPresenter, this.mPopupContext);
    this.mMenuView = ((ActionMenuView)this.mActionMenuPresenter.getMenuView(this));
    this.mMenuView.setBackgroundDrawable(null);
    addView(this.mMenuView, localLayoutParams);
    return;
    if (this.mClose.getParent() == null) {
      addView(this.mClose);
    }
  }
}
项目:FMTech    文件:ToolbarWidgetWrapper.java   
public final void setMenu(Menu paramMenu, MenuPresenter.Callback paramCallback)
{
  if (this.mActionMenuPresenter == null)
  {
    this.mActionMenuPresenter = new ActionMenuPresenter(this.mToolbar.getContext());
    this.mActionMenuPresenter.mId = R.id.action_menu_presenter;
  }
  this.mActionMenuPresenter.mCallback = paramCallback;
  Toolbar localToolbar = this.mToolbar;
  MenuBuilder localMenuBuilder1 = (MenuBuilder)paramMenu;
  ActionMenuPresenter localActionMenuPresenter = this.mActionMenuPresenter;
  if ((localMenuBuilder1 != null) || (localToolbar.mMenuView != null))
  {
    localToolbar.ensureMenuView();
    MenuBuilder localMenuBuilder2 = localToolbar.mMenuView.mMenu;
    if (localMenuBuilder2 != localMenuBuilder1)
    {
      if (localMenuBuilder2 != null)
      {
        localMenuBuilder2.removeMenuPresenter(localToolbar.mOuterActionMenuPresenter);
        localMenuBuilder2.removeMenuPresenter(localToolbar.mExpandedMenuPresenter);
      }
      if (localToolbar.mExpandedMenuPresenter == null) {
        localToolbar.mExpandedMenuPresenter = new Toolbar.ExpandedActionViewMenuPresenter(localToolbar, (byte)0);
      }
      localActionMenuPresenter.mExpandedActionViewsExclusive = true;
      if (localMenuBuilder1 == null) {
        break label197;
      }
      localMenuBuilder1.addMenuPresenter(localActionMenuPresenter, localToolbar.mPopupContext);
      localMenuBuilder1.addMenuPresenter(localToolbar.mExpandedMenuPresenter, localToolbar.mPopupContext);
    }
  }
  for (;;)
  {
    localToolbar.mMenuView.setPopupTheme(localToolbar.mPopupTheme);
    localToolbar.mMenuView.setPresenter(localActionMenuPresenter);
    localToolbar.mOuterActionMenuPresenter = localActionMenuPresenter;
    return;
    label197:
    localActionMenuPresenter.initForMenu(localToolbar.mPopupContext, null);
    localToolbar.mExpandedMenuPresenter.initForMenu(localToolbar.mPopupContext, null);
    localActionMenuPresenter.updateMenuView(true);
    localToolbar.mExpandedMenuPresenter.updateMenuView(true);
  }
}