本文整理匯總了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;
}