android.app.Activity.invalidateOptionsMenu()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(6.0k)|赞(0)|评价(0)|浏览(171)

本文整理了Java中android.app.Activity.invalidateOptionsMenu()方法的一些代码示例,展示了Activity.invalidateOptionsMenu()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Activity.invalidateOptionsMenu()方法的具体详情如下:
包路径:android.app.Activity
类名称:Activity
方法名:invalidateOptionsMenu

Activity.invalidateOptionsMenu介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

class VersionHelper
{
  static void refreshActionBarMenu(Activity activity)
  {
    activity.invalidateOptionsMenu();
  }
}

代码示例来源:origin: pockethub/PocketHub

@Override
  public void onTextChanged(CharSequence s, int start, int before, int count) {
    Activity activity = getActivity();
    if (activity != null) {
      activity.invalidateOptionsMenu();
    }
  }
});

代码示例来源:origin: wangdan/AisenWeiBo

public void setFriendshipShow(FriendshipShow friendship) {
  this.mFriendship = friendship;
  getActivity().invalidateOptionsMenu();
}

代码示例来源:origin: wangdan/AisenWeiBo

@Override
                public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
                  // FIXME
//                                    getPublishBean().setTiming(System.currentTimeMillis() + 15 * 1000);
                  calendar.set(Calendar.SECOND, 0);
                  getPublishBean().setTiming(calendar.getTimeInMillis() / 1000 * 1000);

                  getActivity().invalidateOptionsMenu();

                  setTimingHint();
                }

代码示例来源:origin: wangdan/AisenWeiBo

private void onPictureSelectedChange(String path) {
    if (!selectedFile.contains(path)) {
      if (selectedFile.size() >= maxSize) {
        showMessage(String.format("最多只能选%d张相片", maxSize));
        return;
      }

      selectedFile.add(path);
    }
    else
      selectedFile.remove(path);

    getAdapter().notifyDataSetChanged();
    getActivity().invalidateOptionsMenu();
//        btnCounter.setVisibility(selectedFile.size() == 0 ? View.GONE : View.VISIBLE);
//        txtCounter.setText(String.format("预览(%d/%d)", selectedFile.size(), maxSize));
  }

代码示例来源:origin: wangdan/AisenWeiBo

@Override
  protected void onSuccess(PictureSize pictureSize) {
    super.onSuccess(pictureSize);
    if (getActivity() != null)
      getActivity().invalidateOptionsMenu();
    PictureFragment.this.pictureSize = pictureSize;
  }
}

代码示例来源:origin: wangdan/AisenWeiBo

@Override
  public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    String path = getAdapterItems().get(position);

    // 多选
    if (maxSize > 1) {
      onPictureSelectedChange(path);
      getActivity().invalidateOptionsMenu();
    }
    // 单选
    else {
      selectedFile.add(path);
      savePics();
      // 设置头像
//            PhotoSettingFragment.launch(this, path, 3000);
    }
  }

代码示例来源:origin: wangdan/AisenWeiBo

private void onDownloadPicture(byte[] bytes, File file) {
  if (getActivity() == null)
    return;
  getActivity().invalidateOptionsMenu();
  progressView.setVisibility(View.INVISIBLE);
  Options opts = new Options();
  opts.inJustDecodeBounds = true;
  BitmapFactory.decodeByteArray(bytes, 0, bytes.length, opts);
  // gif
  if (BitmapUtil.getType(bytes) == BitmapType.gif) {
    readGifPicture(mWebView, bytes, file);
  }
  // 图片太大
  else if (opts.outWidth > 1024 || opts.outHeight > 1024) {
    readLargePicture(mWebView, file);
  }
  // 解析图片
  else {
    readPicture(bytes, file, photoView);
  }
  getActivity().invalidateOptionsMenu();
}

代码示例来源:origin: wangdan/AisenWeiBo

