mirror of
https://github.com/nextcloud/android.git
synced 2024-11-27 09:39:25 +03:00
Add MultiChoiceModeListener for both listView and gridView
This commit is contained in:
parent
dd5cb1ad6a
commit
03045c502d
2 changed files with 12 additions and 8 deletions
|
@ -453,12 +453,13 @@ public class ExtendedListFragment extends Fragment
|
|||
}
|
||||
|
||||
protected void setChoiceMode(int choiceMode) {
|
||||
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
|
||||
mListView.setChoiceMode(choiceMode);
|
||||
mGridView.setChoiceMode(choiceMode);
|
||||
} else {
|
||||
((ListView)mListView).setChoiceMode(choiceMode);
|
||||
}
|
||||
mListView.setChoiceMode(choiceMode);
|
||||
mGridView.setChoiceMode(choiceMode);
|
||||
}
|
||||
|
||||
protected void setMultiChoiceModeListener(AbsListView.MultiChoiceModeListener listener) {
|
||||
mListView.setMultiChoiceModeListener(listener);
|
||||
mGridView.setMultiChoiceModeListener(listener);
|
||||
}
|
||||
|
||||
protected void registerForContextMenu() {
|
||||
|
|
|
@ -31,6 +31,7 @@ import android.os.Bundle;
|
|||
import android.preference.PreferenceManager;
|
||||
import android.support.v4.widget.SwipeRefreshLayout;
|
||||
import android.view.ActionMode;
|
||||
import android.view.ContextMenu;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
|
@ -41,6 +42,7 @@ import android.widget.AbsListView;
|
|||
import android.widget.AdapterView;
|
||||
import android.widget.AdapterView.AdapterContextMenuInfo;
|
||||
import android.widget.PopupMenu;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
|
@ -342,9 +344,10 @@ public class OCFileListFragment extends ExtendedListFragment {
|
|||
}
|
||||
|
||||
private void registerLongClickListener() {
|
||||
getListView().setMultiChoiceModeListener(new AbsListView.MultiChoiceModeListener() {
|
||||
AbsListView listView = getListView();
|
||||
setChoiceMode(ListView.CHOICE_MODE_MULTIPLE_MODAL);
|
||||
setMultiChoiceModeListener(new AbsListView.MultiChoiceModeListener() {
|
||||
private Menu menu;
|
||||
|
||||
@Override
|
||||
public void onItemCheckedStateChanged(ActionMode mode, int position, long id, boolean checked) {
|
||||
final int checkedCount = getListView().getCheckedItemCount();
|
||||
|
|
Loading…
Reference in a new issue