android.support.v4.app.FragmentActivity#supportInvalidateOptionsMenu ( )源码实例Demo

下面列出了android.support.v4.app.FragmentActivity#supportInvalidateOptionsMenu ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: SteamGifts   文件: MessageListFragment.java
@Override
public void addItems(List<? extends IEndlessAdaptable> items, boolean clearExistingItems, String foundXsrfToken) {
    super.addItems(items, clearExistingItems, foundXsrfToken);

    if (items != null && clearExistingItems) {
        // The top message for the first page (clearExistingItems == true) will be marked as the last we've actually looked at/dismissed and will not be shown in a notification again.
        for (IEndlessAdaptable item : items)
            if (item instanceof Comment) {
                CheckForNewMessages.setLastDismissedCommentId(getContext(), ((Comment) item).getPermalinkId());
                break;
            }
    }

    FragmentActivity activity = getActivity();
    if (activity != null)
        activity.supportInvalidateOptionsMenu();
}
 
源代码2 项目: SteamGifts   文件: MessageListFragment.java
public void onMarkedMessagesRead() {
    for (int i = 0, size = adapter.getItemCount(); i < size; ++i) {
        IEndlessAdaptable element = adapter.getItem(i);
        if (!(element instanceof Comment))
            continue;

        Comment comment = (Comment) element;

        if (comment.isHighlighted()) {
            comment.setHighlighted(false);
            adapter.notifyItemChanged(i);
        }
    }

    adapter.setXsrfToken(null);

    FragmentActivity activity = getActivity();
    if (activity != null)
        activity.supportInvalidateOptionsMenu();

    // We no longer have any notifications
    SteamGiftsUserData.getCurrent(getContext()).setMessageNotification(0);
}
 
源代码3 项目: android-galaxyzoo   文件: LoginUtils.java
public static void logOut(final ZooFragment fragment) {
    final Activity activity = fragment.getActivity();
    final AccountRemoveTask task = new AccountRemoveTask(activity) {
        @Override
        protected void onPostExecute(final Void result) {
            super.onPostExecute(result);

            //Make sure that the currently-shown menu will update:
            ZooFragment.setCachedLoggedIn(false);

            //TODO: This doesn't actually seem to cause the (various) child fragments'
            //onPrepareOptionsMenu() methods to be called. Maybe it doesn't work with
            //nested child fragments.
            if (activity instanceof FragmentActivity) {
                final FragmentActivity fragmentActivity = (FragmentActivity) activity;
                fragmentActivity.supportInvalidateOptionsMenu();
            } else {
                activity.invalidateOptionsMenu();
            }
        }
    };
    task.execute();
}
 
源代码4 项目: SteamGifts   文件: GiveawayListFragment.java
@Override
public void onFilterUpdated() {
    refresh();

    FragmentActivity activity = getActivity();
    if (activity != null)
        activity.supportInvalidateOptionsMenu();
}
 
源代码5 项目: SteamGifts   文件: SavedGiveawaysFragment.java
/**
 * Callback for {@link #enteredGameListTask}
 * <p>Note: do NOT call this from within this class.</p>
 */
@Override
public void addItems(List<? extends IEndlessAdaptable> items, boolean clearExistingItems) {
    if (items != null) {
        // closed or not deleted
        boolean foundAnyClosedGiveaways = false;

        // do nothing much except update the status of existing giveaways.
        for (IEndlessAdaptable endlessAdaptable : items) {
            ProfileGiveaway giveaway = (ProfileGiveaway) endlessAdaptable;
            if (!giveaway.isOpen() && !giveaway.isDeleted()) {
                foundAnyClosedGiveaways = true;
                break;
            }

            Giveaway existingGiveaway = adapter.findItem(giveaway.getGiveawayId());
            if (existingGiveaway != null) {
                existingGiveaway.setEntries(giveaway.getEntries());
                existingGiveaway.setEntered(true);
                adapter.notifyItemChanged(existingGiveaway);
            }
        }

        FragmentActivity activity = getActivity();
        if (activity != null)
            activity.supportInvalidateOptionsMenu();

        // have we found any non-closed giveaways?
        if (foundAnyClosedGiveaways) {
            enteredGameListTask = null;
        } else {
            enteredGameListTask = new LoadEnteredGameListTask(this, enteredGameListTask.getPage() + 1);
            enteredGameListTask.execute();
        }
    } else {
        showSnack("Failed to update entered giveaways", Snackbar.LENGTH_LONG);
    }
}