@Override
  public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    if (resultCode == Activity.RESULT_OK && requestCode == 2000) {
      String[] pics = data.getStringArrayExtra("images");

      selectedFile.clear();
      for (String pic : pics) {
        selectedFile.add(pic);
      }
//            btnCounter.setVisibility(selectedFile.size() == 0 ? View.GONE : View.VISIBLE);
//            txtCounter.setText(String.format("预览(%d/%d)", selectedFile.size(), maxSize));
      getAdapter().notifyDataSetChanged();
      getActivity().invalidateOptionsMenu();

      // 如果在预览已经确定了,就直接返回数据
      if (data.getBooleanExtra("confirm", false)) {
        savePics();
      }
    }
    // 设置头像成功
    else if (resultCode == Activity.RESULT_OK && requestCode == 3000) {
      getActivity().finish();
    }
  }

代码示例来源:origin: wangdan/AisenWeiBo

getActivity().invalidateOptionsMenu();
  getActivity().invalidateOptionsMenu();
  status == DownloadManager.STATUS_WAITING) {
if (getActivity() != null) {
  getActivity().invalidateOptionsMenu();
  getActivity().invalidateOptionsMenu();

代码示例来源:origin: wangdan/AisenWeiBo

@Override
protected void onSuccess(FriendshipShow result) {
  super.onSuccess(result);
  if (getActivity() != null) {
    mFriendship = result;
    // 设置Pager的菜单显示
    Fragment fragment = getActivity().getFragmentManager().findFragmentByTag(SinaCommonActivity.FRAGMENT_TAG);
    ((ProfilePagerFragment) fragment).setFriendshipShow(mFriendship);
    getActivity().invalidateOptionsMenu();
    setProfile();
  }
}

代码示例来源:origin: wangdan/AisenWeiBo

getActivity().invalidateOptionsMenu();

代码示例来源:origin: wangdan/AisenWeiBo

getActivity().invalidateOptionsMenu();

代码示例来源:origin: com.albedinsky.android/fragments

/**
 */
@Override
void invalidateOptionsMenu() {
  mActivity.invalidateOptionsMenu();
}

代码示例来源:origin: com.uphyca/android-junit4-robolectric

/**
 * 
 * @see android.app.Activity#invalidateOptionsMenu()
 */
public void invalidateOptionsMenu() {
  mActivity.invalidateOptionsMenu();
}

代码示例来源:origin: stackoverflow.com

class VersionHelper
{
  static void refreshActionBarMenu(Activity activity)
  {
    activity.invalidateOptionsMenu();
  }
}

代码示例来源:origin: rsiebert/TVHClient

@Override
public void onSessionEnded(CastSession session, int error) {
  Timber.d("Cast session ended with error " + error);
  if (session == castSession) {
    castSession = null;
  }
  activity.invalidateOptionsMenu();
}

代码示例来源:origin: geniusgithub/AndroidDialer

@Override
public void onTextChanged(CharSequence input, int start, int before, int changeCount) {
  if (mWasEmptyBeforeTextChange != TextUtils.isEmpty(input)) {
    final Activity activity = getActivity();
    if (activity != null) {
      activity.invalidateOptionsMenu();
      updateMenuOverflowButton(mWasEmptyBeforeTextChange);
    }
  }
  // DTMF Tones do not need to be played here any longer -
  // the DTMF dialer handles that functionality now.
}

代码示例来源:origin: NightscoutFoundation/xDrip

@Override
public void onDrawerClosed(View drawerView) {
  super.onDrawerClosed(drawerView);
  if (!isAdded()) {
    return;
  }
  getActivity().invalidateOptionsMenu();
}

代码示例来源:origin: jclehner/rxdroid

private void updateActionBar()
{
  getActivity().invalidateOptionsMenu();
  final SpannableString dateStr = new SpannableString(DateTime.toNativeDate(mDisplayedDate));
  if(mDtInfo.displayDate().equals(mDisplayedDate))
    Util.applyStyle(dateStr, new UnderlineSpan());
  //Util.applyStyle(dateStr, new RelativeSizeSpan(0.75f));
  ((AppCompatActivity) getActivity()).getSupportActionBar().setTitle(dateStr);
}

相关文章

Activity类方法