List of usage examples for android.view ActionMode invalidate
public abstract void invalidate();
From source file:com.btmura.android.reddit.app.AccountListFragment.java
@Override public void onItemCheckedStateChanged(ActionMode mode, int position, long id, boolean checked) { mode.invalidate(); }
From source file:com.btmura.android.reddit.app.SubredditActionModeController.java
@Override public void onItemCheckedStateChanged(ActionMode mode, int pos, long id, boolean checked) { mode.invalidate(); }
From source file:com.vuze.android.remote.AndroidUtils.java
public static void invalidateOptionsMenuHC(final Activity activity, final android.support.v7.view.ActionMode mActionMode) { if (activity == null) { return;//from w w w . jav a2s. c o m } activity.runOnUiThread(new Runnable() { @Override public void run() { if (activity.isFinishing()) { return; } if (mActionMode != null) { mActionMode.invalidate(); return; } if (activity instanceof FragmentActivity) { FragmentActivity aba = (FragmentActivity) activity; aba.supportInvalidateOptionsMenu(); } else { ActivityCompat.invalidateOptionsMenu(activity); } } }); }
From source file:com.jaspersoft.android.jaspermobile.activities.repository.adapter.ResourceAdapter.java
@Override public boolean onActionItemClicked(ActionMode mode, MenuItem item) { ResourceLookup resource = getItem(getCurrentPosition()); switch (item.getItemId()) { case R.id.favoriteAction: Uri uri = favoriteHelper.queryFavoriteUri(resource); favoriteHelper.handleFavoriteMenuAction(uri, resource, null); break;//from w w w.j ava 2 s . c om case R.id.showAction: FragmentManager fm = ((FragmentActivity) getContext()).getSupportFragmentManager(); SimpleDialogFragment.createBuilder(getContext(), fm).setTitle(resource.getLabel()) .setMessage(resource.getDescription()).setNegativeButtonText(android.R.string.ok).show(); break; } mode.invalidate(); return true; }
From source file:com.vuze.android.remote.AndroidUtils.java
public static void invalidateOptionsMenuHC(final Activity activity, final ActionMode mActionMode) { if (activity == null) { return;// ww w. j av a 2s . co m } activity.runOnUiThread(new Runnable() { @Override public void run() { if (activity instanceof FragmentActivity) { FragmentActivity aba = (FragmentActivity) activity; aba.supportInvalidateOptionsMenu(); } else { ActivityCompat.invalidateOptionsMenu(activity); } invalidateActionMode(); } @TargetApi(Build.VERSION_CODES.HONEYCOMB) private void invalidateActionMode() { if (mActionMode != null) { mActionMode.invalidate(); } } }); }
From source file:com.veniosg.dir.android.fragment.SideNavFragment.java
private void setListChoiceListener() { getListView().setMultiChoiceModeListener(new AbsListView.MultiChoiceModeListener() { @Override// w w w .j av a 2s . c o m public boolean onPrepareActionMode(android.view.ActionMode mode, Menu menu) { menu.clear(); mode.getMenuInflater().inflate(R.menu.cab_bookmarks, menu); if (getListView().getCheckedItemCount() != 1) { menu.removeItem(R.id.menu_open_parent); } return true; } @Override public void onDestroyActionMode(android.view.ActionMode mode) { setStatusBarColour(getActivity(), false); } @Override public boolean onCreateActionMode(android.view.ActionMode mode, Menu menu) { setStatusBarColour(getActivity(), true); return true; } @Override public boolean onActionItemClicked(android.view.ActionMode mode, MenuItem item) { switch (item.getItemId()) { case R.id.menu_delete: long[] ids = getListView().getCheckedItemIds(); for (long id : ids) { getListView().getContext().getContentResolver().delete(BookmarkProvider.CONTENT_URI, BookmarkProvider._ID + "=?", new String[] { "" + id }); } mode.finish(); return true; case R.id.menu_open_parent: int pos = 0; SparseBooleanArray checked = getListView().getCheckedItemPositions(); for (int i = 0; i < getListView().getCount(); i++) { if (checked.get(i)) { pos = i; } } String path = ((Cursor) getListAdapter().getItem(pos)).getString(2); ((BookmarkContract) getActivity()).onBookmarkSelected(new File(path).getParent()); mode.finish(); return true; } return false; } @Override public void onItemCheckedStateChanged(android.view.ActionMode mode, int position, long id, boolean checked) { if (getListView().getCheckedItemCount() != 0) { mode.setTitle(getListView().getCheckedItemCount() + " " + getString(R.string.selected)); // Force actions' refresh mode.invalidate(); } } }); getListView().setChoiceMode(ListView.CHOICE_MODE_MULTIPLE_MODAL); }