Item selection
This commit is contained in:
		
							parent
							
								
									7fe40525f2
								
							
						
					
					
						commit
						a6c59bbc10
					
				| @ -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) { | ||||
| 
 | ||||
|             } | ||||
|         }); | ||||
|     } | ||||
| 
 | ||||
| } | ||||
|  | ||||
							
								
								
									
										
											BIN
										
									
								
								app/src/main/res/drawable-hdpi/ic_action_delete.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								app/src/main/res/drawable-hdpi/ic_action_delete.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 161 B | 
							
								
								
									
										
											BIN
										
									
								
								app/src/main/res/drawable-mdpi/ic_action_delete.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								app/src/main/res/drawable-mdpi/ic_action_delete.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 115 B | 
							
								
								
									
										
											BIN
										
									
								
								app/src/main/res/drawable-xhdpi/ic_action_delete.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								app/src/main/res/drawable-xhdpi/ic_action_delete.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 156 B | 
							
								
								
									
										
											BIN
										
									
								
								app/src/main/res/drawable-xxhdpi/ic_action_delete.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								app/src/main/res/drawable-xxhdpi/ic_action_delete.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 200 B | 
							
								
								
									
										
											BIN
										
									
								
								app/src/main/res/drawable-xxxhdpi/ic_action_delete.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								app/src/main/res/drawable-xxxhdpi/ic_action_delete.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 243 B | 
							
								
								
									
										9
									
								
								app/src/main/res/drawable/library_item_background.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								app/src/main/res/drawable/library_item_background.xml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,9 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <selector xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     android:exitFadeDuration="@android:integer/config_shortAnimTime">> | ||||
|     <item android:drawable="@color/line_grey" android:state_pressed="true"/> | ||||
|     <item android:drawable="@color/line_grey" android:state_selected="true"/> | ||||
|     <item android:drawable="@color/line_grey" android:state_activated="true"/> | ||||
|     <item android:drawable="@color/library_text_background"/> | ||||
| 
 | ||||
| </selector> | ||||
| @ -16,6 +16,7 @@ | ||||
|         android:numColumns="auto_fit" | ||||
|         android:stretchMode="columnWidth" | ||||
|         android:fastScrollEnabled="true" | ||||
|         android:choiceMode="multipleChoiceModal" | ||||
|         tools:listitem="@layout/item_library" /> | ||||
| 
 | ||||
| </FrameLayout> | ||||
|  | ||||
| @ -6,6 +6,7 @@ | ||||
|     android:orientation="vertical" | ||||
|     android:layout_width="match_parent" | ||||
|     android:layout_height="match_parent" | ||||
|     android:background="@drawable/library_item_background" | ||||
|     > | ||||
| 
 | ||||
|     <FrameLayout | ||||
| @ -42,7 +43,7 @@ | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="36dp" | ||||
|         android:id="@+id/footerLinearLayout" | ||||
|         android:background="@color/md_grey_300"> | ||||
|         > | ||||
| 
 | ||||
|         <eu.kanade.mangafeed.widget.PTSansTextView | ||||
|             android:layout_width="match_parent" | ||||
|  | ||||
							
								
								
									
										12
									
								
								app/src/main/res/menu/library_selection.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								app/src/main/res/menu/library_selection.xml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,12 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| 
 | ||||
| <menu xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     xmlns:app="http://schemas.android.com/apk/res-auto"> | ||||
| 
 | ||||
|     <item android:id="@+id/action_delete" | ||||
|         android:title="@string/action_delete" | ||||
|         android:icon="@drawable/ic_action_delete" | ||||
|         android:orderInCategory="1" | ||||
|         app:showAsAction="always"/> | ||||
| 
 | ||||
| </menu> | ||||
| @ -14,4 +14,5 @@ | ||||
|     <color name="light_grey">#D4D4D4</color> | ||||
|     <color name="bg_light_grey">#E9E9E9</color> | ||||
|     <color name="black_87pc">#DD000000</color> | ||||
|     <color name="library_text_background">#E8E8E8</color> | ||||
| </resources> | ||||
| @ -33,5 +33,7 @@ | ||||
|     <string name="action_search">Search</string> | ||||
|     <string name="action_refresh">Refresh</string> | ||||
|     <string name="library_search_hint">Title or author...</string> | ||||
|     <string name="action_delete">Delete</string> | ||||
|     <string name="library_selection_title">Selected</string> | ||||
| 
 | ||||
| </resources> | ||||
|  | ||||
| @ -9,6 +9,8 @@ | ||||
|         <item name="android:textColorPrimary">@color/black_87pc</item> | ||||
|         <item name="android:textColor">@color/black_87pc</item> | ||||
|         <item name="colorControlNormal">@color/white</item> | ||||
|         <item name="windowActionModeOverlay">true</item> | ||||
|         <item name="actionModeStyle">@style/Widget.ActionMode</item> | ||||
|     </style> | ||||
| 
 | ||||
|     <style name="AppTheme.NoActionBar" parent="AppTheme"> | ||||
| @ -21,7 +23,10 @@ | ||||
|         <item name="drawerArrowStyle">@style/HamburgerIconStyle</item> | ||||
|         <item name="android:itemTextAppearance">@style/OptionsMenuTextColor</item> | ||||
|     </style> | ||||
| 
 | ||||
|      | ||||
|     <style name="Widget.ActionMode" parent="@style/Widget.AppCompat.ActionMode"> | ||||
|         <item name="background">@color/primary</item> | ||||
|     </style> | ||||
|     <style name="AlertDialogStyle" parent="Theme.AppCompat.Light.Dialog.Alert"> | ||||
|         <item name="android:windowTitleStyle">@style/DialogTitleText</item> | ||||
|         <item name="colorAccent">@color/primary</item> | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 inorichi
						inorichi