added menu options for changing the column counts

This commit is contained in:
tibbi 2017-02-10 23:44:10 +01:00
parent cbcd3cfa6a
commit 7f3b02a765
14 changed files with 49 additions and 2 deletions

View file

@ -70,6 +70,9 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
return false return false
menuInflater.inflate(R.menu.menu_main, menu) menuInflater.inflate(R.menu.menu_main, menu)
menu.findItem(R.id.increase_column_count).isVisible = config.dirColumnCnt < 10
menu.findItem(R.id.reduce_column_count).isVisible = config.dirColumnCnt > 1
return true return true
} }
@ -78,6 +81,8 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
R.id.sort -> showSortingDialog() R.id.sort -> showSortingDialog()
R.id.open_camera -> launchCamera() R.id.open_camera -> launchCamera()
R.id.show_all -> showAllMedia() R.id.show_all -> showAllMedia()
R.id.increase_column_count -> increaseColumnCount()
R.id.reduce_column_count -> reduceColumnCount()
R.id.settings -> launchSettings() R.id.settings -> launchSettings()
R.id.about -> launchAbout() R.id.about -> launchAbout()
else -> return super.onOptionsItemSelected(item) else -> return super.onOptionsItemSelected(item)
@ -216,20 +221,30 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
MyScalableRecyclerView.mListener = object : MyScalableRecyclerView.ZoomListener { MyScalableRecyclerView.mListener = object : MyScalableRecyclerView.ZoomListener {
override fun zoomIn() { override fun zoomIn() {
if (layoutManager.spanCount > 1) { if (layoutManager.spanCount > 1) {
config.dirColumnCnt = --layoutManager.spanCount reduceColumnCount()
DirectoryAdapter.actMode?.finish() DirectoryAdapter.actMode?.finish()
} }
} }
override fun zoomOut() { override fun zoomOut() {
if (layoutManager.spanCount < 10) { if (layoutManager.spanCount < 10) {
config.dirColumnCnt = ++layoutManager.spanCount increaseColumnCount()
DirectoryAdapter.actMode?.finish() DirectoryAdapter.actMode?.finish()
} }
} }
} }
} }
private fun increaseColumnCount() {
config.dirColumnCnt = ++(directories_grid.layoutManager as GridLayoutManager).spanCount
invalidateOptionsMenu()
}
private fun reduceColumnCount() {
config.dirColumnCnt = --(directories_grid.layoutManager as GridLayoutManager).spanCount
invalidateOptionsMenu()
}
private fun isPickImageIntent(intent: Intent) = isPickIntent(intent) && (hasImageContentData(intent) || isImageType(intent)) private fun isPickImageIntent(intent: Intent) = isPickIntent(intent) && (hasImageContentData(intent) || isImageType(intent))
private fun isPickVideoIntent(intent: Intent) = isPickIntent(intent) && (hasVideoContentData(intent) || isVideoType(intent)) private fun isPickVideoIntent(intent: Intent) = isPickIntent(intent) && (hasVideoContentData(intent) || isVideoType(intent))

View file

@ -15,6 +15,14 @@
android:id="@+id/show_all" android:id="@+id/show_all"
android:title="@string/show_all" android:title="@string/show_all"
app:showAsAction="never"/> app:showAsAction="never"/>
<item
android:id="@+id/increase_column_count"
android:title="@string/increase_column_count"
app:showAsAction="never"/>
<item
android:id="@+id/reduce_column_count"
android:title="@string/reduce_column_count"
app:showAsAction="never"/>
<item <item
android:id="@+id/settings" android:id="@+id/settings"
android:title="@string/settings" android:title="@string/settings"

View file

@ -23,6 +23,8 @@
<string name="unknown_location">Unknown location</string> <string name="unknown_location">Unknown location</string>
<string name="no_map_application">No application with maps has been found</string> <string name="no_map_application">No application with maps has been found</string>
<string name="no_camera_app_found">No Camera app has been found</string> <string name="no_camera_app_found">No Camera app has been found</string>
<string name="increase_column_count">Increase column count</string>
<string name="reduce_column_count">Reduce column count</string>
<!-- Resizing --> <!-- Resizing -->
<string name="resize">Größe ändern</string> <string name="resize">Größe ändern</string>

View file

@ -23,6 +23,8 @@
<string name="unknown_location">Unknown location</string> <string name="unknown_location">Unknown location</string>
<string name="no_map_application">No application with maps has been found</string> <string name="no_map_application">No application with maps has been found</string>
<string name="no_camera_app_found">No Camera app has been found</string> <string name="no_camera_app_found">No Camera app has been found</string>
<string name="increase_column_count">Increase column count</string>
<string name="reduce_column_count">Reduce column count</string>
<!-- Resizing --> <!-- Resizing -->
<string name="resize">Resize</string> <string name="resize">Resize</string>

View file

@ -23,6 +23,8 @@
<string name="unknown_location">Unknown location</string> <string name="unknown_location">Unknown location</string>
<string name="no_map_application">No application with maps has been found</string> <string name="no_map_application">No application with maps has been found</string>
<string name="no_camera_app_found">No Camera app has been found</string> <string name="no_camera_app_found">No Camera app has been found</string>
<string name="increase_column_count">Increase column count</string>
<string name="reduce_column_count">Reduce column count</string>
<!-- Resizing --> <!-- Resizing -->
<string name="resize">Redimensionner</string> <string name="resize">Redimensionner</string>

View file

