diff --git a/app/src/main/java/eu/kanade/mangafeed/ui/fragment/LibraryFragment.java b/app/src/main/java/eu/kanade/mangafeed/ui/fragment/LibraryFragment.java index 38a60a193..425f72f42 100644 --- a/app/src/main/java/eu/kanade/mangafeed/ui/fragment/LibraryFragment.java +++ b/app/src/main/java/eu/kanade/mangafeed/ui/fragment/LibraryFragment.java @@ -2,9 +2,11 @@ package eu.kanade.mangafeed.ui.fragment; import android.os.Bundle; import android.support.v7.widget.SearchView; +import android.view.ActionMode; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; +import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.GridView; @@ -93,6 +95,37 @@ public class LibraryFragment extends BaseFragment implements LibraryView { (parent, view, position, id) -> presenter.onMangaClick(position) ); + grid.setMultiChoiceModeListener(new GridView.MultiChoiceModeListener() { + @Override + public void onItemCheckedStateChanged(ActionMode mode, int position, long id, boolean checked) { + mode.setTitle(getResources().getString(R.string.library_selection_title) + + ": " + grid.getCheckedItemCount()); + + + } + + @Override + public boolean onCreateActionMode(ActionMode mode, Menu menu) { + MenuInflater inflater = mode.getMenuInflater(); + inflater.inflate(R.menu.library_selection, menu); + return true; + } + + @Override + public boolean onPrepareActionMode(ActionMode mode, Menu menu) { + return false; + } + + @Override + public boolean onActionItemClicked(ActionMode mode, MenuItem item) { + return false; + } + + @Override + public void onDestroyActionMode(ActionMode mode) { + + } + }); } } diff --git a/app/src/main/res/drawable-hdpi/ic_action_delete.png b/app/src/main/res/drawable-hdpi/ic_action_delete.png new file mode 100644 index 000000000..484ed5656 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_action_delete.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_action_delete.png b/app/src/main/res/drawable-mdpi/ic_action_delete.png new file mode 100644 index 000000000..64a417823 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_action_delete.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_action_delete.png b/app/src/main/res/drawable-xhdpi/ic_action_delete.png new file mode 100644 index 000000000..b3aa07e66 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_action_delete.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_action_delete.png b/app/src/main/res/drawable-xxhdpi/ic_action_delete.png new file mode 100644 index 000000000..8a9c20320 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_action_delete.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_action_delete.png b/app/src/main/res/drawable-xxxhdpi/ic_action_delete.png new file mode 100644 index 000000000..8d322aa9b Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_action_delete.png differ diff --git a/app/src/main/res/drawable/library_item_background.xml b/app/src/main/res/drawable/library_item_background.xml new file mode 100644 index 000000000..7ad2c6c8b --- /dev/null +++ b/app/src/main/res/drawable/library_item_background.xml @@ -0,0 +1,9 @@ + +> + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_library.xml b/app/src/main/res/layout/fragment_library.xml index 15a186c99..75e938b5d 100644 --- a/app/src/main/res/layout/fragment_library.xml +++ b/app/src/main/res/layout/fragment_library.xml @@ -16,6 +16,7 @@ android:numColumns="auto_fit" android:stretchMode="columnWidth" android:fastScrollEnabled="true" + android:choiceMode="multipleChoiceModal" tools:listitem="@layout/item_library" /> diff --git a/app/src/main/res/layout/item_library.xml b/app/src/main/res/layout/item_library.xml index 3fcaa31f2..bfd4f0e77 100644 --- a/app/src/main/res/layout/item_library.xml +++ b/app/src/main/res/layout/item_library.xml @@ -6,6 +6,7 @@ android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" + android:background="@drawable/library_item_background" > + > + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 9af6059c6..503bec0f0 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -14,4 +14,5 @@ #D4D4D4 #E9E9E9 #DD000000 + #E8E8E8 \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index b4090eed2..e3d145ae8 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -33,5 +33,7 @@ Search Refresh Title or author... + Delete + Selected diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 54d2e38dd..71b087af5 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -9,6 +9,8 @@ @color/black_87pc @color/black_87pc @color/white + true + @style/Widget.ActionMode - + +