Android ActionMode - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android ActionMode class.

This code example shows how to use the following methods:setSubtitle
                                        long id, boolean checked) {
    updateSubtitle(mode);
  } 
   
  private void updateSubtitle(ActionMode mode) {
    mode.setSubtitle("("+lv.getCheckedItemCount()+")");
  } 
} 
7
CodeRank
This code example shows how to use the following methods:setSubtitle, setTitle
 
    } 
 
    public class MultiChoiceModeListener implements GridView.MultiChoiceModeListener {
        public boolean onCreateActionMode(ActionMode mode, Menu menu) {
            mode.setTitle("Select Items");
            mode.setSubtitle("One item selected");
            return true; 
        } 
 
        public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
            return true; 
        } 
 
        public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
            return true; 
        } 
 
        public void onDestroyActionMode(ActionMode mode) {
        } 
6
CodeRank
This code example shows how to use the following methods:setSubtitle
                                        long id, boolean checked) {
    updateSubtitle(mode);
  } 
   
  private void updateSubtitle(ActionMode mode) {
    mode.setSubtitle("("+lv.getCheckedItemCount()+")");
  } 
} 
6
CodeRank
This code example shows how to use the following methods:setSubtitle, setTitle
        return mContext;
    } 
 
    @Override 
    public boolean onCreateActionMode(ActionMode mode, Menu menu) {
        mode.setTitle(null);
        mode.setSubtitle(null);
        mEditable = mActionHandler.isSelectionEditable();
        createActionMenu(mode, menu);
        return true; 
    } 
 
    @Override 
    public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
        boolean isEditableNow = mActionHandler.isSelectionEditable();
        if (mEditable != isEditableNow) {
            mEditable = isEditableNow;
            menu.clear();
            createActionMenu(mode, menu);
            return true; 
6
CodeRank
This code example shows how to use the following methods:setSubtitle, setTitle
		return true; 
	} 
 
	@SuppressLint("NewApi") 
	public void onItemCheckedStateChanged( ActionMode mode, int position, long id, boolean checked ) {
		mode.setTitle( "What the fuck!" );
		mode.setSubtitle( "Selected items: " + listView.getCheckedItemCount() );
	} 
} 
5
CodeRank
This code example shows how to use the following methods:finish
	public void leaveSelectionMode() { 
		if (mSelectionMode == false) return;
		mSelectionMode = false;
		 
		if (mActionMode != null) {
			mActionMode.finish();
			mActionMode = null;
		} 
	} 
	 
	/** 
	 * <p>Action mode invalidate</p> 
	 */ 
	public void invalidateActionMode() { 
		if (mActionMode != null) {
			mActionMode.invalidate();
		} 
	} 
	 
	/** 
4
CodeRank
This code example shows how to use the following methods:setSubtitle, setTitle
        return mContext;
    } 
 
    @Override 
    public boolean onCreateActionMode(ActionMode mode, Menu menu) {
        mode.setTitle(BrowserProcessMain.isTabletUi(getContext()) ?
                getContext().getString(ChromeView.getResourceId(
                "R.string.actionbar_textselection_title")) : null); 
        mode.setSubtitle(null);
        mEditable = mActionHandler.isSelectionEditable();
        createActionMenu(mode, menu);
        return true; 
    } 
 
    @Override 
    public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
        boolean isEditableNow = mActionHandler.isSelectionEditable();
        if (mEditable != isEditableNow) {
            mEditable = isEditableNow;
            menu.clear();
5
CodeRank
This code example shows how to use the following methods:finish
      EditorActionModeCallback next=chains.get(item.getItemId());
 
      if (next != null) {
        next.setSelection(new Selection(editor));
        host.startActionMode((EditorActionModeCallback.Native)next);
        mode.finish();
 
        return(true); 
      } 
       
      mode.finish();
 
      return(listener.doAction(item.getItemId()));
    } 
  } 
 
  public static class ABS extends EditorActionModeCallback implements 
      ActionMode.Callback {
    Activity host=null;
 
4
CodeRank
This code example shows how to use the following methods:finish
          Log.e(getClass().getSimpleName(),
                "Exception starting action mode", e);
        } 
 
        // host.startActionMode((EditorActionModeCallback.ABS)next); 
        mode.finish();
 
        return(true); 
      } 
       
      mode.finish();
 
      return(listener.doAction(item.getItemId()));
    } 
  } 
} 
4
CodeRank
This code example shows how to use the following methods:setSubtitle
                                        long id, boolean checked) {
    updateSubtitle(mode);
  } 
   
  private void updateSubtitle(ActionMode mode) {
    mode.setSubtitle("("+lv.getCheckedItemCount()+")");
  } 
} 
4
CodeRank

Related Android ActionMode Questions & Answers:

Other Android ActionMode Examples

4:	
5:	    @Override
6:	    public void onItemCheckedStateChanged(ActionMode mode, int position,
7:	                                          long id, boolean checked) {
8:	        // Here you can do something when items are selected/de-selected,
-
11:	
12:	    @Override
13:	    public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
14:	        // Respond to clicks on the actions in the CAB
15:	        switch (item.getItemId()) {
-
24:	
25:	    @Override
26:	    public boolean onCreateActionMode(ActionMode mode, Menu menu) {
27:	        // Inflate the menu for the CAB
28:	        MenuInflater inflater = mode.getMenuInflater();
-
32:	
33:	    @Override
34:	    public void onDestroyActionMode(ActionMode mode) {
35:	        // Here you can make any necessary updates to the activity when
36:	        // the CAB is removed. By default, selected items are deselected/unchecked.
-
38:	
39:	    @Override
40:	    public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
41:	        // Here you can perform updates to the CAB due to
42:	        // an  request

Read More

3:	    // Called when the action mode is created; startActionMode() was called
4:	    @Override
5:	    public boolean onCreateActionMode(ActionMode mode, Menu menu) {
6:	        // Inflate a menu resource providing context menu items
7:	        MenuInflater inflater = mode.getMenuInflater();
-
13:	    // may be called multiple times if the mode is invalidated.
14:	    @Override
15:	    public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
16:	        return false; // Return false if nothing is done
17:	    }
-
19:	    // Called when the user selects a contextual menu item
20:	    @Override
21:	    public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
22:	        switch (item.getItemId()) {
23:	            case R.id.menu_share:
-
32:	    // Called when the user exits the action mode
33:	    @Override
34:	    public void onDestroyActionMode(ActionMode mode) {
35:	        mActionMode = null;
36:	    }

Read More

See Code Examples for Android ActionMode Methods: