コード例 #1
0
 private void onMenuClick() {
   Log.e(TAG, "onMenuClick");
   if (mPopupWindow == null) {
     mPopupWindow = PopupWindowBuilder.getInstance(mActivity);
     mPopupWindow.showAsDropDown(mActivity.findViewById(mMenu.getItemId()), this);
     Log.e(TAG, "onMenuClick new");
     return;
   }
   if (mPopupWindow.isShowing()) return;
   mPopupWindow.showAsDropDown(mActivity.findViewById(mMenu.getItemId()), this);
 }
コード例 #2
0
  public void showDialog(Boolean animate) {
    Fragment fragment = new FragmentAddGifDialog();
    Bundle b = new Bundle();
    b.putBoolean("ANIMATE", animate);
    fragment.setArguments(b);

    fragmentHandler.addFragment("dialog", mActivity.findViewById(R.id.main_wrapper), fragment);
  }
コード例 #3
0
  private boolean attach() {

    final View attachView =
        mParentView == null
            ? mContext.findViewById(mAttachId)
            : mParentView.findViewById(mAttachId);
    if (attachView instanceof RecyclerView) {
      mRecyclerView = (RecyclerView) attachView;
    } else if (attachView instanceof ViewStub) {
      ViewStub stub = (ViewStub) attachView;
      stub.setLayoutResource(R.layout.weekdays_recycler_view);
      stub.setInflatedId(mAttachId);
      mRecyclerView = (RecyclerView) stub.inflate();
    } else {
      throw new IllegalStateException(
          "Weeekdays Buttons was unable to attach to your Layout, required [ViewStub],[recycleView] or ['parent' View] doesn't exist.");
    }

    if (mRecyclerView != null) {

      getDrawableProvider();

      if (mTextDrawableType == WeekdaysDrawableProvider.MW_MULTIPLE_LETTERS && mNumberOfLetters < 2)
        mNumberOfLetters = 2;

      int position = 0;
      for (Map.Entry<Integer, String> map : getDays().entrySet()) {
        String day = map.getValue();
        int calendarDayId = map.getKey();
        if (!TextUtils.isEmpty(day)) {
          WeekdaysDataItem item =
              itemFromType(position, calendarDayId, day, getSelectedDays().get(calendarDayId));
          if (getWeekdaysCount() == position) getWeekdaysItems().add(item);
          else getWeekdaysItems().set(position, item);

          position++;
        }
      }

      initRecyclerView(mContext);

      return true;
    }
    return false;
  }
コード例 #4
0
 private void showTocOnboarding() {
   View tocButton = parentActivity.findViewById(R.id.floating_toc_button);
   ToolTipUtil.showToolTip(
       parentActivity, tocButton, R.layout.inflate_tool_tip_toc_button, ToolTip.Position.CENTER);
   WikipediaApp.getInstance().getOnboardingStateMachine().setTocTutorial();
 }
コード例 #5
0
 public ToolbarEngine(AppCompatActivity activity, int instanceID) {
   mActivity = activity;
   mToolbar = (Toolbar) mActivity.findViewById(instanceID);
   prepareActionBarWithToolbar();
 }