本文整理汇总了Java中android.app.Activity.invalidateOptionsMenu方法的典型用法代码示例。如果您正苦于以下问题:Java Activity.invalidateOptionsMenu方法的具体用法?Java Activity.invalidateOptionsMenu怎么用?Java Activity.invalidateOptionsMenu使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.app.Activity
的用法示例。
在下文中一共展示了Activity.invalidateOptionsMenu方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onLoadFinished
import android.app.Activity; //导入方法依赖的package包/类
@Override
public void onLoadFinished(Loader<Cursor> cursorLoader, Cursor cursor) {
/*
* Swapping instead of changing Cursor here, to keep the old one open.
* Loader should release the old Cursor - see note in
* {@link LoaderManager.LoaderCallbacks#onLoadFinished).
*/
mListAdapter.swapCursor(cursor);
if (mListAdapter.getCount() > 0) {
mViewFlipper.setDisplayedChild(0);
} else {
mViewFlipper.setDisplayedChild(1);
}
Activity activity = getActivity();
if (activity != null) {
activity.invalidateOptionsMenu();
}
}
示例2: invalidateOptionsMenu
import android.app.Activity; //导入方法依赖的package包/类
static void invalidateOptionsMenu(Activity activity) {
activity.invalidateOptionsMenu();
}
示例3: onCreateView
import android.app.Activity; //导入方法依赖的package包/类
@Override
public View onCreateView(final LayoutInflater inflater, final ViewGroup container,
final Bundle savedInstanceState) {
final View view =
inflater.inflate(R.layout.fragment_saved_entries_recyclerview, container, false);
final Activity activity = getActivity();
mRecyclerView = view.findViewById(R.id.SavedEntriesRecyclerView);
mRecyclerView.setLayoutManager(new CenterLayoutManager(activity));
mSortOrder = SharedPrefUtils.getInt(activity, KEY_SORT_ORDER);
if (savedInstanceState == null || !savedInstanceState.getBoolean(KEY_CAN_ACCESS, false)) {
if (!TextUtils.isEmpty(SharedPrefUtils.getString(activity, KEY_HASHED_PASSWORD))) {
SavedEntriesPasswordFragment.getInstance()
.show(getFragmentManager(), SavedEntriesPasswordFragment.TAG);
} else {
SavedEntriesSetupPasswordFragment.getInstance()
.show(getFragmentManager(), SavedEntriesSetupPasswordFragment.TAG);
}
}
super.initialize((CoordinatorLayout) view, mRecyclerView);
activity.invalidateOptionsMenu();
return view;
}
示例4: hideKeyboard
import android.app.Activity; //导入方法依赖的package包/类
public static void hideKeyboard(Activity activity, EditText editText, int i, String text, String hint) {
editText.clearFocus();
editText.setText("Search Here...");
editText.setHint(hint);
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(activity);
sharedPref.edit().putInt("keyboard", i).apply();
activity.invalidateOptionsMenu();
InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(editText.getWindowToken(), 0);
}
示例5: refreshActionBarMenu
import android.app.Activity; //导入方法依赖的package包/类
private void refreshActionBarMenu(Activity activity) {
activity.invalidateOptionsMenu();
}
示例6: invalidateOptionsMenu
import android.app.Activity; //导入方法依赖的package包/类
@SuppressLint("NewApi")
public void invalidateOptionsMenu(Activity activity) {
activity.invalidateOptionsMenu();
}
示例7: onCreateView
import android.app.Activity; //导入方法依赖的package包/类
@SuppressWarnings({"ConstantConditions", "SuspiciousNameCombination"})
@Override
public View onCreateView(final LayoutInflater inflater,
final ViewGroup container,
final Bundle savedInstanceState) {
final View view =
inflater.inflate(R.layout.fragment_current_feed_recyclerview, container, false);
final Activity activity = getActivity();
mSwipeRefreshLayout = view.findViewById(R.id.CurrentFeedSwipeToRefreshLayout);
if (ThemeUtils.isDarkThemeSelected(activity)) {
final List<Integer> ids = Arrays.asList(
R.attr.colorPrimaryViewBackground,
R.attr.colorAccent);
TypedValueUtils.resolveResourceIds(activity, ids);
mSwipeRefreshLayout.setProgressBackgroundColorSchemeColor(
activity.getColor(ids.get(0)));
mSwipeRefreshLayout.setColorSchemeResources(ids.get(1));
} else {
mSwipeRefreshLayout.setColorSchemeResources(android.R.color.holo_orange_dark,
android.R.color.holo_green_dark, android.R.color.holo_blue_dark,
android.R.color.holo_purple, android.R.color.holo_red_dark);
}
mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
isFeedUpdateAvailable();
}
});
final VerticalSpaceItemDecoration decor =
new VerticalSpaceItemDecoration(activity, DIVIDER_WIDTH);
decor.setDrawable(activity.getDrawable(R.drawable.divider));
mAdapter = new FeedAdapter((MainActivity) activity);
mRecyclerView = view.findViewById(R.id.CurrentFeedRecyclerView);
mRecyclerView.setLayoutManager(new CenterLayoutManager(activity));
mRecyclerView.setAdapter(mAdapter);
mRecyclerView.addItemDecoration(decor);
super.initialize((CoordinatorLayout) view, mRecyclerView);
activity.invalidateOptionsMenu();
return view;
}