From c3e3d550d16a94dca651b087271cb34483df750e Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 6 Dec 2016 16:57:17 +0100 Subject: [PATCH] add a couple things related to displaying all media at once --- .../gallery/activities/MainActivity.kt | 12 ++++++++++++ .../gallery/activities/MediaActivity.kt | 11 +++++++---- .../simplemobiletools/gallery/helpers/Constants.kt | 1 + app/src/main/res/menu/menu_main.xml | 4 ++++ app/src/main/res/values-de/strings.xml | 2 ++ app/src/main/res/values-es/strings.xml | 2 ++ app/src/main/res/values-it/strings.xml | 2 ++ app/src/main/res/values-ja/strings.xml | 2 ++ app/src/main/res/values-pt-rPT/strings.xml | 2 ++ app/src/main/res/values-ru/strings.xml | 2 ++ app/src/main/res/values-sv/strings.xml | 2 ++ app/src/main/res/values-zh/strings.xml | 2 ++ app/src/main/res/values/strings.xml | 2 ++ 13 files changed, 42 insertions(+), 4 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt index a4b0a63ff..369b8470d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -81,6 +81,10 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { startActivity(Intent(MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA)) true } + R.id.show_all -> { + showAllMedia() + true + } R.id.settings -> { startActivity(Intent(applicationContext, SettingsActivity::class.java)) 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) { toast(R.string.deleting) mToBeDeleted = paths diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt index 90dd25390..f03d99531 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -42,6 +42,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { private var mIsGetVideoIntent = false private var mIsGetAnyIntent = false private var mIsGettingMedia = false + private var mShowAll = false } override fun onCreate(savedInstanceState: Bundle?) { @@ -56,6 +57,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { media_holder.setOnRefreshListener({ getMedia() }) mPath = intent.getStringExtra(DIRECTORY) mMedia = ArrayList() + mShowAll = intent.getBooleanExtra(SHOW_ALL, false) } override fun onResume() { @@ -71,7 +73,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { private fun tryloadGallery() { if (hasStoragePermission()) { val dirName = getHumanizedFilename(mPath) - title = dirName + title = if (mShowAll) resources.getString(R.string.all_media) else dirName getMedia() } else { finish() @@ -99,8 +101,8 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { menuInflater.inflate(R.menu.menu_media, menu) val isFolderHidden = mConfig.getIsFolderHidden(mPath) - menu.findItem(R.id.hide_folder).isVisible = !isFolderHidden - menu.findItem(R.id.unhide_folder).isVisible = isFolderHidden + menu.findItem(R.id.hide_folder).isVisible = !isFolderHidden && !mShowAll + menu.findItem(R.id.unhide_folder).isVisible = isFolderHidden && !mShowAll return true } @@ -128,7 +130,8 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { private fun toggleFilenameVisibility() { mConfig.displayFileNames = !mConfig.displayFileNames - (media_grid.adapter as MediaAdapter).updateDisplayFilenames(mConfig.displayFileNames) + if (media_grid.adapter != null) + (media_grid.adapter as MediaAdapter).updateDisplayFilenames(mConfig.displayFileNames) } private fun showSortingDialog() { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt index 5ebb21ce4..e9504baea 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt @@ -26,6 +26,7 @@ val SORT_DESCENDING = 1024 val OPEN_DOCUMENT_TREE = 1000 val DIRECTORY = "directory" +val SHOW_ALL = "show_all" val MEDIUM = "medium" val GET_IMAGE_INTENT = "get_image_intent" val GET_VIDEO_INTENT = "get_video_intent" diff --git a/app/src/main/res/menu/menu_main.xml b/app/src/main/res/menu/menu_main.xml index 62fa39ada..268318060 100644 --- a/app/src/main/res/menu/menu_main.xml +++ b/app/src/main/res/menu/menu_main.xml @@ -11,6 +11,10 @@ android:icon="@mipmap/camera" android:title="@string/open_camera" app:showAsAction="ifRoom"/> + Some files could not be moved Some files could not be copied Der Name enthält nicht erlaubte Zeichen + Show all media files + All media 1 Ordner gelöscht diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index ca679572b..476a4ab71 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -46,6 +46,8 @@ Some files could not be moved Some files could not be copied The name contains invalid characters + Show all media files + All media 1 carpeta eliminada diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 309b83f08..e646b8563 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -46,6 +46,8 @@ Alcuni file non possono essere spostati Alcuni file non possono essere copiati Il nome contiene caratteri non validi + Show all media files + All media 1 cartella eliminata diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 8c57bb44e..aaca52232 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -46,6 +46,8 @@ 一部のファイルが移動できませんでした 一部のファイルがコピーできませんでした 名前に無効な文字が含まれています + Show all media files + All media 1 フォルダーを削除しました diff --git a/app/src/main/res/values-pt-rPT/strings.xml b/app/src/main/res/values-pt-rPT/strings.xml index a07e6c29f..39ac0b805 100644 --- a/app/src/main/res/values-pt-rPT/strings.xml +++ b/app/src/main/res/values-pt-rPT/strings.xml @@ -46,6 +46,8 @@ Alguns ficheiros não foram movidos Alguns ficheiros não foram copiados O nome contém caracteres inválidos + Show all media files + All media 1 pasta apagada diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 04c571b99..057fc142f 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -47,6 +47,8 @@ Некоторые файлы не могут быть перемещены Некоторые файлы не могут быть скопированы Имя содержит недопустимые символы + Show all media files + All media 1 папка удалена diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index f185fc7c8..3f245d35a 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -46,6 +46,8 @@ Some files could not be moved Some files could not be copied Namnet innehåller ogiltiga tecken + Show all media files + All media 1 mapp borttagen diff --git a/app/src/main/res/values-zh/strings.xml b/app/src/main/res/values-zh/strings.xml index b910cae85..ebe8ec7b2 100644 --- a/app/src/main/res/values-zh/strings.xml +++ b/app/src/main/res/values-zh/strings.xml @@ -47,6 +47,8 @@ 相同文件不能移动 相同文件不能复制 The name contains invalid characters + Show all media files + All media 1 folder deleted diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 4d7c66d7b..b3fe3aa84 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -46,6 +46,8 @@ Some files could not be moved Some files could not be copied The name contains invalid characters + Show all media files + All media 1 folder deleted