public void onItemCheckedStateChanged(ActionMode mode, int arg1, long arg2, boolean arg3) { int count = mFolderPathInDB.size(); MusicUtils.updateActionModeTitle(mode, mContext, count); Log.i(TAG, "onItemCheckedStateChanged"); if (isSelectAll()) { mode.setRightActionButtonResource(lewa.R.drawable.ic_menu_clear_select); } else { mode.setRightActionButtonResource(lewa.R.drawable.ic_menu_select_all); } }
// private class ModeCallback implements ListView.MultiChoiceModeListener{ // private Context mContext; // public ModeCallback(Context context){ // mContext=context; // } // @Override // public boolean onActionItemClicked(ActionMode mode, MenuItem item) { // // TODO Auto-generated method stub // switch (item.getItemId()) { // case lewa.R.id.action_mode_right_button: // if(isSelectAll()){ // //mode.setRightActionButtonResource(lewa.R.drawable.ic_menu_select_all); // unselectAll(); // }else{ // //mode.setRightActionButtonResource(lewa.R.drawable.ic_menu_clear_select); // selectAll(); // } // MusicUtils.updateActionModeTitle(mode, mContext, mFolderPathInDB.size()); // break; // case R.id.action_done: // selectDone(); // break; // } // return true; // } // // @Override // public boolean onCreateActionMode(ActionMode mode, Menu menu) { // // TODO Auto-generated method stub // //mode.setRightActionButtonVisibility(View.VISIBLE); // if(isSelectAll()) { // //mode.setRightActionButtonResource(lewa.R.drawable.ic_menu_clear_select); // } else { // //mode.setRightActionButtonResource(lewa.R.drawable.ic_menu_select_all); // } // int count=mFolderPathInDB.size(); // MusicUtils.updateActionModeTitle(mode, mContext, count); // MenuInflater inflater=((ActionBarActivity) mContext).getMenuInflater(); // inflater.inflate(R.menu.operation_menu, menu); // return true; // } // // @Override // public void onDestroyActionMode(ActionMode arg0) { // // TODO Auto-generated method stub // finish(); // } // // @Override // public boolean onPrepareActionMode(ActionMode arg0, Menu arg1) { // // TODO Auto-generated method stub // return false; // } // // @Override // public void onItemCheckedStateChanged(ActionMode mode, int arg1, // long arg2, boolean arg3) { // int count=mFolderPathInDB.size(); // MusicUtils.updateActionModeTitle(mode, mContext, count); // Log.i(TAG, "onItemCheckedStateChanged"); // if(isSelectAll()) { // //mode.setRightActionButtonResource(lewa.R.drawable.ic_menu_clear_select); // } else { // //mode.setRightActionButtonResource(lewa.R.drawable.ic_menu_select_all); // } // } // // } // pr938097 modify by wjhu end public void updateActionModeTitle() { if (mActionMode != null) { MusicUtils.updateActionModeTitle( mActionMode, getApplicationContext(), mFolderPathInDB.size()); if (isSelectAll()) { mActionMode.setRightActionButtonResource(lewa.R.drawable.ic_menu_clear_select); } else { mActionMode.setRightActionButtonResource(lewa.R.drawable.ic_menu_select_all); } } }
@Override public boolean onCreateActionMode(ActionMode mode, Menu menu) { // TODO Auto-generated method stub mode.setRightActionButtonVisibility(View.VISIBLE); if (isSelectAll()) { mode.setRightActionButtonResource(lewa.R.drawable.ic_menu_clear_select); } else { mode.setRightActionButtonResource(lewa.R.drawable.ic_menu_select_all); } int count = mFolderPathInDB.size(); MusicUtils.updateActionModeTitle(mode, mContext, count); MenuInflater inflater = ((ActionBarActivity) mContext).getMenuInflater(); inflater.inflate(R.menu.operation_menu, menu); return true; }
@Override public boolean onActionItemClicked(ActionMode mode, MenuItem item) { // TODO Auto-generated method stub switch (item.getItemId()) { case lewa.support.v7.appcompat.R.id.action_mode_right_button: if (isSelectAll()) { mode.setRightActionButtonResource(lewa.R.drawable.ic_menu_select_all); unselectAll(); } else { mode.setRightActionButtonResource(lewa.R.drawable.ic_menu_clear_select); selectAll(); } MusicUtils.updateActionModeTitle(mode, mContext, mFolderPathInDB.size()); break; case R.id.action_done: selectDone(); break; } return true; }