@ -23,6 +23,8 @@
<string name="unknown_location">Unknown location</string> <string name="unknown_location">Unknown location</string>
<string name="no_map_application">No application with maps has been found</string> <string name="no_map_application">No application with maps has been found</string>
<string name="no_camera_app_found">No Camera app has been found</string> <string name="no_camera_app_found">No Camera app has been found</string>
<string name="increase_column_count">Increase column count</string>
<string name="reduce_column_count">Reduce column count</string>
<!-- Resizing --> <!-- Resizing -->
<string name="resize">Resize</string> <string name="resize">Resize</string>

View file

@ -23,6 +23,8 @@
<string name="unknown_location">Unknown location</string> <string name="unknown_location">Unknown location</string>
<string name="no_map_application">No application with maps has been found</string> <string name="no_map_application">No application with maps has been found</string>
<string name="no_camera_app_found">No Camera app has been found</string> <string name="no_camera_app_found">No Camera app has been found</string>
<string name="increase_column_count">Increase column count</string>
<string name="reduce_column_count">Reduce column count</string>
<!-- Resizing --> <!-- Resizing -->
<string name="resize">Resize</string> <string name="resize">Resize</string>

View file

@ -23,6 +23,8 @@
<string name="unknown_location">Localização desconhecida</string> <string name="unknown_location">Localização desconhecida</string>
<string name="no_map_application">Não existe uma aplicação adequada</string> <string name="no_map_application">Não existe uma aplicação adequada</string>
<string name="no_camera_app_found">No Camera app has been found</string> <string name="no_camera_app_found">No Camera app has been found</string>
<string name="increase_column_count">Increase column count</string>
<string name="reduce_column_count">Reduce column count</string>
<!-- Resizing --> <!-- Resizing -->
<string name="resize">Redimensionar</string> <string name="resize">Redimensionar</string>

View file

@ -23,6 +23,8 @@
<string name="unknown_location">Место съёмки не указано</string> <string name="unknown_location">Место съёмки не указано</string>
<string name="no_map_application">Не найдено приложений с картами</string> <string name="no_map_application">Не найдено приложений с картами</string>
<string name="no_camera_app_found">No Camera app has been found</string> <string name="no_camera_app_found">No Camera app has been found</string>
<string name="increase_column_count">Increase column count</string>
<string name="reduce_column_count">Reduce column count</string>
<!-- Resizing --> <!-- Resizing -->
<string name="resize">Изменить размер</string> <string name="resize">Изменить размер</string>

View file

@ -23,6 +23,8 @@
<string name="unknown_location">Neznáma poloha</string> <string name="unknown_location">Neznáma poloha</string>
<string name="no_map_application">Nenašla sa žiadna mapová aplikácia</string> <string name="no_map_application">Nenašla sa žiadna mapová aplikácia</string>
<string name="no_camera_app_found">Nenašla sa žiadna aplikácia pre fotoaparát</string> <string name="no_camera_app_found">Nenašla sa žiadna aplikácia pre fotoaparát</string>
<string name="increase_column_count">Zvýšiť počet stĺpcov</string>
<string name="reduce_column_count">Znížiť počet stĺpcov</string>
<!-- Resizing --> <!-- Resizing -->
<string name="resize">Zmeniť veľkosť</string> <string name="resize">Zmeniť veľkosť</string>

View file

@ -46,6 +46,8 @@
<string name="filename_invalid_characters">Filnamnet innehåller ogiltiga tecken</string> <string name="filename_invalid_characters">Filnamnet innehåller ogiltiga tecken</string>
<string name="extension">Filändelse</string> <string name="extension">Filändelse</string>
<string name="extension_cannot_be_empty">Filändelsen får inte vara tom</string> <string name="extension_cannot_be_empty">Filändelsen får inte vara tom</string>
<string name="increase_column_count">Increase column count</string>
<string name="reduce_column_count">Reduce column count</string>
<!-- Editor --> <!-- Editor -->
<string name="editor">Redigera</string> <string name="editor">Redigera</string>

View file

@ -23,6 +23,8 @@
<string name="unknown_location">Unknown location</string> <string name="unknown_location">Unknown location</string>
<string name="no_map_application">No application with maps has been found</string> <string name="no_map_application">No application with maps has been found</string>
<string name="no_camera_app_found">No Camera app has been found</string> <string name="no_camera_app_found">No Camera app has been found</string>
<string name="increase_column_count">Increase column count</string>
<string name="reduce_column_count">Reduce column count</string>
<!-- Resizing --> <!-- Resizing -->
<string name="resize">缩放</string> <string name="resize">缩放</string>

View file

@ -23,6 +23,8 @@
<string name="unknown_location">Unknown location</string> <string name="unknown_location">Unknown location</string>
<string name="no_map_application">No application with maps has been found</string> <string name="no_map_application">No application with maps has been found</string>
<string name="no_camera_app_found">No Camera app has been found</string> <string name="no_camera_app_found">No Camera app has been found</string>
<string name="increase_column_count">Increase column count</string>
<string name="reduce_column_count">Reduce column count</string>
<!-- Resizing --> <!-- Resizing -->
<string name="resize">縮放</string> <string name="resize">縮放</string>

View file

@ -23,6 +23,8 @@
<string name="unknown_location">Unknown location</string> <string name="unknown_location">Unknown location</string>
<string name="no_map_application">No application with maps has been found</string> <string name="no_map_application">No application with maps has been found</string>
<string name="no_camera_app_found">No Camera app has been found</string> <string name="no_camera_app_found">No Camera app has been found</string>
<string name="increase_column_count">Increase column count</string>
<string name="reduce_column_count">Reduce column count</string>
<!-- Resizing --> <!-- Resizing -->
<string name="resize">Resize</string> <string name="resize">Resize</string>