Ejemplo n.º 1
0
 public ActionMenuPresenter(Context context) {
   super(
       context,
       ResUtil.getInstance(context)
           .getLayout(
               "abs__action_menu_layout") /* CT_Traffic_R.layout.abs__action_menu_layout()*/,
       ResUtil.getInstance(context)
           .getLayout(
               "abs__action_menu_item_layout") /*CT_Traffic_R.layout.abs__action_menu_item_layout()*/);
 }
Ejemplo n.º 2
0
    public OverflowMenuButton(Context context) {
      super(
          context,
          null,
          ResUtil.getInstance(context)
              .getAttr(
                  "actionOverflowButtonStyle") /* CT_Traffic_R.attr.actionOverflowButtonStyle()*/);

      setClickable(true);
      setFocusable(true);
      setVisibility(VISIBLE);
      setEnabled(true);
    }
Ejemplo n.º 3
0
 public void onConfigurationChanged(Configuration newConfig) {
   if (!mMaxItemsSet) {
     mMaxItems =
         getResources_getInteger(
             mContext,
             ResUtil.getInstance(mContext)
                 .getInteger(
                     "abs__max_action_buttons") /* CT_Traffic_R.integer.abs__max_action_buttons()*/);
     if (mMenu != null) {
       mMenu.onItemsChanged(true);
     }
   }
 }
Ejemplo n.º 4
0
  @Override
  public void initForMenu(Context context, MenuBuilder menu) {
    super.initForMenu(context, menu);

    final Resources res = context.getResources();

    if (!mReserveOverflowSet) {
      mReserveOverflow = reserveOverflow(mContext);
    }

    if (!mWidthLimitSet) {
      mWidthLimit = res.getDisplayMetrics().widthPixels / 2;
    }

    // Measure for initial configuration
    if (!mMaxItemsSet) {
      mMaxItems =
          getResources_getInteger(
              context,
              ResUtil.getInstance(context)
                  .getInteger(
                      "abs__max_action_buttons") /* CT_Traffic_R.integer.abs__max_action_buttons()*/);
    }

    int width = mWidthLimit;
    if (mReserveOverflow) {
      if (mOverflowButton == null) {
        mOverflowButton = new OverflowMenuButton(mSystemContext);
        final int spec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
        mOverflowButton.measure(spec, spec);
      }
      width -= mOverflowButton.getMeasuredWidth();
    } else {
      mOverflowButton = null;
    }

    mActionItemWidthLimit = width;

    mMinCellSize = (int) (ActionMenuView.MIN_CELL_SIZE * res.getDisplayMetrics().density);

    // Drop a scrap view as it may no longer reflect the proper context/config.
    mScrapActionButtonView = null;
  }