add a couple things related to displaying all media at once

This commit is contained in:
tibbi 2016-12-06 16:57:17 +01:00
parent 105866987d
commit c3e3d550d1
13 changed files with 42 additions and 4 deletions

View file

@ -81,6 +81,10 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
startActivity(Intent(MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA)) startActivity(Intent(MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA))
true true
} }
R.id.show_all -> {
showAllMedia()
true
}
R.id.settings -> { R.id.settings -> {
startActivity(Intent(applicationContext, SettingsActivity::class.java)) startActivity(Intent(applicationContext, SettingsActivity::class.java))
true true
@ -145,6 +149,14 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
} }
} }
private fun showAllMedia() {
Intent(this, MediaActivity::class.java).apply {
putExtra(DIRECTORY, "/")
putExtra(SHOW_ALL, true)
startActivity(this)
}
}
override fun prepareForDeleting(paths: ArrayList<String>) { override fun prepareForDeleting(paths: ArrayList<String>) {
toast(R.string.deleting) toast(R.string.deleting)
mToBeDeleted = paths mToBeDeleted = paths

View file

@ -42,6 +42,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
private var mIsGetVideoIntent = false private var mIsGetVideoIntent = false
private var mIsGetAnyIntent = false private var mIsGetAnyIntent = false
private var mIsGettingMedia = false private var mIsGettingMedia = false
private var mShowAll = false
} }
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
@ -56,6 +57,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
media_holder.setOnRefreshListener({ getMedia() }) media_holder.setOnRefreshListener({ getMedia() })
mPath = intent.getStringExtra(DIRECTORY) mPath = intent.getStringExtra(DIRECTORY)
mMedia = ArrayList<Medium>() mMedia = ArrayList<Medium>()
mShowAll = intent.getBooleanExtra(SHOW_ALL, false)
} }
override fun onResume() { override fun onResume() {
@ -71,7 +73,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
private fun tryloadGallery() { private fun tryloadGallery() {
if (hasStoragePermission()) { if (hasStoragePermission()) {
val dirName = getHumanizedFilename(mPath) val dirName = getHumanizedFilename(mPath)
title = dirName title = if (mShowAll) resources.getString(R.string.all_media) else dirName
getMedia() getMedia()
} else { } else {
finish() finish()
@ -99,8 +101,8 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
menuInflater.inflate(R.menu.menu_media, menu) menuInflater.inflate(R.menu.menu_media, menu)
val isFolderHidden = mConfig.getIsFolderHidden(mPath) val isFolderHidden = mConfig.getIsFolderHidden(mPath)
menu.findItem(R.id.hide_folder).isVisible = !isFolderHidden menu.findItem(R.id.hide_folder).isVisible = !isFolderHidden && !mShowAll
menu.findItem(R.id.unhide_folder).isVisible = isFolderHidden menu.findItem(R.id.unhide_folder).isVisible = isFolderHidden && !mShowAll
return true return true
} }
@ -128,6 +130,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
private fun toggleFilenameVisibility() { private fun toggleFilenameVisibility() {
mConfig.displayFileNames = !mConfig.displayFileNames mConfig.displayFileNames = !mConfig.displayFileNames
if (media_grid.adapter != null)
(media_grid.adapter as MediaAdapter).updateDisplayFilenames(mConfig.displayFileNames) (media_grid.adapter as MediaAdapter).updateDisplayFilenames(mConfig.displayFileNames)
} }

View file

@ -26,6 +26,7 @@ val SORT_DESCENDING = 1024
val OPEN_DOCUMENT_TREE = 1000 val OPEN_DOCUMENT_TREE = 1000
val DIRECTORY = "directory" val DIRECTORY = "directory"
val SHOW_ALL = "show_all"
val MEDIUM = "medium" val MEDIUM = "medium"
val GET_IMAGE_INTENT = "get_image_intent" val GET_IMAGE_INTENT = "get_image_intent"
val GET_VIDEO_INTENT = "get_video_intent" val GET_VIDEO_INTENT = "get_video_intent"

View file

@ -11,6 +11,10 @@
android:icon="@mipmap/camera" android:icon="@mipmap/camera"
android:title="@string/open_camera" android:title="@string/open_camera"
app:showAsAction="ifRoom"/> app:showAsAction="ifRoom"/>
<item
android:id="@+id/show_all"
android:title="@string/show_all"
app:showAsAction="never"/>
<item <item
android:id="@+id/settings" android:id="@+id/settings"
android:title="@string/settings" android:title="@string/settings"

View file

@ -46,6 +46,8 @@
<string name="moving_success_partial">Some files could not be moved</string> <string name="moving_success_partial">Some files could not be moved</string>
<string name="copying_success_partial">Some files could not be copied</string> <string name="copying_success_partial">Some files could not be copied</string>
<string name="invalid_name">Der Name enthält nicht erlaubte Zeichen</string> <string name="invalid_name">Der Name enthält nicht erlaubte Zeichen</string>
<string name="show_all">Show all media files</string>
<string name="all_media">All media</string>
<plurals name="folders_deleted"> <plurals name="folders_deleted">
<item quantity="one">1 Ordner gelöscht</item> <item quantity="one">1 Ordner gelöscht</item>

View file

@ -46,6 +46,8 @@
<string name="moving_success_partial">Some files could not be moved</string> <string name="moving_success_partial">Some files could not be moved</string>
<string name="copying_success_partial">Some files could not be copied</string> <string name="copying_success_partial">Some files could not be copied</string>
<string name="invalid_name">The name contains invalid characters</string> <string name="invalid_name">The name contains invalid characters</string>
<string name="show_all">Show all media files</string>
<string name="all_media">All media</string>
<plurals name="folders_deleted"> <plurals name="folders_deleted">
<item quantity="one">1 carpeta eliminada</item> <item quantity="one">1 carpeta eliminada</item>

View file

@ -46,6 +46,8 @@
<string name="moving_success_partial">Alcuni file non possono essere spostati</string> <string name="moving_success_partial">Alcuni file non possono essere spostati</string>
<string name="copying_success_partial">Alcuni file non possono essere copiati</string> <string name="copying_success_partial">Alcuni file non possono essere copiati</string>
<string name="invalid_name">Il nome contiene caratteri non validi</string> <string name="invalid_name">Il nome contiene caratteri non validi</string>
<string name="show_all">Show all media files</string>
<string name="all_media">All media</string>
<plurals name="folders_deleted"> <plurals name="folders_deleted">
<item quantity="one">1 cartella eliminata</item> <item quantity="one">1 cartella eliminata</item>

View file

@ -46,6 +46,8 @@
<string name="moving_success_partial">一部のファイルが移動できませんでした</string> <string name="moving_success_partial">一部のファイルが移動できませんでした</string>
<string name="copying_success_partial">一部のファイルがコピーできませんでした</string> <string name="copying_success_partial">一部のファイルがコピーできませんでした</string>
<string name="invalid_name">名前に無効な文字が含まれています</string> <string name="invalid_name">名前に無効な文字が含まれています</string>
<string name="show_all">Show all media files</string>
<string name="all_media">All media</string>
<plurals name="folders_deleted"> <plurals name="folders_deleted">
<item quantity="one">1 フォルダーを削除しました</item> <item quantity="one">1 フォルダーを削除しました</item>

View file

@ -46,6 +46,8 @@
<string name="moving_success_partial">Alguns ficheiros não foram movidos</string> <string name="moving_success_partial">Alguns ficheiros não foram movidos</string>
<string name="copying_success_partial">Alguns ficheiros não foram copiados</string> <string name="copying_success_partial">Alguns ficheiros não foram copiados</string>
<string name="invalid_name">O nome contém caracteres inválidos</string> <string name="invalid_name">O nome contém caracteres inválidos</string>
<string name="show_all">Show all media files</string>
<string name="all_media">All media</string>
<plurals name="folders_deleted"> <plurals name="folders_deleted">
<item quantity="one">1 pasta apagada</item> <item quantity="one">1 pasta apagada</item>

View file

@ -47,6 +47,8 @@
<string name="moving_success_partial">Некоторые файлы не могут быть перемещены</string> <string name="moving_success_partial">Некоторые файлы не могут быть перемещены</string>
<string name="copying_success_partial">Некоторые файлы не могут быть скопированы</string> <string name="copying_success_partial">Некоторые файлы не могут быть скопированы</string>
<string name="invalid_name">Имя содержит недопустимые символы</string> <string name="invalid_name">Имя содержит недопустимые символы</string>
<string name="show_all">Show all media files</string>
<string name="all_media">All media</string>
<plurals name="folders_deleted"> <plurals name="folders_deleted">
<item quantity="one">1 папка удалена</item> <item quantity="one">1 папка удалена</item>

View file

@ -46,6 +46,8 @@
<string name="moving_success_partial">Some files could not be moved</string> <string name="moving_success_partial">Some files could not be moved</string>
<string name="copying_success_partial">Some files could not be copied</string> <string name="copying_success_partial">Some files could not be copied</string>
<string name="invalid_name">Namnet innehåller ogiltiga tecken</string> <string name="invalid_name">Namnet innehåller ogiltiga tecken</string>
<string name="show_all">Show all media files</string>
<string name="all_media">All media</string>
<plurals name="folders_deleted"> <plurals name="folders_deleted">
<item quantity="one">1 mapp borttagen</item> <item quantity="one">1 mapp borttagen</item>

View file

@ -47,6 +47,8 @@
<string name="moving_success_partial">相同文件不能移动</string> <string name="moving_success_partial">相同文件不能移动</string>
<string name="copying_success_partial">相同文件不能复制</string> <string name="copying_success_partial">相同文件不能复制</string>
<string name="invalid_name">The name contains invalid characters</string> <string name="invalid_name">The name contains invalid characters</string>
<string name="show_all">Show all media files</string>
<string name="all_media">All media</string>
<plurals name="folders_deleted"> <plurals name="folders_deleted">
<item quantity="one">1 folder deleted</item> <item quantity="one">1 folder deleted</item>

View file

@ -46,6 +46,8 @@
<string name="moving_success_partial">Some files could not be moved</string> <string name="moving_success_partial">Some files could not be moved</string>
<string name="copying_success_partial">Some files could not be copied</string> <string name="copying_success_partial">Some files could not be copied</string>
<string name="invalid_name">The name contains invalid characters</string> <string name="invalid_name">The name contains invalid characters</string>
<string name="show_all">Show all media files</string>
<string name="all_media">All media</string>
<plurals name="folders_deleted"> <plurals name="folders_deleted">
<item quantity="one">1 folder deleted</item> <item quantity="one">1 folder deleted</item>