From 4f36f3a6006bfb9891350b19b8677256daa9e64f Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 22 Aug 2017 19:48:56 +0200 Subject: [PATCH 001/207] create a strings file for Catalan language --- app/src/main/res/values-ca/strings.xml | 135 +++++++++++++++++++++++++ 1 file changed, 135 insertions(+) create mode 100644 app/src/main/res/values-ca/strings.xml diff --git a/app/src/main/res/values-ca/strings.xml b/app/src/main/res/values-ca/strings.xml new file mode 100644 index 000000000..496fb5445 --- /dev/null +++ b/app/src/main/res/values-ca/strings.xml @@ -0,0 +1,135 @@ + + + Simple Gallery + Gallery + Edit + Open camera + Open with + No valid app found + (hidden) + Pin folder + Unpin folder + Show all folders content + All folders + Switch to folder view + Other folder + Show on map + Unknown location + No application with maps has been found + No Camera app has been found + Increase column count + Reduce column count + Change cover image + Select photo + Use default + Set as + Volume + Brightness + + + This function hides the folder by adding a \'.nomedia\' file into it, it will hide all subfolders too. You can see them by toggling the \'Show hidden folders\' option in Settings. Continue? + Exclude + Excluded folders + Manage excluded folders + This will exclude the selection together with its subfolders from Simple Gallery only. You can manage excluded folders in Settings. + Exclude a parent instead? + Excluding folders will make them together with their subfolders hidden just in Simple Gallery, they will still be visible in other applications.\n\nIf you want to hide them from other apps too, use the Hide function. + Remove all + Remove all folders from the list of excluded? This will not delete the folders. + + + Included folders + Manage included folders + Add folder + If you have some folders which contain media, but were not recognized by the app, you can add them manually here. + + + Resize + Resize selection and save + Width + Height + Keep aspect ratio + Please enter a valid resolution + + + Editor + Save + Rotate + Path + Invalid image path + Image editing failed + Edit image with: + No image editor found + Unknown file location + Could not overwrite the source file + Rotate left + Rotate right + Rotate by 180º + Flip + Flip horizontally + Flip vertically + Edit with + + + Simple Wallpaper + Set as Wallpaper + Setting as Wallpaper failed + Set as wallpaper with: + No app capable of it has been found + Setting wallpaper… + Wallpaper set successfully + Portrait aspect ratio + Landscape aspect ratio + + + Slideshow + Interval (seconds): + Include photos and GIFs + Include videos + Random order + Use fade animations + Move backwards + The slideshow ended + No media for the slideshow have been found + + + Show hidden media + Play videos automatically + Toggle filename visibility + Show media + Images only + Videos only + GIFs only + Images, videos, GIFs + Images and videos + Loop videos + Animate GIFs at thumbnails + Max brightness when viewing media + Crop thumbnails into squares + Rotate fullscreen media by + System setting + Device rotation + Aspect ratio + Dark background at fullscreen media + Scroll thumbnails horizontally + Automatically hide system UI at fullscreen media + Replace Share with Rotate at fullscreen menu + + + + A gallery for viewing photos and videos without ads. + + A simple tool usable for viewing photos and videos. Items can be sorted by date, size, name both ascending or descending, photos can be zoomed in. Media files are shown in multiple columns depending on the size of the display, you can change the column count by pinch gestures. They can be renamed, shared, deleted, copied, moved. Images can also be cropped, rotated, flipped or set as Wallpaper directly from the app. + + The Gallery is also offered for third party usage for previewing images / videos, adding attachments at email clients etc. It\'s perfect for everyday usage. + + Contains no ads or unnecessary permissions. It is fully opensource, provides customizable colors. + + This app is just one piece of a bigger series of apps. You can find the rest of them at http://www.simplemobiletools.com + + + + From 566e4ea2b379ebcd17bce4a85cc6ae79e87ded77 Mon Sep 17 00:00:00 2001 From: Guido Arnau Date: Sun, 27 Aug 2017 21:22:26 +0100 Subject: [PATCH 002/207] Fixes Crash on Android API 16 (Jelly Bean) Check that the version is greater than API 16 when calling Activity.isDestroyed() --- .../simplemobiletools/gallery/adapters/DirectoryAdapter.kt | 7 +++++-- .../com/simplemobiletools/gallery/adapters/MediaAdapter.kt | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt index 3ef268ecf..7e7a10d01 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt @@ -1,6 +1,7 @@ package com.simplemobiletools.gallery.adapters import android.graphics.PorterDuff +import android.os.Build import android.support.v7.view.ActionMode import android.support.v7.widget.RecyclerView import android.util.SparseArray @@ -430,8 +431,10 @@ class DirectoryAdapter(val activity: SimpleActivity, var dirs: MutableList= Build.VERSION_CODES.JELLY_BEAN_MR1 && activity.isDestroyed) + return + + Glide.with(activity).clear(view.dir_thumbnail) } } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt index 9cbe8915e..c0b026892 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt @@ -1,6 +1,7 @@ package com.simplemobiletools.gallery.adapters import android.graphics.PorterDuff +import android.os.Build import android.support.v7.view.ActionMode import android.support.v7.widget.RecyclerView import android.util.SparseArray @@ -347,8 +348,10 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList, } fun stopLoad() { - if (!activity.isDestroyed) - Glide.with(activity).clear(view.medium_thumbnail) + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 && activity.isDestroyed) + return + + Glide.with(activity).clear(view.medium_thumbnail) } } From 5e121797301aa8085e30add7dc020e0b4f58e15a Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 28 Aug 2017 10:38:19 +0200 Subject: [PATCH 003/207] update commons to 2.26.2 --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 6282b5d27..6a40f01bd 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,7 +37,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.25.4' + compile 'com.simplemobiletools:commons:2.26.2' compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.6.0' compile 'com.theartofdev.edmodo:android-image-cropper:2.4.0' compile 'com.bignerdranch.android:recyclerview-multiselect:0.2' From 272d45b3f4ae9e821585351ba5b3f312140a76fc Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 28 Aug 2017 13:33:46 +0200 Subject: [PATCH 004/207] move the Media filtering from Settings to an actionmenu item --- .../gallery/activities/MainActivity.kt | 5 +++ .../gallery/activities/MediaActivity.kt | 17 +++++---- .../gallery/activities/SettingsActivity.kt | 26 ++------------ .../gallery/extensions/context.kt | 12 +++---- .../gallery/helpers/Config.kt | 6 ++-- .../gallery/helpers/Constants.kt | 13 ++++--- app/src/main/res/layout/activity_settings.xml | 35 ------------------- app/src/main/res/menu/menu_main.xml | 5 +++ app/src/main/res/menu/menu_media.xml | 5 +++ app/src/main/res/values-ca/strings.xml | 12 +++---- app/src/main/res/values-cs/strings.xml | 12 +++---- app/src/main/res/values-de/strings.xml | 12 +++---- app/src/main/res/values-es/strings.xml | 12 +++---- app/src/main/res/values-fr/strings.xml | 12 +++---- app/src/main/res/values-hu/strings.xml | 12 +++---- app/src/main/res/values-it/strings.xml | 12 +++---- app/src/main/res/values-ja/strings.xml | 12 +++---- app/src/main/res/values-pl/strings.xml | 12 +++---- app/src/main/res/values-pt-rBR/strings.xml | 15 ++++---- app/src/main/res/values-pt/strings.xml | 12 +++---- app/src/main/res/values-ru/strings.xml | 12 +++---- app/src/main/res/values-sk/strings.xml | 12 +++---- app/src/main/res/values-sv/strings.xml | 12 +++---- app/src/main/res/values-tr/strings.xml | 12 +++---- app/src/main/res/values-zh-rCN/strings.xml | 12 +++---- app/src/main/res/values-zh-rTW/strings.xml | 12 +++---- app/src/main/res/values/strings.xml | 12 +++---- 27 files changed, 153 insertions(+), 190 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 6952c945e..ed41ca45b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -95,6 +95,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { override fun onOptionsItemSelected(item: MenuItem): Boolean { when (item.itemId) { R.id.sort -> showSortingDialog() + R.id.filter -> showFilterMediaDialog() R.id.open_camera -> launchCamera() R.id.show_all -> showAllMedia() R.id.temporarily_show_hidden -> tryToggleTemporarilyShowHidden() @@ -201,6 +202,10 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { } } + private fun showFilterMediaDialog() { + + } + private fun showAllMedia() { config.showAll = true Intent(this, MediaActivity::class.java).apply { 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 6229ffce7..87417c774 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -210,6 +210,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { override fun onOptionsItemSelected(item: MenuItem): Boolean { when (item.itemId) { R.id.sort -> showSortingDialog() + R.id.filter -> showFilterMediaDialog() R.id.toggle_filename -> toggleFilenameVisibility() R.id.open_camera -> launchCamera() R.id.folder_view -> switchToFolderView() @@ -227,18 +228,22 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { return true } - private fun toggleFilenameVisibility() { - config.displayFileNames = !config.displayFileNames - if (media_grid.adapter != null) - getRecyclerAdapter().updateDisplayFilenames(config.displayFileNames) - } - private fun showSortingDialog() { ChangeSortingDialog(this, false, !config.showAll, mPath) { getMedia() } } + private fun showFilterMediaDialog() { + + } + + private fun toggleFilenameVisibility() { + config.displayFileNames = !config.displayFileNames + if (media_grid.adapter != null) + getRecyclerAdapter().updateDisplayFilenames(config.displayFileNames) + } + private fun switchToFolderView() { config.showAll = false startActivity(Intent(this, MainActivity::class.java)) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt index b5125dff1..65205b02f 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt @@ -11,7 +11,9 @@ import com.simplemobiletools.commons.helpers.SHOW_ALL_TABS import com.simplemobiletools.commons.models.RadioItem import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.extensions.config -import com.simplemobiletools.gallery.helpers.* +import com.simplemobiletools.gallery.helpers.ROTATE_BY_ASPECT_RATIO +import com.simplemobiletools.gallery.helpers.ROTATE_BY_DEVICE_ROTATION +import com.simplemobiletools.gallery.helpers.ROTATE_BY_SYSTEM_SETTING import kotlinx.android.synthetic.main.activity_settings.* class SettingsActivity : SimpleActivity() { @@ -40,7 +42,6 @@ class SettingsActivity : SimpleActivity() { setupScreenRotation() setupReplaceShare() setupPasswordProtection() - setupShowMedia() setupHideSystemUI() updateTextColors(settings_holder) } @@ -187,25 +188,4 @@ class SettingsActivity : SimpleActivity() { ROTATE_BY_DEVICE_ROTATION -> R.string.screen_rotation_device_rotation else -> R.string.screen_rotation_aspect_ratio }) - - private fun setupShowMedia() { - settings_show_media.text = getShowMediaText() - settings_show_media_holder.setOnClickListener { - val items = arrayListOf( - RadioItem(IMAGES_AND_VIDEOS, res.getString(R.string.images_and_videos)), - RadioItem(IMAGES, res.getString(R.string.images)), - RadioItem(VIDEOS, res.getString(R.string.videos))) - - RadioGroupDialog(this@SettingsActivity, items, config.showMedia) { - config.showMedia = it as Int - settings_show_media.text = getShowMediaText() - } - } - } - - private fun getShowMediaText() = getString(when (config.showMedia) { - IMAGES_AND_VIDEOS -> R.string.images_and_videos - IMAGES -> R.string.images - else -> R.string.videos - }) } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt index 2fd607c32..5dc6c7dc3 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt @@ -73,13 +73,13 @@ fun Context.getFilesFrom(curPath: String, isPickImage: Boolean, isPickVideo: Boo private fun parseCursor(context: Context, cur: Cursor, isPickImage: Boolean, isPickVideo: Boolean, curPath: String): ArrayList { val curMedia = ArrayList() val config = context.config - val showMedia = config.showMedia + val filterMedia = config.filterMedia val showHidden = config.shouldShowHidden val includedFolders = config.includedFolders val excludedFolders = config.excludedFolders val noMediaFolders = context.getNoMediaFolders() - cur.use { cur -> + cur.use { if (cur.moveToFirst()) { do { try { @@ -103,10 +103,10 @@ private fun parseCursor(context: Context, cur: Cursor, isPickImage: Boolean, isP if (!isImage && !isVideo) continue - if (isVideo && (isPickImage || showMedia == IMAGES)) + if (isVideo && (isPickImage || filterMedia and VIDEOS == 0)) continue - if (isImage && (isPickVideo || showMedia == VIDEOS)) + if (isImage && (isPickVideo || filterMedia and IMAGES == 0)) continue if (!showHidden && filename.startsWith('.')) @@ -164,10 +164,10 @@ private fun parseCursor(context: Context, cur: Cursor, isPickImage: Boolean, isP if (!isImage && !isVideo) continue - if (isVideo && (isPickImage || showMedia == IMAGES)) + if (isVideo && (isPickImage || filterMedia and VIDEOS == 0)) continue - if (isImage && (isPickVideo || showMedia == VIDEOS)) + if (isImage && (isPickVideo || filterMedia and IMAGES == 0)) continue val dateTaken = file.lastModified() diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt index 167988674..8ce4a8457 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt @@ -156,9 +156,9 @@ class Config(context: Context) : BaseConfig(context) { get() = prefs.getBoolean(DARK_BACKGROUND, false) set(darkBackground) = prefs.edit().putBoolean(DARK_BACKGROUND, darkBackground).apply() - var showMedia: Int - get() = prefs.getInt(SHOW_MEDIA, IMAGES_AND_VIDEOS) - set(showMedia) = prefs.edit().putInt(SHOW_MEDIA, showMedia).apply() + var filterMedia: Int + get() = prefs.getInt(FILTER_MEDIA, IMAGES or VIDEOS or GIFS) + set(filterMedia) = prefs.edit().putInt(FILTER_MEDIA, filterMedia).apply() var dirColumnCnt: Int get() = prefs.getInt(getDirectoryColumnsField(), getDefaultDirectoryColumnCount()) 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 3efd48714..72ab0bc18 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt @@ -15,6 +15,7 @@ val SCREEN_ROTATION = "screen_rotation" val DISPLAY_FILE_NAMES = "display_file_names" val DARK_BACKGROUND = "dark_background" val PINNED_FOLDERS = "pinned_folders" +val FILTER_MEDIA = "filter_media" val DIR_COLUMN_CNT = "dir_column_cnt" val DIR_LANDSCAPE_COLUMN_CNT = "dir_landscape_column_cnt" val DIR_HORIZONTAL_COLUMN_CNT = "dir_horizontal_column_cnt" @@ -24,7 +25,6 @@ val MEDIA_LANDSCAPE_COLUMN_CNT = "media_landscape_column_cnt" val MEDIA_HORIZONTAL_COLUMN_CNT = "media_horizontal_column_cnt" val MEDIA_LANDSCAPE_HORIZONTAL_COLUMN_CNT = "media_landscape_horizontal_column_cnt" val SHOW_ALL = "show_all" // display images and videos from all folders together -val SHOW_MEDIA = "show_media" val SAVE_FOLDER_PREFIX = "folder2_" val HIDE_FOLDER_TOOLTIP_SHOWN = "hide_folder_tooltip_shown" val EXCLUDED_FOLDERS = "excluded_folders" @@ -57,11 +57,6 @@ val IS_VIEW_INTENT = "is_view_intent" val REQUEST_EDIT_IMAGE = 1 val REQUEST_SET_AS = 2 -// show media -val IMAGES_AND_VIDEOS = 0 -val IMAGES = 1 -val VIDEOS = 2 - // rotations val ROTATE_BY_SYSTEM_SETTING = 0 val ROTATE_BY_DEVICE_ROTATION = 1 @@ -70,4 +65,8 @@ val ROTATE_BY_ASPECT_RATIO = 2 val ORIENT_PORTRAIT = 0 val ORIENT_LANDSCAPE_LEFT = 1 val ORIENT_LANDSCAPE_RIGHT = 2 -val ORIENT_UPSIDE_DOWN = 3 + +// filter media +val IMAGES = 1 +val VIDEOS = 2 +val GIFS = 4 diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index ae31ddb62..db2c3fb3b 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -322,40 +322,5 @@ android:clickable="false"/> - - - - - - - - diff --git a/app/src/main/res/menu/menu_main.xml b/app/src/main/res/menu/menu_main.xml index c32d48135..93770fe35 100644 --- a/app/src/main/res/menu/menu_main.xml +++ b/app/src/main/res/menu/menu_main.xml @@ -11,6 +11,11 @@ android:icon="@drawable/ic_camera" android:title="@string/open_camera" app:showAsAction="ifRoom"/> + + Volume Brightness + + Filter media + Images + Videos + GIFs + This function hides the folder by adding a \'.nomedia\' file into it, it will hide all subfolders too. You can see them by toggling the \'Show hidden folders\' option in Settings. Continue? Exclude @@ -96,12 +102,6 @@ Show hidden media Play videos automatically Toggle filename visibility - Show media - Images only - Videos only - GIFs only - Images, videos, GIFs - Images and videos Loop videos Animate GIFs at thumbnails Max brightness when viewing media diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index 3b88dc92d..0d5b5652c 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -26,6 +26,12 @@ Volume Brightness + + Filter media + Images + Videos + GIFs + Tato funkce skryje složku, včetně podsložek, přidáním souboru \'.nomedia\'. Zobrazíte je zvolením možnosti \'Zobrazit skryté složky\' v nastavení. Pokračovat? Vyloučit @@ -96,12 +102,6 @@ Zobrazit skryté média Automaticky přehrávat videa Přepnout viditelnost názvů souborů - Zobrazit média - Jen obrázky - Jen videa - GIFs only - Images, videos, GIFs - Obrázky i videa Přehrávat videa ve smyčce Animovat náhledy souborů GIF Nastavit jas obrazovky na max při zobrazení médií diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index ba4a39d71..205a86c71 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -26,6 +26,12 @@ Lautstärke Helligkeit + + Filter media + Images + Videos + GIFs + Diese Funktion versteckt ausgewählte Ordner (auch für andere Apps), indem dort im Dateisystem eine \'.nomedia\'-Datei abgelegt wird. Dadurch werden auch deren Unterordner versteckt. Solche Ordner werden nur gezeigt, wenn die Einstellung \'Versteckte Ordner zeigen\' aktiv ist (auch andere Apps bieten üblicherweise eine solche Option). Fortfahren? Ordner ausblenden @@ -96,12 +102,6 @@ Versteckte Ordner zeigen Videos automatisch abspielen Beschriftungen ein/aus - Medien auswählen - Nur Bilder - Nur Videos - Nur GIFs - Bilder, Videos und GIFs - Bilder und Videos Videos in Endlosschleife spielen Kacheln von GIFs animieren Helligkeit beim Betrachten maximieren diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index b5bc78a3a..a56b9ba8c 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -26,6 +26,12 @@ Volume Brightness + + Filter media + Images + Videos + GIFs + Esta función oculta la carpeta agregando un archivo \'.nomedia\' en ella, y ocultará también las subcarpetas. Puede mostrarlas cambiando la opción \'Mostrar carpetas ocultas\' en los Ajustes. ¿Continuar? Excluir @@ -96,12 +102,6 @@ Mostrar carpetas ocultas Reproducir vídeos automáticamente Cambiar la visibilidad del nombre de archivo - Mostrar multimedia - Solo imágenes - Solo vídeos - solo GIFs - Imágenes, vídeos, GIFs - Imágenes y vídeos Reproducción continua de vídeos Animar las miniaturas de GIFs Brillo máximo cuando se muestra multimedia diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 09c8d563c..556037f3f 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -26,6 +26,12 @@ Volume Luminosité + + Filter media + Images + Videos + GIFs + Cette option masque le dossier en ajoutant un fichier \'.nomedia\' à l\'intérieur, cela masquera aussi tous les sous-dossiers. Vous pouvez les voir en modifiant l\'option \'Afficher les dossiers cachés\' dans les Paramètres. Continuer ? Exclure @@ -96,12 +102,6 @@ Afficher les dossiers cachés Lecture automatique des vidéos Permuter la visibilité des noms de fichier - Afficher les médias - Seulement les images - Vidéos uniquement - GIFs seulement - Images, vidéos, GIFs - Images et vidéos Tourner en boucle les vidéos GIFs animés sur les miniatures Luminosité maximale lors de l\'affichage de media diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index 8921e7214..1c4b04c34 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -26,6 +26,12 @@ Volume Brightness + + Filter media + Images + Videos + GIFs + This function hides the folder by adding a \'.nomedia\' file into it, it will hide all subfolders too. You can see them by toggling the \'Show hidden folders\' option in Settings. Continue? Exclude @@ -96,12 +102,6 @@ Show hidden media Play videos automatically Toggle filename visibility - Show media - Images only - Videos only - GIFs only - Images, videos, GIFs - Images and videos Loop videos Animate GIFs at thumbnails Max brightness when viewing media diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index b70a13b6c..a1b48cf8c 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -26,6 +26,12 @@ Volume Luminosità + + Filter media + Images + Videos + GIFs + Questa funzione nasconde la cartella aggiungendo un file \'.nomedia\' all\'interno, nasconderà anche tutte le sottocartelle. Puoi vederle attivando l\'opzione \'Mostra cartelle nascoste\' nelle impostazioni. Continuare? Escludi @@ -96,12 +102,6 @@ Mostra cartelle nascoste Riproduci video automaticamente Visibilità nome del file - Mostra tipo di media - Solo immagini - Solo video - Solo GIF - Immagini, video, GIF - Immagini e video Ripeti i video Anima le GIF in miniatura Luminosità max durante visualizzazione diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index a1f649c3a..0a56bc8bd 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -26,6 +26,12 @@ Volume Brightness + + Filter media + Images + Videos + GIFs + This function hides the folder by adding a \'.nomedia\' file into it, it will hide all subfolders too. You can see them by toggling the \'Show hidden folders\' option in Settings. Continue? Exclude @@ -96,12 +102,6 @@ 非表示フォルダーを表示 自動的にビデオを再生 ファイル名の表示を切り替え - Show media - Images only - Videos only - GIFs only - Images, videos, GIFs - Images and videos Loop videos Animate GIFs at thumbnails Max brightness when viewing media diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index 81cbaaae6..722416c06 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -26,6 +26,12 @@ Głośność Jasność + + Filter media + Images + Videos + GIFs + Ta funkcja ukrywa foldery dodając do nich pusty plik .nomedia. Aby móc je zobaczyć, należy włączyć opcję \'Pokazuj ukryte foldery\' w ustawieniach. Kontyntynuować? Wyklucz @@ -96,12 +102,6 @@ Pokazuj ukryte foldery Odtwarzaj filmy automatycznie Pokazuj / ukrywaj nazwy plików - Pokazywane typy multimediów - Tylko obrazy - Tylko filmy - Tylko GIFy - Obrazy, filmy i GIFy - Obrazy i filmy Zapętlaj odtwarzanie filmów Animowane miniatury GIFów Maksymalna jasność podczas wyświetlania multimediów diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index ab1b9691c..24b7e10d4 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -5,8 +5,7 @@ Editar Abrir câmera Abrir com - Nenhum aplicativo encontrado -     + Nenhum aplicativo encontrado     (oculto) Fixar pasta Desfixar pasta @@ -27,6 +26,12 @@ Volume Brightness + + Filter media + Images + Videos + GIFs + Esta opção oculta uma pasta com a adição de um arquivo \'.nomedia\' dentro dela, e irá ocultar todas as subpastas que estejam dentro da mesma. Você poderá rever essas pastas com a opção \'Mostrar pastas ocultas\'. Continuar? Excluir @@ -97,12 +102,6 @@ Mostrar pastas ocultas Reproduzir vídeos automaticamente Mostrar/ocultar nome do arquivo - Mostrar mídia - Apenas imagens - Apenas vídeos - Apenas GIFS - Imagens, vídeos, GIFs - Imagens e vídeos Reproduzir vídeos em ciclo Animação de GIFs nas miniaturas Brilho máximo ao visualizar mídia diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index 300f156b1..d70a29e5b 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -26,6 +26,12 @@ Volume Brilho + + Filter media + Images + Videos + GIFs + Esta opção oculta uma pasta com a adição de um ficheiro \'.nomedia\' na pasta, e irá ocultar todas as subpastas existentes. Pode ver as pastas com a opção \'Mostrar pastas ocultas\'. Continuar? Exclusão @@ -96,12 +102,6 @@ Mostrar pastas ocultas Reproduzir vídeos automaticamente Mostrar/ocultar nome do ficheiro - Mostrar multimédia - Apenas imagens - Apenas vídeos - Apenas GIFs - Imagens, vídeos e GIFs - Imagens e vídeos Vídeos em ciclo Animação de GIFs nas miniaturas Brilho máximo permitido diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 700fc831e..1071d67d1 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -26,6 +26,12 @@ Volume Brightness + + Filter media + Images + Videos + GIFs + Эта опция скрывает папку, добавляя в неё файл \'.nomedia\'; будут скрыты все подпапки. Можно показывать их, переключая \'Показать скрытые папки\' в настройках. Продолжить? Исключить @@ -96,12 +102,6 @@ Показать скрытые папки Воспроизводить видео автоматически Переключить отображение имени файла - Отображать - Только изображения - Только видео - GIFs only - Images, videos, GIFs - Изображения и видео Повторять видео Анимировать эскизы GIF-файлов Максимальная яркость при просмотре файлов diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index b9b0ea85c..9b6c25cd4 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -26,6 +26,12 @@ Hlasitosť Jas + + Filter médií + Obrázky + Videá + GIFká + Táto funkcia skryje priečinok pridaním súboru \'.nomedia\', skryté budú aj podpriečinky. Môžete ich vidieť zvolením možnosti \'Zobraziť skryté priečinky\' v nastaveniach. Pokračovať? Vylúčiť @@ -96,12 +102,6 @@ Zobraziť skryté médiá Spúšťať videá automaticky Prepnúť viditeľnosť názvov súborov - Zobraziť médiá - Iba obrázky - Iba videá - Iba GIFká - Obrázky, videá, GIFká - Obrázky aj videá Automaticky reštartovať videá Animovať GIF súbory pri náhľade Maximálny jas pri prezeraní médií diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index 68558ac8c..d709b0a1c 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -26,6 +26,12 @@ Volume Brightness + + Filter media + Images + Videos + GIFs + Denna funktion döljer mappen och alla dess undermappar genom att lägga till en \'.nomedia\'-fil i den. Du kan se dem genom att växla \'Visa dolda mappar\'-alternativet i Inställningar. Vill du fortsätta? Uteslut @@ -96,12 +102,6 @@ Visa dolda mappar Spela upp videos automatiskt Visa/dölj filnamnen - Visa media - Endast bilder - Endast videos - Bara GIF-bilder - Bilder, videor, GIF-bilder - Bilder och videos Återspela videos Animera GIF-bilders miniatyrer Maximal ljusstyrka när media visas diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index 087a7d896..f8d3f75d8 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -26,6 +26,12 @@ Volume Brightness + + Filter media + Images + Videos + GIFs + Bu işlev, klasöre\'.medya yok\'dosyası ekleyerek gizler; tüm alt klasörleri de gizler. Bunları Ayarlar\'da\'Gizli klasörleri göster\'seçeneğine basarak görebilirsiniz. Devam et? Dışlama @@ -96,12 +102,6 @@ Gizli klasörleri göster Videoları otomatik olarak oynat Dosya adı görünürlüğünü değiştir - Medyayı göster - Yalnızca resimler - Yalnızca videolar - GIFs only - Images, videos, GIFs - Resimler ve videolar Videolar döngüsü Küçük resimlerde GIF\'leri canlandırın Ortam görüntülerken azami parlaklık diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 0dcda3787..52ad95db9 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -26,6 +26,12 @@ 音量 亮度 + + Filter media + Images + Videos + GIFs + 通过添加文件 \'.nomedia\' 到目录,可以防止目录及其子目录下的所有媒体被扫描。您可以通过设置中的 \'显示隐藏目录\' 选项改变设置,是否继续? 排除 @@ -96,12 +102,6 @@ 显示所有 自动播放 显示文件名 - 显示多媒体文件 - 仅图片 - 仅视频 - 仅 GIF - 图片,视频,GIF - 图片和视频 循环播放视频 GIF 缩略图 浏览时最大亮度 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 61cc68907..e21f9c4ec 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -26,6 +26,12 @@ 音量 亮度 + + Filter media + Images + Videos + GIFs + 這功能藉由添加一個\'.nomedia\'檔案,來隱藏資料夾和所有子資料夾。您可以透過設定中的「顯示隱藏的資料夾」選項來查看。\n是否繼續? 排除 @@ -96,12 +102,6 @@ 顯示隱藏的媒體檔案 自動播放影片 顯示檔案名稱 - 顯示媒體檔案 - 只有圖片 - 只有影片 - 只有GIF - 圖片、影片、GIF - 圖片和影片 影片循環播放 縮圖顯示GIF動畫 瀏覽時最大亮度 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 496fb5445..a1f884953 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -26,6 +26,12 @@ Volume Brightness + + Filter media + Images + Videos + GIFs + This function hides the folder by adding a \'.nomedia\' file into it, it will hide all subfolders too. You can see them by toggling the \'Show hidden folders\' option in Settings. Continue? Exclude @@ -96,12 +102,6 @@ Show hidden media Play videos automatically Toggle filename visibility - Show media - Images only - Videos only - GIFs only - Images, videos, GIFs - Images and videos Loop videos Animate GIFs at thumbnails Max brightness when viewing media From d954dc0d5a3bac1e01c473605b91073037be5174 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 28 Aug 2017 14:11:34 +0200 Subject: [PATCH 005/207] adding the Filter Media dialog --- .../gallery/activities/MainActivity.kt | 5 +- .../gallery/activities/MediaActivity.kt | 5 +- .../gallery/dialogs/FilterMediaDialog.kt | 46 +++++++++++++++++++ .../main/res/layout/dialog_filter_media.xml | 36 +++++++++++++++ 4 files changed, 90 insertions(+), 2 deletions(-) create mode 100644 app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/FilterMediaDialog.kt create mode 100644 app/src/main/res/layout/dialog_filter_media.xml 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 ed41ca45b..1cba45262 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -25,6 +25,7 @@ import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.adapters.DirectoryAdapter import com.simplemobiletools.gallery.asynctasks.GetDirectoriesAsynctask import com.simplemobiletools.gallery.dialogs.ChangeSortingDialog +import com.simplemobiletools.gallery.dialogs.FilterMediaDialog import com.simplemobiletools.gallery.extensions.* import com.simplemobiletools.gallery.helpers.* import com.simplemobiletools.gallery.models.Directory @@ -203,7 +204,9 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { } private fun showFilterMediaDialog() { - + FilterMediaDialog(this) { + getDirectories() + } } private fun showAllMedia() { 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 87417c774..6ef580071 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -27,6 +27,7 @@ import com.simplemobiletools.gallery.adapters.MediaAdapter import com.simplemobiletools.gallery.asynctasks.GetMediaAsynctask import com.simplemobiletools.gallery.dialogs.ChangeSortingDialog import com.simplemobiletools.gallery.dialogs.ExcludeFolderDialog +import com.simplemobiletools.gallery.dialogs.FilterMediaDialog import com.simplemobiletools.gallery.extensions.* import com.simplemobiletools.gallery.helpers.* import com.simplemobiletools.gallery.models.Medium @@ -235,7 +236,9 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { } private fun showFilterMediaDialog() { - + FilterMediaDialog(this) { + getMedia() + } } private fun toggleFilenameVisibility() { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/FilterMediaDialog.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/FilterMediaDialog.kt new file mode 100644 index 000000000..f99fc98c3 --- /dev/null +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/FilterMediaDialog.kt @@ -0,0 +1,46 @@ +package com.simplemobiletools.gallery.dialogs + +import android.support.v7.app.AlertDialog +import android.view.LayoutInflater +import android.view.View +import com.simplemobiletools.commons.extensions.setupDialogStuff +import com.simplemobiletools.gallery.R +import com.simplemobiletools.gallery.activities.SimpleActivity +import com.simplemobiletools.gallery.extensions.config +import com.simplemobiletools.gallery.helpers.GIFS +import com.simplemobiletools.gallery.helpers.IMAGES +import com.simplemobiletools.gallery.helpers.VIDEOS +import kotlinx.android.synthetic.main.dialog_filter_media.view.* + +class FilterMediaDialog(val activity: SimpleActivity, val callback: (result: Int) -> Unit) { + private var view: View = LayoutInflater.from(activity).inflate(R.layout.dialog_filter_media, null) + + init { + val filterMedia = activity.config.filterMedia + view.apply { + filter_media_images.isChecked = filterMedia and IMAGES != 0 + filter_media_videos.isChecked = filterMedia and VIDEOS != 0 + filter_media_gifs.isChecked = filterMedia and GIFS != 0 + } + + AlertDialog.Builder(activity) + .setPositiveButton(R.string.ok, { dialog, which -> dialogConfirmed() }) + .setNegativeButton(R.string.cancel, null) + .create().apply { + activity.setupDialogStuff(view, this, R.string.filter_media) + } + } + + private fun dialogConfirmed() { + var result = 0 + if (view.filter_media_images.isChecked) + result += IMAGES + if (view.filter_media_videos.isChecked) + result += VIDEOS + if (view.filter_media_gifs.isChecked) + result += GIFS + + activity.config.filterMedia = result + callback(result) + } +} diff --git a/app/src/main/res/layout/dialog_filter_media.xml b/app/src/main/res/layout/dialog_filter_media.xml new file mode 100644 index 000000000..37f2aba11 --- /dev/null +++ b/app/src/main/res/layout/dialog_filter_media.xml @@ -0,0 +1,36 @@ + + + + + + + + + + From 7046fc9ed4a40d2214374eb84fe9863b491bb015 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 28 Aug 2017 14:16:30 +0200 Subject: [PATCH 006/207] fix #328, properly handle GIF filtering --- .../gallery/extensions/context.kt | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt index 5dc6c7dc3..b95cabbff 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt @@ -13,10 +13,7 @@ import com.simplemobiletools.commons.helpers.SORT_BY_NAME import com.simplemobiletools.commons.helpers.SORT_BY_SIZE import com.simplemobiletools.commons.helpers.SORT_DESCENDING import com.simplemobiletools.gallery.activities.SettingsActivity -import com.simplemobiletools.gallery.helpers.Config -import com.simplemobiletools.gallery.helpers.IMAGES -import com.simplemobiletools.gallery.helpers.NOMEDIA -import com.simplemobiletools.gallery.helpers.VIDEOS +import com.simplemobiletools.gallery.helpers.* import com.simplemobiletools.gallery.models.Medium import java.io.File import java.util.* @@ -97,10 +94,11 @@ private fun parseCursor(context: Context, cur: Cursor, isPickImage: Boolean, isP if (filename.isEmpty()) filename = path.getFilenameFromPath() - val isImage = filename.isImageFast() || filename.isGif() + val isImage = filename.isImageFast() val isVideo = if (isImage) false else filename.isVideoFast() + val isGif = filename.isGif() - if (!isImage && !isVideo) + if (!isImage && !isVideo && !isGif) continue if (isVideo && (isPickImage || filterMedia and VIDEOS == 0)) @@ -109,6 +107,9 @@ private fun parseCursor(context: Context, cur: Cursor, isPickImage: Boolean, isP if (isImage && (isPickVideo || filterMedia and IMAGES == 0)) continue + if (isGif && filterMedia and GIFS == 0) + continue + if (!showHidden && filename.startsWith('.')) continue @@ -158,8 +159,9 @@ private fun parseCursor(context: Context, cur: Cursor, isPickImage: Boolean, isP } val filename = file.name - val isImage = filename.isImageFast() || filename.isGif() + val isImage = filename.isImageFast() val isVideo = if (isImage) false else filename.isVideoFast() + val isGif = filename.isGif() if (!isImage && !isVideo) continue @@ -170,6 +172,9 @@ private fun parseCursor(context: Context, cur: Cursor, isPickImage: Boolean, isP if (isImage && (isPickVideo || filterMedia and IMAGES == 0)) continue + if (isGif && filterMedia and GIFS == 0) + continue + val dateTaken = file.lastModified() val dateModified = file.lastModified() From 60ed21702febefa968678c738eb62184681e0558 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 28 Aug 2017 20:43:39 +0200 Subject: [PATCH 007/207] fix #335, properly show hidden files if open through a file manager --- .../gallery/activities/MainActivity.kt | 2 +- .../gallery/activities/ViewPagerActivity.kt | 23 ++++++++++++++++++- 2 files changed, 23 insertions(+), 2 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 1cba45262..1f8ab2e12 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -72,7 +72,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { mIsGetAnyContentIntent || mIsSetWallpaperIntent directories_refresh_layout.setOnRefreshListener({ getDirectories() }) - mDirs = ArrayList() + mDirs = ArrayList() mStoredAnimateGifs = config.animateGifs mStoredCropThumbnails = config.cropThumbnails mStoredScrollHorizontally = config.scrollHorizontally diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt index b88493874..e034a167d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -98,7 +98,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View return } - if (intent.extras?.containsKey(IS_VIEW_INTENT) == true && File(mPath).isHidden) { + if (intent.extras?.containsKey(IS_VIEW_INTENT) == true && isShowHiddenFlagNeeded()) { if (!config.isPasswordProtectionOn) { config.temporarilyShowHidden = true } @@ -443,6 +443,27 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View out.close() } + + private fun isShowHiddenFlagNeeded(): Boolean { + val file = File(mPath) + if (file.isHidden) + return true + + var parent = file.parentFile + while (true) { + if (parent.isHidden || parent.listFiles()?.contains(File(NOMEDIA)) == true) { + return true + } + + if (parent.absolutePath == "/") { + break + } + parent = parent.parentFile + } + + return false + } + private fun getCurrentFragment() = (view_pager.adapter as MyPagerAdapter).getCurrentFragment(view_pager.currentItem) private fun showProperties() { From e33206b0849f56cad2ebe57275f91d74aa2d16c1 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 28 Aug 2017 20:56:02 +0200 Subject: [PATCH 008/207] make sure we always show manually included folders, even if somehow hidden --- .../gallery/asynctasks/GetDirectoriesAsynctask.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt index ebc8182f0..e903ad565 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt @@ -82,7 +82,9 @@ class GetDirectoriesAsynctask(val context: Context, val isPickVideo: Boolean, va private fun shouldFolderBeVisible(path: String, excludedPaths: MutableSet, includedPaths: MutableSet): Boolean { val file = File(path) - return if (isThisOrParentExcluded(path, excludedPaths, includedPaths)) { + return if (includedPaths.contains(path)) { + true + } else if (isThisOrParentExcluded(path, excludedPaths, includedPaths)) { false } else if (!config.shouldShowHidden && file.isDirectory && file.canonicalFile == file.absoluteFile) { var containsNoMediaOrDot = file.containsNoMedia() || path.contains("/.") From 3876000f17e74090ae71296b637ed6604639df10 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 28 Aug 2017 21:39:18 +0200 Subject: [PATCH 009/207] update commons to 2.26.4 --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 6a40f01bd..088ee9f6d 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,7 +37,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.26.2' + compile 'com.simplemobiletools:commons:2.26.4' compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.6.0' compile 'com.theartofdev.edmodo:android-image-cropper:2.4.0' compile 'com.bignerdranch.android:recyclerview-multiselect:0.2' From c48fef5bb856a5fd2867b751cc0a376aec2606f1 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 28 Aug 2017 22:54:27 +0200 Subject: [PATCH 010/207] show a dialog mentioning app reinstall in case the password is forgotten --- .../simplemobiletools/gallery/activities/SettingsActivity.kt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt index 65205b02f..0e8368634 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt @@ -3,6 +3,7 @@ package com.simplemobiletools.gallery.activities import android.content.Intent import android.content.res.Resources import android.os.Bundle +import com.simplemobiletools.commons.dialogs.ConfirmationDialog import com.simplemobiletools.commons.dialogs.RadioGroupDialog import com.simplemobiletools.commons.dialogs.SecurityDialog import com.simplemobiletools.commons.extensions.handleHiddenFolderPasswordProtection @@ -164,6 +165,10 @@ class SettingsActivity : SimpleActivity() { config.isPasswordProtectionOn = !hasPasswordProtection config.passwordHash = if (hasPasswordProtection) "" else hash config.protectionType = type + + if (config.isPasswordProtectionOn) { + ConfirmationDialog(this, "", R.string.protection_setup_successfully, R.string.ok, 0) { } + } } } } From 141953338e672d80b698cb59a3e2cc698e66bade Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 28 Aug 2017 22:54:36 +0200 Subject: [PATCH 011/207] update Commons to 2.26.6 --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 088ee9f6d..321a59225 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,7 +37,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.26.4' + compile 'com.simplemobiletools:commons:2.26.6' compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.6.0' compile 'com.theartofdev.edmodo:android-image-cropper:2.4.0' compile 'com.bignerdranch.android:recyclerview-multiselect:0.2' From ab35c970b9fcba498113dce53255dd2eaf6b05be Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 28 Aug 2017 23:12:07 +0200 Subject: [PATCH 012/207] show the swipeRefreshLayout spinner at loading images after filtering change --- .../com/simplemobiletools/gallery/activities/MainActivity.kt | 5 +++-- .../simplemobiletools/gallery/activities/MediaActivity.kt | 5 +++-- 2 files changed, 6 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 1f8ab2e12..37fd0df9a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -183,7 +183,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { mIsGettingDirs = true val dirs = getCachedDirectories() if (dirs.isNotEmpty() && !mLoadedInitialPhotos) { - gotDirectories(dirs) + gotDirectories(dirs, true) } if (!mLoadedInitialPhotos) { @@ -205,6 +205,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { private fun showFilterMediaDialog() { FilterMediaDialog(this) { + directories_refresh_layout.isRefreshing = true getDirectories() } } @@ -389,7 +390,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { } } - private fun gotDirectories(dirs: ArrayList) { + private fun gotDirectories(dirs: ArrayList, isFromCache: Boolean = false) { mLastMediaModified = getLastMediaModified() directories_refresh_layout.isRefreshing = false mIsGettingDirs = false 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 6ef580071..0d4ca59fd 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -237,6 +237,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { private fun showFilterMediaDialog() { FilterMediaDialog(this) { + media_refresh_layout.isRefreshing = true getMedia() } } @@ -304,7 +305,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { val token = object : TypeToken>() {}.type val media = Gson().fromJson>(config.loadFolderMedia(mPath), token) ?: ArrayList(1) if (media.isNotEmpty() && !mLoadedInitialPhotos) { - gotMedia(media) + gotMedia(media, true) } else { media_refresh_layout.isRefreshing = true } @@ -453,7 +454,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { } } - private fun gotMedia(media: ArrayList) { + private fun gotMedia(media: ArrayList, isFromCache: Boolean = false) { mLastMediaModified = getLastMediaModified() mIsGettingMedia = false media_refresh_layout.isRefreshing = false From 21a2e2a6b1880c6903f8355fb4982daa5f7955b1 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 28 Aug 2017 23:57:48 +0200 Subject: [PATCH 013/207] add placeholders when no media is shown because of filters --- .../gallery/activities/MainActivity.kt | 9 ++++++++ .../gallery/activities/MediaActivity.kt | 11 +++++++++- app/src/main/res/layout/activity_main.xml | 22 +++++++++++++++++++ app/src/main/res/layout/activity_media.xml | 22 +++++++++++++++++++ app/src/main/res/values-ca/strings.xml | 2 ++ app/src/main/res/values-cs/strings.xml | 2 ++ app/src/main/res/values-de/strings.xml | 2 ++ app/src/main/res/values-es/strings.xml | 2 ++ app/src/main/res/values-fr/strings.xml | 2 ++ app/src/main/res/values-hu/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-pl/strings.xml | 2 ++ app/src/main/res/values-pt-rBR/strings.xml | 2 ++ app/src/main/res/values-pt/strings.xml | 2 ++ app/src/main/res/values-ru/strings.xml | 2 ++ app/src/main/res/values-sk/strings.xml | 2 ++ app/src/main/res/values-sv/strings.xml | 2 ++ app/src/main/res/values-tr/strings.xml | 2 ++ app/src/main/res/values-zh-rCN/strings.xml | 2 ++ app/src/main/res/values-zh-rTW/strings.xml | 2 ++ app/src/main/res/values/strings.xml | 2 ++ 22 files changed, 99 insertions(+), 1 deletion(-) 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 37fd0df9a..1fb33ce88 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -78,6 +78,10 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { mStoredScrollHorizontally = config.scrollHorizontally storeStoragePaths() checkWhatsNewDialog() + + directories_empty_text.setOnClickListener { + showFilterMediaDialog() + } } override fun onCreateOptionsMenu(menu: Menu): Boolean { @@ -130,6 +134,8 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { tryloadGallery() invalidateOptionsMenu() + directories_empty_text_label.setTextColor(config.textColor) + directories_empty_text.setTextColor(config.primaryColor) } override fun onPause() { @@ -395,6 +401,9 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { directories_refresh_layout.isRefreshing = false mIsGettingDirs = false + directories_empty_text_label.beVisibleIf(dirs.isEmpty() && !isFromCache) + directories_empty_text.beVisibleIf(dirs.isEmpty() && !isFromCache) + checkLastMediaChanged() if (dirs.hashCode() == mDirs.hashCode()) return 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 0d4ca59fd..e78513982 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -75,6 +75,10 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { mShowAll = config.showAll if (mShowAll) supportActionBar?.setDisplayHomeAsUpEnabled(false) + + media_empty_text.setOnClickListener { + showFilterMediaDialog() + } } override fun onResume() { @@ -97,6 +101,8 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { tryloadGallery() invalidateOptionsMenu() + media_empty_text_label.setTextColor(config.textColor) + media_empty_text.setTextColor(config.primaryColor) } override fun onPause() { @@ -317,7 +323,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { } private fun isDirEmpty(): Boolean { - return if (mMedia.size <= 0) { + return if (mMedia.size <= 0 && config.filterMedia > 0) { deleteDirectoryIfEmpty() finish() true @@ -459,6 +465,9 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { mIsGettingMedia = false media_refresh_layout.isRefreshing = false + media_empty_text_label.beVisibleIf(media.isEmpty() && !isFromCache) + media_empty_text.beVisibleIf(media.isEmpty() && !isFromCache) + checkLastMediaChanged() if (mLastDrawnHashCode == 0) mLastDrawnHashCode = media.hashCode() diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 19fd7e7bd..9432206a7 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -11,6 +11,28 @@ android:layout_width="match_parent" android:layout_height="wrap_content"> + + + + + + + + Images Videos GIFs + No media files have been found with the selected filters. + Change filters This function hides the folder by adding a \'.nomedia\' file into it, it will hide all subfolders too. You can see them by toggling the \'Show hidden folders\' option in Settings. Continue? diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index 0d5b5652c..59096e4dd 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -31,6 +31,8 @@ Images Videos GIFs + No media files have been found with the selected filters. + Change filters Tato funkce skryje složku, včetně podsložek, přidáním souboru \'.nomedia\'. Zobrazíte je zvolením možnosti \'Zobrazit skryté složky\' v nastavení. Pokračovat? diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 205a86c71..b2283cc77 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -31,6 +31,8 @@ Images Videos GIFs + No media files have been found with the selected filters. + Change filters Diese Funktion versteckt ausgewählte Ordner (auch für andere Apps), indem dort im Dateisystem eine \'.nomedia\'-Datei abgelegt wird. Dadurch werden auch deren Unterordner versteckt. Solche Ordner werden nur gezeigt, wenn die Einstellung \'Versteckte Ordner zeigen\' aktiv ist (auch andere Apps bieten üblicherweise eine solche Option). Fortfahren? diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index a56b9ba8c..ff7f16ab3 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -31,6 +31,8 @@ Images Videos GIFs + No media files have been found with the selected filters. + Change filters Esta función oculta la carpeta agregando un archivo \'.nomedia\' en ella, y ocultará también las subcarpetas. Puede mostrarlas cambiando la opción \'Mostrar carpetas ocultas\' en los Ajustes. ¿Continuar? diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 556037f3f..e6a9920c5 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -31,6 +31,8 @@ Images Videos GIFs + No media files have been found with the selected filters. + Change filters Cette option masque le dossier en ajoutant un fichier \'.nomedia\' à l\'intérieur, cela masquera aussi tous les sous-dossiers. Vous pouvez les voir en modifiant l\'option \'Afficher les dossiers cachés\' dans les Paramètres. Continuer ? diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index 1c4b04c34..675222f5b 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -31,6 +31,8 @@ Images Videos GIFs + No media files have been found with the selected filters. + Change filters This function hides the folder by adding a \'.nomedia\' file into it, it will hide all subfolders too. You can see them by toggling the \'Show hidden folders\' option in Settings. Continue? diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index a1b48cf8c..dca88c2e0 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -31,6 +31,8 @@ Images Videos GIFs + No media files have been found with the selected filters. + Change filters Questa funzione nasconde la cartella aggiungendo un file \'.nomedia\' all\'interno, nasconderà anche tutte le sottocartelle. Puoi vederle attivando l\'opzione \'Mostra cartelle nascoste\' nelle impostazioni. Continuare? diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 0a56bc8bd..673e9ac42 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -31,6 +31,8 @@ Images Videos GIFs + No media files have been found with the selected filters. + Change filters This function hides the folder by adding a \'.nomedia\' file into it, it will hide all subfolders too. You can see them by toggling the \'Show hidden folders\' option in Settings. Continue? diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index 722416c06..61bf33160 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -31,6 +31,8 @@ Images Videos GIFs + No media files have been found with the selected filters. + Change filters Ta funkcja ukrywa foldery dodając do nich pusty plik .nomedia. Aby móc je zobaczyć, należy włączyć opcję \'Pokazuj ukryte foldery\' w ustawieniach. Kontyntynuować? diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 24b7e10d4..11a1c03d6 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -31,6 +31,8 @@ Images Videos GIFs + No media files have been found with the selected filters. + Change filters Esta opção oculta uma pasta com a adição de um arquivo \'.nomedia\' dentro dela, e irá ocultar todas as subpastas que estejam dentro da mesma. Você poderá rever essas pastas com a opção \'Mostrar pastas ocultas\'. Continuar? diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index d70a29e5b..2acddd5b7 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -31,6 +31,8 @@ Images Videos GIFs + No media files have been found with the selected filters. + Change filters Esta opção oculta uma pasta com a adição de um ficheiro \'.nomedia\' na pasta, e irá ocultar todas as subpastas existentes. Pode ver as pastas com a opção \'Mostrar pastas ocultas\'. Continuar? diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 1071d67d1..34aef359a 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -31,6 +31,8 @@ Images Videos GIFs + No media files have been found with the selected filters. + Change filters Эта опция скрывает папку, добавляя в неё файл \'.nomedia\'; будут скрыты все подпапки. Можно показывать их, переключая \'Показать скрытые папки\' в настройках. Продолжить? diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index 9b6c25cd4..deb90488c 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -31,6 +31,8 @@ Obrázky Videá GIFká + So zvolenými filtrami sa nenašli žiadne média súbory. + Zmeniť filtre Táto funkcia skryje priečinok pridaním súboru \'.nomedia\', skryté budú aj podpriečinky. Môžete ich vidieť zvolením možnosti \'Zobraziť skryté priečinky\' v nastaveniach. Pokračovať? diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index d709b0a1c..c99a203bd 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -31,6 +31,8 @@ Images Videos GIFs + No media files have been found with the selected filters. + Change filters Denna funktion döljer mappen och alla dess undermappar genom att lägga till en \'.nomedia\'-fil i den. Du kan se dem genom att växla \'Visa dolda mappar\'-alternativet i Inställningar. Vill du fortsätta? diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index f8d3f75d8..7403747d2 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -31,6 +31,8 @@ Images Videos GIFs + No media files have been found with the selected filters. + Change filters Bu işlev, klasöre\'.medya yok\'dosyası ekleyerek gizler; tüm alt klasörleri de gizler. Bunları Ayarlar\'da\'Gizli klasörleri göster\'seçeneğine basarak görebilirsiniz. Devam et? diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 52ad95db9..78fed273a 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -31,6 +31,8 @@ Images Videos GIFs + No media files have been found with the selected filters. + Change filters 通过添加文件 \'.nomedia\' 到目录,可以防止目录及其子目录下的所有媒体被扫描。您可以通过设置中的 \'显示隐藏目录\' 选项改变设置,是否继续? diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index e21f9c4ec..ca9c2b7ee 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -31,6 +31,8 @@ Images Videos GIFs + No media files have been found with the selected filters. + Change filters 這功能藉由添加一個\'.nomedia\'檔案,來隱藏資料夾和所有子資料夾。您可以透過設定中的「顯示隱藏的資料夾」選項來查看。\n是否繼續? diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index a1f884953..731313068 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -31,6 +31,8 @@ Images Videos GIFs + No media files have been found with the selected filters. + Change filters This function hides the folder by adding a \'.nomedia\' file into it, it will hide all subfolders too. You can see them by toggling the \'Show hidden folders\' option in Settings. Continue? From 8e3b26fa2af9b25017e45df5beee4f46097d22f9 Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 29 Aug 2017 00:00:22 +0200 Subject: [PATCH 014/207] updating Whats new --- .../com/simplemobiletools/gallery/activities/MainActivity.kt | 1 + app/src/main/res/values/donottranslate.xml | 1 + 2 files changed, 2 insertions(+) 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 1fb33ce88..bd43493af 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -512,6 +512,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { add(Release(119, R.string.release_119)) add(Release(122, R.string.release_122)) add(Release(123, R.string.release_123)) + add(Release(125, R.string.release_125)) checkWhatsNew(this, BuildConfig.VERSION_CODE) } } diff --git a/app/src/main/res/values/donottranslate.xml b/app/src/main/res/values/donottranslate.xml index 4f173fa1f..b1c57f56d 100644 --- a/app/src/main/res/values/donottranslate.xml +++ b/app/src/main/res/values/donottranslate.xml @@ -2,6 +2,7 @@ + Moved media type filter from Settings to the Action menu Allow changing the screen brightness and volume at videos by vertically dragging the screen sides Added slideshow at the fullscreen view Added pattern/pin protection for showing hidden items From 407e3bd805bbb79149535c242f87a412a9876129 Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 29 Aug 2017 00:00:32 +0200 Subject: [PATCH 015/207] update version to 2.13.2 (125) --- app/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 321a59225..25b63864d 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,8 +10,8 @@ android { applicationId "com.simplemobiletools.gallery" minSdkVersion 16 targetSdkVersion 23 - versionCode 124 - versionName "2.13.1" + versionCode 125 + versionName "2.13.2" } signingConfigs { From 2a384f82c54d7f08bac3a6f21c92de827170c8a1 Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 29 Aug 2017 00:03:13 +0200 Subject: [PATCH 016/207] updating changelog --- CHANGELOG.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5314e9911..5ba4fd478 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,20 @@ Changelog ========== +Version 2.13.2 *(2017-08-28)* +---------------------------- + + * Moved media type filter from Settings to the Action menu + * Allow filtering GIFs out + * Make sure we always show manually included folders + * Properly show hidden files, when open from some File Manager + +Version 2.13.1 *(2017-08-16)* +---------------------------- + + * Show a folder if its both excluded and included + * Many translation improvements + Version 2.13.0 *(2017-08-07)* ---------------------------- From 1b2e5f613112d87166c37cc928ed4c17b208df27 Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 29 Aug 2017 22:47:50 +0200 Subject: [PATCH 017/207] update commons to 2.26.9 --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 25b63864d..7b6da4445 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,7 +37,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.26.6' + compile 'com.simplemobiletools:commons:2.26.9' compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.6.0' compile 'com.theartofdev.edmodo:android-image-cropper:2.4.0' compile 'com.bignerdranch.android:recyclerview-multiselect:0.2' From 7271ac59b9e39114bd42bc9a33e1f836267875e5 Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 29 Aug 2017 23:25:44 +0200 Subject: [PATCH 018/207] adding a crashfix --- .../simplemobiletools/gallery/activities/ViewPagerActivity.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt index e034a167d..a18890de9 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -449,7 +449,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View if (file.isHidden) return true - var parent = file.parentFile + var parent = file.parentFile ?: return false while (true) { if (parent.isHidden || parent.listFiles()?.contains(File(NOMEDIA)) == true) { return true @@ -458,7 +458,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View if (parent.absolutePath == "/") { break } - parent = parent.parentFile + parent = parent.parentFile ?: return false } return false From 7f426ad0f19b1654d647cc1199c8fc188e4dbc37 Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 29 Aug 2017 23:27:43 +0200 Subject: [PATCH 019/207] update version to 2.13.3 (126) --- app/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 7b6da4445..ebdb3ae39 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,8 +10,8 @@ android { applicationId "com.simplemobiletools.gallery" minSdkVersion 16 targetSdkVersion 23 - versionCode 125 - versionName "2.13.2" + versionCode 126 + versionName "2.13.3" } signingConfigs { From f3255ac1fa7b104a238a42327ed99c5e4995367b Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 29 Aug 2017 23:27:48 +0200 Subject: [PATCH 020/207] updating changelog --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5ba4fd478..c1e33f465 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ Changelog ========== +Version 2.13.3 *(2017-08-29)* +---------------------------- + + * Fixing copy/move actions on some devices + Version 2.13.2 *(2017-08-28)* ---------------------------- From fe09961c618575d122e715669bc0d2514720d9d1 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 31 Aug 2017 09:35:18 +0200 Subject: [PATCH 021/207] simplify the uri getter at sharing media --- .../com/simplemobiletools/gallery/extensions/activity.kt | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt index ddb92198c..d66248274 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt @@ -48,6 +48,7 @@ fun Activity.shareMedium(medium: Medium) { val shareTitle = resources.getString(R.string.share_via) val file = File(medium.path) val uri = Uri.fromFile(file) + Intent().apply { action = Intent.ACTION_SEND putExtra(Intent.EXTRA_STREAM, uri) @@ -59,14 +60,12 @@ fun Activity.shareMedium(medium: Medium) { fun Activity.shareMedia(media: List) { val shareTitle = resources.getString(R.string.share_via) - val uris = ArrayList(media.size) + val uris = media.map { Uri.fromFile(File(it.path)) } as ArrayList + Intent().apply { action = Intent.ACTION_SEND_MULTIPLE type = "image/* video/*" addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) - media.map { File(it.path) } - .mapTo(uris) { Uri.fromFile(it) } - putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris) startActivity(Intent.createChooser(this, shareTitle)) } From 416f459bc55f61af9378e5f30eee387f10710394 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 31 Aug 2017 12:21:14 +0200 Subject: [PATCH 022/207] improve the checks if the file is a gif --- .../com/simplemobiletools/gallery/extensions/context.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt index b95cabbff..2f4faa5b6 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt @@ -96,7 +96,7 @@ private fun parseCursor(context: Context, cur: Cursor, isPickImage: Boolean, isP val isImage = filename.isImageFast() val isVideo = if (isImage) false else filename.isVideoFast() - val isGif = filename.isGif() + val isGif = if (isImage || isVideo) false else filename.isGif() if (!isImage && !isVideo && !isGif) continue @@ -161,7 +161,7 @@ private fun parseCursor(context: Context, cur: Cursor, isPickImage: Boolean, isP val filename = file.name val isImage = filename.isImageFast() val isVideo = if (isImage) false else filename.isVideoFast() - val isGif = filename.isGif() + val isGif = if (isImage || isVideo) false else filename.isGif() if (!isImage && !isVideo) continue From 6b61883214731b1a05e1be90f9178551060b7aee Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 31 Aug 2017 14:28:15 +0200 Subject: [PATCH 023/207] add the slash after nomedia folders right at fetching --- .../com/simplemobiletools/gallery/extensions/context.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt index 2f4faa5b6..4257bbbf0 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt @@ -127,7 +127,7 @@ private fun parseCursor(context: Context, cur: Cursor, isPickImage: Boolean, isP if (!isExcluded && !showHidden) { noMediaFolders.forEach { - if (path.startsWith("$it/")) { + if (path.startsWith(it)) { isExcluded = true } } @@ -225,7 +225,7 @@ fun Context.getNoMediaFolders(): ArrayList { val path = cursor.getString(cursor.getColumnIndex(MediaStore.Files.FileColumns.DATA)) ?: continue val noMediaFile = File(path) if (noMediaFile.exists()) - folders.add(noMediaFile.parent) + folders.add("${noMediaFile.parent}/") } while (cursor.moveToNext()) } } finally { From c7307ce5235e359b549fc83c9cca76a8ce26f20c Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 31 Aug 2017 14:37:13 +0200 Subject: [PATCH 024/207] add the slash after included/excluded folders at init --- .../gallery/extensions/context.kt | 28 +++++++++---------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt index 4257bbbf0..bf93ade2d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt @@ -59,11 +59,11 @@ fun Context.getFilesFrom(curPath: String, isPickImage: Boolean, isPickVideo: Boo val selection = if (curPath.isEmpty()) null else "(${MediaStore.Images.Media.DATA} LIKE ? AND ${MediaStore.Images.Media.DATA} NOT LIKE ?)" val selectionArgs = if (curPath.isEmpty()) null else arrayOf("$curPath/%", "$curPath/%/%") - try { + return try { val cur = contentResolver.query(uri, projection, selection, selectionArgs, getSortingForFolder(curPath)) - return parseCursor(this, cur, isPickImage, isPickVideo, curPath) + parseCursor(this, cur, isPickImage, isPickVideo, curPath) } catch (e: Exception) { - return ArrayList() + ArrayList() } } @@ -72,8 +72,8 @@ private fun parseCursor(context: Context, cur: Cursor, isPickImage: Boolean, isP val config = context.config val filterMedia = config.filterMedia val showHidden = config.shouldShowHidden - val includedFolders = config.includedFolders - val excludedFolders = config.excludedFolders + val includedFolders = config.includedFolders.map { "$it/" } + val excludedFolders = config.excludedFolders.map { "$it/" } val noMediaFolders = context.getNoMediaFolders() cur.use { @@ -115,10 +115,10 @@ private fun parseCursor(context: Context, cur: Cursor, isPickImage: Boolean, isP var isExcluded = false excludedFolders.forEach { - if (path.startsWith("$it/")) { + if (path.startsWith(it)) { isExcluded = true includedFolders.forEach { - if (path.startsWith("$it/")) { + if (path.startsWith(it)) { isExcluded = false } } @@ -193,14 +193,12 @@ private fun parseCursor(context: Context, cur: Cursor, isPickImage: Boolean, isP fun Context.getSortingForFolder(path: String): String { val sorting = config.getFileSorting(path) - val sortValue = if (sorting and SORT_BY_NAME > 0) - MediaStore.Images.Media.DISPLAY_NAME - else if (sorting and SORT_BY_SIZE > 0) - MediaStore.Images.Media.SIZE - else if (sorting and SORT_BY_DATE_MODIFIED > 0) - MediaStore.Images.Media.DATE_MODIFIED - else - MediaStore.Images.Media.DATE_TAKEN + val sortValue = when { + sorting and SORT_BY_NAME > 0 -> MediaStore.Images.Media.DISPLAY_NAME + sorting and SORT_BY_SIZE > 0 -> MediaStore.Images.Media.SIZE + sorting and SORT_BY_DATE_MODIFIED > 0 -> MediaStore.Images.Media.DATE_MODIFIED + else -> MediaStore.Images.Media.DATE_TAKEN + } return if (sorting and SORT_DESCENDING > 0) "$sortValue DESC" From b455721b17d1a77360e53e14ee093cb0f47d9740 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 31 Aug 2017 16:22:19 +0200 Subject: [PATCH 025/207] some code style updates --- .../gallery/activities/ViewPagerActivity.kt | 30 ++++++++----------- 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt index a18890de9..f7b3161b7 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -150,23 +150,19 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View private fun setupOrientationEventListener() { mOrientationEventListener = object : OrientationEventListener(this, SensorManager.SENSOR_DELAY_NORMAL) { override fun onOrientationChanged(orientation: Int) { - val currOrient = if (orientation in 45..134) { - ORIENT_LANDSCAPE_RIGHT - } else if (orientation in 225..314) { - ORIENT_LANDSCAPE_LEFT - } else { - ORIENT_PORTRAIT + val currOrient = when (orientation) { + in 45..134 -> ORIENT_LANDSCAPE_RIGHT + in 225..314 -> ORIENT_LANDSCAPE_LEFT + else -> ORIENT_PORTRAIT } if (mLastHandledOrientation != currOrient) { mLastHandledOrientation = currOrient - if (currOrient == ORIENT_LANDSCAPE_LEFT) { - requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE - } else if (currOrient == ORIENT_LANDSCAPE_RIGHT) { - requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE - } else { - requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT + requestedOrientation = when (currOrient) { + ORIENT_LANDSCAPE_LEFT -> ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE + ORIENT_LANDSCAPE_RIGHT -> ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE + else -> ActivityInfo.SCREEN_ORIENTATION_PORTRAIT } } } @@ -597,10 +593,10 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View mPrevHashcode = media.hashCode() mMedia = media - if (mPos == -1) { - mPos = getPositionInList(media) + mPos = if (mPos == -1) { + getPositionInList(media) } else { - mPos = Math.min(mPos, mMedia.size - 1) + Math.min(mPos, mMedia.size - 1) } updateActionbarTitle() @@ -611,12 +607,10 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View private fun getPositionInList(items: MutableList): Int { mPos = 0 - var i = 0 - for (medium in items) { + for ((i, medium) in items.withIndex()) { if (medium.path == mPath) { return i } - i++ } return mPos } From c04f8872299f0f82f5b23dce9dd1293bc048c01f Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 1 Sep 2017 10:33:51 +0200 Subject: [PATCH 026/207] temporarily show excluded folders if needed, for example at third party intents --- .../gallery/activities/ViewPagerActivity.kt | 15 ++++++++++++--- .../gallery/extensions/context.kt | 3 ++- .../simplemobiletools/gallery/helpers/Config.kt | 4 ++++ .../gallery/helpers/Constants.kt | 1 + 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt index f7b3161b7..863f323f3 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -98,9 +98,17 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View return } - if (intent.extras?.containsKey(IS_VIEW_INTENT) == true && isShowHiddenFlagNeeded()) { - if (!config.isPasswordProtectionOn) { - config.temporarilyShowHidden = true + if (intent.extras?.containsKey(IS_VIEW_INTENT) == true) { + if (isShowHiddenFlagNeeded()) { + if (!config.isPasswordProtectionOn) { + config.temporarilyShowHidden = true + } + } + + config.excludedFolders.map { "$it/" }.forEach { + if (mPath.startsWith(it)) { + config.temporarilyShowExcluded = true + } } } @@ -145,6 +153,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View if (intent.extras?.containsKey(IS_VIEW_INTENT) == true) { config.temporarilyShowHidden = false } + config.temporarilyShowExcluded = false } private fun setupOrientationEventListener() { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt index bf93ade2d..6e812ccad 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt @@ -72,6 +72,7 @@ private fun parseCursor(context: Context, cur: Cursor, isPickImage: Boolean, isP val config = context.config val filterMedia = config.filterMedia val showHidden = config.shouldShowHidden + val showExcluded = config.temporarilyShowExcluded val includedFolders = config.includedFolders.map { "$it/" } val excludedFolders = config.excludedFolders.map { "$it/" } val noMediaFolders = context.getNoMediaFolders() @@ -137,7 +138,7 @@ private fun parseCursor(context: Context, cur: Cursor, isPickImage: Boolean, isP isExcluded = true } - if (!isExcluded) { + if (!isExcluded || showExcluded) { val dateTaken = cur.getLongValue(MediaStore.Images.Media.DATE_TAKEN) val dateModified = cur.getIntValue(MediaStore.Images.Media.DATE_MODIFIED) * 1000L diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt index 8ce4a8457..677b4a662 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt @@ -54,6 +54,10 @@ class Config(context: Context) : BaseConfig(context) { get() = prefs.getBoolean(TEMPORARILY_SHOW_HIDDEN, false) set(temporarilyShowHidden) = prefs.edit().putBoolean(TEMPORARILY_SHOW_HIDDEN, temporarilyShowHidden).apply() + var temporarilyShowExcluded: Boolean + get() = prefs.getBoolean(TEMPORARILY_SHOW_EXCLUDED, false) + set(temporarilyShowExcluded) = prefs.edit().putBoolean(TEMPORARILY_SHOW_EXCLUDED, temporarilyShowExcluded).apply() + var pinnedFolders: Set get() = prefs.getStringSet(PINNED_FOLDERS, HashSet()) set(pinnedFolders) = prefs.edit().putStringSet(PINNED_FOLDERS, pinnedFolders).apply() 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 72ab0bc18..970629d2b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt @@ -6,6 +6,7 @@ val DIRECTORY_SORT_ORDER = "directory_sort_order" val SORT_FOLDER_PREFIX = "sort_folder_" val SHOW_HIDDEN_MEDIA = "show_hidden_media" val TEMPORARILY_SHOW_HIDDEN = "temporarily_show_hidden" +val TEMPORARILY_SHOW_EXCLUDED = "temporarily_show_excluded" val AUTOPLAY_VIDEOS = "autoplay_videos" val LOOP_VIDEOS = "loop_videos" val ANIMATE_GIFS = "animate_gifs" From bc281dd1024992b59b4a981f4b79190fe224a62b Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 1 Sep 2017 11:14:00 +0200 Subject: [PATCH 027/207] properly show third party image, even if its not in mediastore --- .../gallery/activities/MainActivity.kt | 1 + .../gallery/activities/ViewPagerActivity.kt | 12 +-- .../gallery/extensions/context.kt | 76 ++++++++++--------- .../gallery/helpers/Config.kt | 6 +- .../gallery/helpers/Constants.kt | 2 +- 5 files changed, 53 insertions(+), 44 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 bd43493af..f101a7adc 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -116,6 +116,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { override fun onResume() { super.onResume() + config.isThirdPartyIntent = false if (mStoredAnimateGifs != config.animateGifs) { directories_grid.adapter?.notifyDataSetChanged() } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt index 863f323f3..8b9133240 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -105,11 +105,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View } } - config.excludedFolders.map { "$it/" }.forEach { - if (mPath.startsWith(it)) { - config.temporarilyShowExcluded = true - } - } + config.isThirdPartyIntent = true } showSystemUI() @@ -153,7 +149,11 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View if (intent.extras?.containsKey(IS_VIEW_INTENT) == true) { config.temporarilyShowHidden = false } - config.temporarilyShowExcluded = false + + if (config.isThirdPartyIntent) { + mMedia.clear() + config.isThirdPartyIntent = false + } } private fun setupOrientationEventListener() { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt index 6e812ccad..e9087e1aa 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt @@ -16,7 +16,6 @@ import com.simplemobiletools.gallery.activities.SettingsActivity import com.simplemobiletools.gallery.helpers.* import com.simplemobiletools.gallery.models.Medium import java.io.File -import java.util.* val Context.portrait get() = resources.configuration.orientation == Configuration.ORIENTATION_PORTRAIT val Context.audioManager get() = getSystemService(Context.AUDIO_SERVICE) as AudioManager @@ -72,10 +71,10 @@ private fun parseCursor(context: Context, cur: Cursor, isPickImage: Boolean, isP val config = context.config val filterMedia = config.filterMedia val showHidden = config.shouldShowHidden - val showExcluded = config.temporarilyShowExcluded val includedFolders = config.includedFolders.map { "$it/" } val excludedFolders = config.excludedFolders.map { "$it/" } val noMediaFolders = context.getNoMediaFolders() + val isThirdPartyIntent = config.isThirdPartyIntent cur.use { if (cur.moveToFirst()) { @@ -138,7 +137,7 @@ private fun parseCursor(context: Context, cur: Cursor, isPickImage: Boolean, isP isExcluded = true } - if (!isExcluded || showExcluded) { + if (!isExcluded || isThirdPartyIntent) { val dateTaken = cur.getLongValue(MediaStore.Images.Media.DATE_TAKEN) val dateModified = cur.getIntValue(MediaStore.Images.Media.DATE_MODIFIED) * 1000L @@ -152,38 +151,12 @@ private fun parseCursor(context: Context, cur: Cursor, isPickImage: Boolean, isP } } - config.includedFolders.filter { it.isNotEmpty() && (curPath.isEmpty() || it == curPath) }.mapNotNull { File(it).listFiles() }.forEach { - for (file in it) { - val size = file.length() - if (size <= 0L) { - continue - } + config.includedFolders.filter { it.isNotEmpty() && (curPath.isEmpty() || it == curPath) }.forEach { + getMediaInFolder(it, curMedia, isPickImage, isPickVideo, filterMedia) + } - val filename = file.name - val isImage = filename.isImageFast() - val isVideo = if (isImage) false else filename.isVideoFast() - val isGif = if (isImage || isVideo) false else filename.isGif() - - if (!isImage && !isVideo) - continue - - if (isVideo && (isPickImage || filterMedia and VIDEOS == 0)) - continue - - if (isImage && (isPickVideo || filterMedia and IMAGES == 0)) - continue - - if (isGif && filterMedia and GIFS == 0) - continue - - val dateTaken = file.lastModified() - val dateModified = file.lastModified() - - val medium = Medium(filename, file.absolutePath, isVideo, dateModified, dateTaken, size) - val isAlreadyAdded = curMedia.any { it.path == file.absolutePath } - if (!isAlreadyAdded) - curMedia.add(medium) - } + if (isThirdPartyIntent && curPath.isNotEmpty() && curMedia.isEmpty()) { + getMediaInFolder(curPath, curMedia, isPickImage, isPickVideo, filterMedia) } Medium.sorting = config.getFileSorting(curPath) @@ -192,6 +165,41 @@ private fun parseCursor(context: Context, cur: Cursor, isPickImage: Boolean, isP return curMedia } +private fun getMediaInFolder(folder: String, curMedia: ArrayList, isPickImage: Boolean, isPickVideo: Boolean, filterMedia: Int) { + val files = File(folder).listFiles() ?: return + for (file in files) { + val size = file.length() + if (size <= 0L) { + continue + } + + val filename = file.name + val isImage = filename.isImageFast() + val isVideo = if (isImage) false else filename.isVideoFast() + val isGif = if (isImage || isVideo) false else filename.isGif() + + if (!isImage && !isVideo) + continue + + if (isVideo && (isPickImage || filterMedia and VIDEOS == 0)) + continue + + if (isImage && (isPickVideo || filterMedia and IMAGES == 0)) + continue + + if (isGif && filterMedia and GIFS == 0) + continue + + val dateTaken = file.lastModified() + val dateModified = file.lastModified() + + val medium = Medium(filename, file.absolutePath, isVideo, dateModified, dateTaken, size) + val isAlreadyAdded = curMedia.any { it.path == file.absolutePath } + if (!isAlreadyAdded) + curMedia.add(medium) + } +} + fun Context.getSortingForFolder(path: String): String { val sorting = config.getFileSorting(path) val sortValue = when { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt index 677b4a662..709086913 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt @@ -54,9 +54,9 @@ class Config(context: Context) : BaseConfig(context) { get() = prefs.getBoolean(TEMPORARILY_SHOW_HIDDEN, false) set(temporarilyShowHidden) = prefs.edit().putBoolean(TEMPORARILY_SHOW_HIDDEN, temporarilyShowHidden).apply() - var temporarilyShowExcluded: Boolean - get() = prefs.getBoolean(TEMPORARILY_SHOW_EXCLUDED, false) - set(temporarilyShowExcluded) = prefs.edit().putBoolean(TEMPORARILY_SHOW_EXCLUDED, temporarilyShowExcluded).apply() + var isThirdPartyIntent: Boolean + get() = prefs.getBoolean(IS_THIRD_PARTY_INTENT, false) + set(isThirdPartyIntent) = prefs.edit().putBoolean(IS_THIRD_PARTY_INTENT, isThirdPartyIntent).apply() var pinnedFolders: Set get() = prefs.getStringSet(PINNED_FOLDERS, HashSet()) 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 970629d2b..475c915d0 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt @@ -6,7 +6,7 @@ val DIRECTORY_SORT_ORDER = "directory_sort_order" val SORT_FOLDER_PREFIX = "sort_folder_" val SHOW_HIDDEN_MEDIA = "show_hidden_media" val TEMPORARILY_SHOW_HIDDEN = "temporarily_show_hidden" -val TEMPORARILY_SHOW_EXCLUDED = "temporarily_show_excluded" +val IS_THIRD_PARTY_INTENT = "is_third_party_intent" val AUTOPLAY_VIDEOS = "autoplay_videos" val LOOP_VIDEOS = "loop_videos" val ANIMATE_GIFS = "animate_gifs" From 9fe361ea6297ebb8afc04f8c53ec54f603cbf7ff Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 1 Sep 2017 11:37:56 +0200 Subject: [PATCH 028/207] fix #341, add a switch for not deleting empty folders --- .../gallery/activities/MediaActivity.kt | 3 ++- .../gallery/activities/SettingsActivity.kt | 11 +++++++++- .../gallery/activities/ViewPagerActivity.kt | 2 +- .../gallery/helpers/Config.kt | 4 ++++ .../gallery/helpers/Constants.kt | 1 + app/src/main/res/layout/activity_settings.xml | 20 +++++++++++++++++++ app/src/main/res/values-ca/strings.xml | 1 + app/src/main/res/values-cs/strings.xml | 1 + app/src/main/res/values-de/strings.xml | 1 + app/src/main/res/values-es/strings.xml | 1 + app/src/main/res/values-fr/strings.xml | 11 +++++++++- app/src/main/res/values-hu/strings.xml | 1 + app/src/main/res/values-it/strings.xml | 1 + app/src/main/res/values-ja/strings.xml | 1 + app/src/main/res/values-pl/strings.xml | 1 + app/src/main/res/values-pt-rBR/strings.xml | 1 + app/src/main/res/values-pt/strings.xml | 1 + app/src/main/res/values-ru/strings.xml | 1 + app/src/main/res/values-sk/strings.xml | 1 + app/src/main/res/values-sv/strings.xml | 1 + app/src/main/res/values-tr/strings.xml | 1 + app/src/main/res/values-zh-rCN/strings.xml | 1 + app/src/main/res/values-zh-rTW/strings.xml | 1 + app/src/main/res/values/strings.xml | 1 + 24 files changed, 65 insertions(+), 4 deletions(-) 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 e78513982..a2787f895 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -298,7 +298,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { private fun deleteDirectoryIfEmpty() { val file = File(mPath) - if (!file.isDownloadsFolder() && file.isDirectory && file.listFiles()?.isEmpty() == true) { + if (config.deleteEmptyFolders && !file.isDownloadsFolder() && file.isDirectory && file.listFiles()?.isEmpty() == true) { file.delete() } } @@ -497,6 +497,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { if (!it) { toast(R.string.unknown_error_occurred) } else if (mMedia.isEmpty()) { + deleteDirectoryIfEmpty() finish() } } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt index 0e8368634..040222a7b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt @@ -41,9 +41,10 @@ class SettingsActivity : SimpleActivity() { setupDarkBackground() setupScrollHorizontally() setupScreenRotation() + setupHideSystemUI() setupReplaceShare() setupPasswordProtection() - setupHideSystemUI() + setupDeleteEmptyFolders() updateTextColors(settings_holder) } @@ -173,6 +174,14 @@ class SettingsActivity : SimpleActivity() { } } + private fun setupDeleteEmptyFolders() { + settings_delete_empty_folders.isChecked = config.deleteEmptyFolders + settings_delete_empty_folders_holder.setOnClickListener { + settings_delete_empty_folders.toggle() + config.deleteEmptyFolders = settings_delete_empty_folders.isChecked + } + } + private fun setupScreenRotation() { settings_screen_rotation.text = getScreenRotationText() settings_screen_rotation_holder.setOnClickListener { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt index 8b9133240..a7c435468 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -626,7 +626,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View private fun deleteDirectoryIfEmpty() { val file = File(mDirectory) - if (!file.isDownloadsFolder() && file.isDirectory && file.listFiles()?.isEmpty() == true) { + if (config.deleteEmptyFolders && !file.isDownloadsFolder() && file.isDirectory && file.listFiles()?.isEmpty() == true) { file.delete() } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt index 709086913..58671c861 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt @@ -237,6 +237,10 @@ class Config(context: Context) : BaseConfig(context) { get() = prefs.getBoolean(REPLACE_SHARE_WITH_ROTATE, false) set(replaceShare) = prefs.edit().putBoolean(REPLACE_SHARE_WITH_ROTATE, replaceShare).apply() + var deleteEmptyFolders: Boolean + get() = prefs.getBoolean(DELETE_EMPTY_FOLDERS, true) + set(deleteEmptyFolders) = prefs.edit().putBoolean(DELETE_EMPTY_FOLDERS, deleteEmptyFolders).apply() + var slideshowInterval: Int get() = prefs.getInt(SLIDESHOW_INTERVAL, SLIDESHOW_DEFAULT_INTERVAL) set(slideshowInterval) = prefs.edit().putInt(SLIDESHOW_INTERVAL, slideshowInterval).apply() 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 475c915d0..e402e7b53 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt @@ -34,6 +34,7 @@ val ALBUM_COVERS = "album_covers" val SCROLL_HORIZONTALLY = "scroll_horizontally" val HIDE_SYSTEM_UI = "hide_system_ui" val REPLACE_SHARE_WITH_ROTATE = "replace_share_with_rotate" +val DELETE_EMPTY_FOLDERS = "delete_empty_folders" // slideshow val SLIDESHOW_INTERVAL = "slideshow_interval" diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index db2c3fb3b..3eb8673df 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -288,6 +288,26 @@ + + + + + + Dark background at fullscreen media Scroll thumbnails horizontally Automatically hide system UI at fullscreen media + Delete empty folders after deleting their content Replace Share with Rotate at fullscreen menu diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index 59096e4dd..4bc4b8b14 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -115,6 +115,7 @@ Dark background at fullscreen media Scroll thumbnails horizontally Automatically hide system UI at fullscreen media + Delete empty folders after deleting their content Replace Share with Rotate at fullscreen menu diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index b2283cc77..33d812529 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -115,6 +115,7 @@ Schwarzer Hintergrund im Vollbild Kacheln horizontal scrollen Systemleisten ausblenden im Vollbild + Delete empty folders after deleting their content Teilen/Drehen im Vollbild-Menü vertauschen diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index ff7f16ab3..d22244878 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -115,6 +115,7 @@ Utilizar siempre fondo oscuro en pantalla completa Desplazar miniaturas horizontalmente Ocultar automáticamente la interfaz de usuario del sistema en medios de pantalla completa + Delete empty folders after deleting their content Reemplazar Compartir con Girar en el menú de pantalla completa diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index e6a9920c5..6c5b2f717 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -115,12 +115,21 @@ Dark background at fullscreen media Défilement des mignatures horizontalement Automatically hide system UI at fullscreen media + Delete empty folders after deleting their content Replace Share with Rotate at fullscreen menu Un album pour visionner photos et vidéos sans publicité. - Un simple outil pour visionner les photos et les vidéos. Elles peuvent être triées par dates, tailles, noms dans les deux sens (alphabétique comme désalphabétique), il est possible de zoomer sur les photos. Les fichiers sont affichés sur de multiple colonnes en fonction de la taille de l\'écran, vous pouvez changer le nombre de colonnes par pincement. Elles peuvent être renommées, partagées, supprimées, copiées et déplacées. Les images peuvent en plus être tournées, rognées ou être définies comme fond d\'écran directement depuis l\'application. La galerie est aussi offerte pour l\'utiliser comme une tierce partie pour de la prévisualisation des images/vidéos, joindre aux clients mail etc. C\'est parfait pour un usage au quotidien. L\'application ne contient ni de publicité ni d\'autorisation inutile. Elle est totalement OpenSource et est aussi fournie avec un thème sombre. Cette application est juste l\'une des applications d\'une plus grande suite. Vous pouvez trouver les autres sur http://www.simplemobiletools.com + + Un simple outil pour visionner les photos et les vidéos. Elles peuvent être triées par dates, tailles, noms dans les deux sens (alphabétique comme désalphabétique), il est possible de zoomer sur les photos. Les fichiers sont affichés sur de multiple colonnes en fonction de la taille de l\'écran, vous pouvez changer le nombre de colonnes par pincement. Elles peuvent être renommées, partagées, supprimées, copiées et déplacées. Les images peuvent en plus être tournées, rognées ou être définies comme fond d\'écran directement depuis l\'application. La galerie est aussi offerte pour l\'utiliser comme une tierce partie pour de la prévisualisation des images/vidéos, joindre aux clients mail etc. C\'est parfait pour un usage au quotidien. + + L\'application ne contient ni de publicité ni d\'autorisation inutile. Elle est totalement OpenSource et est aussi fournie avec un thème sombre. + + Cette application est juste l\'une des applications d\'une plus grande suite. + + Vous pouvez trouver les autres sur http://www.simplemobiletools.com + diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index dca88c2e0..504074c43 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -115,6 +115,7 @@ Sfondo scuro a schermo intero Scorri miniature orizzontalmente Nascondi UI di sistema con media a schermo intero + Delete empty folders after deleting their content Sostituisci Condividi con Ruota a schermo intero diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 673e9ac42..edcde8db9 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -115,6 +115,7 @@ Dark background at fullscreen media Scroll thumbnails horizontally Automatically hide system UI at fullscreen media + Delete empty folders after deleting their content Replace Share with Rotate at fullscreen menu diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index 61bf33160..2f8cd067d 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -115,6 +115,7 @@ Czarne tło przy podglądzie pełnoekranowym Przewijaj miniatury poziomo Ukrywaj interfejs przy pełnoekranowym podglądzie + Delete empty folders after deleting their content Zamień funkcję udostępniania na obracanie w menu pełnoekranowym diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 11a1c03d6..88d4621e9 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -115,6 +115,7 @@ Fundo de tela escuro em mídia tela cheia Rolar miniaturas horizontalmente Automatically hide system UI at fullscreen media + Delete empty folders after deleting their content Replace Share with Rotate at fullscreen menu diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index 2acddd5b7..4e94ab418 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -115,6 +115,7 @@ Usar sempre um fundo escuro se em ecrã completo Deslocação horizontal de miniaturas Ocultar interface do sistema se em ecrã completo + Delete empty folders after deleting their content Substituir a opção Partilhar pela opção Rodar se em ecrã completo diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 34aef359a..04444d31f 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -115,6 +115,7 @@ Dark background at fullscreen media Scroll thumbnails horizontally Automatically hide system UI at fullscreen media + Delete empty folders after deleting their content Replace Share with Rotate at fullscreen menu diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index deb90488c..7722991ea 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -115,6 +115,7 @@ Tmavé pozadie pri médiách na celú obrazovku Prehliadať miniatúry vodorovne Automaticky skrývať systémové lišty pri celoobrazovkových médiách + Odstrániť prázdne priečinky po vymazaní ich obsahu Nahradiť Zdieľanie s Otočením v celoobrazovkovom menu diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index c99a203bd..95533a57e 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -115,6 +115,7 @@ Mörk bakgrund när media visas i helskärmsläge Rulla horisontellt genom miniatyrer Dölj systemanvändargränssnittet automatiskt när media visas i helskärmsläge + Delete empty folders after deleting their content Replace Share with Rotate at fullscreen menu diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index 7403747d2..30bf6bd81 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -115,6 +115,7 @@ Dark background at fullscreen media Scroll thumbnails horizontally Automatically hide system UI at fullscreen media + Delete empty folders after deleting their content Replace Share with Rotate at fullscreen menu diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 78fed273a..2d544fb09 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -115,6 +115,7 @@ 全屏时黑色背景 水平滚动缩略图 全屏时自动隐藏状态栏 + Delete empty folders after deleting their content 替换全屏时菜单栏的“分享”为“旋转” diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index ca9c2b7ee..98c5e913e 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -115,6 +115,7 @@ 全螢幕時黑背景 橫向滑動縮圖 全螢幕時自動隱藏系統介面 + Delete empty folders after deleting their content 將全螢幕選單的分享取代為旋轉 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 731313068..ba76c736d 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -115,6 +115,7 @@ Dark background at fullscreen media Scroll thumbnails horizontally Automatically hide system UI at fullscreen media + Delete empty folders after deleting their content Replace Share with Rotate at fullscreen menu From 01495680cba3b4528689ee70d5d1b9b658c69516 Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 1 Sep 2017 11:51:11 +0200 Subject: [PATCH 029/207] fix #333, add a switch for disabling video gestures --- .../gallery/activities/SettingsActivity.kt | 9 +++++++++ .../gallery/fragments/VideoFragment.kt | 3 +++ .../gallery/helpers/Config.kt | 4 ++++ .../gallery/helpers/Constants.kt | 1 + app/src/main/res/layout/activity_settings.xml | 20 +++++++++++++++++++ app/src/main/res/values-ca/strings.xml | 1 + app/src/main/res/values-cs/strings.xml | 1 + app/src/main/res/values-de/strings.xml | 1 + app/src/main/res/values-es/strings.xml | 1 + app/src/main/res/values-fr/strings.xml | 1 + app/src/main/res/values-hu/strings.xml | 1 + app/src/main/res/values-it/strings.xml | 1 + app/src/main/res/values-ja/strings.xml | 1 + app/src/main/res/values-pl/strings.xml | 1 + app/src/main/res/values-pt-rBR/strings.xml | 1 + app/src/main/res/values-pt/strings.xml | 1 + app/src/main/res/values-ru/strings.xml | 1 + app/src/main/res/values-sk/strings.xml | 1 + app/src/main/res/values-sv/strings.xml | 1 + app/src/main/res/values-tr/strings.xml | 1 + app/src/main/res/values-zh-rCN/strings.xml | 1 + app/src/main/res/values-zh-rTW/strings.xml | 1 + app/src/main/res/values/strings.xml | 1 + 23 files changed, 55 insertions(+) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt index 040222a7b..92329d023 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt @@ -45,6 +45,7 @@ class SettingsActivity : SimpleActivity() { setupReplaceShare() setupPasswordProtection() setupDeleteEmptyFolders() + setupAllowVideoGestures() updateTextColors(settings_holder) } @@ -182,6 +183,14 @@ class SettingsActivity : SimpleActivity() { } } + private fun setupAllowVideoGestures() { + settings_allow_video_gestures.isChecked = config.allowVideoGestures + settings_allow_video_gestures_holder.setOnClickListener { + settings_allow_video_gestures.toggle() + config.allowVideoGestures = settings_allow_video_gestures.isChecked + } + } + private fun setupScreenRotation() { settings_screen_rotation.text = getScreenRotationText() settings_screen_rotation_holder.setOnClickListener { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt index f93bc617e..47c8f93b6 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt @@ -14,6 +14,7 @@ import android.view.* import android.view.animation.AnimationUtils import android.widget.SeekBar import android.widget.TextView +import com.simplemobiletools.commons.extensions.beVisibleIf import com.simplemobiletools.commons.extensions.getFormattedDuration import com.simplemobiletools.commons.extensions.toast import com.simplemobiletools.commons.extensions.updateTextColors @@ -85,6 +86,8 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee override fun onResume() { super.onResume() activity.updateTextColors(mView.video_holder) + mView.video_volume_controller.beVisibleIf(context.config.allowVideoGestures) + mView.video_brightness_controller.beVisibleIf(context.config.allowVideoGestures) } private fun setupPlayer() { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt index 58671c861..f8b61b8f8 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt @@ -241,6 +241,10 @@ class Config(context: Context) : BaseConfig(context) { get() = prefs.getBoolean(DELETE_EMPTY_FOLDERS, true) set(deleteEmptyFolders) = prefs.edit().putBoolean(DELETE_EMPTY_FOLDERS, deleteEmptyFolders).apply() + var allowVideoGestures: Boolean + get() = prefs.getBoolean(ALLOW_VIDEO_GESTURES, true) + set(allowVideoGestures) = prefs.edit().putBoolean(ALLOW_VIDEO_GESTURES, allowVideoGestures).apply() + var slideshowInterval: Int get() = prefs.getInt(SLIDESHOW_INTERVAL, SLIDESHOW_DEFAULT_INTERVAL) set(slideshowInterval) = prefs.edit().putInt(SLIDESHOW_INTERVAL, slideshowInterval).apply() 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 e402e7b53..b6a5fbc45 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt @@ -35,6 +35,7 @@ val SCROLL_HORIZONTALLY = "scroll_horizontally" val HIDE_SYSTEM_UI = "hide_system_ui" val REPLACE_SHARE_WITH_ROTATE = "replace_share_with_rotate" val DELETE_EMPTY_FOLDERS = "delete_empty_folders" +val ALLOW_VIDEO_GESTURES = "allow_video_gestures" // slideshow val SLIDESHOW_INTERVAL = "slideshow_interval" diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index 3eb8673df..ab5bd8f0e 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -308,6 +308,26 @@ + + + + + + Scroll thumbnails horizontally Automatically hide system UI at fullscreen media Delete empty folders after deleting their content + Allow controlling video volume and brightness with vertical gestures Replace Share with Rotate at fullscreen menu diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index 4bc4b8b14..064f7380e 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -116,6 +116,7 @@ Scroll thumbnails horizontally Automatically hide system UI at fullscreen media Delete empty folders after deleting their content + Allow controlling video volume and brightness with vertical gestures Replace Share with Rotate at fullscreen menu diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 33d812529..8ceb1f74e 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -116,6 +116,7 @@ Kacheln horizontal scrollen Systemleisten ausblenden im Vollbild Delete empty folders after deleting their content + Allow controlling video volume and brightness with vertical gestures Teilen/Drehen im Vollbild-Menü vertauschen diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index d22244878..779ea07d3 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -116,6 +116,7 @@ Desplazar miniaturas horizontalmente Ocultar automáticamente la interfaz de usuario del sistema en medios de pantalla completa Delete empty folders after deleting their content + Allow controlling video volume and brightness with vertical gestures Reemplazar Compartir con Girar en el menú de pantalla completa diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 6c5b2f717..f41202660 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -116,6 +116,7 @@ Défilement des mignatures horizontalement Automatically hide system UI at fullscreen media Delete empty folders after deleting their content + Allow controlling video volume and brightness with vertical gestures Replace Share with Rotate at fullscreen menu diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index c24b42b35..f8bbce01f 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -116,6 +116,7 @@ Scroll thumbnails horizontally Automatically hide system UI at fullscreen media Delete empty folders after deleting their content + Allow controlling video volume and brightness with vertical gestures Replace Share with Rotate at fullscreen menu diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 504074c43..1af0bd606 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -116,6 +116,7 @@ Scorri miniature orizzontalmente Nascondi UI di sistema con media a schermo intero Delete empty folders after deleting their content + Allow controlling video volume and brightness with vertical gestures Sostituisci Condividi con Ruota a schermo intero diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index edcde8db9..5bb6e82f2 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -116,6 +116,7 @@ Scroll thumbnails horizontally Automatically hide system UI at fullscreen media Delete empty folders after deleting their content + Allow controlling video volume and brightness with vertical gestures Replace Share with Rotate at fullscreen menu diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index 2f8cd067d..ec77abdff 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -116,6 +116,7 @@ Przewijaj miniatury poziomo Ukrywaj interfejs przy pełnoekranowym podglądzie Delete empty folders after deleting their content + Allow controlling video volume and brightness with vertical gestures Zamień funkcję udostępniania na obracanie w menu pełnoekranowym diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 88d4621e9..17816a8f7 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -116,6 +116,7 @@ Rolar miniaturas horizontalmente Automatically hide system UI at fullscreen media Delete empty folders after deleting their content + Allow controlling video volume and brightness with vertical gestures Replace Share with Rotate at fullscreen menu diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index 4e94ab418..41ff89b4c 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -116,6 +116,7 @@ Deslocação horizontal de miniaturas Ocultar interface do sistema se em ecrã completo Delete empty folders after deleting their content + Allow controlling video volume and brightness with vertical gestures Substituir a opção Partilhar pela opção Rodar se em ecrã completo diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 04444d31f..26d1ef055 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -116,6 +116,7 @@ Scroll thumbnails horizontally Automatically hide system UI at fullscreen media Delete empty folders after deleting their content + Allow controlling video volume and brightness with vertical gestures Replace Share with Rotate at fullscreen menu diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index 7722991ea..2cf132f11 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -116,6 +116,7 @@ Prehliadať miniatúry vodorovne Automaticky skrývať systémové lišty pri celoobrazovkových médiách Odstrániť prázdne priečinky po vymazaní ich obsahu + Povoliť ovládanie hlasitosti a jasu videí vertikálnymi ťahmi Nahradiť Zdieľanie s Otočením v celoobrazovkovom menu diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index 95533a57e..043f1f72e 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -116,6 +116,7 @@ Rulla horisontellt genom miniatyrer Dölj systemanvändargränssnittet automatiskt när media visas i helskärmsläge Delete empty folders after deleting their content + Allow controlling video volume and brightness with vertical gestures Replace Share with Rotate at fullscreen menu diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index 30bf6bd81..aade22087 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -116,6 +116,7 @@ Scroll thumbnails horizontally Automatically hide system UI at fullscreen media Delete empty folders after deleting their content + Allow controlling video volume and brightness with vertical gestures Replace Share with Rotate at fullscreen menu diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 2d544fb09..c8a8b6900 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -116,6 +116,7 @@ 水平滚动缩略图 全屏时自动隐藏状态栏 Delete empty folders after deleting their content + Allow controlling video volume and brightness with vertical gestures 替换全屏时菜单栏的“分享”为“旋转” diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 98c5e913e..9bf27b92e 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -116,6 +116,7 @@ 橫向滑動縮圖 全螢幕時自動隱藏系統介面 Delete empty folders after deleting their content + Allow controlling video volume and brightness with vertical gestures 將全螢幕選單的分享取代為旋轉 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index ba76c736d..6acb28aed 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -116,6 +116,7 @@ Scroll thumbnails horizontally Automatically hide system UI at fullscreen media Delete empty folders after deleting their content + Allow controlling video volume and brightness with vertical gestures Replace Share with Rotate at fullscreen menu From 2a76929312b7240aa80bc7b4a87bced98172263b Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 1 Sep 2017 12:21:31 +0200 Subject: [PATCH 030/207] properly delete empty folders from SD card too --- .../com/simplemobiletools/gallery/activities/MediaActivity.kt | 2 +- .../simplemobiletools/gallery/activities/ViewPagerActivity.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 a2787f895..e5d2d7fc7 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -299,7 +299,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { private fun deleteDirectoryIfEmpty() { val file = File(mPath) if (config.deleteEmptyFolders && !file.isDownloadsFolder() && file.isDirectory && file.listFiles()?.isEmpty() == true) { - file.delete() + deleteFile(file, true) {} } } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt index a7c435468..648f28abd 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -627,7 +627,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View private fun deleteDirectoryIfEmpty() { val file = File(mDirectory) if (config.deleteEmptyFolders && !file.isDownloadsFolder() && file.isDirectory && file.listFiles()?.isEmpty() == true) { - file.delete() + deleteFile(file, true) {} } scanPath(mDirectory) {} From bfad77b597e16431c014636fa609f207827bcb25 Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 1 Sep 2017 15:17:11 +0200 Subject: [PATCH 031/207] minor code style updates --- .../gallery/fragments/PhotoFragment.kt | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt index 3d634a516..dd0ccb737 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt @@ -123,13 +123,11 @@ class PhotoFragment : ViewPagerFragment() { } } - private fun degreesForRotation(orientation: Int): Int { - return when (orientation) { - 8 -> 270 - 3 -> 180 - 6 -> 90 - else -> 0 - } + private fun degreesForRotation(orientation: Int) = when (orientation) { + 8 -> 270 + 3 -> 180 + 6 -> 90 + else -> 0 } private fun rotateViaMatrix(original: Bitmap, orientation: Int): Bitmap { @@ -176,9 +174,7 @@ class PhotoFragment : ViewPagerFragment() { .load(medium.path) .apply(options) .listener(object : RequestListener { - override fun onLoadFailed(e: GlideException?, model: Any?, target: Target?, isFirstResource: Boolean): Boolean { - return false - } + override fun onLoadFailed(e: GlideException?, model: Any?, target: Target?, isFirstResource: Boolean) = false override fun onResourceReady(resource: Bitmap?, model: Any?, target: Target?, dataSource: DataSource?, isFirstResource: Boolean): Boolean { if (isFragmentVisible) From 9656fc92f5b5389fb485f8cfc9bfc2ff4fa89280 Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 1 Sep 2017 15:26:18 +0200 Subject: [PATCH 032/207] updating the release notes --- .../simplemobiletools/gallery/activities/MainActivity.kt | 1 + app/src/main/res/values/donottranslate.xml | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) 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 f101a7adc..d148a13d1 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -514,6 +514,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { add(Release(122, R.string.release_122)) add(Release(123, R.string.release_123)) add(Release(125, R.string.release_125)) + add(Release(127, R.string.release_127)) checkWhatsNew(this, BuildConfig.VERSION_CODE) } } diff --git a/app/src/main/res/values/donottranslate.xml b/app/src/main/res/values/donottranslate.xml index b1c57f56d..b880748b9 100644 --- a/app/src/main/res/values/donottranslate.xml +++ b/app/src/main/res/values/donottranslate.xml @@ -2,13 +2,17 @@ + + Added a switch for disabling video gestures\n + Added a switch for deleting empty folders after deleting content + Moved media type filter from Settings to the Action menu Allow changing the screen brightness and volume at videos by vertically dragging the screen sides Added slideshow at the fullscreen view Added pattern/pin protection for showing hidden items Added a toggle for replacing Share with Rotate at fullscreen media - Added an indicator of folders located on SD cards + Added an indicator of folders located on SD cards\n Improved the way of rotating jpg images on the internal storage by modifying the exif tags + added autosave Added an option for automatically hiding the system UI at entering fullscreen mode From 3556a44fdd6189d37b09b204599a9b92d62b61b3 Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 1 Sep 2017 15:26:32 +0200 Subject: [PATCH 033/207] update version to 2.13.4 (127) --- app/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index ebdb3ae39..54035fb66 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,8 +10,8 @@ android { applicationId "com.simplemobiletools.gallery" minSdkVersion 16 targetSdkVersion 23 - versionCode 126 - versionName "2.13.3" + versionCode 127 + versionName "2.13.4" } signingConfigs { From 582893c66bb8b2f9afe90ca2d27225ef170707c0 Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 1 Sep 2017 15:26:38 +0200 Subject: [PATCH 034/207] updating changelog --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c1e33f465..a2e38f3e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,14 @@ Changelog ========== +Version 2.13.4 *(2017-09-01)* +---------------------------- + + * Improved the image loading performance + * Added a switch for disabling video gestures + * Added a switch for deleting empty folders after deleting content + * Show excluded folder content at third party intent if needed + Version 2.13.3 *(2017-08-29)* ---------------------------- From f6c8dbd44401b14f332236d65bcb528c142d0d41 Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 1 Sep 2017 21:28:36 +0200 Subject: [PATCH 035/207] creating GlideDecoder, to be used with subsamplingscaleimageview --- .../gallery/helpers/GlideDecoder.kt | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 app/src/main/kotlin/com/simplemobiletools/gallery/helpers/GlideDecoder.kt diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/GlideDecoder.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/GlideDecoder.kt new file mode 100644 index 000000000..5c5cbacbd --- /dev/null +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/GlideDecoder.kt @@ -0,0 +1,49 @@ +package com.simplemobiletools.gallery.helpers + +import android.content.Context +import android.graphics.Bitmap +import android.graphics.Canvas +import android.graphics.drawable.BitmapDrawable +import android.graphics.drawable.Drawable +import android.net.Uri +import com.bumptech.glide.Glide +import com.bumptech.glide.load.DecodeFormat +import com.bumptech.glide.load.engine.DiskCacheStrategy +import com.bumptech.glide.request.RequestOptions +import com.davemorrissey.labs.subscaleview.decoder.ImageDecoder + + +class GlideDecoder : ImageDecoder { + override fun decode(context: Context, uri: Uri): Bitmap { + val options = RequestOptions() + .format(DecodeFormat.PREFER_ARGB_8888) + .diskCacheStrategy(DiskCacheStrategy.NONE) + + val drawable = Glide.with(context) + .load(uri) + .apply(options) + .submit() + .get() + + return drawableToBitmap(drawable) + } + + private fun drawableToBitmap(drawable: Drawable): Bitmap { + if (drawable is BitmapDrawable) { + if (drawable.bitmap != null) { + return drawable.bitmap + } + } + + val bitmap = if (drawable.intrinsicWidth <= 0 || drawable.intrinsicHeight <= 0) { + Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888) + } else { + Bitmap.createBitmap(drawable.intrinsicWidth, drawable.intrinsicHeight, Bitmap.Config.ARGB_8888) + } + + val canvas = Canvas(bitmap) + drawable.setBounds(0, 0, canvas.width, canvas.height) + drawable.draw(canvas) + return bitmap + } +} From 087031ee1c0905913c8f235ab59002a166711721 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Marques?= Date: Fri, 1 Sep 2017 22:57:55 +0100 Subject: [PATCH 036/207] Update strings.xml --- app/src/main/res/values-pt/strings.xml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index 41ff89b4c..f7353a6ec 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -27,21 +27,21 @@ Brilho - Filter media - Images - Videos + Filtrar multimédia + Imagenss + Vídeos GIFs - No media files have been found with the selected filters. - Change filters + Naõ foram encontrados ficheiros que cumpram os requisitos. + Alterar filtros Esta opção oculta uma pasta com a adição de um ficheiro \'.nomedia\' na pasta, e irá ocultar todas as subpastas existentes. Pode ver as pastas com a opção \'Mostrar pastas ocultas\'. Continuar? Exclusão Pastas excluídas Gerir pastas excluídas - Esta ação apenas exclui as pastas selecionadas da lista de pastas desta aplicação. Pode gerir as pastas excuídas nas Definições. + Esta ação apenas exclui as pastas selecionadas da lista de pastas desta aplicação. Pode gerir as pastas excluídas nas Definições. Excluir antes a pasta superior? - A exlusão de uma pasta apenas oculta o seu conteúdo do Simple Gallery uma vez que as outras aplicações continuarão a poder aceder-lhes.\\n\\nSe quiser ocultar também das outras aplicações, utilize a função Ocultar. + A exclusão de uma pasta apenas oculta o seu conteúdo do Simple Gallery porque as outras aplicações continuarão a poder aceder-lhes.\\n\\nSe quiser ocultar também das outras aplicações, utilize a função Ocultar. Remover todas Remover todas as pastas de lista de exclusões? Esta ação não apaga as pastas. @@ -115,8 +115,8 @@ Usar sempre um fundo escuro se em ecrã completo Deslocação horizontal de miniaturas Ocultar interface do sistema se em ecrã completo - Delete empty folders after deleting their content - Allow controlling video volume and brightness with vertical gestures + Apagar as pastas vazias depois de remover o seu conteúdo + Permitir controlo do volume e brilho dos vídeos através de gestos verticais Substituir a opção Partilhar pela opção Rodar se em ecrã completo From a0543cb134c27e3e5cc27319b3fb7d4f32734ad2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Marques?= Date: Fri, 1 Sep 2017 23:29:04 +0100 Subject: [PATCH 037/207] Update strings.xml Ops... My bad. Sorry --- app/src/main/res/values-pt/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index f7353a6ec..d43d3e4ca 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -28,7 +28,7 @@ Filtrar multimédia - Imagenss + Imagens Vídeos GIFs Naõ foram encontrados ficheiros que cumpram os requisitos. From d0d65b2a42e1a6f2286616fb63450ae52d9230b8 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 2 Sep 2017 19:53:18 +0200 Subject: [PATCH 038/207] remove some invoke calls --- .../gallery/asynctasks/GetDirectoriesAsynctask.kt | 2 +- .../simplemobiletools/gallery/asynctasks/GetMediaAsynctask.kt | 2 +- .../com/simplemobiletools/gallery/helpers/GlideDecoder.kt | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt index e903ad565..b68d69d09 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt @@ -125,6 +125,6 @@ class GetDirectoriesAsynctask(val context: Context, val isPickVideo: Boolean, va override fun onPostExecute(dirs: ArrayList) { super.onPostExecute(dirs) - callback.invoke(dirs) + callback(dirs) } } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetMediaAsynctask.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetMediaAsynctask.kt index 89342dc00..68595ae46 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetMediaAsynctask.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetMediaAsynctask.kt @@ -17,6 +17,6 @@ class GetMediaAsynctask(val context: Context, val mPath: String, val isPickVideo override fun onPostExecute(media: ArrayList) { super.onPostExecute(media) - callback.invoke(media) + callback(media) } } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/GlideDecoder.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/GlideDecoder.kt index 5c5cbacbd..1e3796359 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/GlideDecoder.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/GlideDecoder.kt @@ -12,7 +12,6 @@ import com.bumptech.glide.load.engine.DiskCacheStrategy import com.bumptech.glide.request.RequestOptions import com.davemorrissey.labs.subscaleview.decoder.ImageDecoder - class GlideDecoder : ImageDecoder { override fun decode(context: Context, uri: Uri): Bitmap { val options = RequestOptions() From 6bfa62599c409c87e9c75ee36a3c0e8016f8c0fa Mon Sep 17 00:00:00 2001 From: gregory678 Date: Sun, 3 Sep 2017 00:35:31 +0200 Subject: [PATCH 039/207] Updates for version 2.13.4 PS: Please update Google Play Store description to one from this file. Current one is looking like machine-made. --- app/src/main/res/values-pl/strings.xml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index ec77abdff..25af3d4ee 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -27,12 +27,12 @@ Jasność - Filter media - Images - Videos - GIFs - No media files have been found with the selected filters. - Change filters + Filtruj multimedia + Obrazy + Filmy + GIFy + Nie znalazłem multimediów z wybranymi filtrami. + Zmień filtry Ta funkcja ukrywa foldery dodając do nich pusty plik .nomedia. Aby móc je zobaczyć, należy włączyć opcję \'Pokazuj ukryte foldery\' w ustawieniach. Kontyntynuować? @@ -115,15 +115,15 @@ Czarne tło przy podglądzie pełnoekranowym Przewijaj miniatury poziomo Ukrywaj interfejs przy pełnoekranowym podglądzie - Delete empty folders after deleting their content - Allow controlling video volume and brightness with vertical gestures + Usuwaj puste foldery po usunięciu ich zawartości + Zezwalaj na kontrolę jasności i głośności filmów pionowymi gestami Zamień funkcję udostępniania na obracanie w menu pełnoekranowym Darmowa galeria bez reklam do przeglądania obrazów i filmów. - Prosta aplikacja galerii do oglądania obrazów i filmów. Pliki mogą być sortowane według daty, rozmiaru i nazwy, zarówno w porządku rosnącym jak i malejącym. W zależności od wielkości ekranu wyświetlane mogą być w wielu kolumnach. Liczbę kolumn można zmieniać za pomocą gestów. Zdjęcia mogą być powiększane, przycinane, obracane lub ustawiane jako tapeta bezpośrednio z poziomu aplikacji. Kolory aplikacji można dowolnie ustawiać. + Prosta aplikacja galerii do oglądania obrazów i filmów. Pliki mogą być sortowane według daty, rozmiaru i nazwy, zarówno w porządku rosnącym, jak i malejącym. W zależności od wielkości ekranu wyświetlane mogą być w wielu kolumnach. Liczbę kolumn można zmieniać za pomocą gestów. Zdjęcia mogą być powiększane, przycinane, obracane lub ustawiane jako tapeta bezpośrednio z poziomu aplikacji. Kolory aplikacji można dowolnie ustawiać. Aplikacja nie zawiera żadnych reklam ani niepotrzebnych uprawnień. Jest też w pełni otawrtoźrodłowa. From d41f891ff02f084f63e8f0b8ea8e5bab22a25482 Mon Sep 17 00:00:00 2001 From: fricyo <30796677+fricyo@users.noreply.github.com> Date: Sun, 3 Sep 2017 20:26:04 +0800 Subject: [PATCH 040/207] Translation update --- app/src/main/res/values-zh-rTW/strings.xml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 9bf27b92e..66b15f9e1 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -27,12 +27,12 @@ 亮度 - Filter media - Images - Videos - GIFs - No media files have been found with the selected filters. - Change filters + 篩選媒體檔案 + 圖片 + 影片 + GIF + 選擇的篩選條件未發現媒體檔案。 + 更改篩選條件 這功能藉由添加一個\'.nomedia\'檔案,來隱藏資料夾和所有子資料夾。您可以透過設定中的「顯示隱藏的資料夾」選項來查看。\n是否繼續? @@ -115,8 +115,8 @@ 全螢幕時黑背景 橫向滑動縮圖 全螢幕時自動隱藏系統介面 - Delete empty folders after deleting their content - Allow controlling video volume and brightness with vertical gestures + 刪除內容後刪除空白資料夾 + 允許用上下手勢來控制影片的音量和亮度 將全螢幕選單的分享取代為旋轉 From 5d8ecd53449b788c03f59a703df89671468a0c0f Mon Sep 17 00:00:00 2001 From: Primokorn Date: Mon, 4 Sep 2017 14:54:25 +0200 Subject: [PATCH 041/207] Update FR strings.xml --- app/src/main/res/values-fr/strings.xml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index f41202660..fe09d0460 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -27,12 +27,12 @@ Luminosité - Filter media + Filtrer medias Images - Videos + Vidéos GIFs - No media files have been found with the selected filters. - Change filters + Aucun fichier média trouvé avec les filtres sélectionnés. + Changer les filtres Cette option masque le dossier en ajoutant un fichier \'.nomedia\' à l\'intérieur, cela masquera aussi tous les sous-dossiers. Vous pouvez les voir en modifiant l\'option \'Afficher les dossiers cachés\' dans les Paramètres. Continuer ? @@ -96,9 +96,9 @@ Inclure vidéos Ordre aléatoire Utiliser un fondu - Move backwards + Revenir en arrière Diaporama terminé - No media for the slideshow have been found + Aucun média trouvé pour le diaporama Afficher les dossiers cachés @@ -112,12 +112,12 @@ Paramètres système Rotation de l\'appareil Ratio d\'aspect - Dark background at fullscreen media + Arrière-plan sombre pour média plein écran Défilement des mignatures horizontalement - Automatically hide system UI at fullscreen media - Delete empty folders after deleting their content - Allow controlling video volume and brightness with vertical gestures - Replace Share with Rotate at fullscreen menu + Masquer automatiquement l\'interface utilisateur si média plein écran + Supprimer les dossiers vides après avoir supprimé leur contenu + Permettre le contrôle du volume vidéo et de la luminosité avec des gestes verticaux + Remplacer Partager par Pivoter si menu en plein écran From 619647b16ab4d26bec4875b717e1eaa2b274337a Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 4 Sep 2017 20:08:07 +0200 Subject: [PATCH 042/207] update commons to 2.27.8 --- app/build.gradle | 2 +- .../simplemobiletools/gallery/activities/EditActivity.kt | 6 +++++- .../gallery/activities/ViewPagerActivity.kt | 6 ++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 54035fb66..04af3840c 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,7 +37,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.26.9' + compile 'com.simplemobiletools:commons:2.27.8' compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.6.0' compile 'com.theartofdev.edmodo:android-image-cropper:2.4.0' compile 'com.bignerdranch.android:recyclerview-multiselect:0.2' diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/EditActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/EditActivity.kt index ca9cf9bf6..0da6c4bef 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/EditActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/EditActivity.kt @@ -172,7 +172,11 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener try { getFileOutputStream(file) { - saveBitmap(file, bitmap, it) + if (it != null) { + saveBitmap(file, bitmap, it) + } else { + toast(R.string.image_editing_failed) + } } } catch (e: Exception) { Log.e(TAG, "Crop compressing failed $path $e") diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt index 648f28abd..bbb805353 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -418,6 +418,12 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View try { val bitmap = BitmapFactory.decodeFile(currPath) getFileOutputStream(tmpFile) { + if (it == null) { + toast(R.string.unknown_error_occurred) + deleteFile(tmpFile) {} + return@getFileOutputStream + } + saveFile(tmpFile, bitmap, it) if (needsStupidWritePermissions(selectedFile.absolutePath)) { deleteFile(selectedFile) {} From b1c1d131d9583a1a24a3619a240bec1bb713ec90 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 4 Sep 2017 21:52:48 +0200 Subject: [PATCH 043/207] properly allow excluding or including the root folder --- .../com/simplemobiletools/gallery/extensions/context.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt index e9087e1aa..d0d6dcd00 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt @@ -71,8 +71,8 @@ private fun parseCursor(context: Context, cur: Cursor, isPickImage: Boolean, isP val config = context.config val filterMedia = config.filterMedia val showHidden = config.shouldShowHidden - val includedFolders = config.includedFolders.map { "$it/" } - val excludedFolders = config.excludedFolders.map { "$it/" } + val includedFolders = config.includedFolders.map { "${it.trimEnd('/')}/" } + val excludedFolders = config.excludedFolders.map { "${it.trimEnd('/')}/" } val noMediaFolders = context.getNoMediaFolders() val isThirdPartyIntent = config.isThirdPartyIntent From 467f603ba1102ca1af521ddb332ced9b26c322f8 Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 5 Sep 2017 09:53:51 +0200 Subject: [PATCH 044/207] rename rotation to orientation at exif changes --- .../gallery/activities/ViewPagerActivity.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt index bbb805353..639cecda8 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -383,15 +383,15 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View private fun rotateByExif() { val exif = ExifInterface(getCurrentPath()) - val rotation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL) - val newRotation = getNewRotation(rotation) - exif.setAttribute(ExifInterface.TAG_ORIENTATION, newRotation) + val orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL) + val newOrientation = getNewOrientation(orientation) + exif.setAttribute(ExifInterface.TAG_ORIENTATION, newOrientation) exif.saveAttributes() File(getCurrentPath()).setLastModified(System.currentTimeMillis()) (getCurrentFragment() as? PhotoFragment)?.refreshBitmap() } - private fun getNewRotation(rotation: Int): String { + private fun getNewOrientation(rotation: Int): String { return when (rotation) { ExifInterface.ORIENTATION_ROTATE_90 -> ExifInterface.ORIENTATION_ROTATE_180 ExifInterface.ORIENTATION_ROTATE_180 -> ExifInterface.ORIENTATION_ROTATE_270 From f4d9ab0ff59614fbd3b54b345fdfcc489a67e737 Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 5 Sep 2017 10:20:15 +0200 Subject: [PATCH 045/207] use the GlideDecoder at SubsamplingScaleImageView --- .../gallery/fragments/PhotoFragment.kt | 2 ++ .../gallery/helpers/GlideDecoder.kt | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt index dd0ccb737..2e8b5a2ce 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt @@ -33,6 +33,7 @@ import com.simplemobiletools.gallery.extensions.config import com.simplemobiletools.gallery.extensions.getFileSignature import com.simplemobiletools.gallery.extensions.getRealPathFromURI import com.simplemobiletools.gallery.extensions.portrait +import com.simplemobiletools.gallery.helpers.GlideDecoder import com.simplemobiletools.gallery.helpers.GlideRotateTransformation import com.simplemobiletools.gallery.helpers.MEDIUM import com.simplemobiletools.gallery.models.Medium @@ -199,6 +200,7 @@ class PhotoFragment : ViewPagerFragment() { private fun addZoomableView() { if ((medium.isImage()) && isFragmentVisible && view.subsampling_view.visibility == View.GONE) { view.subsampling_view.apply { + setBitmapDecoderClass(GlideDecoder::class.java) maxScale = 10f beVisible() setImage(ImageSource.uri(medium.path)) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/GlideDecoder.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/GlideDecoder.kt index 1e3796359..9cba5dbef 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/GlideDecoder.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/GlideDecoder.kt @@ -5,6 +5,7 @@ import android.graphics.Bitmap import android.graphics.Canvas import android.graphics.drawable.BitmapDrawable import android.graphics.drawable.Drawable +import android.media.ExifInterface import android.net.Uri import com.bumptech.glide.Glide import com.bumptech.glide.load.DecodeFormat @@ -14,9 +15,13 @@ import com.davemorrissey.labs.subscaleview.decoder.ImageDecoder class GlideDecoder : ImageDecoder { override fun decode(context: Context, uri: Uri): Bitmap { + val exif = android.media.ExifInterface(uri.path) + val orientation = exif.getAttributeInt(android.media.ExifInterface.TAG_ORIENTATION, android.media.ExifInterface.ORIENTATION_NORMAL) + val options = RequestOptions() .format(DecodeFormat.PREFER_ARGB_8888) .diskCacheStrategy(DiskCacheStrategy.NONE) + .transform(GlideRotateTransformation(context, getRotationDegrees(orientation))) val drawable = Glide.with(context) .load(uri) @@ -45,4 +50,12 @@ class GlideDecoder : ImageDecoder { drawable.draw(canvas) return bitmap } + + // rotating backwards intentionally, as SubsamplingScaleImageView will rotate it properly at displaying + private fun getRotationDegrees(orientation: Int) = when (orientation) { + ExifInterface.ORIENTATION_ROTATE_270 -> 90f + ExifInterface.ORIENTATION_ROTATE_180 -> 180f + ExifInterface.ORIENTATION_ROTATE_90 -> 270f + else -> 0f + } } From f7ca4a657d72b3b922846abb12e6bbb87d31065b Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 5 Sep 2017 14:18:24 +0200 Subject: [PATCH 046/207] update version to 1.1.4-3 --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 04af3840c..ffaf9879e 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -52,7 +52,7 @@ dependencies { } buildscript { - ext.kotlin_version = '1.1.4-2' + ext.kotlin_version = '1.1.4-3' repositories { mavenCentral() } From a1cda024c7d368fc2fd4522ee69322bbd4c243e3 Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 5 Sep 2017 14:35:30 +0200 Subject: [PATCH 047/207] slow down the swipe speed during slideshow --- .../gallery/activities/ViewPagerActivity.kt | 50 ++++++++++++++++--- .../gallery/helpers/Constants.kt | 1 + 2 files changed, 45 insertions(+), 6 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt index 639cecda8..5b2747fec 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -1,5 +1,7 @@ package com.simplemobiletools.gallery.activities +import android.animation.Animator +import android.animation.ValueAnimator import android.app.Activity import android.content.Intent import android.content.pm.ActivityInfo @@ -20,6 +22,7 @@ import android.provider.MediaStore import android.support.v4.view.ViewPager import android.util.DisplayMetrics import android.view.* +import android.view.animation.DecelerateInterpolator import com.simplemobiletools.commons.dialogs.ConfirmationDialog import com.simplemobiletools.commons.dialogs.PropertiesDialog import com.simplemobiletools.commons.dialogs.RenameItemDialog @@ -288,6 +291,46 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View } } + private fun animatePagerTransition(forward: Boolean) { + val oldPosition = view_pager.currentItem + val animator = ValueAnimator.ofInt(0, view_pager.width) + animator.addListener(object : Animator.AnimatorListener { + override fun onAnimationRepeat(animation: Animator?) { + } + + override fun onAnimationEnd(animation: Animator?) { + view_pager.endFakeDrag() + + if (view_pager.currentItem == oldPosition) { + stopSlideshow() + toast(R.string.slideshow_ended) + } + } + + override fun onAnimationCancel(animation: Animator?) { + view_pager.endFakeDrag() + } + + override fun onAnimationStart(animation: Animator?) { + } + }) + + animator.interpolator = DecelerateInterpolator() + animator.addUpdateListener(object : ValueAnimator.AnimatorUpdateListener { + var oldDragPosition = 0 + override fun onAnimationUpdate(animation: ValueAnimator) { + val dragPosition = animation.animatedValue as Int + val dragOffset = dragPosition - oldDragPosition + oldDragPosition = dragPosition + view_pager.fakeDragBy(dragOffset * (if (forward) 1f else -1f)) + } + }) + + animator.duration = SLIDESHOW_SCROLL_DURATION + view_pager.beginFakeDrag() + animator.start() + } + private fun stopSlideshow() { if (mIsSlideshowActive) { showSystemUI() @@ -313,12 +356,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View } private fun swipeToNextMedium() { - val before = view_pager.currentItem - view_pager.currentItem = if (mSlideshowMoveBackwards) --view_pager.currentItem else ++view_pager.currentItem - if (before == view_pager.currentItem) { - stopSlideshow() - toast(R.string.slideshow_ended) - } + animatePagerTransition(!mSlideshowMoveBackwards) } private fun getMediaForSlideshow(): Boolean { 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 b6a5fbc45..55ec434db 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt @@ -45,6 +45,7 @@ val SLIDESHOW_RANDOM_ORDER = "slideshow_random_order" val SLIDESHOW_USE_FADE = "slideshow_use_fade" val SLIDESHOW_MOVE_BACKWARDS = "slideshow_move_backwards" val SLIDESHOW_DEFAULT_INTERVAL = 5 +val SLIDESHOW_SCROLL_DURATION = 500L val NOMEDIA = ".nomedia" From a663b89665dc3b6146d1733128c307677df5d2ee Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 5 Sep 2017 15:14:44 +0200 Subject: [PATCH 048/207] do not trigger the brightness and volume slider so agressively --- .../com/simplemobiletools/gallery/fragments/VideoFragment.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt index 47c8f93b6..a2762d99a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt @@ -154,7 +154,7 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee val diffX = mTouchDownX - event.x val diffY = mTouchDownY - event.y - if (Math.abs(diffY) > Math.abs(diffX)) { + if (Math.abs(diffY) > 20 && Math.abs(diffY) > Math.abs(diffX)) { var percent = ((diffY / ViewPagerActivity.screenHeight) * 100).toInt() * 3 percent = Math.min(100, Math.max(-100, percent)) @@ -190,7 +190,7 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee val diffX = mTouchDownX - event.x val diffY = mTouchDownY - event.y - if (Math.abs(diffY) > Math.abs(diffX)) { + if (Math.abs(diffY) > 20 && Math.abs(diffY) > Math.abs(diffX)) { var percent = ((diffY / ViewPagerActivity.screenHeight) * 100).toInt() * 3 percent = Math.min(100, Math.max(-100, percent)) From 1397c2d48b241e742757d97f959e03f9286be59c Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 5 Sep 2017 15:39:11 +0200 Subject: [PATCH 049/207] update the way we are selecting media at share --- .../com/simplemobiletools/gallery/adapters/MediaAdapter.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt index c0b026892..986f7a9e0 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt @@ -162,9 +162,9 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList, } private fun shareMedia() { - if (selectedPositions.size <= 1) { + if (selectedPositions.size == 1 && selectedPositions.first() != -1) { activity.shareMedium(getSelectedMedia()[0]) - } else { + } else if (selectedPositions.size > 1) { activity.shareMedia(getSelectedMedia()) } } From ac1c84d279fc69c82416a5f4c9b4e68ed1ff3b2b Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 5 Sep 2017 15:45:35 +0200 Subject: [PATCH 050/207] do not clear mMedia after third party intents --- .../simplemobiletools/gallery/activities/ViewPagerActivity.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt index 5b2747fec..5b09bcf6d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -154,7 +154,6 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View } if (config.isThirdPartyIntent) { - mMedia.clear() config.isThirdPartyIntent = false } } From 067798e5c2a941dde3ee381793635d020ebb4056 Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 5 Sep 2017 16:06:42 +0200 Subject: [PATCH 051/207] use different toggles for photos and gifs at the slideshow setup --- .../gallery/activities/ViewPagerActivity.kt | 6 ++++- .../gallery/dialogs/SlideshowDialog.kt | 7 ++++++ .../gallery/helpers/Config.kt | 4 ++++ .../gallery/helpers/Constants.kt | 1 + app/src/main/res/layout/dialog_slideshow.xml | 23 ++++++++++++++++++- app/src/main/res/values-ca/strings.xml | 3 ++- app/src/main/res/values-cs/strings.xml | 3 ++- app/src/main/res/values-de/strings.xml | 3 ++- app/src/main/res/values-es/strings.xml | 3 ++- app/src/main/res/values-fr/strings.xml | 3 ++- app/src/main/res/values-hu/strings.xml | 3 ++- app/src/main/res/values-it/strings.xml | 3 ++- app/src/main/res/values-ja/strings.xml | 3 ++- app/src/main/res/values-pl/strings.xml | 3 ++- app/src/main/res/values-pt-rBR/strings.xml | 3 ++- app/src/main/res/values-pt/strings.xml | 3 ++- app/src/main/res/values-ru/strings.xml | 3 ++- app/src/main/res/values-sk/strings.xml | 3 ++- app/src/main/res/values-sv/strings.xml | 3 ++- app/src/main/res/values-tr/strings.xml | 3 ++- app/src/main/res/values-zh-rCN/strings.xml | 3 ++- app/src/main/res/values-zh-rTW/strings.xml | 3 ++- app/src/main/res/values/strings.xml | 3 ++- 23 files changed, 75 insertions(+), 20 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt index 5b09bcf6d..71cb64e7a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -361,13 +361,17 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View private fun getMediaForSlideshow(): Boolean { mSlideshowMedia = mMedia.toMutableList() if (!config.slideshowIncludePhotos) { - mSlideshowMedia = mSlideshowMedia.filter { !it.isImage() && !it.isGif() } as MutableList + mSlideshowMedia = mSlideshowMedia.filter { !it.isImage() } as MutableList } if (!config.slideshowIncludeVideos) { mSlideshowMedia = mSlideshowMedia.filter { it.isImage() || it.isGif() } as MutableList } + if (!config.slideshowIncludeGIFs) { + mSlideshowMedia = mSlideshowMedia.filter { !it.isGif() } as MutableList + } + if (config.slideshowRandomOrder) { Collections.shuffle(mSlideshowMedia) mPos = 0 diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/SlideshowDialog.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/SlideshowDialog.kt index f28d8ef62..60923a220 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/SlideshowDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/SlideshowDialog.kt @@ -42,6 +42,11 @@ class SlideshowDialog(val activity: SimpleActivity, val callback: () -> Unit) { include_videos.toggle() } + include_gifs_holder.setOnClickListener { + interval_value.clearFocus() + include_gifs.toggle() + } + random_order_holder.setOnClickListener { interval_value.clearFocus() random_order.toggle() @@ -74,6 +79,7 @@ class SlideshowDialog(val activity: SimpleActivity, val callback: () -> Unit) { interval_value.setText(config.slideshowInterval.toString()) include_photos.isChecked = config.slideshowIncludePhotos include_videos.isChecked = config.slideshowIncludeVideos + include_gifs.isChecked = config.slideshowIncludeGIFs random_order.isChecked = config.slideshowRandomOrder use_fade.isChecked = config.slideshowUseFade move_backwards.isChecked = config.slideshowMoveBackwards @@ -89,6 +95,7 @@ class SlideshowDialog(val activity: SimpleActivity, val callback: () -> Unit) { slideshowInterval = interval.toInt() slideshowIncludePhotos = view.include_photos.isChecked slideshowIncludeVideos = view.include_videos.isChecked + slideshowIncludeGIFs = view.include_gifs.isChecked slideshowRandomOrder = view.random_order.isChecked slideshowUseFade = view.use_fade.isChecked slideshowMoveBackwards = view.move_backwards.isChecked diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt index f8b61b8f8..882a9ddef 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt @@ -257,6 +257,10 @@ class Config(context: Context) : BaseConfig(context) { get() = prefs.getBoolean(SLIDESHOW_INCLUDE_VIDEOS, false) set(slideshowIncludeVideos) = prefs.edit().putBoolean(SLIDESHOW_INCLUDE_VIDEOS, slideshowIncludeVideos).apply() + var slideshowIncludeGIFs: Boolean + get() = prefs.getBoolean(SLIDESHOW_INCLUDE_GIFS, false) + set(slideshowIncludeGIFs) = prefs.edit().putBoolean(SLIDESHOW_INCLUDE_GIFS, slideshowIncludeGIFs).apply() + var slideshowRandomOrder: Boolean get() = prefs.getBoolean(SLIDESHOW_RANDOM_ORDER, false) set(slideshowRandomOrder) = prefs.edit().putBoolean(SLIDESHOW_RANDOM_ORDER, slideshowRandomOrder).apply() 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 55ec434db..3e3cb7285 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt @@ -41,6 +41,7 @@ val ALLOW_VIDEO_GESTURES = "allow_video_gestures" val SLIDESHOW_INTERVAL = "slideshow_interval" val SLIDESHOW_INCLUDE_PHOTOS = "slideshow_include_photos" val SLIDESHOW_INCLUDE_VIDEOS = "slideshow_include_videos" +val SLIDESHOW_INCLUDE_GIFS = "slideshow_include_gifs" val SLIDESHOW_RANDOM_ORDER = "slideshow_random_order" val SLIDESHOW_USE_FADE = "slideshow_use_fade" val SLIDESHOW_MOVE_BACKWARDS = "slideshow_move_backwards" diff --git a/app/src/main/res/layout/dialog_slideshow.xml b/app/src/main/res/layout/dialog_slideshow.xml index d057acf77..570c48c03 100644 --- a/app/src/main/res/layout/dialog_slideshow.xml +++ b/app/src/main/res/layout/dialog_slideshow.xml @@ -78,7 +78,7 @@ + + + + + + Slideshow Interval (seconds): - Include photos and GIFs + Include photos Include videos + Include GIFs Random order Use fade animations Move backwards diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index 064f7380e..ed1a567f2 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -92,8 +92,9 @@ Slideshow Interval (seconds): - Include photos and GIFs + Include photos Include videos + Include GIFs Random order Use fade animations Move backwards diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 8ceb1f74e..2caeb213e 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -92,8 +92,9 @@ Diashow Intervall (Sekunden): - Bilder/GIFs verwenden + Bilder verwenden Videos verwenden + GIF verwenden Zufällige Reihenfolge Übergänge animieren Rückwärts abspielen diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 779ea07d3..86d314cb3 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -92,8 +92,9 @@ Slideshow Interval (seconds): - Include photos and GIFs + Include photos Include videos + Include GIFs Random order Use fade animations Move backwards diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index fe09d0460..fdc3cd59d 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -92,8 +92,9 @@ Diaporama Intervalle​ (secondes): - Inclure photos et GIFs + Inclure photos Inclure vidéos + Inclure GIFs Ordre aléatoire Utiliser un fondu Revenir en arrière diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index f8bbce01f..8be078b61 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -92,8 +92,9 @@ Slideshow Interval (seconds): - Include photos and GIFs + Include photos Include videos + Include GIFs Random order Use fade animations Move backwards diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 1af0bd606..4a1ddc1a9 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -92,8 +92,9 @@ Presentazione Intervallo (secondi): - Includi foto e GIF + Includi foto Includi video + Includi GIF Ordine sparso Usa animazioni a dissolvenza Scorri al contrario diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 5bb6e82f2..24d9db9de 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -92,8 +92,9 @@ Slideshow Interval (seconds): - Include photos and GIFs + Include photos Include videos + Include GIFs Random order Use fade animations Move backwards diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index 25af3d4ee..675aa2838 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -92,8 +92,9 @@ Pokaz slajdów Przedział (sekundy): - Dołączaj zdjęcia i GIFy + Dołączaj zdjęcia Dołączaj filmy + Dołączaj GIFy Losowa kolejność Używaj płynnych przejść    Odwrotna kolejność diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 17816a8f7..9c1991111 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -92,8 +92,9 @@ Slideshow Interval (seconds): - Include photos and GIFs + Include photos Include videos + Include GIFs Random order Use fade animations Move backwards diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index d43d3e4ca..3542bb452 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -92,8 +92,9 @@ Apresentação Intervalo (segundos): - Incluir fotos e GIFs + Incluir fotos Incluir vídeos + Incluir GIFs Ordem aleatória Usar animações Mover para trás diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 26d1ef055..04f9a508a 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -92,8 +92,9 @@ Slideshow Interval (seconds): - Include photos and GIFs + Include photos Include videos + Include GIFs Random order Use fade animations Move backwards diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index 2cf132f11..d3c9d326e 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -92,8 +92,9 @@ Prezentácia Interval (sekundy): - Zahrnúť fotky a GIF súbory + Zahrnúť fotky Zahrnúť videá + Zahrnúť GIFy Náhodné poradie Používať miznúce animácie Ísť opačným smerom diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index 043f1f72e..fc94187c0 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -92,8 +92,9 @@ Slideshow Interval (seconds): - Include photos and GIFs + Include photos Include videos + Include GIFs Random order Use fade animations Move backwards diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index aade22087..3fc8b0e18 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -92,8 +92,9 @@ Slideshow Interval (seconds): - Include photos and GIFs + Include photos Include videos + Include GIFs Random order Use fade animations Move backwards diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index c8a8b6900..a1170b885 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -92,8 +92,9 @@ 幻灯片 间隔(秒): - 包含照片和动态图 + Include photos 包含视频 + Include GIFs 随机顺序 使用渐变动画 倒播 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 66b15f9e1..822c72607 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -92,8 +92,9 @@ 投影片 間隔 (秒): - 包含照片和GIF + Include photos 包含影片 + Include GIFs 隨機順序 使用淡入淡出動畫 反向播放 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 6acb28aed..7d3ec4a59 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -92,8 +92,9 @@ Slideshow Interval (seconds): - Include photos and GIFs + Include photos Include videos + Include GIFs Random order Use fade animations Move backwards From 848c6c56679f25e6ae453c3bd573f97f1244001c Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 5 Sep 2017 16:29:51 +0200 Subject: [PATCH 052/207] show an error toast earlier if every media is filtered out at slideshow --- .../gallery/dialogs/SlideshowDialog.kt | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/SlideshowDialog.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/SlideshowDialog.kt index 60923a220..d4753c047 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/SlideshowDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/SlideshowDialog.kt @@ -6,6 +6,7 @@ import android.view.View import android.view.WindowManager import com.simplemobiletools.commons.extensions.hideKeyboard import com.simplemobiletools.commons.extensions.setupDialogStuff +import com.simplemobiletools.commons.extensions.toast import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.activities.SimpleActivity import com.simplemobiletools.gallery.extensions.config @@ -14,7 +15,6 @@ import kotlinx.android.synthetic.main.dialog_slideshow.view.* class SlideshowDialog(val activity: SimpleActivity, val callback: () -> Unit) { - val dialog: AlertDialog val view: View init { @@ -64,12 +64,22 @@ class SlideshowDialog(val activity: SimpleActivity, val callback: () -> Unit) { } setupValues() - dialog = AlertDialog.Builder(activity) - .setPositiveButton(R.string.ok, { dialog, which -> dialogConfirmed() }) + AlertDialog.Builder(activity) + .setPositiveButton(R.string.ok, null) .setNegativeButton(R.string.cancel, null) .create().apply { window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN) activity.setupDialogStuff(view, this) + getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener({ + if (!view.include_photos.isChecked && !view.include_videos.isChecked && !view.include_gifs.isChecked) { + activity.toast(R.string.no_media_for_slideshow) + return@setOnClickListener + } + + storeValues() + callback() + dismiss() + }) } } @@ -86,7 +96,7 @@ class SlideshowDialog(val activity: SimpleActivity, val callback: () -> Unit) { } } - private fun dialogConfirmed() { + private fun storeValues() { var interval = view.interval_value.text.toString() if (interval.trim('0').isEmpty()) interval = SLIDESHOW_DEFAULT_INTERVAL.toString() @@ -100,7 +110,5 @@ class SlideshowDialog(val activity: SimpleActivity, val callback: () -> Unit) { slideshowUseFade = view.use_fade.isChecked slideshowMoveBackwards = view.move_backwards.isChecked } - dialog.dismiss() - callback() } } From afa72a1aad51794e7425a16a46ea6c1f03cf779e Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 5 Sep 2017 16:31:57 +0200 Subject: [PATCH 053/207] add the string for looping slideshow --- app/src/main/res/values-ca/strings.xml | 1 + app/src/main/res/values-cs/strings.xml | 1 + app/src/main/res/values-de/strings.xml | 1 + app/src/main/res/values-es/strings.xml | 1 + app/src/main/res/values-fr/strings.xml | 1 + app/src/main/res/values-hu/strings.xml | 1 + app/src/main/res/values-it/strings.xml | 1 + app/src/main/res/values-ja/strings.xml | 1 + app/src/main/res/values-pl/strings.xml | 1 + app/src/main/res/values-pt-rBR/strings.xml | 1 + app/src/main/res/values-pt/strings.xml | 1 + app/src/main/res/values-ru/strings.xml | 1 + app/src/main/res/values-sk/strings.xml | 1 + app/src/main/res/values-sv/strings.xml | 1 + app/src/main/res/values-tr/strings.xml | 1 + app/src/main/res/values-zh-rCN/strings.xml | 1 + app/src/main/res/values-zh-rTW/strings.xml | 1 + app/src/main/res/values/strings.xml | 1 + 18 files changed, 18 insertions(+) diff --git a/app/src/main/res/values-ca/strings.xml b/app/src/main/res/values-ca/strings.xml index 7d3ec4a59..13d30d4ba 100644 --- a/app/src/main/res/values-ca/strings.xml +++ b/app/src/main/res/values-ca/strings.xml @@ -98,6 +98,7 @@ Random order Use fade animations Move backwards + Loop slideshow The slideshow ended No media for the slideshow have been found diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index ed1a567f2..ee99698ff 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -98,6 +98,7 @@ Random order Use fade animations Move backwards + Loop slideshow The slideshow ended No media for the slideshow have been found diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 2caeb213e..6815e2f67 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -98,6 +98,7 @@ Zufällige Reihenfolge Übergänge animieren Rückwärts abspielen + Loop slideshow Diashow beendet Keine Medien für Diashow gefunden diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 86d314cb3..6aad7a9c4 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -98,6 +98,7 @@ Random order Use fade animations Move backwards + Loop slideshow The slideshow ended No media for the slideshow have been found diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index fdc3cd59d..ec733b59c 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -98,6 +98,7 @@ Ordre aléatoire Utiliser un fondu Revenir en arrière + Loop slideshow Diaporama terminé Aucun média trouvé pour le diaporama diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index 8be078b61..70e9df0c8 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -98,6 +98,7 @@ Random order Use fade animations Move backwards + Loop slideshow The slideshow ended No media for the slideshow have been found diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 4a1ddc1a9..b723068ba 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -98,6 +98,7 @@ Ordine sparso Usa animazioni a dissolvenza Scorri al contrario + Loop slideshow La presentazione è terminata Nessun media trovato per la presentazione diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 24d9db9de..f0fbd9f19 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -98,6 +98,7 @@ Random order Use fade animations Move backwards + Loop slideshow The slideshow ended No media for the slideshow have been found diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index 675aa2838..7b9f6575f 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -98,6 +98,7 @@ Losowa kolejność Używaj płynnych przejść    Odwrotna kolejność + Loop slideshow Pokaz slajdów zakończony Nie znalazłem multimediów do pokazu slajdów diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 9c1991111..3c4b4032f 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -98,6 +98,7 @@ Random order Use fade animations Move backwards + Loop slideshow The slideshow ended No media for the slideshow have been found diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index 3542bb452..0ac84d7d6 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -98,6 +98,7 @@ Ordem aleatória Usar animações Mover para trás + Loop slideshow Apresentação terminada Não foram encontrados ficheiros para a apresentação diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 04f9a508a..ba2bae55d 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -98,6 +98,7 @@ Random order Use fade animations Move backwards + Loop slideshow The slideshow ended No media for the slideshow have been found diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index d3c9d326e..0d7fe9f86 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -98,6 +98,7 @@ Náhodné poradie Používať miznúce animácie Ísť opačným smerom + Automaticky reštartovať prezentáciu Prezentácia skončila Pre prezentáciu sa nenašli žiadne vhodné súbory diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index fc94187c0..6442a31fe 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -98,6 +98,7 @@ Random order Use fade animations Move backwards + Loop slideshow The slideshow ended No media for the slideshow have been found diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index 3fc8b0e18..ded134a6d 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -98,6 +98,7 @@ Random order Use fade animations Move backwards + Loop slideshow The slideshow ended No media for the slideshow have been found diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index a1170b885..ccbd2c8cd 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -98,6 +98,7 @@ 随机顺序 使用渐变动画 倒播 + Loop slideshow 幻灯片结束 未发现可用媒体 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 822c72607..a2b80e15e 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -98,6 +98,7 @@ 隨機順序 使用淡入淡出動畫 反向播放 + Loop slideshow 投影片結束 找不到投影片的媒體檔案 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 7d3ec4a59..13d30d4ba 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -98,6 +98,7 @@ Random order Use fade animations Move backwards + Loop slideshow The slideshow ended No media for the slideshow have been found From 8ea418dad6c634c96605b11b3bc4b569e744e3a8 Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 5 Sep 2017 20:04:09 +0200 Subject: [PATCH 054/207] add an option to loop slideshows --- .../gallery/activities/ViewPagerActivity.kt | 16 ++++++++++++-- .../gallery/dialogs/SlideshowDialog.kt | 7 +++++++ .../gallery/helpers/Config.kt | 4 ++++ .../gallery/helpers/Constants.kt | 1 + app/src/main/res/layout/dialog_slideshow.xml | 21 +++++++++++++++++++ 5 files changed, 47 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt index 71cb64e7a..87f0129cc 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -301,8 +301,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View view_pager.endFakeDrag() if (view_pager.currentItem == oldPosition) { - stopSlideshow() - toast(R.string.slideshow_ended) + slideshowEnded(forward) } } @@ -330,6 +329,19 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View animator.start() } + private fun slideshowEnded(forward: Boolean) { + if (config.loopSlideshow) { + if (forward) { + view_pager.setCurrentItem(0, false) + } else { + view_pager.setCurrentItem(view_pager.adapter!!.count - 1, false) + } + } else { + stopSlideshow() + toast(R.string.slideshow_ended) + } + } + private fun stopSlideshow() { if (mIsSlideshowActive) { showSystemUI() diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/SlideshowDialog.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/SlideshowDialog.kt index d4753c047..cffb769b6 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/SlideshowDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/SlideshowDialog.kt @@ -61,6 +61,11 @@ class SlideshowDialog(val activity: SimpleActivity, val callback: () -> Unit) { interval_value.clearFocus() move_backwards.toggle() } + + loop_slideshow_holder.setOnClickListener { + interval_value.clearFocus() + loop_slideshow.toggle() + } } setupValues() @@ -93,6 +98,7 @@ class SlideshowDialog(val activity: SimpleActivity, val callback: () -> Unit) { random_order.isChecked = config.slideshowRandomOrder use_fade.isChecked = config.slideshowUseFade move_backwards.isChecked = config.slideshowMoveBackwards + loop_slideshow.isChecked = config.loopSlideshow } } @@ -109,6 +115,7 @@ class SlideshowDialog(val activity: SimpleActivity, val callback: () -> Unit) { slideshowRandomOrder = view.random_order.isChecked slideshowUseFade = view.use_fade.isChecked slideshowMoveBackwards = view.move_backwards.isChecked + loopSlideshow = view.loop_slideshow.isChecked } } } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt index 882a9ddef..9fa94ce47 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt @@ -272,4 +272,8 @@ class Config(context: Context) : BaseConfig(context) { var slideshowMoveBackwards: Boolean get() = prefs.getBoolean(SLIDESHOW_MOVE_BACKWARDS, false) set(slideshowMoveBackwards) = prefs.edit().putBoolean(SLIDESHOW_MOVE_BACKWARDS, slideshowMoveBackwards).apply() + + var loopSlideshow: Boolean + get() = prefs.getBoolean(SLIDESHOW_LOOP, false) + set(loopSlideshow) = prefs.edit().putBoolean(SLIDESHOW_LOOP, loopSlideshow).apply() } 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 3e3cb7285..7b743837f 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt @@ -45,6 +45,7 @@ val SLIDESHOW_INCLUDE_GIFS = "slideshow_include_gifs" val SLIDESHOW_RANDOM_ORDER = "slideshow_random_order" val SLIDESHOW_USE_FADE = "slideshow_use_fade" val SLIDESHOW_MOVE_BACKWARDS = "slideshow_move_backwards" +val SLIDESHOW_LOOP = "loop_slideshow" val SLIDESHOW_DEFAULT_INTERVAL = 5 val SLIDESHOW_SCROLL_DURATION = 500L diff --git a/app/src/main/res/layout/dialog_slideshow.xml b/app/src/main/res/layout/dialog_slideshow.xml index 570c48c03..dd17378d4 100644 --- a/app/src/main/res/layout/dialog_slideshow.xml +++ b/app/src/main/res/layout/dialog_slideshow.xml @@ -161,5 +161,26 @@ android:text="@string/move_backwards"/> + + + + + + From 2aab1ba5e56219e0aa36f745b03cea2856ed395a Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 5 Sep 2017 21:11:50 +0200 Subject: [PATCH 055/207] add a menu button for easier new folder creating --- app/build.gradle | 2 +- .../gallery/activities/MainActivity.kt | 19 +++++++++++++++++++ app/src/main/res/menu/menu_main.xml | 4 ++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index ffaf9879e..ace0d079e 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,7 +37,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.27.8' + compile 'com.simplemobiletools:commons:2.27.9' compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.6.0' compile 'com.theartofdev.edmodo:android-image-cropper:2.4.0' compile 'com.bignerdranch.android:recyclerview-multiselect:0.2' 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 d148a13d1..0d68ab3fb 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -17,6 +17,8 @@ import android.view.MenuItem import android.view.ViewGroup import android.widget.FrameLayout import com.google.gson.Gson +import com.simplemobiletools.commons.dialogs.CreateNewFolderDialog +import com.simplemobiletools.commons.dialogs.FilePickerDialog import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.models.Release import com.simplemobiletools.commons.views.MyScalableRecyclerView @@ -55,6 +57,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { private var mLoadedInitialPhotos = false private var mLastMediaModified = 0 private var mLastMediaHandler = Handler() + private var mNewFolderPath = "" private var mCurrAsyncTask: GetDirectoriesAsynctask? = null @@ -105,6 +108,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { R.id.show_all -> showAllMedia() R.id.temporarily_show_hidden -> tryToggleTemporarilyShowHidden() R.id.stop_showing_hidden -> tryToggleTemporarilyShowHidden() + R.id.create_new_folder -> createNewFolder() R.id.increase_column_count -> increaseColumnCount() R.id.reduce_column_count -> reduceColumnCount() R.id.settings -> launchSettings() @@ -155,6 +159,13 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { override fun onDestroy() { super.onDestroy() config.temporarilyShowHidden = false + + val newFolder = File(mNewFolderPath) + if (newFolder.exists() && newFolder.isDirectory) { + if (newFolder.list()?.isEmpty() == true) { + deleteFileBg(newFolder, true) { } + } + } } private fun tryloadGallery() { @@ -300,6 +311,14 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { } } + private fun createNewFolder() { + FilePickerDialog(this, internalStoragePath, false, config.shouldShowHidden) { + CreateNewFolderDialog(this, it) { + mNewFolderPath = it + } + } + } + private fun increaseColumnCount() { config.dirColumnCnt = ++(directories_grid.layoutManager as GridLayoutManager).spanCount invalidateOptionsMenu() diff --git a/app/src/main/res/menu/menu_main.xml b/app/src/main/res/menu/menu_main.xml index 93770fe35..e94eacea7 100644 --- a/app/src/main/res/menu/menu_main.xml +++ b/app/src/main/res/menu/menu_main.xml @@ -28,6 +28,10 @@ android:id="@+id/stop_showing_hidden" android:title="@string/stop_showing_hidden" app:showAsAction="never"/> + Date: Tue, 5 Sep 2017 21:43:21 +0200 Subject: [PATCH 056/207] make sure the new directory is the first one --- .../gallery/activities/MainActivity.kt | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 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 0d68ab3fb..e1dcac814 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -210,7 +210,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { mLoadedInitialPhotos = true mCurrAsyncTask = GetDirectoriesAsynctask(applicationContext, mIsPickVideoIntent || mIsGetVideoContentIntent, mIsPickImageIntent || mIsGetImageContentIntent) { - gotDirectories(it) + addTempFolderIfNeeded(it, false) } mCurrAsyncTask!!.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR) } @@ -315,10 +315,21 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { FilePickerDialog(this, internalStoragePath, false, config.shouldShowHidden) { CreateNewFolderDialog(this, it) { mNewFolderPath = it + addTempFolderIfNeeded(mDirs, true) } } } + private fun addTempFolderIfNeeded(dirs: ArrayList, isFromCache: Boolean) { + val directories = ArrayList() + if (mNewFolderPath.isNotEmpty()) { + val newFolder = Directory(mNewFolderPath, "", mNewFolderPath.getFilenameFromPath(), 0, 0, 0, 0L) + directories.add(newFolder) + } + directories.addAll(dirs) + gotDirectories(directories, isFromCache) + } + private fun increaseColumnCount() { config.dirColumnCnt = ++(directories_grid.layoutManager as GridLayoutManager).spanCount invalidateOptionsMenu() @@ -416,7 +427,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { } } - private fun gotDirectories(dirs: ArrayList, isFromCache: Boolean = false) { + private fun gotDirectories(dirs: ArrayList, isFromCache: Boolean) { mLastMediaModified = getLastMediaModified() directories_refresh_layout.isRefreshing = false mIsGettingDirs = false @@ -433,11 +444,12 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { runOnUiThread { setupAdapter() } + storeDirectories() } private fun storeDirectories() { - if (!config.temporarilyShowHidden) { + if (!config.temporarilyShowHidden && mNewFolderPath.isEmpty()) { val directories = Gson().toJson(mDirs) config.directories = directories } From 189f9b7410893684a8918bf070c20905ff88f0fb Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 5 Sep 2017 21:58:22 +0200 Subject: [PATCH 057/207] store the new folder path in shared prefs, so its more accessible --- .../gallery/activities/MainActivity.kt | 14 ++++++++------ .../simplemobiletools/gallery/helpers/Config.kt | 4 ++++ .../simplemobiletools/gallery/helpers/Constants.kt | 1 + 3 files changed, 13 insertions(+), 6 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 e1dcac814..ad77fa735 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -57,7 +57,6 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { private var mLoadedInitialPhotos = false private var mLastMediaModified = 0 private var mLastMediaHandler = Handler() - private var mNewFolderPath = "" private var mCurrAsyncTask: GetDirectoriesAsynctask? = null @@ -74,6 +73,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { mIsThirdPartyIntent = mIsPickImageIntent || mIsPickVideoIntent || mIsGetImageContentIntent || mIsGetVideoContentIntent || mIsGetAnyContentIntent || mIsSetWallpaperIntent + config.tempFolderPath = "" directories_refresh_layout.setOnRefreshListener({ getDirectories() }) mDirs = ArrayList() mStoredAnimateGifs = config.animateGifs @@ -160,12 +160,13 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { super.onDestroy() config.temporarilyShowHidden = false - val newFolder = File(mNewFolderPath) + val newFolder = File(config.tempFolderPath) if (newFolder.exists() && newFolder.isDirectory) { if (newFolder.list()?.isEmpty() == true) { deleteFileBg(newFolder, true) { } } } + config.tempFolderPath = "" } private fun tryloadGallery() { @@ -314,7 +315,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { private fun createNewFolder() { FilePickerDialog(this, internalStoragePath, false, config.shouldShowHidden) { CreateNewFolderDialog(this, it) { - mNewFolderPath = it + config.tempFolderPath = it addTempFolderIfNeeded(mDirs, true) } } @@ -322,8 +323,9 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { private fun addTempFolderIfNeeded(dirs: ArrayList, isFromCache: Boolean) { val directories = ArrayList() - if (mNewFolderPath.isNotEmpty()) { - val newFolder = Directory(mNewFolderPath, "", mNewFolderPath.getFilenameFromPath(), 0, 0, 0, 0L) + val tempFolderPath = config.tempFolderPath + if (tempFolderPath.isNotEmpty()) { + val newFolder = Directory(tempFolderPath, "", tempFolderPath.getFilenameFromPath(), 0, 0, 0, 0L) directories.add(newFolder) } directories.addAll(dirs) @@ -449,7 +451,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { } private fun storeDirectories() { - if (!config.temporarilyShowHidden && mNewFolderPath.isEmpty()) { + if (!config.temporarilyShowHidden && config.tempFolderPath.isEmpty()) { val directories = Gson().toJson(mDirs) config.directories = directories } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt index 9fa94ce47..f17e9eed1 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt @@ -276,4 +276,8 @@ class Config(context: Context) : BaseConfig(context) { var loopSlideshow: Boolean get() = prefs.getBoolean(SLIDESHOW_LOOP, false) set(loopSlideshow) = prefs.edit().putBoolean(SLIDESHOW_LOOP, loopSlideshow).apply() + + var tempFolderPath: String + get() = prefs.getString(TEMP_FOLDER_PATH, "") + set(tempFolderPath) = prefs.edit().putString(TEMP_FOLDER_PATH, tempFolderPath).apply() } 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 7b743837f..705c91d76 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt @@ -36,6 +36,7 @@ val HIDE_SYSTEM_UI = "hide_system_ui" val REPLACE_SHARE_WITH_ROTATE = "replace_share_with_rotate" val DELETE_EMPTY_FOLDERS = "delete_empty_folders" val ALLOW_VIDEO_GESTURES = "allow_video_gestures" +val TEMP_FOLDER_PATH = "temp_folder_path" // slideshow val SLIDESHOW_INTERVAL = "slideshow_interval" From 54a4d292336857305b60b6ee785510edf45d67d0 Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 5 Sep 2017 22:18:46 +0200 Subject: [PATCH 058/207] show the temp folder at Copy/move dialog too --- .../gallery/activities/MainActivity.kt | 15 ++------------- .../gallery/activities/SimpleActivity.kt | 14 ++++++++++++++ .../gallery/activities/ViewPagerActivity.kt | 1 + .../gallery/adapters/DirectoryAdapter.kt | 1 + .../gallery/adapters/MediaAdapter.kt | 1 + .../gallery/dialogs/PickDirectoryDialog.kt | 4 ++-- 6 files changed, 21 insertions(+), 15 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 ad77fa735..38d8cafc1 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -211,7 +211,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { mLoadedInitialPhotos = true mCurrAsyncTask = GetDirectoriesAsynctask(applicationContext, mIsPickVideoIntent || mIsGetVideoContentIntent, mIsPickImageIntent || mIsGetImageContentIntent) { - addTempFolderIfNeeded(it, false) + gotDirectories(addTempFolderIfNeeded(it), false) } mCurrAsyncTask!!.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR) } @@ -316,22 +316,11 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { FilePickerDialog(this, internalStoragePath, false, config.shouldShowHidden) { CreateNewFolderDialog(this, it) { config.tempFolderPath = it - addTempFolderIfNeeded(mDirs, true) + gotDirectories(addTempFolderIfNeeded(mDirs), true) } } } - private fun addTempFolderIfNeeded(dirs: ArrayList, isFromCache: Boolean) { - val directories = ArrayList() - val tempFolderPath = config.tempFolderPath - if (tempFolderPath.isNotEmpty()) { - val newFolder = Directory(tempFolderPath, "", tempFolderPath.getFilenameFromPath(), 0, 0, 0, 0L) - directories.add(newFolder) - } - directories.addAll(dirs) - gotDirectories(directories, isFromCache) - } - private fun increaseColumnCount() { config.dirColumnCnt = ++(directories_grid.layoutManager as GridLayoutManager).spanCount invalidateOptionsMenu() diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SimpleActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SimpleActivity.kt index 6cfd6eb38..f30d65e31 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SimpleActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SimpleActivity.kt @@ -1,9 +1,12 @@ package com.simplemobiletools.gallery.activities import com.simplemobiletools.commons.activities.BaseSimpleActivity +import com.simplemobiletools.commons.extensions.getFilenameFromPath import com.simplemobiletools.commons.extensions.toast import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.dialogs.PickDirectoryDialog +import com.simplemobiletools.gallery.extensions.config +import com.simplemobiletools.gallery.models.Directory import java.io.File import java.util.* @@ -19,4 +22,15 @@ open class SimpleActivity : BaseSimpleActivity() { copyMoveFilesTo(files, source.trimEnd('/'), it, isCopyOperation, true, callback) } } + + fun addTempFolderIfNeeded(dirs: ArrayList): ArrayList { + val directories = ArrayList() + val tempFolderPath = config.tempFolderPath + if (tempFolderPath.isNotEmpty()) { + val newFolder = Directory(tempFolderPath, "", tempFolderPath.getFilenameFromPath(), 0, 0, 0, 0L) + directories.add(newFolder) + } + directories.addAll(dirs) + return directories + } } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt index 87f0129cc..6318293ae 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -405,6 +405,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View private fun copyMoveTo(isCopyOperation: Boolean) { val files = ArrayList(1).apply { add(getCurrentFile()) } tryCopyMoveFilesTo(files, isCopyOperation) { + config.tempFolderPath = "" if (!isCopyOperation) { reloadViewPager() } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt index 7e7a10d01..08e08e439 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt @@ -234,6 +234,7 @@ class DirectoryAdapter(val activity: SimpleActivity, var dirs: MutableList, selectedPositions.forEach { files.add(File(media[it].path)) } activity.tryCopyMoveFilesTo(files, isCopyOperation) { + config.tempFolderPath = "" if (!isCopyOperation) { listener?.refreshItems() } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickDirectoryDialog.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickDirectoryDialog.kt index 39d0ca7f2..a52a395cd 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickDirectoryDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickDirectoryDialog.kt @@ -38,11 +38,11 @@ class PickDirectoryDialog(val activity: SimpleActivity, val sourcePath: String, val dirs = activity.getCachedDirectories() if (dirs.isNotEmpty()) { - gotDirectories(dirs) + gotDirectories(activity.addTempFolderIfNeeded(dirs)) } GetDirectoriesAsynctask(activity, false, false) { - gotDirectories(it) + gotDirectories(activity.addTempFolderIfNeeded(it)) }.execute() } } From 51b4d9981fd944f64160737e4676fc3900f774cf Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 5 Sep 2017 22:23:15 +0200 Subject: [PATCH 059/207] try removing temp folder at app start too, if available --- .../com/simplemobiletools/gallery/activities/MainActivity.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 38d8cafc1..c484be0a4 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -73,7 +73,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { mIsThirdPartyIntent = mIsPickImageIntent || mIsPickVideoIntent || mIsGetImageContentIntent || mIsGetVideoContentIntent || mIsGetAnyContentIntent || mIsSetWallpaperIntent - config.tempFolderPath = "" + removeTempFolder() directories_refresh_layout.setOnRefreshListener({ getDirectories() }) mDirs = ArrayList() mStoredAnimateGifs = config.animateGifs @@ -159,7 +159,10 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { override fun onDestroy() { super.onDestroy() config.temporarilyShowHidden = false + removeTempFolder() + } + private fun removeTempFolder() { val newFolder = File(config.tempFolderPath) if (newFolder.exists() && newFolder.isDirectory) { if (newFolder.list()?.isEmpty() == true) { From 90b9ed75e1733cffea471e6cde0a270df76be05a Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 5 Sep 2017 22:30:15 +0200 Subject: [PATCH 060/207] update version to 2.14.0 --- app/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index ace0d079e..5af2fcd76 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,8 +10,8 @@ android { applicationId "com.simplemobiletools.gallery" minSdkVersion 16 targetSdkVersion 23 - versionCode 127 - versionName "2.13.4" + versionCode 128 + versionName "2.14.0" } signingConfigs { From 3341a70a4d285d12131d0208ef166ccb1cc88c5a Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 5 Sep 2017 22:30:21 +0200 Subject: [PATCH 061/207] updating changelog --- CHANGELOG.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a2e38f3e1..3f83482a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,15 @@ Changelog ========== +Version 2.14.0 *(2017-09-05)* +---------------------------- + + * Simplified the way of creating new folders + * Added a loop option to slideshows, slowed down the swipe animation + * Added an option to filter out gifs from slideshows + * Improved the quality of fullscreen images + * Properly allow excluding the root folder + Version 2.13.4 *(2017-09-01)* ---------------------------- From 2c2ae9b6c4c61e0c26cafd9518ea11596d6fee3a Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 6 Sep 2017 11:12:52 +0200 Subject: [PATCH 062/207] tweak the functionality of Glide ImageDecoder --- .../gallery/dialogs/SlideshowDialog.kt | 1 - .../gallery/fragments/PhotoFragment.kt | 3 ++- .../simplemobiletools/gallery/helpers/GlideDecoder.kt | 10 +++++++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/SlideshowDialog.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/SlideshowDialog.kt index cffb769b6..493e8a980 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/SlideshowDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/SlideshowDialog.kt @@ -13,7 +13,6 @@ import com.simplemobiletools.gallery.extensions.config import com.simplemobiletools.gallery.helpers.SLIDESHOW_DEFAULT_INTERVAL import kotlinx.android.synthetic.main.dialog_slideshow.view.* - class SlideshowDialog(val activity: SimpleActivity, val callback: () -> Unit) { val view: View diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt index 2e8b5a2ce..8a1f24ffc 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt @@ -167,7 +167,7 @@ class PhotoFragment : ViewPagerFragment() { val options = RequestOptions() .signature(medium.path.getFileSignature()) .format(DecodeFormat.PREFER_ARGB_8888) - .diskCacheStrategy(DiskCacheStrategy.NONE) + .diskCacheStrategy(DiskCacheStrategy.RESOURCE) .override(targetWidth, targetHeight) Glide.with(this) @@ -201,6 +201,7 @@ class PhotoFragment : ViewPagerFragment() { if ((medium.isImage()) && isFragmentVisible && view.subsampling_view.visibility == View.GONE) { view.subsampling_view.apply { setBitmapDecoderClass(GlideDecoder::class.java) + setMaxTileSize(10000) maxScale = 10f beVisible() setImage(ImageSource.uri(medium.path)) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/GlideDecoder.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/GlideDecoder.kt index 9cba5dbef..fe7c7f9e5 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/GlideDecoder.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/GlideDecoder.kt @@ -11,17 +11,25 @@ import com.bumptech.glide.Glide import com.bumptech.glide.load.DecodeFormat import com.bumptech.glide.load.engine.DiskCacheStrategy import com.bumptech.glide.request.RequestOptions +import com.bumptech.glide.request.target.Target import com.davemorrissey.labs.subscaleview.decoder.ImageDecoder +import com.simplemobiletools.gallery.activities.ViewPagerActivity +import com.simplemobiletools.gallery.extensions.getFileSignature class GlideDecoder : ImageDecoder { override fun decode(context: Context, uri: Uri): Bitmap { val exif = android.media.ExifInterface(uri.path) val orientation = exif.getAttributeInt(android.media.ExifInterface.TAG_ORIENTATION, android.media.ExifInterface.ORIENTATION_NORMAL) + val targetWidth = if (ViewPagerActivity.screenWidth == 0) Target.SIZE_ORIGINAL else ViewPagerActivity.screenWidth + val targetHeight = if (ViewPagerActivity.screenHeight == 0) Target.SIZE_ORIGINAL else ViewPagerActivity.screenHeight + val options = RequestOptions() + .signature(uri.path.getFileSignature()) .format(DecodeFormat.PREFER_ARGB_8888) - .diskCacheStrategy(DiskCacheStrategy.NONE) + .diskCacheStrategy(DiskCacheStrategy.RESOURCE) .transform(GlideRotateTransformation(context, getRotationDegrees(orientation))) + .override(targetWidth, targetHeight) val drawable = Glide.with(context) .load(uri) From 188e2f125480bec6601b3395ceb50fd226b2b0c4 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 7 Sep 2017 21:34:44 +0200 Subject: [PATCH 063/207] catch exceptions thrown at ViewPagerActivity --- .../gallery/activities/ViewPagerActivity.kt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt index 6318293ae..fb809047b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -91,8 +91,14 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View cursor?.close() } } else { - mPath = intent.getStringExtra(MEDIUM) - mShowAll = config.showAll + try { + mPath = intent.getStringExtra(MEDIUM) + mShowAll = config.showAll + } catch (e: Exception) { + showErrorToast(e) + finish() + return + } } if (mPath.isEmpty()) { From d46a783423d087858c07a57a549c70467e6a2ad1 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 7 Sep 2017 21:44:30 +0200 Subject: [PATCH 064/207] update version to 2.14.1 (129) --- app/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 5af2fcd76..a4500bd24 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,8 +10,8 @@ android { applicationId "com.simplemobiletools.gallery" minSdkVersion 16 targetSdkVersion 23 - versionCode 128 - versionName "2.14.0" + versionCode 129 + versionName "2.14.1" } signingConfigs { From 918f3beed141d890dea55eac1c7cf68174be6476 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 7 Sep 2017 21:44:57 +0200 Subject: [PATCH 065/207] updating changelog --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f83482a4..8ab949842 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ Changelog ========== +Version 2.14.1 *(2017-09-07)* +---------------------------- + + * Fixing some glitches around fullscreen view + Version 2.14.0 *(2017-09-05)* ---------------------------- From 47134105826efee3fd5e3bfc596a6adc55c2d7e8 Mon Sep 17 00:00:00 2001 From: solokot Date: Sat, 9 Sep 2017 14:29:34 +0300 Subject: [PATCH 066/207] Update strings.xml --- app/src/main/res/values-ru/strings.xml | 66 +++++++++++++------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index ba2bae55d..9cc2b0b4c 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -20,26 +20,26 @@ Добавить 1 столбец Убрать 1 столбец Change cover image - Select photo - Use default - Set as - Volume - Brightness + Выбрать изображение + Использовать по умолчанию + Установить как + Громкость + Яркость - Filter media - Images - Videos - GIFs - No media files have been found with the selected filters. - Change filters + Фильтр медиа + Изображения + Видео + GIF + При заданных фильтрах медиафайлы не найдены. + Изменить фильтры - Эта опция скрывает папку, добавляя в неё файл \'.nomedia\'; будут скрыты все подпапки. Можно показывать их, переключая \'Показать скрытые папки\' в настройках. Продолжить? + Эта функция скрывает папку, добавляя в неё файл \'.nomedia\'; будут скрыты все подпапки. Можно показывать их, переключая \'Показать скрытые папки\' в настройках. Продолжить? Исключить Исключённые папки Управление исключёнными папками - Эта опция исключит выбранные папки вместе с подпапками только для Simple Gallery. Можно управлять исключёнными папками из настроек. + Эта функция исключит выбранные папки вместе с подпапками только для Simple Gallery. Можно управлять исключёнными папками из настроек. Исключить только родительский каталог? Исключая папки, вы сделаете их скрытыми вместе с подпапками в Simple Gallery, но они будут видны в других приложениях. Если вы хотите скрыть их в других приложениях, используйте функцию Скрыть. Удалить всё @@ -72,11 +72,11 @@ Не удалось перезаписать исходный файл Повернуть влево Повернуть вправо - Перевернуть на 180º + Перевернуть на 180° Отразить По горизонтали По вертикали - Edit with + Редактировать в Простые обои @@ -90,36 +90,36 @@ Пейзажное соотношение сторон - Slideshow - Interval (seconds): - Include photos - Include videos - Include GIFs - Random order - Use fade animations - Move backwards - Loop slideshow - The slideshow ended - No media for the slideshow have been found + Слайдшоу + Интервал (секунды): + Включать изображения + Включать видео + Включать GIF + Случайный порядок + Эффект затухания + В обратном направлении + Закольцевать слайдшоу + Слайдшоу закончилось + Никаких медиафайлов для слайдшоу не было найдено. Показать скрытые папки Воспроизводить видео автоматически Переключить отображение имени файла Повторять видео - Анимировать эскизы GIF-файлов + Анимировать эскизы GIF Максимальная яркость при просмотре файлов Нарезать миниатюры в квадраты Полноэкранный поворот Системные настройки Поворот устройства Соотношение сторон - Dark background at fullscreen media - Scroll thumbnails horizontally - Automatically hide system UI at fullscreen media - Delete empty folders after deleting their content - Allow controlling video volume and brightness with vertical gestures - Replace Share with Rotate at fullscreen menu + Тёмный фон в полноэкранном режиме + Прокрутка эскизов по горизонтали + Автоматически скрывать системный интерфейс в полноэкранном режиме + Удалять пустые папки после удаления их содержимого + Управлять громкостью и яркостью видео с помощью вертикальных жестов + Заменить \'Поделиться\' на \'Повернуть\' в меню полноэкранного режима From d81ea17ffe708507bfceb6d85e883edf8ea5c335 Mon Sep 17 00:00:00 2001 From: solokot Date: Sat, 9 Sep 2017 14:35:03 +0300 Subject: [PATCH 067/207] Update strings.xml --- app/src/main/res/values-ru/strings.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 9cc2b0b4c..439f91e4f 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -46,8 +46,8 @@ Очистить список исключённых? Сами папки не будут удалены. - Включенные папки - Управление включенными папками + Включённые папки + Управление включёнными папками Добавление папки Если у вас есть папки содержащие медиа, но не распознанные Simple Gallery. Вы можете добавить их вручную. @@ -72,7 +72,7 @@ Не удалось перезаписать исходный файл Повернуть влево Повернуть вправо - Перевернуть на 180° + Перевернуть на 180º Отразить По горизонтали По вертикали @@ -99,7 +99,7 @@ Эффект затухания В обратном направлении Закольцевать слайдшоу - Слайдшоу закончилось + Слайдшоу завершилось Никаких медиафайлов для слайдшоу не было найдено. From 4c37615d0613ec6957ff9c0493098425de3b1ade Mon Sep 17 00:00:00 2001 From: solokot Date: Sat, 9 Sep 2017 14:43:30 +0300 Subject: [PATCH 068/207] Update strings.xml --- app/src/main/res/values-ru/strings.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 439f91e4f..1576a4b44 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -19,7 +19,7 @@ Не найдено приложения камеры Добавить 1 столбец Убрать 1 столбец - Change cover image + Изменить обложку Выбрать изображение Использовать по умолчанию Установить как @@ -72,7 +72,7 @@ Не удалось перезаписать исходный файл Повернуть влево Повернуть вправо - Перевернуть на 180º + Перевернуть на 180° Отразить По горизонтали По вертикали From 78407c445707e0bf07e81a2eeca79965bc648fd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Sch=C3=A4ferdiek?= Date: Sat, 9 Sep 2017 14:09:23 +0200 Subject: [PATCH 069/207] update german translations --- app/src/main/res/values-de/strings.xml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 6815e2f67..fbfa8bf60 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -19,7 +19,7 @@ Keine Kamera-App gefunden Kacheln verkleinern Kacheln vergrößern - Cover-Bild ändern + Coverbild ändern Auswählen Standard Festlegen als @@ -27,12 +27,12 @@ Helligkeit - Filter media + Medienfilter Images Videos GIFs - No media files have been found with the selected filters. - Change filters + Keine Medien für die ausgewählten Filter gefunden + Filter wechseln Diese Funktion versteckt ausgewählte Ordner (auch für andere Apps), indem dort im Dateisystem eine \'.nomedia\'-Datei abgelegt wird. Dadurch werden auch deren Unterordner versteckt. Solche Ordner werden nur gezeigt, wenn die Einstellung \'Versteckte Ordner zeigen\' aktiv ist (auch andere Apps bieten üblicherweise eine solche Option). Fortfahren? @@ -98,7 +98,7 @@ Zufällige Reihenfolge Übergänge animieren Rückwärts abspielen - Loop slideshow + Slideshow in Endlosschleife Diashow beendet Keine Medien für Diashow gefunden @@ -117,8 +117,8 @@ Schwarzer Hintergrund im Vollbild Kacheln horizontal scrollen Systemleisten ausblenden im Vollbild - Delete empty folders after deleting their content - Allow controlling video volume and brightness with vertical gestures + Lösche leere Ordner nachdem ihr Inhalt gelöscht wurde + Erlaube die Kontrolle von Videolautstärke und Helligkeit über vertikale Gesten Teilen/Drehen im Vollbild-Menü vertauschen From 98aa0ae9a7e12c1e0ff99b6141298c9afd3f1dfc Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 9 Sep 2017 14:36:58 +0200 Subject: [PATCH 070/207] updating some german strings --- app/src/main/res/values-de/strings.xml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 6815e2f67..2cfddfe01 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -28,11 +28,11 @@ Filter media - Images + Bilder Videos GIFs - No media files have been found with the selected filters. - Change filters + Keine entsprechenden Medien gefunden. + Filter ändern Diese Funktion versteckt ausgewählte Ordner (auch für andere Apps), indem dort im Dateisystem eine \'.nomedia\'-Datei abgelegt wird. Dadurch werden auch deren Unterordner versteckt. Solche Ordner werden nur gezeigt, wenn die Einstellung \'Versteckte Ordner zeigen\' aktiv ist (auch andere Apps bieten üblicherweise eine solche Option). Fortfahren? @@ -94,11 +94,11 @@ Intervall (Sekunden): Bilder verwenden Videos verwenden - GIF verwenden + GIFs verwenden Zufällige Reihenfolge Übergänge animieren Rückwärts abspielen - Loop slideshow + Endlos abspielen Diashow beendet Keine Medien für Diashow gefunden @@ -117,8 +117,8 @@ Schwarzer Hintergrund im Vollbild Kacheln horizontal scrollen Systemleisten ausblenden im Vollbild - Delete empty folders after deleting their content - Allow controlling video volume and brightness with vertical gestures + Nach Löschen leere Ordner löschen + Gesten für Video-Lautstärke/Helligkeit Teilen/Drehen im Vollbild-Menü vertauschen From a10b3ecdc6996db031ca597e9c422cec09a8da1e Mon Sep 17 00:00:00 2001 From: en2sv Date: Sun, 10 Sep 2017 10:28:53 +0200 Subject: [PATCH 071/207] Update Swedish translation --- app/src/main/res/values-sv/strings.xml | 50 +++++++++++++------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index 6442a31fe..aa1fea2ec 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -23,16 +23,16 @@ Välj foto Använd standard Ange som - Volume - Brightness + Volym + Ljusstyrka - Filter media - Images - Videos - GIFs - No media files have been found with the selected filters. - Change filters + Filtrera media + Bilder + Videor + GIF-bilder + Inga mediefiler hittades med valda filter. + Ändra filter Denna funktion döljer mappen och alla dess undermappar genom att lägga till en \'.nomedia\'-fil i den. Du kan se dem genom att växla \'Visa dolda mappar\'-alternativet i Inställningar. Vill du fortsätta? @@ -49,7 +49,7 @@ Inkluderade mappar Hantera inkluderade mappar Lägg till mapp - Om du har vissa mappar som innehåller media men som inte känns igen av appen kan du lägga till dem manuellt här. + Om du har vissa mappar som innehåller media men som inte känns igen av appen, kan du lägga till dem manuellt här. Ändra storlek @@ -90,17 +90,17 @@ Liggande bildförhållande - Slideshow - Interval (seconds): - Include photos - Include videos - Include GIFs - Random order - Use fade animations - Move backwards - Loop slideshow - The slideshow ended - No media for the slideshow have been found + Bildspel + Intervall (sekunder): + Inkludera foton + Inkludera videor + Inkludera GIF-bilder + Spela upp i slumpmässig ordning + Använd toningsanimationer + Spela upp i omvänd ordning + Spela upp i en slinga + Bildspelet har avslutats + Ingen media hittades för bildspelet Visa dolda mappar @@ -117,17 +117,17 @@ Mörk bakgrund när media visas i helskärmsläge Rulla horisontellt genom miniatyrer Dölj systemanvändargränssnittet automatiskt när media visas i helskärmsläge - Delete empty folders after deleting their content - Allow controlling video volume and brightness with vertical gestures - Replace Share with Rotate at fullscreen menu + Ta bort tomma mappar när deras innehåll tas bort + Tillåt styrning av videovolym och videoljusstyrka med vertikala gester + Ersätt Dela med Rotera i helskärmsmenyn Ett Galleri för att visa bilder och videos utan en massa reklam. - Ett enkelt verktyg för att visa bilder och vdeos. Objekten kan sorteras efter datum, storlek, namn både stigande och fallande, bilder kan zoomas in. Mediafiler visas i flera kolumner beroende av skärmens storlek, du kan ändra antalet kolumner genom en nyp-rörelse. De går att döpa om, dela, ta bort, kopiera, flytta. Bilder kan också beskäras, roteras och anges som bakgrundsbild direkt från appen. + Ett enkelt verktyg för att visa bilder och videos. Objekten kan sorteras efter datum, storlek, namn både stigande och fallande, bilder kan zoomas in. Mediafiler visas i flera kolumner beroende av skärmens storlek, du kan ändra antalet kolumner genom en nyp-rörelse. De går att döpa om, dela, ta bort, kopiera, flytta. Bilder kan också beskäras, roteras och anges som bakgrundsbild direkt från appen. - Galleriet kan också användas av tredjeparts för förhandsgranskning av bilder / videos, bifoga bilagor i e-postklienter etc. Den är perfekt för det dagliga användandet. + Galleriet kan också användas av tredjepartsappar för förhandsgranskning av bilder / videos, bifoga bilagor i e-postklienter etc. Den är perfekt för det dagliga användandet. Innehåller ingen reklam eller onödiga behörigheter. Det är helt och hållet opensource, innehåller anpassningsbara färger. From 5273ea431bea76ad78ea0217426edfd7a853a062 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 10 Sep 2017 18:57:04 +0200 Subject: [PATCH 072/207] show an error toast if something breaks during loading the image --- .../com/simplemobiletools/gallery/fragments/PhotoFragment.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt index 8a1f24ffc..c722958f3 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt @@ -26,8 +26,10 @@ import com.davemorrissey.labs.subscaleview.ImageSource import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView import com.simplemobiletools.commons.extensions.beGone import com.simplemobiletools.commons.extensions.beVisible +import com.simplemobiletools.commons.extensions.showErrorToast import com.simplemobiletools.commons.extensions.toast import com.simplemobiletools.gallery.R +import com.simplemobiletools.gallery.activities.SimpleActivity import com.simplemobiletools.gallery.activities.ViewPagerActivity import com.simplemobiletools.gallery.extensions.config import com.simplemobiletools.gallery.extensions.getFileSignature @@ -221,9 +223,10 @@ class PhotoFragment : ViewPagerFragment() { override fun onPreviewReleased() { } - override fun onImageLoadError(e: Exception?) { + override fun onImageLoadError(e: Exception) { background = ColorDrawable(Color.TRANSPARENT) beGone() + (activity as SimpleActivity).showErrorToast(e) } override fun onPreviewLoadError(e: Exception?) { From 9e809adf10d83f79a039b923541f17dbd83d2f75 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 10 Sep 2017 19:19:06 +0200 Subject: [PATCH 073/207] update commons to 2.27.10 --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index a4500bd24..bd165fa86 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,7 +37,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.27.9' + compile 'com.simplemobiletools:commons:2.27.10' compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.6.0' compile 'com.theartofdev.edmodo:android-image-cropper:2.4.0' compile 'com.bignerdranch.android:recyclerview-multiselect:0.2' From 316566b09c5818ffbde533fa43178d32a6e21c90 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 10 Sep 2017 19:59:37 +0200 Subject: [PATCH 074/207] clear media on destroy at third party intents --- .../simplemobiletools/gallery/activities/ViewPagerActivity.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt index fb809047b..6e300077d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -160,6 +160,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View } if (config.isThirdPartyIntent) { + mMedia.clear() config.isThirdPartyIntent = false } } From 832d549fedd59787353f9dbcf11d9e09e596ce58 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 10 Sep 2017 21:50:58 +0200 Subject: [PATCH 075/207] remove the manual setting of max tilesize to 10000 --- .../com/simplemobiletools/gallery/fragments/PhotoFragment.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt index c722958f3..d7aca9dbf 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt @@ -203,7 +203,6 @@ class PhotoFragment : ViewPagerFragment() { if ((medium.isImage()) && isFragmentVisible && view.subsampling_view.visibility == View.GONE) { view.subsampling_view.apply { setBitmapDecoderClass(GlideDecoder::class.java) - setMaxTileSize(10000) maxScale = 10f beVisible() setImage(ImageSource.uri(medium.path)) From ffcd632bad0b3a5d682ee84d75097d329a02957b Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 11 Sep 2017 21:15:59 +0200 Subject: [PATCH 076/207] small code style update --- .../com/simplemobiletools/gallery/extensions/activity.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt index d66248274..a7fc915a2 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt @@ -250,10 +250,10 @@ fun SimpleActivity.removeNoMedia(path: String, callback: () -> Unit) { fun SimpleActivity.toggleFileVisibility(oldFile: File, hide: Boolean, callback: (newFile: File) -> Unit) { val path = oldFile.parent var filename = oldFile.name - if (hide) { - filename = ".${filename.trimStart('.')}" + filename = if (hide) { + ".${filename.trimStart('.')}" } else { - filename = filename.substring(1, filename.length) + filename.substring(1, filename.length) } val newFile = File(path, filename) renameFile(oldFile, newFile) { From 624c0e2d083e780fade5ab541d277589eab03841 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 11 Sep 2017 21:34:15 +0200 Subject: [PATCH 077/207] check the filesize only after checking the file type --- .../gallery/extensions/context.kt | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt index d0d6dcd00..3d0d115b6 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt @@ -81,14 +81,6 @@ private fun parseCursor(context: Context, cur: Cursor, isPickImage: Boolean, isP do { try { val path = cur.getStringValue(MediaStore.Images.Media.DATA) - var size = cur.getLongValue(MediaStore.Images.Media.SIZE) - if (size == 0L) { - size = File(path).length() - } - - if (size <= 0L) { - continue - } var filename = cur.getStringValue(MediaStore.Images.Media.DISPLAY_NAME) ?: "" if (filename.isEmpty()) @@ -113,6 +105,15 @@ private fun parseCursor(context: Context, cur: Cursor, isPickImage: Boolean, isP if (!showHidden && filename.startsWith('.')) continue + var size = cur.getLongValue(MediaStore.Images.Media.SIZE) + val file = File(path) + if (size == 0L) { + size = file.length() + } + + if (size <= 0L) + continue + var isExcluded = false excludedFolders.forEach { if (path.startsWith(it)) { @@ -168,11 +169,6 @@ private fun parseCursor(context: Context, cur: Cursor, isPickImage: Boolean, isP private fun getMediaInFolder(folder: String, curMedia: ArrayList, isPickImage: Boolean, isPickVideo: Boolean, filterMedia: Int) { val files = File(folder).listFiles() ?: return for (file in files) { - val size = file.length() - if (size <= 0L) { - continue - } - val filename = file.name val isImage = filename.isImageFast() val isVideo = if (isImage) false else filename.isVideoFast() @@ -190,6 +186,10 @@ private fun getMediaInFolder(folder: String, curMedia: ArrayList, isPick if (isGif && filterMedia and GIFS == 0) continue + val size = file.length() + if (size <= 0L) + continue + val dateTaken = file.lastModified() val dateModified = file.lastModified() From 28ccfb6fe1f49e240345579633b3a12a442bd2e1 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 11 Sep 2017 21:34:23 +0200 Subject: [PATCH 078/207] add a file.exists() check too --- .../kotlin/com/simplemobiletools/gallery/extensions/context.kt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt index 3d0d115b6..8a0613a58 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt @@ -139,6 +139,9 @@ private fun parseCursor(context: Context, cur: Cursor, isPickImage: Boolean, isP } if (!isExcluded || isThirdPartyIntent) { + if (!file.exists()) + continue + val dateTaken = cur.getLongValue(MediaStore.Images.Media.DATE_TAKEN) val dateModified = cur.getIntValue(MediaStore.Images.Media.DATE_MODIFIED) * 1000L From bc82d940b1d6cda45eaa5ebf775f4e982da280f3 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 11 Sep 2017 22:44:04 +0200 Subject: [PATCH 079/207] update commons to 2.27.11 --- app/build.gradle | 2 +- .../com/simplemobiletools/gallery/activities/MediaActivity.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index bd165fa86..d375e73ea 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,7 +37,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.27.10' + compile 'com.simplemobiletools:commons:2.27.11' compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.6.0' compile 'com.theartofdev.edmodo:android-image-cropper:2.4.0' compile 'com.bignerdranch.android:recyclerview-multiselect:0.2' 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 e5d2d7fc7..6ef9182f7 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -309,7 +309,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { mIsGettingMedia = true val token = object : TypeToken>() {}.type - val media = Gson().fromJson>(config.loadFolderMedia(mPath), token) ?: ArrayList(1) + val media = Gson().fromJson>(config.loadFolderMedia(mPath), token) ?: ArrayList(1) if (media.isNotEmpty() && !mLoadedInitialPhotos) { gotMedia(media, true) } else { From 0ba5262f00d54c98cddc4055441fcc73d3d6484a Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 11 Sep 2017 22:47:06 +0200 Subject: [PATCH 080/207] update version to 2.14.2 (130) --- app/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index d375e73ea..5bc9dd503 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,8 +10,8 @@ android { applicationId "com.simplemobiletools.gallery" minSdkVersion 16 targetSdkVersion 23 - versionCode 129 - versionName "2.14.1" + versionCode 130 + versionName "2.14.2" } signingConfigs { From 17947e369acc2b014e1b3f3f12d6f5bcda43de17 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 11 Sep 2017 22:47:11 +0200 Subject: [PATCH 081/207] updating changelog --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ab949842..595a80b08 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,13 @@ Changelog ========== +Version 2.14.2 *(2017-09-11)* +---------------------------- + + * Fixing some glitches with fullscreen images + * Add an extra check to avoid displaying non-existing media + * Fix opening media from third party intents + Version 2.14.1 *(2017-09-07)* ---------------------------- From 7539bf35529b675f56c5f81dd376a05675b44a95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Marques?= Date: Wed, 13 Sep 2017 21:29:16 +0100 Subject: [PATCH 082/207] Update strings.xml --- app/src/main/res/values-pt/strings.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index 0ac84d7d6..d0869b9c2 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -31,7 +31,7 @@ Imagens Vídeos GIFs - Naõ foram encontrados ficheiros que cumpram os requisitos. + Não foram encontrados ficheiros que cumpram os requisitos. Alterar filtros @@ -98,7 +98,7 @@ Ordem aleatória Usar animações Mover para trás - Loop slideshow + Apresentação em ciclo Apresentação terminada Não foram encontrados ficheiros para a apresentação From 0af594ee0bd44eb2d59a0ab0b2d0723576e8a7e0 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 14 Sep 2017 15:40:33 +0200 Subject: [PATCH 083/207] use glide rotate transformation only when needed --- .../com/simplemobiletools/gallery/helpers/GlideDecoder.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/GlideDecoder.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/GlideDecoder.kt index fe7c7f9e5..08d7002b3 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/GlideDecoder.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/GlideDecoder.kt @@ -28,9 +28,12 @@ class GlideDecoder : ImageDecoder { .signature(uri.path.getFileSignature()) .format(DecodeFormat.PREFER_ARGB_8888) .diskCacheStrategy(DiskCacheStrategy.RESOURCE) - .transform(GlideRotateTransformation(context, getRotationDegrees(orientation))) .override(targetWidth, targetHeight) + val degrees = getRotationDegrees(orientation) + if (degrees != 0f) + options.transform(GlideRotateTransformation(context, getRotationDegrees(orientation))) + val drawable = Glide.with(context) .load(uri) .apply(options) From 6f3fd675e23d99de6d963d66682e4d3119f42fff Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 15 Sep 2017 15:48:18 +0200 Subject: [PATCH 084/207] remove some empty spaces --- .../com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt index 08e08e439..86fbc9e4e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt @@ -405,8 +405,6 @@ class DirectoryAdapter(val activity: SimpleActivity, var dirs: MutableList Date: Fri, 15 Sep 2017 23:22:33 +0200 Subject: [PATCH 085/207] simplify the squareImageView creation --- .../com/simplemobiletools/gallery/views/MySquareImageView.kt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/views/MySquareImageView.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/views/MySquareImageView.kt index 3e0c79df1..f254d4183 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/views/MySquareImageView.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/views/MySquareImageView.kt @@ -14,8 +14,7 @@ class MySquareImageView : ImageView { constructor(context: Context, attrs: AttributeSet, defStyle: Int) : super(context, attrs, defStyle) override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) { - super.onMeasure(widthMeasureSpec, heightMeasureSpec) - val spec = if (isVerticalScrolling) measuredWidth else measuredHeight - setMeasuredDimension(spec, spec) + val spec = if (isVerticalScrolling) widthMeasureSpec else heightMeasureSpec + super.onMeasure(spec, spec) } } From d09acabdc3f6643fff3721471a0ddf241859024e Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 16 Sep 2017 20:20:25 +0200 Subject: [PATCH 086/207] use match_parent height at directories grid --- app/src/main/res/layout/dialog_directory_picker.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/layout/dialog_directory_picker.xml b/app/src/main/res/layout/dialog_directory_picker.xml index 0a586affb..bc18bfb19 100644 --- a/app/src/main/res/layout/dialog_directory_picker.xml +++ b/app/src/main/res/layout/dialog_directory_picker.xml @@ -10,7 +10,7 @@ From f7e7d83382b92888d21fabbebd3ce3962f2ee67e Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 16 Sep 2017 20:20:43 +0200 Subject: [PATCH 087/207] do not force ARGB_8888 format at fullscreen media --- .../com/simplemobiletools/gallery/helpers/GlideDecoder.kt | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/GlideDecoder.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/GlideDecoder.kt index 08d7002b3..fbddb788b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/GlideDecoder.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/GlideDecoder.kt @@ -8,7 +8,6 @@ import android.graphics.drawable.Drawable import android.media.ExifInterface import android.net.Uri import com.bumptech.glide.Glide -import com.bumptech.glide.load.DecodeFormat import com.bumptech.glide.load.engine.DiskCacheStrategy import com.bumptech.glide.request.RequestOptions import com.bumptech.glide.request.target.Target @@ -26,7 +25,6 @@ class GlideDecoder : ImageDecoder { val options = RequestOptions() .signature(uri.path.getFileSignature()) - .format(DecodeFormat.PREFER_ARGB_8888) .diskCacheStrategy(DiskCacheStrategy.RESOURCE) .override(targetWidth, targetHeight) From 9247b5119478f0bafdac48251b27f31cb8a85954 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 16 Sep 2017 20:37:18 +0200 Subject: [PATCH 088/207] lets not toast errors if loading fullscreen media fails --- .../com/simplemobiletools/gallery/fragments/PhotoFragment.kt | 3 --- 1 file changed, 3 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt index d7aca9dbf..c24c09f96 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt @@ -26,10 +26,8 @@ import com.davemorrissey.labs.subscaleview.ImageSource import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView import com.simplemobiletools.commons.extensions.beGone import com.simplemobiletools.commons.extensions.beVisible -import com.simplemobiletools.commons.extensions.showErrorToast import com.simplemobiletools.commons.extensions.toast import com.simplemobiletools.gallery.R -import com.simplemobiletools.gallery.activities.SimpleActivity import com.simplemobiletools.gallery.activities.ViewPagerActivity import com.simplemobiletools.gallery.extensions.config import com.simplemobiletools.gallery.extensions.getFileSignature @@ -225,7 +223,6 @@ class PhotoFragment : ViewPagerFragment() { override fun onImageLoadError(e: Exception) { background = ColorDrawable(Color.TRANSPARENT) beGone() - (activity as SimpleActivity).showErrorToast(e) } override fun onPreviewLoadError(e: Exception?) { From ea74fcf2c494258c2b9880aaa7905b7a5e5e2901 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 16 Sep 2017 22:13:15 +0200 Subject: [PATCH 089/207] disable swipe-to-refresh in horizontal scrolling --- .../com/simplemobiletools/gallery/activities/MainActivity.kt | 2 ++ .../com/simplemobiletools/gallery/activities/MediaActivity.kt | 2 ++ 2 files changed, 4 insertions(+) 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 c484be0a4..42dc79140 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -462,6 +462,8 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { } private fun setupScrollDirection() { + directories_refresh_layout.isEnabled = !config.scrollHorizontally + directories_vertical_fastscroller.isHorizontal = false directories_vertical_fastscroller.beGoneIf(config.scrollHorizontally) 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 6ef9182f7..67765fab8 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -159,6 +159,8 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { } private fun setupScrollDirection() { + media_refresh_layout.isEnabled = !config.scrollHorizontally + media_vertical_fastscroller.isHorizontal = false media_vertical_fastscroller.beGoneIf(config.scrollHorizontally) From b8478f1a5c11fca7cd02235f473d4a9b4f2038c8 Mon Sep 17 00:00:00 2001 From: SuperUser Date: Sat, 16 Sep 2017 16:13:23 -0400 Subject: [PATCH 090/207] Add full copy of the Apache license This pull request adds a full copy of the Apache 2.0 license to uncopyright the code correctly. Current file leaves the code technically copyrighted since that statement included is only supposed to be used if the license is present in the repository. --- LICENSE | 208 +++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 198 insertions(+), 10 deletions(-) diff --git a/LICENSE b/LICENSE index 28c26588c..ff97af7d9 100644 --- a/LICENSE +++ b/LICENSE @@ -1,13 +1,201 @@ -Copyright 2016 SimpleMobileTools + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - https://www.apache.org/licenses/LICENSE-2.0 + 1. Definitions. -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2017 SimpleMobileTools + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. From a64195750fd55fb6cfee26933b84eb16bae3e3f6 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 16 Sep 2017 22:31:00 +0200 Subject: [PATCH 091/207] remove some visual glitches at horizontally swiping at the folder thumbnails --- app/src/main/res/layout/directory_item.xml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/src/main/res/layout/directory_item.xml b/app/src/main/res/layout/directory_item.xml index f6d296e07..6903b7f46 100644 --- a/app/src/main/res/layout/directory_item.xml +++ b/app/src/main/res/layout/directory_item.xml @@ -39,7 +39,9 @@ android:id="@+id/dir_shadow_holder" android:layout_width="match_parent" android:layout_height="@dimen/tmb_shadow_height" + android:layout_alignLeft="@+id/dir_bottom_holder" android:layout_alignParentBottom="true" + android:layout_alignRight="@+id/dir_bottom_holder" android:background="@drawable/gradient_background"/> Date: Sun, 17 Sep 2017 10:50:23 +0200 Subject: [PATCH 092/207] change the way we get layout position in adapters --- .../gallery/adapters/DirectoryAdapter.kt | 24 +++++++++---------- .../gallery/adapters/MediaAdapter.kt | 24 +++++++++---------- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt index 86fbc9e4e..02aae82b2 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt @@ -336,7 +336,7 @@ class DirectoryAdapter(val activity: SimpleActivity, var dirs: MutableList -1 && min < to) { - (min..to - 1).filter { it != from } + (min until to).filter { it != from } .forEach { toggleItemSelection(false, it) } } if (max > -1) { @@ -386,7 +386,7 @@ class DirectoryAdapter(val activity: SimpleActivity, var dirs: MutableList -1) { - for (i in min..from - 1) + for (i in min until from) toggleItemSelection(false, i) } } @@ -395,7 +395,7 @@ class DirectoryAdapter(val activity: SimpleActivity, var dirs: MutableList (Unit)) : SwappingHolder(view, MultiSelector()) { - fun bindView(directory: Directory, isPinned: Boolean, scrollVertically: Boolean): View { + fun bindView(directory: Directory, isPinned: Boolean, scrollVertically: Boolean, position: Int): View { itemView.apply { dir_name.text = directory.name photo_cnt.text = directory.mediaCnt.toString() @@ -403,29 +403,29 @@ class DirectoryAdapter(val activity: SimpleActivity, var dirs: MutableList, } override fun onBindViewHolder(holder: ViewHolder, position: Int) { - itemViews.put(position, holder.bindView(media[position], displayFilenames, scrollVertically)) + itemViews.put(position, holder.bindView(media[position], displayFilenames, scrollVertically, position)) toggleItemSelection(selectedPositions.contains(position), position) holder.itemView.tag = holder } @@ -289,7 +289,7 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList, toggleItemSelection(true, i) if (min > -1 && min < to) { - (min..to - 1).filter { it != from } + (min until to).filter { it != from } .forEach { toggleItemSelection(false, it) } } if (max > -1) { @@ -306,7 +306,7 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList, } if (min > -1) { - for (i in min..from - 1) + for (i in min until from) toggleItemSelection(false, i) } } @@ -315,36 +315,36 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList, class ViewHolder(val view: View, val adapterListener: MyAdapterListener, val activity: SimpleActivity, val multiSelectorCallback: ModalMultiSelectorCallback, val multiSelector: MultiSelector, val listener: MediaOperationsListener?, val isPickIntent: Boolean, val itemClick: (Medium) -> (Unit)) : SwappingHolder(view, MultiSelector()) { - fun bindView(medium: Medium, displayFilenames: Boolean, scrollVertically: Boolean): View { + fun bindView(medium: Medium, displayFilenames: Boolean, scrollVertically: Boolean, position: Int): View { itemView.apply { play_outline.visibility = if (medium.video) View.VISIBLE else View.GONE photo_name.beVisibleIf(displayFilenames) photo_name.text = medium.name activity.loadImage(medium.path, medium_thumbnail, scrollVertically) - setOnClickListener { viewClicked(medium) } - setOnLongClickListener { if (isPickIntent) viewClicked(medium) else viewLongClicked(); true } + setOnClickListener { viewClicked(medium, position) } + setOnLongClickListener { if (isPickIntent) viewClicked(medium, position) else viewLongClicked(position); true } } return itemView } - fun viewClicked(medium: Medium) { + private fun viewClicked(medium: Medium, position: Int) { if (multiSelector.isSelectable) { - val isSelected = adapterListener.getSelectedPositions().contains(layoutPosition) - adapterListener.toggleItemSelectionAdapter(!isSelected, layoutPosition) + val isSelected = adapterListener.getSelectedPositions().contains(position) + adapterListener.toggleItemSelectionAdapter(!isSelected, position) } else { itemClick(medium) } } - fun viewLongClicked() { + private fun viewLongClicked(position: Int) { if (listener != null) { if (!multiSelector.isSelectable) { activity.startSupportActionMode(multiSelectorCallback) - adapterListener.toggleItemSelectionAdapter(true, layoutPosition) + adapterListener.toggleItemSelectionAdapter(true, position) } - listener.itemLongClicked(layoutPosition) + listener.itemLongClicked(position) } } From 2fe1f91c87a8bef7ee072a2672209a48ee26327b Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 17 Sep 2017 11:07:14 +0200 Subject: [PATCH 093/207] moving a toast further --- .../simplemobiletools/gallery/activities/ViewPagerActivity.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt index 6e300077d..468e2d69c 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -511,8 +511,8 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View val bmp = Bitmap.createBitmap(bitmap, 0, 0, bitmap.width, bitmap.height, matrix, true) bmp.compress(file.getCompressionFormat(), 90, out) out.flush() - toast(R.string.file_saved) out.close() + toast(R.string.file_saved) } From 56a31e6ced95b9a923099503f66250067c4fc8d6 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 17 Sep 2017 11:17:51 +0200 Subject: [PATCH 094/207] fix #326, properly set bottom padding in landscape mode videos --- .../gallery/extensions/context.kt | 29 +++++++++++++++++++ .../gallery/fragments/VideoFragment.kt | 6 ++-- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt index 8a0613a58..51ac6da09 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt @@ -4,9 +4,12 @@ import android.content.Context import android.content.Intent import android.content.res.Configuration import android.database.Cursor +import android.graphics.Point import android.media.AudioManager import android.net.Uri +import android.os.Build import android.provider.MediaStore +import android.view.WindowManager import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.helpers.SORT_BY_DATE_MODIFIED import com.simplemobiletools.commons.helpers.SORT_BY_NAME @@ -19,6 +22,32 @@ import java.io.File val Context.portrait get() = resources.configuration.orientation == Configuration.ORIENTATION_PORTRAIT val Context.audioManager get() = getSystemService(Context.AUDIO_SERVICE) as AudioManager +val Context.windowManager: WindowManager get() = getSystemService(Context.WINDOW_SERVICE) as WindowManager +val Context.navigationBarRight: Boolean get() = usableScreenSize.x < realScreenSize.x +val Context.navigationBarBottom: Boolean get() = usableScreenSize.y < realScreenSize.y +val Context.navigationBarHeight: Int get() = if (navigationBarBottom) navigationBarSize.y else 0 + +internal val Context.navigationBarSize: Point + get() = when { + navigationBarRight -> Point(realScreenSize.x - usableScreenSize.x, usableScreenSize.y) + navigationBarBottom -> Point(usableScreenSize.x, realScreenSize.y - usableScreenSize.y) + else -> Point() + } + +val Context.usableScreenSize: Point + get() { + val size = Point() + windowManager.defaultDisplay.getSize(size) + return size + } + +val Context.realScreenSize: Point + get() { + val size = Point() + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) + windowManager.defaultDisplay.getRealSize(size) + return size + } fun Context.getRealPathFromURI(uri: Uri): String? { var cursor: Cursor? = null diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt index a2762d99a..1828912e7 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt @@ -20,10 +20,7 @@ import com.simplemobiletools.commons.extensions.toast import com.simplemobiletools.commons.extensions.updateTextColors import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.activities.ViewPagerActivity -import com.simplemobiletools.gallery.extensions.audioManager -import com.simplemobiletools.gallery.extensions.config -import com.simplemobiletools.gallery.extensions.getNavBarHeight -import com.simplemobiletools.gallery.extensions.hasNavBar +import com.simplemobiletools.gallery.extensions.* import com.simplemobiletools.gallery.helpers.MEDIUM import com.simplemobiletools.gallery.models.Medium import kotlinx.android.synthetic.main.pager_video_item.view.* @@ -273,6 +270,7 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee bottom += height } else { right += height + bottom += context.navigationBarHeight } mTimeHolder!!.setPadding(left, top, right, bottom) } From fc3363987ee005d2ca3496a7d47458b8fbbd28ca Mon Sep 17 00:00:00 2001 From: anthologist Date: Sun, 17 Sep 2017 11:25:00 +0200 Subject: [PATCH 095/207] Updated italian --- app/src/main/res/values-it/strings.xml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index b723068ba..725bdbf01 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -27,12 +27,12 @@ Luminosità - Filter media - Images - Videos - GIFs - No media files have been found with the selected filters. - Change filters + Filtra i media + Immagini + Video + GIF + Nessun file trovato per il filtro selezionato. + Cambia filtro Questa funzione nasconde la cartella aggiungendo un file \'.nomedia\' all\'interno, nasconderà anche tutte le sottocartelle. Puoi vederle attivando l\'opzione \'Mostra cartelle nascoste\' nelle impostazioni. Continuare? @@ -98,7 +98,7 @@ Ordine sparso Usa animazioni a dissolvenza Scorri al contrario - Loop slideshow + Ripeti presentazione La presentazione è terminata Nessun media trovato per la presentazione @@ -117,8 +117,8 @@ Sfondo scuro a schermo intero Scorri miniature orizzontalmente Nascondi UI di sistema con media a schermo intero - Delete empty folders after deleting their content - Allow controlling video volume and brightness with vertical gestures + Elimina cartelle vuote dopo averne eliminato il contenuto + Gestisci il volume e la luminosità dei video con gesti verticali Sostituisci Condividi con Ruota a schermo intero From 3c01cb9fb62cdfffef015cdef9fcd5808e5474f6 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 17 Sep 2017 22:21:29 +0200 Subject: [PATCH 096/207] update commons to 2.28.0 --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 5bc9dd503..d1a3d40a5 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,7 +37,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.27.11' + compile 'com.simplemobiletools:commons:2.28.0' compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.6.0' compile 'com.theartofdev.edmodo:android-image-cropper:2.4.0' compile 'com.bignerdranch.android:recyclerview-multiselect:0.2' From de264466feb47857bc3bda5a01719164adeed146 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 17 Sep 2017 23:05:52 +0200 Subject: [PATCH 097/207] update version to 2.14.3 --- app/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index d1a3d40a5..78040bab9 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,8 +10,8 @@ android { applicationId "com.simplemobiletools.gallery" minSdkVersion 16 targetSdkVersion 23 - versionCode 130 - versionName "2.14.2" + versionCode 131 + versionName "2.14.3" } signingConfigs { From 11be1b1e14daa57576034e9388b4fb243441cc60 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 17 Sep 2017 23:05:58 +0200 Subject: [PATCH 098/207] updating changelog --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 595a80b08..ffbe7a0df 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,14 @@ Changelog ========== +Version 2.14.3 *(2017-09-17)* +---------------------------- + + * Removed some error toast messages after delete, or if image loading failed + * Fixed some visual glitches at horizontal scrolling + * Disable pull-to-refresh at horizontal scrolling + * Many other smaller bugfixes and improvements + Version 2.14.2 *(2017-09-11)* ---------------------------- From 6ed100e2047914bcf879bb0cff46ebb20ecac15a Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 18 Sep 2017 10:31:45 +0200 Subject: [PATCH 099/207] do not use GlideDecoder at SubsamplingScaleImageView for now --- .../com/simplemobiletools/gallery/fragments/PhotoFragment.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt index c24c09f96..c3709bd68 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt @@ -200,7 +200,7 @@ class PhotoFragment : ViewPagerFragment() { private fun addZoomableView() { if ((medium.isImage()) && isFragmentVisible && view.subsampling_view.visibility == View.GONE) { view.subsampling_view.apply { - setBitmapDecoderClass(GlideDecoder::class.java) + //setBitmapDecoderClass(GlideDecoder::class.java) // causing random crashes on Android 7+ maxScale = 10f beVisible() setImage(ImageSource.uri(medium.path)) From 07429c70093985a851ed7a382b0af65ed77f0259 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 18 Sep 2017 10:32:07 +0200 Subject: [PATCH 100/207] update version to 2.14.4 (132) --- app/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 78040bab9..90b986ddb 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,8 +10,8 @@ android { applicationId "com.simplemobiletools.gallery" minSdkVersion 16 targetSdkVersion 23 - versionCode 131 - versionName "2.14.3" + versionCode 132 + versionName "2.14.4" } signingConfigs { From 7597efcba272fd597403a6b2d33b83328a54dc5b Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 18 Sep 2017 10:32:46 +0200 Subject: [PATCH 101/207] updating changelog --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ffbe7a0df..19b5481bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ Changelog ========== +Version 2.14.4 *(2017-09-18)* +---------------------------- + + * Revert to the old way of loading fullscreen images to avoid issues on Android 7+ + Version 2.14.3 *(2017-09-17)* ---------------------------- From aa160841922ee40be52fed867eaa8ad2c5176723 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 18 Sep 2017 20:25:03 +0200 Subject: [PATCH 102/207] use layoutPosition at directory and media adapters --- .../gallery/adapters/DirectoryAdapter.kt | 20 +++++++++---------- .../gallery/adapters/MediaAdapter.kt | 20 +++++++++---------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt index 02aae82b2..c7e3dcbbf 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt @@ -336,7 +336,7 @@ class DirectoryAdapter(val activity: SimpleActivity, var dirs: MutableList (Unit)) : SwappingHolder(view, MultiSelector()) { - fun bindView(directory: Directory, isPinned: Boolean, scrollVertically: Boolean, position: Int): View { + fun bindView(directory: Directory, isPinned: Boolean, scrollVertically: Boolean): View { itemView.apply { dir_name.text = directory.name photo_cnt.text = directory.mediaCnt.toString() @@ -403,29 +403,29 @@ class DirectoryAdapter(val activity: SimpleActivity, var dirs: MutableList, } override fun onBindViewHolder(holder: ViewHolder, position: Int) { - itemViews.put(position, holder.bindView(media[position], displayFilenames, scrollVertically, position)) + itemViews.put(position, holder.bindView(media[position], displayFilenames, scrollVertically)) toggleItemSelection(selectedPositions.contains(position), position) holder.itemView.tag = holder } @@ -315,36 +315,36 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList, class ViewHolder(val view: View, val adapterListener: MyAdapterListener, val activity: SimpleActivity, val multiSelectorCallback: ModalMultiSelectorCallback, val multiSelector: MultiSelector, val listener: MediaOperationsListener?, val isPickIntent: Boolean, val itemClick: (Medium) -> (Unit)) : SwappingHolder(view, MultiSelector()) { - fun bindView(medium: Medium, displayFilenames: Boolean, scrollVertically: Boolean, position: Int): View { + fun bindView(medium: Medium, displayFilenames: Boolean, scrollVertically: Boolean): View { itemView.apply { play_outline.visibility = if (medium.video) View.VISIBLE else View.GONE photo_name.beVisibleIf(displayFilenames) photo_name.text = medium.name activity.loadImage(medium.path, medium_thumbnail, scrollVertically) - setOnClickListener { viewClicked(medium, position) } - setOnLongClickListener { if (isPickIntent) viewClicked(medium, position) else viewLongClicked(position); true } + setOnClickListener { viewClicked(medium) } + setOnLongClickListener { if (isPickIntent) viewClicked(medium) else viewLongClicked(); true } } return itemView } - private fun viewClicked(medium: Medium, position: Int) { + private fun viewClicked(medium: Medium) { if (multiSelector.isSelectable) { - val isSelected = adapterListener.getSelectedPositions().contains(position) - adapterListener.toggleItemSelectionAdapter(!isSelected, position) + val isSelected = adapterListener.getSelectedPositions().contains(layoutPosition) + adapterListener.toggleItemSelectionAdapter(!isSelected, layoutPosition) } else { itemClick(medium) } } - private fun viewLongClicked(position: Int) { + private fun viewLongClicked() { if (listener != null) { if (!multiSelector.isSelectable) { activity.startSupportActionMode(multiSelectorCallback) - adapterListener.toggleItemSelectionAdapter(true, position) + adapterListener.toggleItemSelectionAdapter(true, layoutPosition) } - listener.itemLongClicked(position) + listener.itemLongClicked(layoutPosition) } } From 11068f5d7582c52dae52dce04fa64910c1f848c4 Mon Sep 17 00:00:00 2001 From: Unknown Date: Wed, 20 Sep 2017 00:57:38 +0900 Subject: [PATCH 103/207] Update Japanese translation --- app/src/main/res/values-ja/strings.xml | 168 ++++++++++++------------- 1 file changed, 84 insertions(+), 84 deletions(-) diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index f0fbd9f19..869005886 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -4,122 +4,122 @@ ギャラリー 編集 カメラを開く - …で開く + 別のアプリで開く 有効なアプリが見つかりません (非表示) - Pin folder - Unpin folder - Show all folders content - All media - Switch to folder view - Other folder - Show on map - Unknown location - No application with maps has been found - No Camera app has been found - Increase column count - Reduce column count - Change cover image - Select photo - Use default - Set as - Volume - Brightness + フォルダーをピン留めする + フォルダーのピン留めを外す + すべてのフォルダーの内容を表示 + すべてのフォルダー + フォルダーを選択する + その他のフォルダー + 地図で表示 + 位置情報がありません + 地図アプリが見つかりません + カメラアプリが見つかりません + 表示列数を増やす + 表示列数を減らす + カバー画像を変更 + 写真を選択 + デフォルトに戻す + 他で使う + 音量 + 明るさ - Filter media - Images - Videos - GIFs - No media files have been found with the selected filters. - Change filters + 絞り込み + 画像 + ビデオ + GIF + 絞り込み条件に該当するメディアがありません。 + 絞り込み条件を変更 - This function hides the folder by adding a \'.nomedia\' file into it, it will hide all subfolders too. You can see them by toggling the \'Show hidden folders\' option in Settings. Continue? - Exclude - Excluded folders - Manage excluded folders - This will exclude the selection together with its subfolders from Simple Gallery only. You can manage excluded folders in Settings. - Exclude a parent instead? - Excluding folders will make them together with their subfolders hidden just in Simple Gallery, they will still be visible in other applications.\\n\\nIf you want to hide them from other apps too, use the Hide function. - Remove all - Remove all folders from the list of excluded? This will not delete the folders. + 対象のフォルダーに「.nomedia」というファイルを作成し、フォルダーを非表示にします。そのフォルダー以下のすべてのサブフォルダーも、同様に非表示となります。非表示となったフォルダーを見るには、「設定」の中にある「非表示のフォルダーを表示」オプションを切り替えてください。このフォルダーを非表示にしますか? + 除外する + 除外フォルダー + 除外フォルダーを管理 + 選択したフォルダーとそのサブフォルダーを、Simple Galleyの一覧から除外します。除外したフォルダーは「設定」で管理できます。 + 親フォルダーを選択して除外することもできます。 + フォルダーを除外すると、サブフォルダーも含めSimple Galleyの一覧から除外します。他のアプリでは引き続き表示されます。\\n\\n他のアプリでも非表示にしたい場合は、「非表示」機能を使用してください。 + すべて解除 + 除外するフォルダーの登録をすべて解除しますか? フォルダー自体は削除されません。 - Included folders - Manage included folders - Add folder - If you have some folders which contain media, but were not recognized by the app, you can add them manually here. + 追加フォルダー + 追加フォルダーを管理 + フォルダーを追加 + メディアを含んでいるフォルダーがアプリから認識されていない場合は、手動で追加できます。 - Resize - Resize selection and save - Width - Height - Keep aspect ratio - Please enter a valid resolution + リサイズ + 選択領域をリサイズして保存 + + 高さ + 縦横比を固定 + 解像度を正しく入力してください エディター 保存 回転 - Path + パス 無効な画像パス 画像の編集に失敗しました 画像を編集: 画像エディターが見つかりません ファイルの場所が不明です 元のファイルを上書きできません - Rotate left - Rotate right - Rotate by 180º - Flip - Flip horizontally - Flip vertically - Edit with + 左に回転 + 右に回転 + 180º回転 + 反転 + 水平方向に反転 + 垂直方向に反転 + 他のアプリで編集 シンプル壁紙 - 壁紙として設定 - 壁紙としての設定に失敗しました - 壁紙として設定: + 壁紙に設定 + 壁紙の設定に失敗しました + 壁紙に設定: 対応できるアプリが見つかりません - 壁紙の設定… + 壁紙に設定中… 壁紙を正常に設定しました - Portrait aspect ratio - Landscape aspect ratio + 縦向きの縦横比 + 横向きの縦横比 - Slideshow - Interval (seconds): - Include photos - Include videos - Include GIFs - Random order - Use fade animations - Move backwards - Loop slideshow - The slideshow ended - No media for the slideshow have been found + スライドショー + 間隔 (秒): + 写真を含める + ビデオを含める + GIFを含める + ランダムな順序 + フェードアニメーションを使用する + 逆方向に進む + スライドショーをリピート再生する + スライドショーが終了しました + スライドショーに表示するメディアがありません 非表示フォルダーを表示 - 自動的にビデオを再生 + ビデオを自動再生する ファイル名の表示を切り替え - Loop videos - Animate GIFs at thumbnails - Max brightness when viewing media - Crop thumbnails into squares - Rotate fullscreen media by - System setting - Device rotation - Aspect ratio - Dark background at fullscreen media - Scroll thumbnails horizontally - Automatically hide system UI at fullscreen media - Delete empty folders after deleting their content - Allow controlling video volume and brightness with vertical gestures - Replace Share with Rotate at fullscreen menu + ビデオをリピート再生する + GIF画像のサムネイルをアニメーション表示する + メディア再生時に明るさを最大にする + サムネイルを正方形に切り取る + メディア再生時のフルスクリーン表示切り替え + システム設定に従う + 端末の向きに従う + メディアの縦横比に従う + 黒背景でフルスクリーン表示 + サムネイル画面を横方向にスクロール + フルスクリーン時にシステムUIを非表示にする + メディアの削除後にフォルダーが空になった場合、そのフォルダーを削除する + ビデオ再生中に、音量と明るさを縦方向のジェスチャーで変更する + フルスクリーンメニューの「共有」を「回転」に置き換える From c314d3dad71a0f04383b7fb43fefc112093f05b7 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 20 Sep 2017 23:50:28 +0200 Subject: [PATCH 104/207] updating some Frech string styling --- app/src/main/res/values-fr/strings.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index ec733b59c..cb8271195 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -125,13 +125,13 @@ Un album pour visionner photos et vidéos sans publicité. - Un simple outil pour visionner les photos et les vidéos. Elles peuvent être triées par dates, tailles, noms dans les deux sens (alphabétique comme désalphabétique), il est possible de zoomer sur les photos. Les fichiers sont affichés sur de multiple colonnes en fonction de la taille de l\'écran, vous pouvez changer le nombre de colonnes par pincement. Elles peuvent être renommées, partagées, supprimées, copiées et déplacées. Les images peuvent en plus être tournées, rognées ou être définies comme fond d\'écran directement depuis l\'application. La galerie est aussi offerte pour l\'utiliser comme une tierce partie pour de la prévisualisation des images/vidéos, joindre aux clients mail etc. C\'est parfait pour un usage au quotidien. + Un simple outil pour visionner les photos et les vidéos. Elles peuvent être triées par dates, tailles, noms dans les deux sens (alphabétique comme désalphabétique), il est possible de zoomer sur les photos. Les fichiers sont affichés sur de multiple colonnes en fonction de la taille de l\'écran, vous pouvez changer le nombre de colonnes par pincement. Elles peuvent être renommées, partagées, supprimées, copiées et déplacées. Les images peuvent en plus être tournées, rognées ou être définies comme fond d\'écran directement depuis l\'application. + + La galerie est aussi offerte pour l\'utiliser comme une tierce partie pour de la prévisualisation des images/vidéos, joindre aux clients mail etc. C\'est parfait pour un usage au quotidien. L\'application ne contient ni de publicité ni d\'autorisation inutile. Elle est totalement OpenSource et est aussi fournie avec un thème sombre. - Cette application est juste l\'une des applications d\'une plus grande suite. - - Vous pouvez trouver les autres sur http://www.simplemobiletools.com + Cette application est juste l\'une des applications d\'une plus grande suite. Vous pouvez trouver les autres sur http://www.simplemobiletools.com - 絞り込み + 表示メディア種 画像 ビデオ GIF From faf0aba579e6e75b067f948e46dcdfe195acc10d Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 23 Sep 2017 12:15:26 +0200 Subject: [PATCH 106/207] update commons to 2.28.4 --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 90b986ddb..2e21c56de 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,7 +37,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.28.0' + compile 'com.simplemobiletools:commons:2.28.4' compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.6.0' compile 'com.theartofdev.edmodo:android-image-cropper:2.4.0' compile 'com.bignerdranch.android:recyclerview-multiselect:0.2' From 2640f99e229e89d7a88ef186b23c27759d29d18e Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 23 Sep 2017 12:15:41 +0200 Subject: [PATCH 107/207] update kotlin to 1.1.50 --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 2e21c56de..c50f15187 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -52,7 +52,7 @@ dependencies { } buildscript { - ext.kotlin_version = '1.1.4-3' + ext.kotlin_version = '1.1.50' repositories { mavenCentral() } From 7a653ec0c6211dd8b44df41f0b53cc17e3b8cbc8 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 24 Sep 2017 22:51:03 +0200 Subject: [PATCH 108/207] some code style update at the Directory and Medium classes --- .../gallery/models/Directory.kt | 40 ++++++++----------- .../gallery/models/Medium.kt | 40 ++++++++----------- 2 files changed, 34 insertions(+), 46 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/models/Directory.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/models/Directory.kt index 6293eba76..ec877c43c 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/models/Directory.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/models/Directory.kt @@ -16,29 +16,23 @@ data class Directory(val path: String, val tmb: String, val name: String, var me override fun compareTo(other: Directory): Int { var result: Int - if (sorting and SORT_BY_NAME != 0) { - result = AlphanumComparator().compare(name.toLowerCase(), other.name.toLowerCase()) - } else if (sorting and SORT_BY_SIZE != 0) { - result = if (size == other.size) - 0 - else if (size > other.size) - 1 - else - -1 - } else if (sorting and SORT_BY_DATE_MODIFIED != 0) { - result = if (modified == other.modified) - 0 - else if (modified > other.modified) - 1 - else - -1 - } else { - result = if (taken == other.taken) - 0 - else if (taken > other.taken) - 1 - else - -1 + when { + sorting and SORT_BY_NAME != 0 -> result = AlphanumComparator().compare(name.toLowerCase(), other.name.toLowerCase()) + sorting and SORT_BY_SIZE != 0 -> result = when { + size == other.size -> 0 + size > other.size -> 1 + else -> -1 + } + sorting and SORT_BY_DATE_MODIFIED != 0 -> result = when { + modified == other.modified -> 0 + modified > other.modified -> 1 + else -> -1 + } + else -> result = when { + taken == other.taken -> 0 + taken > other.taken -> 1 + else -> -1 + } } if (sorting and SORT_DESCENDING != 0) { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/models/Medium.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/models/Medium.kt index 1663c60b1..a04a39aa9 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/models/Medium.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/models/Medium.kt @@ -25,29 +25,23 @@ data class Medium(var name: String, var path: String, val video: Boolean, val mo override fun compareTo(other: Medium): Int { var result: Int - if (sorting and SORT_BY_NAME != 0) { - result = AlphanumComparator().compare(name.toLowerCase(), other.name.toLowerCase()) - } else if (sorting and SORT_BY_SIZE != 0) { - result = if (size == other.size) - 0 - else if (size > other.size) - 1 - else - -1 - } else if (sorting and SORT_BY_DATE_MODIFIED != 0) { - result = if (modified == other.modified) - 0 - else if (modified > other.modified) - 1 - else - -1 - } else { - result = if (taken == other.taken) - 0 - else if (taken > other.taken) - 1 - else - -1 + when { + sorting and SORT_BY_NAME != 0 -> result = AlphanumComparator().compare(name.toLowerCase(), other.name.toLowerCase()) + sorting and SORT_BY_SIZE != 0 -> result = when { + size == other.size -> 0 + size > other.size -> 1 + else -> -1 + } + sorting and SORT_BY_DATE_MODIFIED != 0 -> result = when { + modified == other.modified -> 0 + modified > other.modified -> 1 + else -> -1 + } + else -> result = when { + taken == other.taken -> 0 + taken > other.taken -> 1 + else -> -1 + } } if (sorting and SORT_DESCENDING != 0) { From 9d9866c1d23451ecbd693e2c76193b99c3b26e29 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 25 Sep 2017 20:42:47 +0200 Subject: [PATCH 109/207] use simple asynctask execute() at fetching directories --- .../com/simplemobiletools/gallery/activities/MainActivity.kt | 3 +-- 1 file changed, 1 insertion(+), 2 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 42dc79140..5a6075197 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -5,7 +5,6 @@ import android.app.Activity import android.content.Intent import android.content.pm.PackageManager import android.net.Uri -import android.os.AsyncTask import android.os.Build import android.os.Bundle import android.os.Handler @@ -216,7 +215,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { mCurrAsyncTask = GetDirectoriesAsynctask(applicationContext, mIsPickVideoIntent || mIsGetVideoContentIntent, mIsPickImageIntent || mIsGetImageContentIntent) { gotDirectories(addTempFolderIfNeeded(it), false) } - mCurrAsyncTask!!.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR) + mCurrAsyncTask!!.execute() } private fun showSortingDialog() { From 0da84f295887c9ce8c33fa2a5aab6692b20069b2 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 25 Sep 2017 21:04:09 +0200 Subject: [PATCH 110/207] change the way directories are grouped and sorted --- .../asynctasks/GetDirectoriesAsynctask.kt | 100 +++++++++++------- .../gallery/extensions/arrayList.kt | 5 + .../gallery/helpers/Config.kt | 8 +- 3 files changed, 69 insertions(+), 44 deletions(-) create mode 100644 app/src/main/kotlin/com/simplemobiletools/gallery/extensions/arrayList.kt diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt index b68d69d09..9f609bb23 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt @@ -6,10 +6,12 @@ import com.simplemobiletools.commons.extensions.getFilenameFromPath import com.simplemobiletools.commons.extensions.hasWriteStoragePermission import com.simplemobiletools.commons.extensions.internalStoragePath import com.simplemobiletools.commons.extensions.sdCardPath +import com.simplemobiletools.commons.helpers.SORT_DESCENDING import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.extensions.config import com.simplemobiletools.gallery.extensions.containsNoMedia import com.simplemobiletools.gallery.extensions.getFilesFrom +import com.simplemobiletools.gallery.extensions.sumByLong import com.simplemobiletools.gallery.models.Directory import com.simplemobiletools.gallery.models.Medium import java.io.File @@ -19,7 +21,7 @@ class GetDirectoriesAsynctask(val context: Context, val isPickVideo: Boolean, va val callback: (dirs: ArrayList) -> Unit) : AsyncTask>() { var config = context.config var shouldStop = false - val showHidden = config.shouldShowHidden + private val showHidden = config.shouldShowHidden override fun doInBackground(vararg params: Void): ArrayList { if (!context.hasWriteStoragePermission()) @@ -28,53 +30,71 @@ class GetDirectoriesAsynctask(val context: Context, val isPickVideo: Boolean, va val media = context.getFilesFrom("", isPickImage, isPickVideo) val excludedPaths = config.excludedFolders val includedPaths = config.includedFolders + val hidden = context.resources.getString(R.string.hidden) val directories = groupDirectories(media) - val dirs = ArrayList(directories.values - .filter { File(it.path).exists() }) - .filter { shouldFolderBeVisible(it.path, excludedPaths, includedPaths) } as ArrayList + + val removePaths = ArrayList() + directories.keys.forEach { + if (!File(it).exists() || !shouldFolderBeVisible(it, excludedPaths, includedPaths)) { + removePaths.add(it) + } + } + + removePaths.forEach { + directories.remove(it) + } + + val dirs = ArrayList() + val albumCovers = config.parseAlbumCovers() + for ((path, curMedia) in directories) { + Medium.sorting = config.getFileSorting(path) + curMedia.sort() + + val firstItem = curMedia.first() + val lastItem = curMedia.last() + val parentDir = File(firstItem.path).parent + var thumbnail = firstItem.path + albumCovers.forEach { + if (it.path == parentDir && File(it.tmb).exists()) { + thumbnail = it.tmb + } + } + + var dirName = when (parentDir) { + context.internalStoragePath -> context.getString(R.string.internal) + context.sdCardPath -> context.getString(R.string.sd_card) + else -> parentDir.getFilenameFromPath() + } + + if (File(path).containsNoMedia()) { + dirName += " $hidden" + } + + val lastModified = if (config.directorySorting and SORT_DESCENDING > 0) Math.max(firstItem.modified, lastItem.modified) else Math.min(firstItem.modified, lastItem.modified) + val dateTaken = if (config.directorySorting and SORT_DESCENDING > 0) Math.max(firstItem.taken, lastItem.taken) else Math.min(firstItem.taken, lastItem.taken) + val size = curMedia.sumByLong { it.size } + val directory = Directory(parentDir, thumbnail, dirName, curMedia.size, lastModified, dateTaken, size) + dirs.add(directory) + } + Directory.sorting = config.directorySorting dirs.sort() return movePinnedToFront(dirs) } - private fun groupDirectories(media: ArrayList): Map { - val albumCovers = config.parseAlbumCovers() - val hidden = context.resources.getString(R.string.hidden) - val directories = LinkedHashMap() - for ((name, path, isVideo, dateModified, dateTaken, size) in media) { - if (shouldStop) + private fun groupDirectories(media: ArrayList): HashMap> { + val directories = LinkedHashMap>() + for (medium in media) { + if (shouldStop) { cancel(true) + break + } - val parentDir = File(path).parent ?: continue - if (directories.containsKey(parentDir.toLowerCase())) { - val directory = directories[parentDir.toLowerCase()]!! - val newImageCnt = directory.mediaCnt + 1 - directory.mediaCnt = newImageCnt - directory.addSize(size) + val parentDir = File(medium.path).parent?.toLowerCase() ?: continue + if (directories.containsKey(parentDir)) { + directories[parentDir]!!.add(medium) } else { - var dirName = parentDir.getFilenameFromPath() - if (parentDir == context.internalStoragePath) { - dirName = context.getString(R.string.internal) - } else if (parentDir == context.sdCardPath) { - dirName = context.getString(R.string.sd_card) - } - - if (File(parentDir).containsNoMedia()) { - dirName += " $hidden" - - if (!showHidden) - continue - } - - var thumbnail = path - albumCovers.forEach { - if (it.path == parentDir && File(it.tmb).exists()) { - thumbnail = it.tmb - } - } - - val directory = Directory(parentDir, thumbnail, dirName, 1, dateModified, dateTaken, size) - directories.put(parentDir.toLowerCase(), directory) + directories.put(parentDir, arrayListOf(medium)) } } return directories @@ -86,7 +106,7 @@ class GetDirectoriesAsynctask(val context: Context, val isPickVideo: Boolean, va true } else if (isThisOrParentExcluded(path, excludedPaths, includedPaths)) { false - } else if (!config.shouldShowHidden && file.isDirectory && file.canonicalFile == file.absoluteFile) { + } else if (!showHidden && file.isDirectory && file.canonicalFile == file.absoluteFile) { var containsNoMediaOrDot = file.containsNoMedia() || path.contains("/.") if (!containsNoMediaOrDot) { containsNoMediaOrDot = checkParentHasNoMedia(file.parentFile) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/arrayList.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/arrayList.kt new file mode 100644 index 000000000..8d5d3ad27 --- /dev/null +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/arrayList.kt @@ -0,0 +1,5 @@ +package com.simplemobiletools.gallery.extensions + +import java.util.* + +fun ArrayList.sumByLong(selector: (E) -> Long) = map { selector(it) }.sum() diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt index f17e9eed1..5cd08be16 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt @@ -28,17 +28,17 @@ class Config(context: Context) : BaseConfig(context) { if (path.isEmpty()) { fileSorting = value } else { - prefs.edit().putInt(SORT_FOLDER_PREFIX + path, value).apply() + prefs.edit().putInt(SORT_FOLDER_PREFIX + path.toLowerCase(), value).apply() } } - fun getFileSorting(path: String) = prefs.getInt(SORT_FOLDER_PREFIX + path, fileSorting) + fun getFileSorting(path: String) = prefs.getInt(SORT_FOLDER_PREFIX + path.toLowerCase(), fileSorting) fun removeFileSorting(path: String) { - prefs.edit().remove(SORT_FOLDER_PREFIX + path).apply() + prefs.edit().remove(SORT_FOLDER_PREFIX + path.toLowerCase()).apply() } - fun hasCustomSorting(path: String) = prefs.contains(SORT_FOLDER_PREFIX + path) + fun hasCustomSorting(path: String) = prefs.contains(SORT_FOLDER_PREFIX + path.toLowerCase()) var wasHideFolderTooltipShown: Boolean get() = prefs.getBoolean(HIDE_FOLDER_TOOLTIP_SHOWN, false) From 417c1169f8edcb6a7ac3e01410b145a528608f57 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 25 Sep 2017 22:34:58 +0200 Subject: [PATCH 111/207] just quickly resort directories at sorting change, when possible --- .../gallery/activities/MainActivity.kt | 15 ++++++++++++--- .../asynctasks/GetDirectoriesAsynctask.kt | 14 +------------- .../gallery/dialogs/PickDirectoryDialog.kt | 12 +++++++----- .../gallery/extensions/context.kt | 19 +++++++++++++++++++ 4 files changed, 39 insertions(+), 21 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 5a6075197..220d5e4b9 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -19,6 +19,8 @@ import com.google.gson.Gson import com.simplemobiletools.commons.dialogs.CreateNewFolderDialog import com.simplemobiletools.commons.dialogs.FilePickerDialog import com.simplemobiletools.commons.extensions.* +import com.simplemobiletools.commons.helpers.SORT_BY_DATE_MODIFIED +import com.simplemobiletools.commons.helpers.SORT_BY_DATE_TAKEN import com.simplemobiletools.commons.models.Release import com.simplemobiletools.commons.views.MyScalableRecyclerView import com.simplemobiletools.gallery.BuildConfig @@ -220,7 +222,11 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { private fun showSortingDialog() { ChangeSortingDialog(this, true, false) { - getDirectories() + if (config.directorySorting and SORT_BY_DATE_MODIFIED > 0 || config.directorySorting and SORT_BY_DATE_TAKEN > 0) { + getDirectories() + } else { + gotDirectories(mDirs, true) + } } } @@ -420,7 +426,9 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { } } - private fun gotDirectories(dirs: ArrayList, isFromCache: Boolean) { + private fun gotDirectories(newDirs: ArrayList, isFromCache: Boolean) { + val dirs = getSortedDirectories(newDirs) + mLastMediaModified = getLastMediaModified() directories_refresh_layout.isRefreshing = false mIsGettingDirs = false @@ -429,8 +437,9 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { directories_empty_text.beVisibleIf(dirs.isEmpty() && !isFromCache) checkLastMediaChanged() - if (dirs.hashCode() == mDirs.hashCode()) + if (dirs.hashCode() == mDirs.hashCode()) { return + } mDirs = dirs diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt index 9f609bb23..604822008 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt @@ -77,9 +77,7 @@ class GetDirectoriesAsynctask(val context: Context, val isPickVideo: Boolean, va dirs.add(directory) } - Directory.sorting = config.directorySorting - dirs.sort() - return movePinnedToFront(dirs) + return dirs } private fun groupDirectories(media: ArrayList): HashMap> { @@ -133,16 +131,6 @@ class GetDirectoriesAsynctask(val context: Context, val isPickVideo: Boolean, va private fun isThisOrParentExcluded(path: String, excludedPaths: MutableSet, includedPaths: MutableSet) = includedPaths.none { path.startsWith(it) } && excludedPaths.any { path.startsWith(it) } - private fun movePinnedToFront(dirs: ArrayList): ArrayList { - val foundFolders = ArrayList() - val pinnedFolders = config.pinnedFolders - - dirs.forEach { if (pinnedFolders.contains(it.path)) foundFolders.add(it) } - dirs.removeAll(foundFolders) - dirs.addAll(0, foundFolders) - return dirs - } - override fun onPostExecute(dirs: ArrayList) { super.onPostExecute(dirs) callback(dirs) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickDirectoryDialog.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickDirectoryDialog.kt index a52a395cd..a4e877bad 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickDirectoryDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickDirectoryDialog.kt @@ -15,6 +15,7 @@ import com.simplemobiletools.gallery.adapters.DirectoryAdapter import com.simplemobiletools.gallery.asynctasks.GetDirectoriesAsynctask import com.simplemobiletools.gallery.extensions.config import com.simplemobiletools.gallery.extensions.getCachedDirectories +import com.simplemobiletools.gallery.extensions.getSortedDirectories import com.simplemobiletools.gallery.models.Directory import kotlinx.android.synthetic.main.dialog_directory_picker.view.* @@ -47,19 +48,20 @@ class PickDirectoryDialog(val activity: SimpleActivity, val sourcePath: String, } } - fun showOtherFolder() { + private fun showOtherFolder() { val showHidden = activity.config.shouldShowHidden FilePickerDialog(activity, sourcePath, false, showHidden, true) { callback(it) } } - private fun gotDirectories(directories: ArrayList) { - if (directories.hashCode() == shownDirectories.hashCode()) + private fun gotDirectories(newDirs: ArrayList) { + val dirs = activity.getSortedDirectories(newDirs) + if (dirs.hashCode() == shownDirectories.hashCode()) return - shownDirectories = directories - val adapter = DirectoryAdapter(activity, directories, null, true) { + shownDirectories = dirs + val adapter = DirectoryAdapter(activity, dirs, null, true) { if (it.path.trimEnd('/') == sourcePath) { activity.toast(R.string.source_and_destination_same) return@DirectoryAdapter diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt index 51ac6da09..e6ae6d99e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt @@ -17,6 +17,7 @@ import com.simplemobiletools.commons.helpers.SORT_BY_SIZE import com.simplemobiletools.commons.helpers.SORT_DESCENDING import com.simplemobiletools.gallery.activities.SettingsActivity import com.simplemobiletools.gallery.helpers.* +import com.simplemobiletools.gallery.models.Directory import com.simplemobiletools.gallery.models.Medium import java.io.File @@ -289,3 +290,21 @@ fun Context.getLastMediaModified(): Int { } return 0 } + +fun Context.movePinnedDirectoriesToFront(dirs: ArrayList): ArrayList { + val foundFolders = ArrayList() + val pinnedFolders = config.pinnedFolders + + dirs.forEach { if (pinnedFolders.contains(it.path)) foundFolders.add(it) } + dirs.removeAll(foundFolders) + dirs.addAll(0, foundFolders) + return dirs +} + +@Suppress("UNCHECKED_CAST") +fun Context.getSortedDirectories(source: ArrayList): ArrayList { + Directory.sorting = config.directorySorting + val dirs = source.clone() as ArrayList + dirs.sort() + return movePinnedDirectoriesToFront(dirs) +} From c242f74f9b41a9aab09232064cb7e6cca7b8285c Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 25 Sep 2017 22:55:22 +0200 Subject: [PATCH 112/207] fix some glitches with incasesensitive paths at directories --- .../gallery/asynctasks/GetDirectoriesAsynctask.kt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt index 604822008..d6054eb74 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt @@ -34,9 +34,11 @@ class GetDirectoriesAsynctask(val context: Context, val isPickVideo: Boolean, va val directories = groupDirectories(media) val removePaths = ArrayList() - directories.keys.forEach { - if (!File(it).exists() || !shouldFolderBeVisible(it, excludedPaths, includedPaths)) { - removePaths.add(it) + for ((path, curMedia) in directories) { + // make sure the path has uppercase letters wherever appropriate + val groupPath = File(curMedia.first().path).parent + if (!File(groupPath).exists() || !shouldFolderBeVisible(groupPath, excludedPaths, includedPaths)) { + removePaths.add(groupPath) } } @@ -66,7 +68,7 @@ class GetDirectoriesAsynctask(val context: Context, val isPickVideo: Boolean, va else -> parentDir.getFilenameFromPath() } - if (File(path).containsNoMedia()) { + if (File(parentDir).containsNoMedia()) { dirName += " $hidden" } From fcad1f6fa590d6aefd8feacba56746b522bf340f Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 25 Sep 2017 23:01:02 +0200 Subject: [PATCH 113/207] properly hide hidden folders --- .../gallery/asynctasks/GetDirectoriesAsynctask.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt index d6054eb74..80d629d32 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt @@ -38,7 +38,7 @@ class GetDirectoriesAsynctask(val context: Context, val isPickVideo: Boolean, va // make sure the path has uppercase letters wherever appropriate val groupPath = File(curMedia.first().path).parent if (!File(groupPath).exists() || !shouldFolderBeVisible(groupPath, excludedPaths, includedPaths)) { - removePaths.add(groupPath) + removePaths.add(groupPath.toLowerCase()) } } From d8811d66b80310769680c210e2c9381acf7fbe3f Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 25 Sep 2017 23:19:17 +0200 Subject: [PATCH 114/207] move some media getting functions in Context extensions --- .../gallery/activities/MainActivity.kt | 1 - .../asynctasks/GetDirectoriesAsynctask.kt | 83 ++----------------- .../gallery/extensions/context.kt | 73 ++++++++++++++++ 3 files changed, 79 insertions(+), 78 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 220d5e4b9..35deec3c1 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -146,7 +146,6 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { override fun onPause() { super.onPause() - mCurrAsyncTask?.shouldStop = true storeDirectories() directories_refresh_layout.isRefreshing = false mIsGettingDirs = false diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt index 80d629d32..a6450aac1 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt @@ -10,45 +10,25 @@ import com.simplemobiletools.commons.helpers.SORT_DESCENDING import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.extensions.config import com.simplemobiletools.gallery.extensions.containsNoMedia -import com.simplemobiletools.gallery.extensions.getFilesFrom +import com.simplemobiletools.gallery.extensions.getMediaByDirectories import com.simplemobiletools.gallery.extensions.sumByLong import com.simplemobiletools.gallery.models.Directory import com.simplemobiletools.gallery.models.Medium import java.io.File -import java.util.* class GetDirectoriesAsynctask(val context: Context, val isPickVideo: Boolean, val isPickImage: Boolean, val callback: (dirs: ArrayList) -> Unit) : AsyncTask>() { - var config = context.config - var shouldStop = false - private val showHidden = config.shouldShowHidden override fun doInBackground(vararg params: Void): ArrayList { if (!context.hasWriteStoragePermission()) return ArrayList() - val media = context.getFilesFrom("", isPickImage, isPickVideo) - val excludedPaths = config.excludedFolders - val includedPaths = config.includedFolders + val config = context.config + val groupedMedia = context.getMediaByDirectories(isPickVideo, isPickImage) + val directories = ArrayList() val hidden = context.resources.getString(R.string.hidden) - val directories = groupDirectories(media) - - val removePaths = ArrayList() - for ((path, curMedia) in directories) { - // make sure the path has uppercase letters wherever appropriate - val groupPath = File(curMedia.first().path).parent - if (!File(groupPath).exists() || !shouldFolderBeVisible(groupPath, excludedPaths, includedPaths)) { - removePaths.add(groupPath.toLowerCase()) - } - } - - removePaths.forEach { - directories.remove(it) - } - - val dirs = ArrayList() val albumCovers = config.parseAlbumCovers() - for ((path, curMedia) in directories) { + for ((path, curMedia) in groupedMedia) { Medium.sorting = config.getFileSorting(path) curMedia.sort() @@ -76,63 +56,12 @@ class GetDirectoriesAsynctask(val context: Context, val isPickVideo: Boolean, va val dateTaken = if (config.directorySorting and SORT_DESCENDING > 0) Math.max(firstItem.taken, lastItem.taken) else Math.min(firstItem.taken, lastItem.taken) val size = curMedia.sumByLong { it.size } val directory = Directory(parentDir, thumbnail, dirName, curMedia.size, lastModified, dateTaken, size) - dirs.add(directory) + directories.add(directory) } - return dirs - } - - private fun groupDirectories(media: ArrayList): HashMap> { - val directories = LinkedHashMap>() - for (medium in media) { - if (shouldStop) { - cancel(true) - break - } - - val parentDir = File(medium.path).parent?.toLowerCase() ?: continue - if (directories.containsKey(parentDir)) { - directories[parentDir]!!.add(medium) - } else { - directories.put(parentDir, arrayListOf(medium)) - } - } return directories } - private fun shouldFolderBeVisible(path: String, excludedPaths: MutableSet, includedPaths: MutableSet): Boolean { - val file = File(path) - return if (includedPaths.contains(path)) { - true - } else if (isThisOrParentExcluded(path, excludedPaths, includedPaths)) { - false - } else if (!showHidden && file.isDirectory && file.canonicalFile == file.absoluteFile) { - var containsNoMediaOrDot = file.containsNoMedia() || path.contains("/.") - if (!containsNoMediaOrDot) { - containsNoMediaOrDot = checkParentHasNoMedia(file.parentFile) - } - !containsNoMediaOrDot - } else { - true - } - } - - private fun checkParentHasNoMedia(file: File): Boolean { - var curFile = file - while (true) { - if (curFile.containsNoMedia()) { - return true - } - curFile = curFile.parentFile - if (curFile.absolutePath == "/") - break - } - return false - } - - private fun isThisOrParentExcluded(path: String, excludedPaths: MutableSet, includedPaths: MutableSet) = - includedPaths.none { path.startsWith(it) } && excludedPaths.any { path.startsWith(it) } - override fun onPostExecute(dirs: ArrayList) { super.onPostExecute(dirs) callback(dirs) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt index e6ae6d99e..095d8f348 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt @@ -20,6 +20,10 @@ import com.simplemobiletools.gallery.helpers.* import com.simplemobiletools.gallery.models.Directory import com.simplemobiletools.gallery.models.Medium import java.io.File +import java.util.LinkedHashMap +import kotlin.collections.ArrayList +import kotlin.collections.component1 +import kotlin.collections.component2 val Context.portrait get() = resources.configuration.orientation == Configuration.ORIENTATION_PORTRAIT val Context.audioManager get() = getSystemService(Context.AUDIO_SERVICE) as AudioManager @@ -301,6 +305,75 @@ fun Context.movePinnedDirectoriesToFront(dirs: ArrayList): ArrayList< return dirs } +fun Context.getMediaByDirectories(isPickVideo: Boolean, isPickImage: Boolean): HashMap> { + val media = getFilesFrom("", isPickImage, isPickVideo) + val excludedPaths = config.excludedFolders + val includedPaths = config.includedFolders + val showHidden = config.shouldShowHidden + val directories = groupDirectories(media) + + val removePaths = ArrayList() + for ((path, curMedia) in directories) { + // make sure the path has uppercase letters wherever appropriate + val groupPath = File(curMedia.first().path).parent + if (!File(groupPath).exists() || !shouldFolderBeVisible(groupPath, excludedPaths, includedPaths, showHidden)) { + removePaths.add(groupPath.toLowerCase()) + } + } + + removePaths.forEach { + directories.remove(it) + } + + return directories +} + +private fun groupDirectories(media: ArrayList): HashMap> { + val directories = LinkedHashMap>() + for (medium in media) { + val parentDir = File(medium.path).parent?.toLowerCase() ?: continue + if (directories.containsKey(parentDir)) { + directories[parentDir]!!.add(medium) + } else { + directories.put(parentDir, arrayListOf(medium)) + } + } + return directories +} + +private fun shouldFolderBeVisible(path: String, excludedPaths: MutableSet, includedPaths: MutableSet, showHidden: Boolean): Boolean { + val file = File(path) + return if (includedPaths.contains(path)) { + true + } else if (isThisOrParentExcluded(path, excludedPaths, includedPaths)) { + false + } else if (!showHidden && file.isDirectory && file.canonicalFile == file.absoluteFile) { + var containsNoMediaOrDot = file.containsNoMedia() || path.contains("/.") + if (!containsNoMediaOrDot) { + containsNoMediaOrDot = checkParentHasNoMedia(file.parentFile) + } + !containsNoMediaOrDot + } else { + true + } +} + +private fun checkParentHasNoMedia(file: File): Boolean { + var curFile = file + while (true) { + if (curFile.containsNoMedia()) { + return true + } + curFile = curFile.parentFile + if (curFile.absolutePath == "/") + break + } + return false +} + +private fun isThisOrParentExcluded(path: String, excludedPaths: MutableSet, includedPaths: MutableSet) = + includedPaths.none { path.startsWith(it) } && excludedPaths.any { path.startsWith(it) } + @Suppress("UNCHECKED_CAST") fun Context.getSortedDirectories(source: ArrayList): ArrayList { Directory.sorting = config.directorySorting From 64f8d3754474aee5ad8c672a72b6d57a658f134d Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 25 Sep 2017 23:26:26 +0200 Subject: [PATCH 115/207] fix #370, make sure only the proper items are shown in "All media" view --- .../gallery/asynctasks/GetMediaAsynctask.kt | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetMediaAsynctask.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetMediaAsynctask.kt index 68595ae46..13002eb86 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetMediaAsynctask.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetMediaAsynctask.kt @@ -2,7 +2,9 @@ package com.simplemobiletools.gallery.asynctasks import android.content.Context import android.os.AsyncTask +import com.simplemobiletools.gallery.extensions.config import com.simplemobiletools.gallery.extensions.getFilesFrom +import com.simplemobiletools.gallery.extensions.getMediaByDirectories import com.simplemobiletools.gallery.models.Medium import java.util.* @@ -11,8 +13,19 @@ class GetMediaAsynctask(val context: Context, val mPath: String, val isPickVideo AsyncTask>() { override fun doInBackground(vararg params: Void): ArrayList { - val path = if (showAll) "" else mPath - return context.getFilesFrom(path, isPickImage, isPickVideo) + return if (showAll) { + val mediaMap = context.getMediaByDirectories(isPickVideo, isPickImage) + val media = ArrayList() + for ((path, curMedia) in mediaMap) { + media.addAll(curMedia) + } + + Medium.sorting = context.config.getFileSorting("") + media.sort() + media + } else { + context.getFilesFrom(mPath, isPickImage, isPickVideo) + } } override fun onPostExecute(media: ArrayList) { From 80f6df5e2958337ac9fd806985508e716a1af900 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 25 Sep 2017 23:53:15 +0200 Subject: [PATCH 116/207] do not autosave rotated images, related to #372 --- app/build.gradle | 2 +- .../gallery/activities/ViewPagerActivity.kt | 35 +++---------------- 2 files changed, 5 insertions(+), 32 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index c50f15187..1dbbd4cac 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,7 +37,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.28.4' + compile 'com.simplemobiletools:commons:2.28.5' compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.6.0' compile 'com.theartofdev.edmodo:android-image-cropper:2.4.0' compile 'com.bignerdranch.android:recyclerview-multiselect:0.2' diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt index 468e2d69c..8b1150d40 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -434,34 +434,6 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View } private fun rotateImage() { - val currentMedium = getCurrentMedium() ?: return - if (currentMedium.isJpg() && !isPathOnSD(currentMedium.path)) { - rotateByExif() - } else { - rotateByDegrees() - } - } - - private fun rotateByExif() { - val exif = ExifInterface(getCurrentPath()) - val orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL) - val newOrientation = getNewOrientation(orientation) - exif.setAttribute(ExifInterface.TAG_ORIENTATION, newOrientation) - exif.saveAttributes() - File(getCurrentPath()).setLastModified(System.currentTimeMillis()) - (getCurrentFragment() as? PhotoFragment)?.refreshBitmap() - } - - private fun getNewOrientation(rotation: Int): String { - return when (rotation) { - ExifInterface.ORIENTATION_ROTATE_90 -> ExifInterface.ORIENTATION_ROTATE_180 - ExifInterface.ORIENTATION_ROTATE_180 -> ExifInterface.ORIENTATION_ROTATE_270 - ExifInterface.ORIENTATION_ROTATE_270 -> ExifInterface.ORIENTATION_NORMAL - else -> ExifInterface.ORIENTATION_ROTATE_90 - }.toString() - } - - private fun rotateByDegrees() { mRotationDegrees = (mRotationDegrees + 90) % 360 getCurrentFragment()?.let { (it as? PhotoFragment)?.rotateImageViewBy(mRotationDegrees) @@ -475,7 +447,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View Thread({ toast(R.string.saving) val selectedFile = File(it) - val tmpFile = File(selectedFile.parent, "tmp_${it.getFilenameFromPath()}") + val tmpFile = File(selectedFile.parent, ".tmp_${it.getFilenameFromPath()}") try { val bitmap = BitmapFactory.decodeFile(currPath) getFileOutputStream(tmpFile) { @@ -498,7 +470,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View toast(R.string.out_of_memory_error) deleteFile(tmpFile) {} } catch (e: Exception) { - toast(R.string.unknown_error_occurred) + showErrorToast(e) deleteFile(tmpFile) {} } }).start() @@ -513,9 +485,10 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View out.flush() out.close() toast(R.string.file_saved) + mRotationDegrees = 0f + invalidateOptionsMenu() } - private fun isShowHiddenFlagNeeded(): Boolean { val file = File(mPath) if (file.isHidden) From dfdfd8894125060cef4ba8e78f11a160e29f8770 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 27 Sep 2017 21:50:42 +0200 Subject: [PATCH 117/207] fix #181, add fingerprint protection to hidden folder showing --- app/build.gradle | 2 +- app/src/main/kotlin/com/simplemobiletools/gallery/App.kt | 2 ++ .../simplemobiletools/gallery/activities/SettingsActivity.kt | 5 ++++- .../kotlin/com/simplemobiletools/gallery/models/Directory.kt | 2 +- .../kotlin/com/simplemobiletools/gallery/models/Medium.kt | 2 +- 5 files changed, 9 insertions(+), 4 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 1dbbd4cac..697211b8f 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,7 +37,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.28.5' + compile 'com.simplemobiletools:commons:2.28.7' compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.6.0' compile 'com.theartofdev.edmodo:android-image-cropper:2.4.0' compile 'com.bignerdranch.android:recyclerview-multiselect:0.2' diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/App.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/App.kt index 4cbda3237..48ef23b19 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/App.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/App.kt @@ -1,12 +1,14 @@ package com.simplemobiletools.gallery import android.app.Application +import com.github.ajalt.reprint.core.Reprint import com.squareup.leakcanary.LeakCanary class App : Application() { val USE_LEAK_CANARY = false override fun onCreate() { super.onCreate() + Reprint.initialize(this) if (USE_LEAK_CANARY) { if (LeakCanary.isInAnalyzerProcess(this)) { return diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt index 92329d023..8ba896f00 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt @@ -8,6 +8,7 @@ import com.simplemobiletools.commons.dialogs.RadioGroupDialog import com.simplemobiletools.commons.dialogs.SecurityDialog import com.simplemobiletools.commons.extensions.handleHiddenFolderPasswordProtection import com.simplemobiletools.commons.extensions.updateTextColors +import com.simplemobiletools.commons.helpers.PROTECTION_FINGERPRINT import com.simplemobiletools.commons.helpers.SHOW_ALL_TABS import com.simplemobiletools.commons.models.RadioItem import com.simplemobiletools.gallery.R @@ -169,7 +170,9 @@ class SettingsActivity : SimpleActivity() { config.protectionType = type if (config.isPasswordProtectionOn) { - ConfirmationDialog(this, "", R.string.protection_setup_successfully, R.string.ok, 0) { } + val confirmationTextId = if (config.protectionType == PROTECTION_FINGERPRINT) + R.string.fingerprint_setup_successfully else R.string.protection_setup_successfully + ConfirmationDialog(this, "", confirmationTextId, R.string.ok, 0) { } } } } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/models/Directory.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/models/Directory.kt index ec877c43c..7271dc2e8 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/models/Directory.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/models/Directory.kt @@ -17,7 +17,7 @@ data class Directory(val path: String, val tmb: String, val name: String, var me override fun compareTo(other: Directory): Int { var result: Int when { - sorting and SORT_BY_NAME != 0 -> result = AlphanumComparator().compare(name.toLowerCase(), other.name.toLowerCase()) + sorting and SORT_BY_NAME != 0 -> result = AlphanumericComparator().compare(name.toLowerCase(), other.name.toLowerCase()) sorting and SORT_BY_SIZE != 0 -> result = when { size == other.size -> 0 size > other.size -> 1 diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/models/Medium.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/models/Medium.kt index a04a39aa9..fadf715ea 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/models/Medium.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/models/Medium.kt @@ -26,7 +26,7 @@ data class Medium(var name: String, var path: String, val video: Boolean, val mo override fun compareTo(other: Medium): Int { var result: Int when { - sorting and SORT_BY_NAME != 0 -> result = AlphanumComparator().compare(name.toLowerCase(), other.name.toLowerCase()) + sorting and SORT_BY_NAME != 0 -> result = AlphanumericComparator().compare(name.toLowerCase(), other.name.toLowerCase()) sorting and SORT_BY_SIZE != 0 -> result = when { size == other.size -> 0 size > other.size -> 1 From 373e06c98fbca38e0ef2969586846e48c341fd5e Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 27 Sep 2017 23:10:14 +0200 Subject: [PATCH 118/207] ignore the root folders at fetching media --- .../gallery/extensions/context.kt | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt index 095d8f348..e22a90243 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt @@ -89,8 +89,8 @@ fun Context.getFilesFrom(curPath: String, isPickImage: Boolean, isPickVideo: Boo MediaStore.Images.Media.DATA, MediaStore.Images.Media.SIZE) val uri = MediaStore.Files.getContentUri("external") - val selection = if (curPath.isEmpty()) null else "(${MediaStore.Images.Media.DATA} LIKE ? AND ${MediaStore.Images.Media.DATA} NOT LIKE ?)" - val selectionArgs = if (curPath.isEmpty()) null else arrayOf("$curPath/%", "$curPath/%/%") + val selection = getSelectionQuery(curPath) + val selectionArgs = getSelectionArgsQuery(curPath) return try { val cur = contentResolver.query(uri, projection, selection, selectionArgs, getSortingForFolder(curPath)) @@ -100,6 +100,27 @@ fun Context.getFilesFrom(curPath: String, isPickImage: Boolean, isPickVideo: Boo } } +fun Context.getSelectionQuery(path: String): String { + val dataQuery = "${MediaStore.Images.Media.DATA} LIKE ?" + return if (path.isEmpty()) { + var query = "($dataQuery)" + if (hasExternalSDCard()) { + query += " OR ($dataQuery)" + } + query + } else { + "($dataQuery AND ${MediaStore.Images.Media.DATA} NOT LIKE ?)" + } +} + +fun Context.getSelectionArgsQuery(path: String): Array { + return if (path.isEmpty()) { + if (hasExternalSDCard()) arrayOf("$internalStoragePath/%", "$sdCardPath/%") else arrayOf("$internalStoragePath/%") + } else { + arrayOf("$path/%", "$path/%/%") + } +} + private fun parseCursor(context: Context, cur: Cursor, isPickImage: Boolean, isPickVideo: Boolean, curPath: String): ArrayList { val curMedia = ArrayList() val config = context.config From 33a4b81279dc632a2ab4c1d92d22a0385210aab2 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 27 Sep 2017 23:58:30 +0200 Subject: [PATCH 119/207] replace lastModified mediaitem checking with latest media date taken --- app/build.gradle | 2 +- .../gallery/activities/MainActivity.kt | 10 +++++----- .../gallery/activities/MediaActivity.kt | 10 +++++----- .../gallery/extensions/context.kt | 16 ---------------- 4 files changed, 11 insertions(+), 27 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 697211b8f..1b8f6288b 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,7 +37,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.28.7' + compile 'com.simplemobiletools:commons:2.28.9' compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.6.0' compile 'com.theartofdev.edmodo:android-image-cropper:2.4.0' compile 'com.bignerdranch.android:recyclerview-multiselect:0.2' 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 35deec3c1..b7227be6e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -56,7 +56,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { private var mStoredCropThumbnails = true private var mStoredScrollHorizontally = true private var mLoadedInitialPhotos = false - private var mLastMediaModified = 0 + private var mLatestMediaId = 0L private var mLastMediaHandler = Handler() private var mCurrAsyncTask: GetDirectoriesAsynctask? = null @@ -428,7 +428,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { private fun gotDirectories(newDirs: ArrayList, isFromCache: Boolean) { val dirs = getSortedDirectories(newDirs) - mLastMediaModified = getLastMediaModified() + mLatestMediaId = getLatestMediaId() directories_refresh_layout.isRefreshing = false mIsGettingDirs = false @@ -491,9 +491,9 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { mLastMediaHandler.removeCallbacksAndMessages(null) mLastMediaHandler.postDelayed({ Thread({ - val lastModified = getLastMediaModified() - if (mLastMediaModified != lastModified) { - mLastMediaModified = lastModified + val mediaId = getLatestMediaId() + if (mLatestMediaId != mediaId) { + mLatestMediaId = mediaId runOnUiThread { getDirectories() } 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 67765fab8..8be958661 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -51,7 +51,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { private var mStoredCropThumbnails = true private var mStoredScrollHorizontally = true private var mLastDrawnHashCode = 0 - private var mLastMediaModified = 0 + private var mLatestMediaId = 0L private var mLastMediaHandler = Handler() companion object { @@ -181,9 +181,9 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { mLastMediaHandler.removeCallbacksAndMessages(null) mLastMediaHandler.postDelayed({ Thread({ - val lastModified = getLastMediaModified() - if (mLastMediaModified != lastModified) { - mLastMediaModified = lastModified + val mediaId = getLatestMediaId() + if (mLatestMediaId != mediaId) { + mLatestMediaId = mediaId runOnUiThread { getMedia() } @@ -463,7 +463,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { } private fun gotMedia(media: ArrayList, isFromCache: Boolean = false) { - mLastMediaModified = getLastMediaModified() + mLatestMediaId = getLatestMediaId() mIsGettingMedia = false media_refresh_layout.isRefreshing = false diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt index e22a90243..ac943fe25 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt @@ -300,22 +300,6 @@ fun Context.getNoMediaFolders(): ArrayList { return folders } -fun Context.getLastMediaModified(): Int { - val max = "max" - val uri = MediaStore.Files.getContentUri("external") - val projection = arrayOf(MediaStore.Images.Media._ID, "MAX(${MediaStore.Images.Media.DATE_MODIFIED}) AS $max") - var cursor: Cursor? = null - try { - cursor = contentResolver.query(uri, projection, null, null, null) - if (cursor?.moveToFirst() == true) { - return cursor.getIntValue(max) - } - } finally { - cursor?.close() - } - return 0 -} - fun Context.movePinnedDirectoriesToFront(dirs: ArrayList): ArrayList { val foundFolders = ArrayList() val pinnedFolders = config.pinnedFolders From fc3565129d4c0afb65a426d90f38ae67db6701a6 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 28 Sep 2017 21:04:24 +0200 Subject: [PATCH 120/207] add the dialogs for changing the view type --- .../gallery/activities/MainActivity.kt | 13 +++++++++++++ .../gallery/activities/MediaActivity.kt | 13 +++++++++++++ .../com/simplemobiletools/gallery/helpers/Config.kt | 8 ++++++++ .../simplemobiletools/gallery/helpers/Constants.kt | 6 ++++++ app/src/main/res/menu/menu_main.xml | 4 ++++ app/src/main/res/menu/menu_media.xml | 4 ++++ app/src/main/res/values-ca/strings.xml | 5 +++++ app/src/main/res/values-cs/strings.xml | 5 +++++ app/src/main/res/values-de/strings.xml | 5 +++++ app/src/main/res/values-es/strings.xml | 5 +++++ app/src/main/res/values-fr/strings.xml | 5 +++++ app/src/main/res/values-hu/strings.xml | 5 +++++ app/src/main/res/values-it/strings.xml | 5 +++++ app/src/main/res/values-ja/strings.xml | 5 +++++ app/src/main/res/values-pl/strings.xml | 5 +++++ app/src/main/res/values-pt-rBR/strings.xml | 5 +++++ app/src/main/res/values-pt/strings.xml | 5 +++++ app/src/main/res/values-ru/strings.xml | 5 +++++ app/src/main/res/values-sk/strings.xml | 5 +++++ app/src/main/res/values-sv/strings.xml | 5 +++++ app/src/main/res/values-tr/strings.xml | 5 +++++ app/src/main/res/values-zh-rCN/strings.xml | 5 +++++ app/src/main/res/values-zh-rTW/strings.xml | 5 +++++ app/src/main/res/values/strings.xml | 5 +++++ 24 files changed, 138 insertions(+) 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 b7227be6e..e9dc6255a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -18,9 +18,11 @@ import android.widget.FrameLayout import com.google.gson.Gson import com.simplemobiletools.commons.dialogs.CreateNewFolderDialog import com.simplemobiletools.commons.dialogs.FilePickerDialog +import com.simplemobiletools.commons.dialogs.RadioGroupDialog import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.helpers.SORT_BY_DATE_MODIFIED import com.simplemobiletools.commons.helpers.SORT_BY_DATE_TAKEN +import com.simplemobiletools.commons.models.RadioItem import com.simplemobiletools.commons.models.Release import com.simplemobiletools.commons.views.MyScalableRecyclerView import com.simplemobiletools.gallery.BuildConfig @@ -107,6 +109,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { R.id.filter -> showFilterMediaDialog() R.id.open_camera -> launchCamera() R.id.show_all -> showAllMedia() + R.id.change_view_type -> changeViewType() R.id.temporarily_show_hidden -> tryToggleTemporarilyShowHidden() R.id.stop_showing_hidden -> tryToggleTemporarilyShowHidden() R.id.create_new_folder -> createNewFolder() @@ -245,6 +248,16 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { finish() } + private fun changeViewType() { + val items = arrayListOf( + RadioItem(VIEW_TYPE_GRID, getString(R.string.grid)), + RadioItem(VIEW_TYPE_LIST, getString(R.string.list))) + + RadioGroupDialog(this, items, config.viewTypeFolders) { + config.viewTypeFolders = it as Int + } + } + private fun tryToggleTemporarilyShowHidden() { if (config.temporarilyShowHidden) { toggleTemporarilyShowHidden(false) 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 8be958661..f02a18cfa 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -20,7 +20,9 @@ import com.bumptech.glide.request.transition.Transition import com.google.gson.Gson import com.google.gson.reflect.TypeToken import com.simplemobiletools.commons.dialogs.ConfirmationDialog +import com.simplemobiletools.commons.dialogs.RadioGroupDialog import com.simplemobiletools.commons.extensions.* +import com.simplemobiletools.commons.models.RadioItem import com.simplemobiletools.commons.views.MyScalableRecyclerView import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.adapters.MediaAdapter @@ -223,6 +225,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { R.id.toggle_filename -> toggleFilenameVisibility() R.id.open_camera -> launchCamera() R.id.folder_view -> switchToFolderView() + R.id.change_view_type -> changeViewType() R.id.hide_folder -> tryHideFolder() R.id.unhide_folder -> unhideFolder() R.id.exclude_folder -> tryExcludeFolder() @@ -262,6 +265,16 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { finish() } + private fun changeViewType() { + val items = arrayListOf( + RadioItem(VIEW_TYPE_GRID, getString(R.string.grid)), + RadioItem(VIEW_TYPE_LIST, getString(R.string.list))) + + RadioGroupDialog(this, items, config.viewTypeFiles) { + config.viewTypeFiles = it as Int + } + } + private fun tryHideFolder() { if (config.wasHideFolderTooltipShown) { hideFolder() diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt index 5cd08be16..26f679028 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt @@ -280,4 +280,12 @@ class Config(context: Context) : BaseConfig(context) { var tempFolderPath: String get() = prefs.getString(TEMP_FOLDER_PATH, "") set(tempFolderPath) = prefs.edit().putString(TEMP_FOLDER_PATH, tempFolderPath).apply() + + var viewTypeFolders: Int + get() = prefs.getInt(VIEW_TYPE_FOLDERS, VIEW_TYPE_GRID) + set(viewTypeFolders) = prefs.edit().putInt(VIEW_TYPE_FOLDERS, viewTypeFolders).apply() + + var viewTypeFiles: Int + get() = prefs.getInt(VIEW_TYPE_FILES, VIEW_TYPE_GRID) + set(viewTypeFiles) = prefs.edit().putInt(VIEW_TYPE_FILES, viewTypeFiles).apply() } 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 705c91d76..691031eb3 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt @@ -37,6 +37,8 @@ val REPLACE_SHARE_WITH_ROTATE = "replace_share_with_rotate" val DELETE_EMPTY_FOLDERS = "delete_empty_folders" val ALLOW_VIDEO_GESTURES = "allow_video_gestures" val TEMP_FOLDER_PATH = "temp_folder_path" +val VIEW_TYPE_FOLDERS = "view_type_folders" +val VIEW_TYPE_FILES = "view_type_files" // slideshow val SLIDESHOW_INTERVAL = "slideshow_interval" @@ -77,3 +79,7 @@ val ORIENT_LANDSCAPE_RIGHT = 2 val IMAGES = 1 val VIDEOS = 2 val GIFS = 4 + +// view types +val VIEW_TYPE_GRID = 1 +val VIEW_TYPE_LIST = 2 diff --git a/app/src/main/res/menu/menu_main.xml b/app/src/main/res/menu/menu_main.xml index e94eacea7..b1a4035e7 100644 --- a/app/src/main/res/menu/menu_main.xml +++ b/app/src/main/res/menu/menu_main.xml @@ -16,6 +16,10 @@ android:icon="@drawable/ic_filter" android:title="@string/filter_media" app:showAsAction="ifRoom"/> + + The slideshow ended No media for the slideshow have been found + + Change view type + Grid + List + Show hidden media Play videos automatically diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index ee99698ff..af7703ab4 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -102,6 +102,11 @@ The slideshow ended No media for the slideshow have been found + + Change view type + Grid + List + Zobrazit skryté média Automaticky přehrávat videa diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index f0351f613..96580f927 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -102,6 +102,11 @@ Diashow beendet Keine Medien für Diashow gefunden + + Change view type + Grid + List + Versteckte Ordner zeigen Videos automatisch abspielen diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 6aad7a9c4..5b5350d6c 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -102,6 +102,11 @@ The slideshow ended No media for the slideshow have been found + + Change view type + Grid + List + Mostrar carpetas ocultas Reproducir vídeos automáticamente diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index cb8271195..ca60589f2 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -102,6 +102,11 @@ Diaporama terminé Aucun média trouvé pour le diaporama + + Change view type + Grid + List + Afficher les dossiers cachés Lecture automatique des vidéos diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index 70e9df0c8..c42d41e12 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -102,6 +102,11 @@ The slideshow ended No media for the slideshow have been found + + Change view type + Grid + List + Show hidden media Play videos automatically diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 725bdbf01..e77d073ef 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -102,6 +102,11 @@ La presentazione è terminata Nessun media trovato per la presentazione + + Change view type + Grid + List + Mostra cartelle nascoste Riproduci video automaticamente diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index d9af73f59..ef90a0d11 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -102,6 +102,11 @@ スライドショーが終了しました スライドショーに表示するメディアがありません + + Change view type + Grid + List + 非表示フォルダーを表示 ビデオを自動再生する diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index 7b9f6575f..0c8b066f8 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -102,6 +102,11 @@ Pokaz slajdów zakończony Nie znalazłem multimediów do pokazu slajdów + + Change view type + Grid + List + Pokazuj ukryte foldery Odtwarzaj filmy automatycznie diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 3c4b4032f..e549de037 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -102,6 +102,11 @@ The slideshow ended No media for the slideshow have been found + + Change view type + Grid + List + Mostrar pastas ocultas Reproduzir vídeos automaticamente diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index d0869b9c2..5128dfaf4 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -102,6 +102,11 @@ Apresentação terminada Não foram encontrados ficheiros para a apresentação + + Change view type + Grid + List + Mostrar pastas ocultas Reproduzir vídeos automaticamente diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 1576a4b44..f0ff4a8df 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -102,6 +102,11 @@ Слайдшоу завершилось Никаких медиафайлов для слайдшоу не было найдено. + + Change view type + Grid + List + Показать скрытые папки Воспроизводить видео автоматически diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index 0d7fe9f86..89a8fe5bb 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -102,6 +102,11 @@ Prezentácia skončila Pre prezentáciu sa nenašli žiadne vhodné súbory + + Zmeniť typ zobrazenia + Mriežka + Zoznam + Zobraziť skryté médiá Spúšťať videá automaticky diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index aa1fea2ec..834755adf 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -102,6 +102,11 @@ Bildspelet har avslutats Ingen media hittades för bildspelet + + Change view type + Grid + List + Visa dolda mappar Spela upp videos automatiskt diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index ded134a6d..e98004c41 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -102,6 +102,11 @@ The slideshow ended No media for the slideshow have been found + + Change view type + Grid + List + Gizli klasörleri göster Videoları otomatik olarak oynat diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index ccbd2c8cd..1b6a61f9e 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -102,6 +102,11 @@ 幻灯片结束 未发现可用媒体 + + Change view type + Grid + List + 显示所有 自动播放 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index a2b80e15e..6f7ec0dc1 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -102,6 +102,11 @@ 投影片結束 找不到投影片的媒體檔案 + + Change view type + Grid + List + 顯示隱藏的媒體檔案 自動播放影片 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 13d30d4ba..ddc156702 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -102,6 +102,11 @@ The slideshow ended No media for the slideshow have been found + + Change view type + Grid + List + Show hidden media Play videos automatically From 9c5c359e4d780f419b01360e999a91e75f324837 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 28 Sep 2017 21:28:42 +0200 Subject: [PATCH 121/207] rename directory_item to directory_item_grid --- .../simplemobiletools/gallery/adapters/DirectoryAdapter.kt | 4 ++-- .../layout/{directory_item.xml => directory_item_grid.xml} | 0 2 files changed, 2 insertions(+), 2 deletions(-) rename app/src/main/res/layout/{directory_item.xml => directory_item_grid.xml} (100%) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt index c7e3dcbbf..49ac1c739 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt @@ -22,7 +22,7 @@ import com.simplemobiletools.gallery.dialogs.PickMediumDialog import com.simplemobiletools.gallery.extensions.* import com.simplemobiletools.gallery.models.AlbumCover import com.simplemobiletools.gallery.models.Directory -import kotlinx.android.synthetic.main.directory_item.view.* +import kotlinx.android.synthetic.main.directory_item_grid.view.* import java.io.File import java.util.* @@ -330,7 +330,7 @@ class DirectoryAdapter(val activity: SimpleActivity, var dirs: MutableList Date: Thu, 28 Sep 2017 21:48:08 +0200 Subject: [PATCH 122/207] minor code style updates --- .../gallery/activities/MainActivity.kt | 2 +- .../gallery/activities/MediaActivity.kt | 2 +- .../gallery/adapters/DirectoryAdapter.kt | 24 ++--- .../gallery/adapters/MediaAdapter.kt | 20 ++-- .../main/res/layout/directory_item_list.xml | 93 +++++++++++++++++++ 5 files changed, 113 insertions(+), 28 deletions(-) create mode 100644 app/src/main/res/layout/directory_item_list.xml 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 e9dc6255a..6cc80922d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -135,7 +135,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { if (mStoredScrollHorizontally != config.scrollHorizontally) { directories_grid.adapter?.let { - (it as DirectoryAdapter).scrollVertically = !config.scrollHorizontally + (it as DirectoryAdapter).scrollVertically = config.viewTypeFolders == VIEW_TYPE_LIST || !config.scrollHorizontally it.notifyDataSetChanged() } setupScrollDirection() 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 f02a18cfa..95e18c854 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -95,7 +95,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { if (mStoredScrollHorizontally != config.scrollHorizontally) { media_grid.adapter?.let { - (it as MediaAdapter).scrollVertically = !config.scrollHorizontally + (it as MediaAdapter).scrollVertically = config.viewTypeFiles == VIEW_TYPE_LIST || !config.scrollHorizontally it.notifyDataSetChanged() } setupScrollDirection() diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt index 49ac1c739..e9e01d93d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt @@ -56,12 +56,12 @@ class DirectoryAdapter(val activity: SimpleActivity, var dirs: MutableList = selectedPositions } - val multiSelectorMode = object : ModalMultiSelectorCallback(multiSelector) { + private val multiSelectorMode = object : ModalMultiSelectorCallback(multiSelector) { override fun onActionItemClicked(mode: ActionMode, item: MenuItem): Boolean { when (item.itemId) { R.id.cab_properties -> showProperties() @@ -119,7 +119,7 @@ class DirectoryAdapter(val activity: SimpleActivity, var dirs: MutableList() - var curIndex = 0 - for (i in 0..itemViews.size() - 1) { - if (itemViews[i] != null) { - newItems.put(curIndex, itemViews[i]) - curIndex++ - } - } + (0 until itemViews.size()) + .filter { itemViews[it] != null } + .forEachIndexed { curIndex, i -> newItems.put(curIndex, itemViews[i]) } itemViews = newItems } @@ -330,7 +326,7 @@ class DirectoryAdapter(val activity: SimpleActivity, var dirs: MutableList, updateTitle(selectedPositions.size) } - fun updateTitle(cnt: Int) { + private fun updateTitle(cnt: Int) { actMode?.title = "$cnt / ${media.size}" actMode?.invalidate() } - val adapterListener = object : MyAdapterListener { + private val adapterListener = object : MyAdapterListener { override fun toggleItemSelectionAdapter(select: Boolean, position: Int) { toggleItemSelection(select, position) } @@ -66,7 +66,7 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList, override fun getSelectedPositions(): HashSet = selectedPositions } - val multiSelectorMode = object : ModalMultiSelectorCallback(multiSelector) { + private val multiSelectorMode = object : ModalMultiSelectorCallback(multiSelector) { override fun onActionItemClicked(mode: ActionMode, item: MenuItem): Boolean { when (item.itemId) { R.id.cab_properties -> showProperties() @@ -112,7 +112,7 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList, fun checkHideBtnVisibility(menu: Menu) { var hiddenCnt = 0 var unhiddenCnt = 0 - selectedPositions.map { media.getOrNull(it) }.filterNotNull().forEach { + selectedPositions.mapNotNull { media.getOrNull(it) }.forEach { if (it.name.startsWith('.')) hiddenCnt++ else @@ -184,7 +184,7 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList, fun selectAll() { val cnt = media.size - for (i in 0..cnt - 1) { + for (i in 0 until cnt) { selectedPositions.add(i) multiSelector.setSelected(i, 0, true) notifyItemChanged(i) @@ -227,13 +227,9 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList, listener?.deleteFiles(files) val newItems = SparseArray() - var curIndex = 0 - for (i in 0..itemViews.size() - 1) { - if (itemViews[i] != null) { - newItems.put(curIndex, itemViews[i]) - curIndex++ - } - } + (0 until itemViews.size()) + .filter { itemViews[it] != null } + .forEachIndexed { curIndex, i -> newItems.put(curIndex, itemViews[i]) } itemViews = newItems } diff --git a/app/src/main/res/layout/directory_item_list.xml b/app/src/main/res/layout/directory_item_list.xml new file mode 100644 index 000000000..6903b7f46 --- /dev/null +++ b/app/src/main/res/layout/directory_item_list.xml @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + + + + + + + + + From 5e733a44c342770afcf8e96b57ec24d1e6d5f326 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 28 Sep 2017 21:51:14 +0200 Subject: [PATCH 123/207] use the directory grid view by default --- .../com/simplemobiletools/gallery/activities/MediaActivity.kt | 1 - .../com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) 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 95e18c854..9778bd761 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -38,7 +38,6 @@ import java.io.File import java.io.IOException class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { - private val TAG = MediaActivity::class.java.simpleName private val SAVE_MEDIA_CNT = 40 private val LAST_MEDIA_CHECK_PERIOD = 3000L diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt index e9e01d93d..6a7d4874e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt @@ -326,7 +326,7 @@ class DirectoryAdapter(val activity: SimpleActivity, var dirs: MutableList Date: Thu, 28 Sep 2017 21:55:33 +0200 Subject: [PATCH 124/207] hide the menu buttons for changing column count at list views --- .../com/simplemobiletools/gallery/activities/MainActivity.kt | 5 +++-- .../simplemobiletools/gallery/activities/MediaActivity.kt | 5 +++-- 2 files changed, 6 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 6cc80922d..9799dd666 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -95,8 +95,8 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { menuInflater.inflate(R.menu.menu_main_intent, menu) } else { 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 + menu.findItem(R.id.increase_column_count).isVisible = config.viewTypeFolders == VIEW_TYPE_GRID && config.dirColumnCnt < 10 + menu.findItem(R.id.reduce_column_count).isVisible = config.viewTypeFolders == VIEW_TYPE_GRID && config.dirColumnCnt > 1 } menu.findItem(R.id.temporarily_show_hidden).isVisible = !config.shouldShowHidden menu.findItem(R.id.stop_showing_hidden).isVisible = config.temporarilyShowHidden @@ -255,6 +255,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { RadioGroupDialog(this, items, config.viewTypeFolders) { config.viewTypeFolders = it as Int + invalidateOptionsMenu() } } 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 9778bd761..47eff4f7c 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -210,8 +210,8 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { findItem(R.id.temporarily_show_hidden).isVisible = !config.shouldShowHidden findItem(R.id.stop_showing_hidden).isVisible = config.temporarilyShowHidden - findItem(R.id.increase_column_count).isVisible = config.mediaColumnCnt < 10 - findItem(R.id.reduce_column_count).isVisible = config.mediaColumnCnt > 1 + findItem(R.id.increase_column_count).isVisible = config.viewTypeFiles == VIEW_TYPE_GRID && config.mediaColumnCnt < 10 + findItem(R.id.reduce_column_count).isVisible = config.viewTypeFiles == VIEW_TYPE_GRID && config.mediaColumnCnt > 1 } return true @@ -271,6 +271,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { RadioGroupDialog(this, items, config.viewTypeFiles) { config.viewTypeFiles = it as Int + invalidateOptionsMenu() } } From c9e355eecfdca974b6ad8d66c501a9d65b378e2a Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 28 Sep 2017 23:17:53 +0200 Subject: [PATCH 125/207] adding an initial implementation of directory_item_list --- .../gallery/activities/MainActivity.kt | 17 +++- .../main/res/layout/directory_item_list.xml | 80 +++++++------------ app/src/main/res/values/dimens.xml | 1 + 3 files changed, 46 insertions(+), 52 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 9799dd666..4380187b1 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -181,7 +181,12 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { showAllMedia() else getDirectories() - setupLayoutManager() + + if (config.viewTypeFolders == VIEW_TYPE_GRID) + setupGridLayoutManager() + else + setupListLayoutManager() + checkIfColorChanged() } else { ActivityCompat.requestPermissions(this, arrayOf(Manifest.permission.WRITE_EXTERNAL_STORAGE), STORAGE_PERMISSION) @@ -295,7 +300,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { private fun getRecyclerAdapter() = (directories_grid.adapter as DirectoryAdapter) - private fun setupLayoutManager() { + private fun setupGridLayoutManager() { val layoutManager = directories_grid.layoutManager as GridLayoutManager if (config.scrollHorizontally) { layoutManager.orientation = GridLayoutManager.HORIZONTAL @@ -333,6 +338,14 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { } } + private fun setupListLayoutManager() { + directories_grid.isDragSelectionEnabled = true + directories_grid.isZoomingEnabled = false + + val layoutManager = directories_grid.layoutManager as GridLayoutManager + layoutManager.spanCount = 1 + } + private fun createNewFolder() { FilePickerDialog(this, internalStoragePath, false, config.shouldShowHidden) { CreateNewFolderDialog(this, it) { diff --git a/app/src/main/res/layout/directory_item_list.xml b/app/src/main/res/layout/directory_item_list.xml index 6903b7f46..3f282976f 100644 --- a/app/src/main/res/layout/directory_item_list.xml +++ b/app/src/main/res/layout/directory_item_list.xml @@ -4,12 +4,13 @@ android:id="@+id/dir_holder" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:padding="1px"> + android:paddingLeft="@dimen/small_margin" + android:paddingTop="@dimen/small_margin"> + android:layout_width="@dimen/list_view_folder_thumbnail_size" + android:layout_height="@dimen/list_view_folder_thumbnail_size"/> + + + + - - - - - - - - - - 24dp 50dp 150dp + 72dp From 2ee425e21d7cc09c95e3eb7c189f597ffb384492 Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 29 Sep 2017 20:24:35 +0200 Subject: [PATCH 126/207] couple UI updates to the directory list view --- .../main/res/layout/directory_item_list.xml | 47 ++++++++++--------- 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/app/src/main/res/layout/directory_item_list.xml b/app/src/main/res/layout/directory_item_list.xml index 3f282976f..2588e528f 100644 --- a/app/src/main/res/layout/directory_item_list.xml +++ b/app/src/main/res/layout/directory_item_list.xml @@ -31,10 +31,10 @@ android:layout_toRightOf="@+id/dir_thumbnail" android:ellipsize="end" android:maxLines="1" - android:paddingLeft="@dimen/small_margin" - android:paddingRight="@dimen/small_margin" + android:paddingLeft="6dp" + android:paddingRight="6dp" android:textColor="@android:color/white" - android:textSize="@dimen/normal_text_size"/> + android:textSize="@dimen/bigger_text_size"/> - + android:layout_marginRight="@dimen/small_margin" + android:gravity="end" + android:orientation="horizontal"> - + + + From da00ed8422e1096c3e7403d72edefdc018deb936 Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 29 Sep 2017 21:31:12 +0200 Subject: [PATCH 127/207] add a divider between folders --- .../gallery/adapters/DirectoryAdapter.kt | 5 ++++- app/src/main/res/layout/directory_item_list.xml | 10 ++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt index 6a7d4874e..098aa11b9 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt @@ -20,6 +20,7 @@ import com.simplemobiletools.gallery.activities.SimpleActivity import com.simplemobiletools.gallery.dialogs.ExcludeFolderDialog import com.simplemobiletools.gallery.dialogs.PickMediumDialog import com.simplemobiletools.gallery.extensions.* +import com.simplemobiletools.gallery.helpers.VIEW_TYPE_LIST import com.simplemobiletools.gallery.models.AlbumCover import com.simplemobiletools.gallery.models.Directory import kotlinx.android.synthetic.main.directory_item_grid.view.* @@ -31,6 +32,7 @@ class DirectoryAdapter(val activity: SimpleActivity, var dirs: MutableList() @@ -326,7 +328,8 @@ class DirectoryAdapter(val activity: SimpleActivity, var dirs: MutableList + + + From 9947d661a3345b4e21bab2429a01dc4186ea3295 Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 29 Sep 2017 21:47:27 +0200 Subject: [PATCH 128/207] refresh the folders at changing view type --- .../gallery/activities/MainActivity.kt | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 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 4380187b1..57d7dff6c 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -182,11 +182,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { else getDirectories() - if (config.viewTypeFolders == VIEW_TYPE_GRID) - setupGridLayoutManager() - else - setupListLayoutManager() - + setupLayoutManager() checkIfColorChanged() } else { ActivityCompat.requestPermissions(this, arrayOf(Manifest.permission.WRITE_EXTERNAL_STORAGE), STORAGE_PERMISSION) @@ -261,6 +257,9 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { RadioGroupDialog(this, items, config.viewTypeFolders) { config.viewTypeFolders = it as Int invalidateOptionsMenu() + setupLayoutManager() + directories_grid.adapter = null + setupAdapter() } } @@ -300,6 +299,13 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { private fun getRecyclerAdapter() = (directories_grid.adapter as DirectoryAdapter) + private fun setupLayoutManager() { + if (config.viewTypeFolders == VIEW_TYPE_GRID) + setupGridLayoutManager() + else + setupListLayoutManager() + } + private fun setupGridLayoutManager() { val layoutManager = directories_grid.layoutManager as GridLayoutManager if (config.scrollHorizontally) { From d7eaaa070dcff34b244fa3622fb4afd0ab8ab6f4 Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 29 Sep 2017 21:57:24 +0200 Subject: [PATCH 129/207] show folder path at the list view --- .../gallery/adapters/DirectoryAdapter.kt | 3 ++- app/src/main/res/layout/directory_item_list.xml | 16 +++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt index 098aa11b9..5b0f851bc 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt @@ -23,7 +23,7 @@ import com.simplemobiletools.gallery.extensions.* import com.simplemobiletools.gallery.helpers.VIEW_TYPE_LIST import com.simplemobiletools.gallery.models.AlbumCover import com.simplemobiletools.gallery.models.Directory -import kotlinx.android.synthetic.main.directory_item_grid.view.* +import kotlinx.android.synthetic.main.directory_item_list.view.* import java.io.File import java.util.* @@ -397,6 +397,7 @@ class DirectoryAdapter(val activity: SimpleActivity, var dirs: MutableList + + From 216e51beff5a20062b79881f6149ff1f54c36f46 Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 29 Sep 2017 22:52:30 +0200 Subject: [PATCH 130/207] rename photo_video_item to photo_video_item_grid --- .../gallery/adapters/DirectoryAdapter.kt | 6 +-- .../gallery/adapters/MediaAdapter.kt | 13 ++--- ...deo_item.xml => photo_video_item_grid.xml} | 0 .../main/res/layout/photo_video_item_list.xml | 53 +++++++++++++++++++ 4 files changed, 62 insertions(+), 10 deletions(-) rename app/src/main/res/layout/{photo_video_item.xml => photo_video_item_grid.xml} (100%) create mode 100644 app/src/main/res/layout/photo_video_item_list.xml diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt index 5b0f851bc..c70d13194 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt @@ -430,10 +430,8 @@ class DirectoryAdapter(val activity: SimpleActivity, var dirs: MutableList= Build.VERSION_CODES.JELLY_BEAN_MR1 && activity.isDestroyed) - return - - Glide.with(activity).clear(view.dir_thumbnail) + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1 || !activity.isDestroyed) + Glide.with(activity).clear(view.dir_thumbnail) } } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt index 5441df3c2..3c71c7f6c 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt @@ -18,8 +18,9 @@ import com.simplemobiletools.commons.extensions.beVisibleIf import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.activities.SimpleActivity import com.simplemobiletools.gallery.extensions.* +import com.simplemobiletools.gallery.helpers.VIEW_TYPE_LIST import com.simplemobiletools.gallery.models.Medium -import kotlinx.android.synthetic.main.photo_video_item.view.* +import kotlinx.android.synthetic.main.photo_video_item_grid.view.* import java.io.File import java.util.* @@ -28,6 +29,7 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList, val multiSelector = MultiSelector() val config = activity.config + val isListViewType = config.viewTypeFiles == VIEW_TYPE_LIST var actMode: ActionMode? = null var itemViews = SparseArray() @@ -242,7 +244,8 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList, } override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): ViewHolder { - val view = LayoutInflater.from(parent?.context).inflate(R.layout.photo_video_item, parent, false) + val layoutType = if (isListViewType) R.layout.photo_video_item_list else R.layout.photo_video_item_grid + val view = LayoutInflater.from(parent?.context).inflate(layoutType, parent, false) return ViewHolder(view, adapterListener, activity, multiSelectorMode, multiSelector, listener, isPickIntent, itemClick) } @@ -345,10 +348,8 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList, } fun stopLoad() { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 && activity.isDestroyed) - return - - Glide.with(activity).clear(view.medium_thumbnail) + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1 || !activity.isDestroyed) + Glide.with(activity).clear(view.medium_thumbnail) } } diff --git a/app/src/main/res/layout/photo_video_item.xml b/app/src/main/res/layout/photo_video_item_grid.xml similarity index 100% rename from app/src/main/res/layout/photo_video_item.xml rename to app/src/main/res/layout/photo_video_item_grid.xml diff --git a/app/src/main/res/layout/photo_video_item_list.xml b/app/src/main/res/layout/photo_video_item_list.xml new file mode 100644 index 000000000..a8fdf5d21 --- /dev/null +++ b/app/src/main/res/layout/photo_video_item_list.xml @@ -0,0 +1,53 @@ + + + + + + + + + + + + From c8c09e09118beaa9373db614c29ec920a3db96c5 Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 29 Sep 2017 23:22:52 +0200 Subject: [PATCH 131/207] add the list view type handling in media activity --- .../gallery/activities/MediaActivity.kt | 20 +++++++ .../gallery/adapters/MediaAdapter.kt | 2 +- .../main/res/layout/directory_item_list.xml | 3 +- .../main/res/layout/photo_video_item_list.xml | 53 +++++++++++-------- app/src/main/res/values/dimens.xml | 1 + 5 files changed, 55 insertions(+), 24 deletions(-) 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 47eff4f7c..66a4eb984 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -212,6 +212,8 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { findItem(R.id.increase_column_count).isVisible = config.viewTypeFiles == VIEW_TYPE_GRID && config.mediaColumnCnt < 10 findItem(R.id.reduce_column_count).isVisible = config.viewTypeFiles == VIEW_TYPE_GRID && config.mediaColumnCnt > 1 + + findItem(R.id.toggle_filename).isVisible = config.viewTypeFiles == VIEW_TYPE_GRID } return true @@ -272,6 +274,9 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { RadioGroupDialog(this, items, config.viewTypeFiles) { config.viewTypeFiles = it as Int invalidateOptionsMenu() + setupLayoutManager() + media_grid.adapter = null + setupAdapter() } } @@ -365,6 +370,13 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { private fun getRecyclerAdapter() = (media_grid.adapter as MediaAdapter) private fun setupLayoutManager() { + if (config.viewTypeFiles == VIEW_TYPE_GRID) + setupGridLayoutManager() + else + setupListLayoutManager() + } + + private fun setupGridLayoutManager() { val layoutManager = media_grid.layoutManager as GridLayoutManager if (config.scrollHorizontally) { layoutManager.orientation = GridLayoutManager.HORIZONTAL @@ -402,6 +414,14 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { } } + private fun setupListLayoutManager() { + media_grid.isDragSelectionEnabled = true + media_grid.isZoomingEnabled = false + + val layoutManager = media_grid.layoutManager as GridLayoutManager + layoutManager.spanCount = 1 + } + private fun increaseColumnCount() { config.mediaColumnCnt = ++(media_grid.layoutManager as GridLayoutManager).spanCount invalidateOptionsMenu() diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt index 3c71c7f6c..e89d3b8c4 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt @@ -250,7 +250,7 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList, } override fun onBindViewHolder(holder: ViewHolder, position: Int) { - itemViews.put(position, holder.bindView(media[position], displayFilenames, scrollVertically)) + itemViews.put(position, holder.bindView(media[position], displayFilenames || isListViewType, scrollVertically)) toggleItemSelection(selectedPositions.contains(position), position) holder.itemView.tag = holder } diff --git a/app/src/main/res/layout/directory_item_list.xml b/app/src/main/res/layout/directory_item_list.xml index 3ecc8152d..5d5b4c21f 100644 --- a/app/src/main/res/layout/directory_item_list.xml +++ b/app/src/main/res/layout/directory_item_list.xml @@ -69,7 +69,8 @@ android:layout_alignParentRight="true" android:layout_marginRight="@dimen/small_margin" android:gravity="end" - android:orientation="horizontal"> + android:orientation="horizontal" + android:paddingBottom="@dimen/tiny_margin"> + android:paddingLeft="@dimen/small_margin" + android:paddingTop="@dimen/small_margin"> + android:layout_width="@dimen/list_view_folder_thumbnail_size" + android:layout_height="@dimen/list_view_folder_thumbnail_size"/> + + + android:layout_height="1dp" + android:layout_alignBottom="@+id/medium_thumbnail" + android:layout_marginTop="2dp" + android:layout_toRightOf="@+id/medium_thumbnail" + android:background="@drawable/divider"/> diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index 0c8d41eea..58e7e8c8e 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -3,6 +3,7 @@ 150dp 100dp 20dp + 22dp 26dp 150dp 24dp From d89ebec57a96c9c88a80d033368e5bcdd60e690f Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 29 Sep 2017 23:28:55 +0200 Subject: [PATCH 132/207] remove a redundant function --- .../simplemobiletools/gallery/fragments/PhotoFragment.kt | 6 ------ 1 file changed, 6 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt index c3709bd68..108cf9bc9 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt @@ -33,7 +33,6 @@ import com.simplemobiletools.gallery.extensions.config import com.simplemobiletools.gallery.extensions.getFileSignature import com.simplemobiletools.gallery.extensions.getRealPathFromURI import com.simplemobiletools.gallery.extensions.portrait -import com.simplemobiletools.gallery.helpers.GlideDecoder import com.simplemobiletools.gallery.helpers.GlideRotateTransformation import com.simplemobiletools.gallery.helpers.MEDIUM import com.simplemobiletools.gallery.models.Medium @@ -254,11 +253,6 @@ class PhotoFragment : ViewPagerFragment() { } } - fun refreshBitmap() { - view.subsampling_view.beGone() - loadBitmap() - } - fun rotateImageViewBy(degrees: Float) { view.subsampling_view.beGone() loadBitmap(degrees) From 1cd68fe9a034eaafb2c5bfb243506e82e2171448 Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 29 Sep 2017 23:46:09 +0200 Subject: [PATCH 133/207] color icons and texts in list views appropriately --- .../gallery/adapters/DirectoryAdapter.kt | 11 +++++++++-- .../gallery/adapters/MediaAdapter.kt | 12 +++++++++--- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt index c70d13194..257b94375 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt @@ -38,6 +38,7 @@ class DirectoryAdapter(val activity: SimpleActivity, var dirs: MutableList() val selectedPositions = HashSet() var primaryColor = config.primaryColor + var textColor = config.textColor var pinnedFolders = config.pinnedFolders var scrollVertically = !config.scrollHorizontally @@ -335,7 +336,7 @@ class DirectoryAdapter(val activity: SimpleActivity, var dirs: MutableList (Unit)) : SwappingHolder(view, MultiSelector()) { - fun bindView(directory: Directory, isPinned: Boolean, scrollVertically: Boolean): View { + fun bindView(directory: Directory, isPinned: Boolean, scrollVertically: Boolean, isListView: Boolean, textColor: Int): View { itemView.apply { dir_name.text = directory.name dir_path?.text = "${directory.path.substringBeforeLast("/")}/" @@ -403,6 +404,12 @@ class DirectoryAdapter(val activity: SimpleActivity, var dirs: MutableList, var itemViews = SparseArray() val selectedPositions = HashSet() var primaryColor = config.primaryColor + var textColor = config.textColor var displayFilenames = config.displayFileNames var scrollVertically = !config.scrollHorizontally @@ -250,7 +251,7 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList, } override fun onBindViewHolder(holder: ViewHolder, position: Int) { - itemViews.put(position, holder.bindView(media[position], displayFilenames || isListViewType, scrollVertically)) + itemViews.put(position, holder.bindView(media[position], displayFilenames, scrollVertically, isListViewType, textColor)) toggleItemSelection(selectedPositions.contains(position), position) holder.itemView.tag = holder } @@ -314,13 +315,18 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList, class ViewHolder(val view: View, val adapterListener: MyAdapterListener, val activity: SimpleActivity, val multiSelectorCallback: ModalMultiSelectorCallback, val multiSelector: MultiSelector, val listener: MediaOperationsListener?, val isPickIntent: Boolean, val itemClick: (Medium) -> (Unit)) : SwappingHolder(view, MultiSelector()) { - fun bindView(medium: Medium, displayFilenames: Boolean, scrollVertically: Boolean): View { + fun bindView(medium: Medium, displayFilenames: Boolean, scrollVertically: Boolean, isListViewType: Boolean, textColor: Int): View { itemView.apply { play_outline.visibility = if (medium.video) View.VISIBLE else View.GONE - photo_name.beVisibleIf(displayFilenames) + photo_name.beVisibleIf(displayFilenames || isListViewType) photo_name.text = medium.name activity.loadImage(medium.path, medium_thumbnail, scrollVertically) + if (isListViewType) { + photo_name.setTextColor(textColor) + play_outline.setColorFilter(textColor, PorterDuff.Mode.SRC_IN) + } + setOnClickListener { viewClicked(medium) } setOnLongClickListener { if (isPickIntent) viewClicked(medium) else viewLongClicked(); true } } From 99da56deec7562043c9b7efc8f879a3da6bd420e Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 29 Sep 2017 23:54:23 +0200 Subject: [PATCH 134/207] use a different video icon at list view, without fill --- .../gallery/adapters/DirectoryAdapter.kt | 2 ++ .../res/drawable-hdpi/img_play_outline_empty.png | Bin 0 -> 2228 bytes .../drawable-xhdpi/img_play_outline_empty.png | Bin 0 -> 2857 bytes .../drawable-xxhdpi/img_play_outline_empty.png | Bin 0 -> 5674 bytes .../drawable-xxxhdpi/img_play_outline_empty.png | Bin 0 -> 6911 bytes .../main/res/layout/photo_video_item_list.xml | 2 +- 6 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 app/src/main/res/drawable-hdpi/img_play_outline_empty.png create mode 100644 app/src/main/res/drawable-xhdpi/img_play_outline_empty.png create mode 100644 app/src/main/res/drawable-xxhdpi/img_play_outline_empty.png create mode 100644 app/src/main/res/drawable-xxxhdpi/img_play_outline_empty.png diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt index 257b94375..875115514 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt @@ -406,6 +406,8 @@ class DirectoryAdapter(val activity: SimpleActivity, var dirs: MutableListS zKCF9eb2)qVKIiOx?)@h>_hIin>p$zPS+i!%nn?^9>TF;!unc(9U{M&^?vm~YTNqIR$oycRX?FFp6>ouhPqO{U45ZOg_PkH^#|%XYU87#FR07Z zZ&|;!R7G3er{1f+ZN?}{ookr+&S_H2RJ7HX)OG4{)2*Cy)Q!#z#Y{z8eMY@>kUsWh zhQ`cvJ#Yu`h927yXag@3)A&|k2e2DBH2HiEun<@RtRTXGA5v{~ zi!rOMwkF4^E>}N0sql#&6!oOKvJMX2NS&-cR8cu?^;z{6bx|XPg440;T6L3Qp;hp- zy1H&6C-k741L~~~F?dstQEyatSK!!j-lx|ke4hGXMZp`@vuhFDAJ?VoPpoE5o7IyB z6*${)$YshIRlnhM#~u7XF1y(X8q4s2dh8&=K4$rBbwItznG(59Lj8a-DK}E9aS3oW{LG|bb#4P zP1B)VV@AHKq;DIHb!K5BD~x z+lSX>K5DBs*F>;a4otWq4d~vA-Sl$SGgFCiC)moxf~GK^+`4 z;;cr8oRLe~li{%rpyM1bq&V066tKBTvQsb@xCMAvJ+mnxDW!eDgPB*}t+ramUitY2 zF9|%5QnGf2c_iRG;5WuB*VK@EfY?CjhBJW^TSOtj(t?-Tz+(*%tBNJSUBDgc+y>g; zL=;JM!*Rfh7ExWXpx~vKfF~Lt)(hqWpCX1_-Lu@YMD<8F%m&VA5&KTF3tsv!@IuX` z`avSxz^|+^uuLh91J7k-u4)0NQtY6&&#>~6CBWUl`Wk1sXEV=EZ4tYcMc7soi8?VG z_%!hAnugrg%(KNUAeXd$u?7N7AORNu57iJ@?#?`$-y)n~5e^L?xM?KdMBpCaYw9t5 zwv+4QQDx3<*zr$47y(WvKN51t_OS(wWuBK77fd50DmT6eT$57T)n_}oK8}t6`!g>r z>{IA4umiX;rPMvaRUNrL?jIp)bc(QSK;cb5;66e*ML}LK$n|kgi{eNU;Iv_+9(urj zU>z}}>QD~An={XLju1uKV|0(E7ZPi=e#dv6_$P1!u%WKS^JGMxQ_w$JM4(jUhmHr% zs)Nh`XagI7H7TXKGYiX!l|(m;0nfCEwN}x3YZg$xnbsWk1GfTK4=_vRa5lx^!9L*m zR!Zp*@OZ&X3Am&IVpZ^O;40wOlu}VjVo+Sn;iTbIYyoz59zINQz_dnPUNf;A+Q9w5 zc`2n|HkGWK%rAYA;)VKSDW!>yf*v7EsvG72*VW9g2nRSE_|-K_72#sykWDvC5ZT6n zQSS0cCV~BgM{a`*fK1YUyLwq2GAeKwG0K9AHY&EM3#Wc`V@5#}>e`yfO;u1^{e@bT z_N^W28l%pj2zPe-Xp#DI=A*x=^J^e?q=NRTUvh|r3`Sx4Pc!`-SJxDM{C$hfZbJQJ z4Fo$1+HO?b54A!~eUJKDMnQil)jz58${Jd2RIe6cT)kyT{i+S>W$LRX)^mB4 zhLUlVAgAg5l^UBNFkDBj?owl96m5UKuE7OH2}lmR)$%W11WG*{VLBIIcG zXC+po5!c*cg%gBL!MCNcOQM|Ne@_)CB1x^E2 z5?eD%i3EGAN8S^_kAcrLl=v@(`XO~|50*4+>@|*yPT%IIx>)^=)uz^AVa!-t;u2k`gFzb(MOQc4rU;`~4SVM%ef`60ak0000#6Y5wXq=c!F%n5oDGElz3^G@t0~9Qj*#a`Or4-t}`}4!P4_@oz zy?yRI=brQWPx|4d=kC4sT4%4b_u6ayccS4?#{rXoJ%P!<4xPUz0^@-MtOZsBD}gtG zWxx{P&6Lub8pO^jZUA^0xE+`a+?7&VUQu6JsLcTC6yS8=B;XTt_lEZ*0^zRy z4E&ZbM!U~4^cU(T>T&8F>ROwF0d;};Ep>~!^;A04aq8FAg=)J-MURHIx=cM!om98p zdWM?Rqt$tJYPCzesGebbqsAW8-P9Y@b#-d7N3_)k)kEsmXEuzt{!I0aT2)sr-d8VG zCzh?RQddFh4#3sKlCtU*mc+7BU|b*i16Tl@l2V#qR)eJptsV;e9@w>{b_G@e{{j{Q zPZFD|{}4Of<(+5f^tU;&iJMI9B|Zu42OJD+M|sQKcY#^JoRpHIJzO~qmor0MRl-zX zqdub1)Q{Gtm9;AL(y|W}a2h^Wg_Xk>SsXw&$5A9O*5_Lbd(hZrqvtf*R9Yywn zx$0I`$~)3PHc>CL`*nR={ik}ex_M3VAEo}q-d>>l)a~jJ{+b??zgYc>5$UWIh6|ml z-qz)K+Umo7GlIRn`ERM;w{G7#3_6B5QC-r-*xKp?>el@b@}e#U{F}OGr2>`!bsP1U zb{DJqt2&`d;bvIeU%scFt8QAEU==_;UVXI-BV1t>3kh|)#g}les7IDAOrN0cp*~b_ z%x(4TvIW^*eZHU|PpEs9Do71bC#g3T9Q$g^iXRz%f3Ep{e{fasu~GzR0Mt#@*#&f< z`i#158J(Y5u;Yi-?MoPUqhOqATwOp98b<3rEMtU}|68ELMQ%iI{)RAS!VLxVu}(d% z+s;zK&R%gN@cE-b-9o*$fL@-mn{b8tMe~=O@2N*sFy2POh$p?6shhTXVbKo8sgD-u z;M|JF+E}PZbY8q1ELV3f()iah8&>_h6~uJZZLK&m+AAy;75GJNqnj8h8aa5|iu}HM zmU^vK$5(oQI>9)<$ichnE;)@JTfnO4RXDg=oj&HP2UgWjuTT#&?_8m+UXs(`?U~Ad z+6tqZLkytdLucB{nz}-$zsuCw>yDIfq)su81#_% zBz0f&mZk5j`wsqY=m4eyyJhtC9Po#dd6pHXr6Hjf7*@`^#ASFU*)eYt&CwBKigx#RYAMl{R3N zq>eZ5++?+#o$=rszax;dp?VT{s;U9>fGvS5fotn@Nu7GMTQeS=KxFKFV1Vi5l?C0@ z;3|>?oCe&dex^n_{z#r1Is!g4z~?f4AaF-_GW8V)0QVRNNp-lShlrfk(J)<2g9g|? z;|HsVO2e^$t$@pb+4ebgFr~Btcr4@5y?_ZVV?(u1#t-JDlyWTF6toDJ^q~EZCEcCz z%r?N}7E$y(dXx^H=t-n{kcbrZd+qPWEk{=gn9?GqLXKch_asui7~HsBV}HWixw_iB zMHDsU;NM*e(-gFTZxFMgYL}F&tH~{bdm#rebSX^JFt|#pY~$9czJEL8(H&Yq?vz~C zy-1D2B;X2QPK6t{9DPk{5v(JlL10C1@-z-D;8Y@(RE0~*(bvQlkdw8%j=bI7Si}@! z_gwZWX>GHaeCK z&?ZPk4lk2vV+7>t>X|_o^jgNleK`xR04sqrfHOO>`hFl+SBqPnbIhFJ(ZPrS)CDy0v*l*#qj) zm59H-JR{|XwvDRwdg#K2fx4smW~Tl=SS5Wh13KrJb2IvC0q4||bq2Aqnn{JRoGvi~ z$l-=q3_LvS|ENcrS8%qT6|2B7GoWo0?B!(f^%Vxm(`y-eQ@voMhEivcIk?jbXTb&r z7%({M8sl{E!M6HM^UG8#E7TiefVb7tt2A~mFuy=g^}3t}CmIy)Iaq2L zoH)bFG0P}|Zfy9&;7z?bQ&$7(LAecoFSF6M`s<1Yx1SBE|N1BxoTs_uuQwHGcuVss z%GRn)4^fm3gHJA(OKFWobB_#$#N2PetBwIm%Cca%=?5}(qk45Woos4cUXY7NY%sA# zSup(ml?C+jhTX=`)M@5(;%JcjjkQCYLQpTT7=dAL6qe@G7Yt&K4d8^X0>;X$2yyM* z_WDAqo2!o%=(KIH1#VO`LH)MH=#0zbQd0L<-zm_!>W%7_r3g?X44;3Y#oqh@^|Z1D zIjx`&8q6TOmMTaeVK5|KWpT3d-&7^gr3D31eaSJ%A8oAji!3zgZlzp-NayugoXoB%3_j)H++latku71f9 z<4Oh}-XZG61~F9`7mVIx2_M{2PMM6;sxR9X8Sp+NrmZX$MEGRK9 zWZnzdgUHc2oG8HCnsVyg+Q3!7Ib~3{m3^7#G~#;jDr*VeCW@d}@L~DvIHD$NN22n- zs)EAhz;{wgqaQ71qV#iCbsONP1TVwJ5|oq3pPiXfT2i+#Sx}ELK2lA-!aN6W7=gI4 z7hE(pZRZ=2!Lf!lMjR-g_rIx7C#ydju(Smfv1YzKb1fB0xsyD^}k)MAn za1-$G|D}re5sgasQzsKfID#m2+lQ#P>P5~~z)~V3`EKBTU}>F7ABsj9U?@7XV*B}hkB5_Qk75~a6`=~N>&mGSp~O4LqoW36yM00000NkvXX Hu0mjfyHa=o literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-xxhdpi/img_play_outline_empty.png b/app/src/main/res/drawable-xxhdpi/img_play_outline_empty.png new file mode 100644 index 0000000000000000000000000000000000000000..95a4f7d28d423042ab1402a1a7181145dc7cc1ac GIT binary patch literal 5674 zcmV+_7S-vAP)V-HmG^k)Vh@gy0iz13LBQpU)2${%SRqyLR_I*iF zBqVk28}55mzqQ^{%)LdsNiUJ_g2J;1HN4Zu~v zy(y)Y?HpJxs=CmdL?LnZ2Hpw09GC}8C6r$1j5%3+Rsr_{e+DiBE=?)*wR2#@MJFsa zY7e3C9ta!>90qLF)|Rko&Djr!JhGw^NTQsD6_NTf7U(#24>295?k0nBXS{p+6JJ|b$qjEJH?0^C=8<`dS=LLv}a zzXmoCX95v(t4H!@6EU~Bz%)YfpHckYm_gUJ0&9Q^fiI<$Zg0^&TSp*uJK!_KmNl&f z_m+4&mjQPXk@33;Z*QF}iyEOjsFT@{F0v<~&&@0TzAZ40)~t0Oa6Rxz;14OKfo9*Z zB?MBR51c|+S>v01J0i*JRw5+u8$!Y?29~u#*;Kb8@{DE^+w|eU!NiNxY(t?&ME(B_ zxV+i1wWboNa10(sOlE&J=n;)ZKe6rHPIzvA0sN&(fk|~o;1J+Vz)Oj(ZamFd4~eb% zRN(6=rPWQi2hcTl2y`gnao?LrZfgdX z0sjh|ol;ubqwMZb@DWF z5tgXusYe*uh+PFWse7rPSMO=U`mIq7uv0a_6?$qx2wHoR~_3zaijjg*8sHsmG zde_)?&v8A}7pONF(xMUQS8rC2R3~kI1lp6iMpaeYpeRC`gW_J3aHzu-?wpZ z$y)Ui^+3BsNiGX@M?*Jy(#CCRH>-!*PL;qgpTBNs`DG_oQx_THb!yutRZ$qy==JJt zYG28VEB<)QQGh(TK_1r=FmWYukh>4#QG=wfZYVQkO-)dXYM@9h2EZeayy) z)O!tmr`wL|G#rK`+S}OX8?p9l4MEVltxVlTy}slGYQ`IItGZ9i2HzzxJlW?N%5~Z2 z@TlLi?D@zPogFL@e4{Q3MyAgO!y zEUa5w?`rq}M>y2o)t_75#J|!w@X*k~B_qytSINOGGEDVRYpcO9Vvz?~J{Gy$@WoAN zj>LA)fcK)mwa}YxS0gB&6#U+fxjU?`Mw7Hm?+)W&P4Z}fe)y2+c<`nBBgW}adv)H ziLcoY$cxw;TKzw$OEcM9Qy);DS7HJUfsq<=mwK^rMr}ku9cvss$aTH+7uRo{bMv|C zFU=Q$OV#%@VO@refuc{1bL zs$n*80`Q-9(W%%%FTIB77L=n4?Mzf&TaTdx+JpS<>rUX>E@}Cgh}H^k27Yd2BXrA_ zb}u1?axevW?cg5_CD0+n_BCAVOQI^+BbfuMBI;Y(Jm8DKXVhu!9a4D|`sq)IcAdk% z9C($3j+?J1ka5`lVDc)7tpYCVP~~}ZsQ2&q2(hJggOzqWa2t8s*iMA&19&=FW|Oyl zNfflaHRIY&LA}K9k-)|3`#ah3Sk#WZm@s^Xi?P7V3yb|}1lo%Yy|{*h0a{QEv?54E z3ExwJ6O9l-CBiis_&=f$=WvmTG>>sm5Xd;jaR7Oq=Ve4~;*o-Sfbk^YKZqBv6Y(JV z+t_Zv*04bWO#xn#@kJ6vyzkApw$m}02>D#np^nEVfIpG9jcrd@?CS|MgYW?j7ZTOq zmt8M+2bAU5}lR7MxwuX3iIo+Zs0&~=!I)P>pQfRp7BP7tWjBC3Ivw-6XE3G5E z*G03sI|;|{aJR9oh&hkxDU`sugh(DP77|TiyU~0f4ifQJ9syiwWIT4lmUbKPaK?3G z3C>LDA-c-UB^F?~SVlB18O1ZxLq2WwGai?dN1(dUnbJeBX(oB)_LmY;XcQZefb9s! z>g>(@emih~=5>>S$vuQeF}KL#J(<^yG;9NW95_wgz1@Qu zg4}1=3rwv`pj?aLfz0bhA|?|VkCz!moT^eleL2yLZ@3r(Y*SaFb8EpY$h>YOVzA@! zYgEMXSonh;&%Atcoj|#L6Gknt;Uf_W=!w8L9nN{H<{{@fCSXz-0@cXR@E_@@J01@Q zE?3_(G+DjH$PGn3x9&*HDZNr7FOoZo4X7WrJ{9;>8y%0iXZXhTklzTmk5K|O0(HmZ zM}e;xofuo~c+Ab^>a7P;a|SG<1ZpJ46S+mZlXohn46=QBz2p<2mlpM%9|7niG6YWn ze%prZ&fKoi1HD8_YECr0m*%wc9%)z&oCkabxT7$uTa8=-_4N|$&tZHb#BNSP(nyEI zw($_~S>VEy(z-T|C-;EBs$O7S@fj`>5s~eNlc=r6TH+Y^8N`8vcI%S4*58UAf;?+8 zzhGwObt4&l!1sv^#$Q%|Jdj5qfv0+j+}NiwZ(Id0YNw!|$U#1n3RN&MIz(=tacK>B zvMhmi%Dir*VSp$+aXN5aRmf9dE_ue#0I;}DpxmVR5mPd^1l9l-0G|UMs9^ro3pW2N z8^vm1c`qS-9?krcS?c7JQceZXZbyyC_B#W(Af;4QYc;pX=mKC#FTtb*gh(20Ol%sV zfQ=I9>F6gMgP)~6j=?QL5i-f`4Ym+?s)v~D!{qsMrVw$QQEb3U!pb@>rF30Y$x~n) zklRUMKCrx}*pnY5Pm!Jh>{ZoM2Q9_`al+wPf;_p&>aE1CY^3t)7NDQVMqN?Yz8@oR z8=64up;bL`&?>9}t^_`sQaY#2UghE7g~XBe;R=A&1ZVo|QQybNODY;euy`tY6|cGh zeZcpKG}XJ?JCrSl`W)if<>bS!1m>rd2I>-MF>p)fSoR<)n~pT}6P3P>2R@Qgx}#$L zoy}o7QBXA}8}$j`4k#Q*g~+`z`sEc&zbJ#rgvGoa!`FXmg!T2n;2%DXKt(r~E6J-`m56gqM`T=E1=KSJj{}ZR zDc#v6`p#hNO%N#O+}Se1_w}^m1GPbaX)qB*xHO@kH zJ=COrTwPt_8D42_6*cvxhCY*vb?Px{uHx1ZsQankQ{QM_uGHA5NCX(iP#sFTzk+D+tELY<=imtidA;wCls+}Qeo%rY#PTo(7M7uo&k z9+iPQLH&ffw8V4kQ;%-cfc{lon>i5GmFgGNR#)B{kubLEzm_0RO})`Z)v`9~_Wi!Z zfK(T&huawr#*T$Lvv~MrwytIBdmA~ZUc=$Gu*9HhhC==tN02VkN*H?Hxt4p;*QsZz zTQ_=e+o|W399+M8mAX$u2R91Tt<_W2|frz}Ov{`(mp*suvq(UKy-V zzoX7=>VUf#26>KE=UZO#+@l`eib40NuT$?U#~*8kd4IkY2zPWM49QcLJQ^?azt~E( z!e|h(s^q|H#pfc!RWNFuZ2=60`JXJmZE0*>XRA|NJ&Cc!jn|c&fW|^xuD+tBljuOG za|~;1k>$x#Q*TvwZP#RWGa~L~oK|)8sW+>ybOZ%FhXccva<2N6<;kP^sQRvUPilYl zw+)(5O?_Pbq&iyptbh^QdZYS>2CcK|0z(1MZ8q4j$&FFpPz#c%1 z)d-CK)y7DA4Qc;*TdntO3Pz~oV@ABI5vUou)z#{o9U%!|gJC3t%`;Lm%0$(NqF?=~ zjSf|mg&}57Fydv6nrz+F|B)e$+AD5b0E0L)4J+#*L+UhYJ=YlFsGPcp&4-c1^eMx< zZ`7nU7V$=dpk3>DG!oyAFue3@ny`i!tGUOTTLa?=$=8fL+(s@yT{pT$eYMSu*R&Xh zb9N`gGykx$%`_4NMt0#Yc7jf6kmzI^yPefhGstT zqt|P-q4ShWO>H%b#rc@!(+f6*n!3ag%g3s_+94T_hK}Ex|(IEa3E% zQd2uhwnVHMTg$<~7lD_Nf53l>Z%G`>ev%;5O+?9>yNDyY%Nkwx$Jipq5taMr5p9(A zAx`J+K%CZX_Ie9EPPCRfKc%#^$@gnr+wNk4_XR#p)aV=AqWjm$w3;B)LqwyHdkJ#Q zC+Y$%8jgfA3Nq|W)B)I~`0PZKPniKsBFfz)S~JfYa3}Bu;K!}1GSYIz%EqUI~W zHSOw%*!H)+kVbDIDulfhm`DZ2RbliIrI`O4IIZ2SG%N9-j0Ccsfp-G$Bg*7eVr&(| za-xCnIlv87C_h}Ohonv*>KK23@SBV#+XwoIDq&v-E(I31(x>%os1$+fDDR0IpqD}`6A#|iS09(^qv%ejv*Kqs|a0zf}O6i{V z4r$YI*XJvM$Ese#v7;VBL8dvty9sah&IFly z>9DyJs1X(5A0b*yd<(dxlbYCd;-X_5K->X%G4N{OK*DmHLTAirHPN`_kA$ST3Am#Q zR@HFP35)%#P$v^)ng_h5`0PmayxRl7BH#u>x4DIAT=GOGH*~4e0yhLkS+<>s4vPB$ zyAd(B$-q`LKZsio+^!%RliW{qxw)2T70}Uy8H%nW&|nyO)6;<638^%jh?dVGTm!QS zV)e2iFuEmcBB8$w5M+6b2*S=M@{b+^9wu5tJ_fAnCejQ>R}*M33UBuqBIY)Qa8gbu z2sDjQ#wQg&pGa(hb>)13Fs)Y+k?$2mYRFR5y2acTT7k#*V QdjJ3c07*qoM6N<$f`c;9-T(jq literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-xxxhdpi/img_play_outline_empty.png b/app/src/main/res/drawable-xxxhdpi/img_play_outline_empty.png new file mode 100644 index 0000000000000000000000000000000000000000..df8727abdb133e6d99e3b44abe6934d0e86d5ed2 GIT binary patch literal 6911 zcmVqP)el7f<=(n$pS{mM`y1no(o@AcbFIDRUUSVg=Uj=FQcx3+fT7~gX(K*EBfbZ)_;iZT zFtBpOcczp&y_A1YNH6?PTGm7{$)^G912ciGfL8(A0b2l@0xt$O1YT79n{|uN^y0rw z#DpIPmKUF;z@p-_0GJOv0XzWQ3ETxNEdG9Zs~l@js{oTgU7wiH+X6cQy8y2&{(L#G zP7lSI2iykC1?~WDClq5Iu%K0niP0*+IH(%|n-g#JLxKH>$-W`+2Cvij4Fk)72Z0-a zOMw3d9s=g2lvY+KTWzV+1FRf%2-pnR75D>Sf8b@scS9A5wze!H6yP@CJm6|zZc1rc zrBc<1RsjHYYv5qu5a0k{2f{vY5&};WtHZB>i-8+bN-HXrs$vFK0n|+hljbO5;&08W zO=;5+cn0_%;D>}V%o)Ue!yr8D=O|2^oq%JAiN6iunHgk;2~X4Yz?r}=Qc6pz6{&X& zgaWA337h_Xz(K&q)k;)bRuG<~9|C8ml6U6mDvw4^hQhx8GvH*x%xPpldw|5j-1)#Mz|Bo_r#5P0sI!6NffImNR4h)@ zSVkzqmw@Y2O2ZY)lZ8eofVu%;>U;{=v0`zW&T`-^;56X2l#&(8GbQ?30n~K}zy046 zhgSV~Sk;e6c#ggdd@H5&XvOlZHGQi9>W;u?fOi42Di&u@=@6&PUj)ugDJ`v7o=MYp z3ZTv+?EH@q0cb7Nvy=$6I3=ZYQ`N#uhQ3jNBJ_A~;%##f5scPS9|RsJHpyqClonPj z&xGg;1yI)|T$+DLL}#|tmleQofRCn>ZmU|D7ozqGpl%PGPQ>f9Z~gw^QQ&harLR{l z$avIR0n~Q`Uni1KYAx#|>83rdAWVnp#b;!iWD{5k{1rt1gqrZhea+(&pv?gJhJ9xncT6nKhN;RfAL8u3||NT=Ka*pi4+-JA&G+Zot| zNWtvp7T0-fAo_O~@Fyvy>#G)KG_@N%^%cN3hzzVc`t`es>Whh7-OGTRh?K;8fcsNQ z%S-!l-Hh;l?MP&&9ZV?4EFvYdcF(k6KJZE4oH~V5)Ml^>FV8{1*NDXOIwA39zn{pe zy0ZA(S%;I*BIs{_U?1QOgko$?{q{`DfUgkl(x z|2vUbUi(Qu9_lv4%J4^oQfx{+Ov|f)52TcCuTqFg6=2k6x9T_4L%@Z=e*%}Ml%B0v zo~#rm=FY%jz&nXU#a@kNDwd=7s2i%^RfnyPVRerBH|i@5^P%w+V}H1M zp1QEQ;aBxx_28<>#rhZ7>(s(-#9O_JUU-kRyVzpDz^O&c;z3TDk z3F>V1{0awquKGbEYpexOXQ+Ft-?5sPQb(PyzN_l7C>3MrJbzSve?Cs=#T>V?)gtTRfsE4S(Fhc~9+OT?+x^LBeZyLt_t-BiZiksB!s_y$*p(gbhd*^3ftp0<# zY1MsiD(aAWsCsLUo~h~uYF)x(CXV_h^@$!0(u3;JwzhsxP`6QkWbe${Z>#H7-R}uw zoT}d5qrtgS-L>jI4;t$F>R+qR^xzq|GOV6u#K*T(fN^ecq~WzG zn?>qjRrmP?QNL{YOXD*2@6|d)j}A1(UT;4mw4`hvFcPNfiF$$6n-u@==OX`ru32%GI)esCv$)ScbqYUP&d-bwIZ!+w!GPp`@OQ1IlLkUi>9B*OA zNbE1a%!{${{Y?p-(1_}61KS#kk$iu;<+w*z*o%B(^?jC;8MN5ec-gw?E!`Y+)(u4TJ@l+W$I^)GL^ZV zDjoHNoI)OJ{-tWEeK>hsT>&)8`JG@de9#TVFoiD4JhwVV_{F+81e`YNf#>3EdwG1F z37@Y38s!(yw#`poE7U!W7h+D9nXrY9LH7w4Oi~<>VZ|u*pC>w zwA);+d=+>JEmD zo0GYgd0JO8u6YF*$qMy*wpHpTh5B*x?ln8=spI|T3)$d*4$RKiMLNJgHSPYbF_;eg zF>tZEzwHV4MEMSJsdg?BaJ1v3POeb_)Y(Ap8$0F@m(UFgyAju`o?s4-M8iob%_HuK z&UyFp7Qh;_#>QI#_5)s;QIHOBYD#H-#y0zb*}&<*S8csS6XCnWHMO~z1{~oUHpAm7 zz`KB)$NhH!=VffKpBMt(4_u_ap*4xtOtA`lhrFx6KEMuR{l%CHU|g>J){FuG{0MkF zbDRA{0`?$Gzz^F`)sB15kAa6XwznDZ2V?!knpS`}06A-}JOrGRQp%~-{mSORKLh_} z8%wk%?jl~8IXT?8n0+;#rvS$3?4gA1l#2_2do#Az@2pFhMCYjoR4q*1C|;C51fI^= z?5lw1-8M7U3NRbkmsqlMupIcmDW%~|?KOq&!P&V+d6_nrXmxG@ZqC@=i;2C!YK)}- zy8%08{NY=HUuSHuX>0*}2{@xYI9o+ZX))mu>SSti2zZC1O6`oL07n41j`0P)pHg}z zQ+rKi1`%>{sk(dB!qkZKfCn?S_c}(o_E%E?;}-S3GydR{z$F>mYcdJg6}a4}h*w?B z%lhyLa0U5XqMHG)8TrNN6<|wX`%FIua5r#!#`Xq*S-@$)H^w`{9|Vfc@C87w{o{0C z-;w7qqZQzlgqto00zXSBEy>j0AkjTI`?+!bP~YWEWaJWHUdHzJ0-kd?j2_rGkMZ5w zvJki^Q(J>b0(J*}0{q3G9-O6=9t5t<*yNssM+g`(*^2?rSzqx!^187GmF~gW>1xi{ ztbXEr@|i)KGs4R`@@>B-SHc#0Iwon>f;jf+HEbX*o-(hJ8Mu5&I(H+ z=X}~8SPu#XD3;Wn$rt|c1aSh~QV#178D|%$InQnC%w^;|4|plC0jyd9rZGmK&{`sJ zNlGc#5q8ViB*LR{u~BEU>8{dW6LDoZ*o49p)E%_-2@@y>0ykx9t7Uu=up#gj;2fKM zvBio9j!lu} zw6XtHu_tkGc3jgA&Wf;zoE0OsRfoC?uye+S7Xc4sY_DZnA)Y6uzu{WzqH8!Cx zQO>!wJ}_&D*b(PEP|0bhwM?Dagh}+x2Gk|GGhpjd0HUxpHRkwB%u3!b|jX zb^oe`nF33I1)18K4$STo>wqv3bYDPe`XM|M3)p9XMGV~U7Q8voL?Ju zSAbj|0)e&yME|fG@N?qetY5rDIg4e@93leYa@m6&^3`!^=?$}qlH~p3CCXV~ZD!XE znyU=rO7d3qZRrg|z%jrti&&yMn?$)HLIGxU6(Cpe)CyV!=x25Z&IL|1=S98Hpx=2h@Q37$4#-JP6FUtN6E;_))5)hyExl(Y@J-;Tl+yiG3$q4t=0Xoo zC$9p`AfGwa(pwe)p8&p_Qp#y&#X94eMz~qO#)k{_Y3%bQ{ zb7paEucr1=?8=!3{4c`fX-bujoY!|f4y@>&+U87T-;lgX_AQg=3gWiUvl=w{Az$@E zfO~+IT?NQl%5Wxm>kPF_oaIC;&%07eS2b`I-X&vOcc+w|Q-Ej4muoqVsJhkCTb=<< z0!~aRJzljixhXER$hiXC4XZB1SWH}Jn&Xshh`gJXmhlm|5%^$AsmWEjH)7N!*Hh$r zSQWXsoUn;(j!$1(_>ys-twJScUR7l3h)$pZ+72>HZn8^60tl-0B81bAlp=UBl%*0mJ{O% zj8K3=BQDAGBM?{8ADFSdL1a1b4dC4=rRxXr=FOsr@7u|jYI_SK$}5geVE=FOCC5wy zj;eW)r8+Yo_$ctPl+qwq+}@wO_Wy4gk^eGU0UiYI%lKn^llSmqP`DX51UO?rO`egw zjeNzM1+E#nl8#n@`M_E=OjagIk(o$k%#Gk=y4>7dWC zngXPhhKXvyxdwg)aCB=1O^C;Uj}S@f&sHr=P1uLLVKuih>aO9jidbDv#7gJlO~7k1 zw%0U^;INGCHHoD}#@1me zr5maire8t@v=OQRpI(MxP~!I`!y-RjfB567c+np z)SP#b^&=~RGl*E8CM2ns#UbSN9xem^eJroqm6T zN@HHGH=Y9AL6J6=kt2!yz@RWpB&okSrF7j3{o_HWxT*3JL}7(oECPPAroUXH0u=Vr z8RWf_X+7X$YR=6~9qCrvJD%|J^i%caD%lHoYvwku2d-MH|59C7y+!SqkB<6=ynXB) z>P+>9ar!r`UZ?I;wXFR_G1q>Tah|CzSKm9{?~Z$&QDLwCh`blyCEyFjW~XU%54L{4 zkE<_N#o^>HrtlE(t0}dhZl%u8teL9E+Q;|$kb%UYnWr(R%w>td;z zvyLdJuTd9g7PO;YX&(j3sq3p>Rrj^cbC?pwo@rU;Ii-4L8NyCee^`RBE7gBg`{IIa zHL2@WEl0nj?xH?e!hBky?pBu2yPJO%P<>j>eE`x@Qw%e*4AV#To0j!5Rfp8mN)r4I zbM4w&YK{80#>$_Y`D(d$Q>Z%`8^AL74>e~BTuaSR4_BWlVeWL)FWL)J+VI;Bm(+>R z*_KpnB!=C8UkUR@^-eYCE%M`bWDE7TC3R$>`c7L9OQTRXRWB-O&a6;B*y|3x*ZhZL zT^?0m-_s7Yl!oCtKD(s3qWVjF?MgSI_kLhG8)A(mt-Wik&rzqVU$C4_uf{2IHFr^{ zdl*4rWpTB-StXro$%1;Kli?(o@IGnp)QwM_HlR1q)}(6AF*7U zzoR~`zPjrEj)}U7dTWUT(B)?JwYG<4wZPa1e!+;tFO%i!aaH$sT-4pvCrTa&jXlTP zY?Yu=j1%7PSe~E1OGiDe>i$j$^?jDR6n2?sxMAC@tO`(fHBMoB!NuzAs{1@4jO3ZW zvz&mr(X3F<=$pZ52u4)r{XKZTs&}c|Ro&-Fp>Ak|O7wzmYULhP_q*vB$t<6@TsP-P z=BWo)-S4$ReTjN`j|Qq+o985(S#+y%)K{y&uzY*J%Odqy`+1*dB+%T_qXE+h%lLu1 zQ`LQM3dURi&ke^z*>3JGOVv->gxnByFZF>Q4V=b9dRYCC?P@S3j2GC2mK*Oinql>y z8ujedHyHL@uihXUOZCO-o>lk1-!Odpe{JO1_VSr^jKucldG^$|82QA#98iq|lz&rS zR`nRv9V5@U}nL2{sCwy-Ynu zy~66=_+6G7O_0UPoCrvtxVwJZf4;6dVYwTpoZQc4e0E7IgJ-m0$$-bP$Kvzu{3Y<+ zlv2*Ss3%P=6aXTZ0QeGcEOE1Z9gw){bUyG~;HQLA%tNAf+_7YGJz6ZIHTevfl%~2E2?K$~Xdn6~HsV z-N0SI9N-b)PT)4+sp8);nKz!R_8-%M?FbX*rNAqIor~|b0oDQP94{lVlDIJZvnizo z70a_4wVhn*%YknIhf?nc{6Z`M9tIvOK2H&Qj1|SFLrn7SL|zxz9M}Tbl6b54YfOy5 z6U4;NduLZBYO4ScW%Ynh0iOhBRV+@+GrCHSrfHZfG+Brhz;_dyujt& zEwx}Fa4K+WO6lpUg&B{&PyhgROW@PMp8*?GD^1H9ka+8V4){ecodRo1-zWe?t}(Ge z{v5CeVLP|fgL%L?z(1svo~T-wiPBdJ(8UO1JB~O^*@QmrM?+W%Tn2m=xUTAht;y22 z6UPW%+l^3y_tLHgRd5&ZMc}_uO3zd+%-Ybm3ecs9B{>NA-^9^>OZm(Pz7BjPrSy2! z!c2v}SAZ_+EZ}h9Z-7_PpuW|JrNI9I{t>vpA2zu!MB^rjQ9}Ja#M#02#n+ANXAcor zPHb>b2X1M?#P8DBiJ{H}jscD*_6l_guO2pdqbBs|=1Qr3;67g4;_LDDv zDh!MQj6~gvNWOU|uos~WgE$sTfjfYUh+Ky&n`GZlgh71h&rz%j+W|)chY=yio6_uY zSxO|OTnl_3xTary_&I3ugPs({rumh`if|;bKXJ<3@0;fiG3jpyE(Cr> z)+5p!yUNj>{C{maQH5%!D475N002ovPDHLk FV1g~FaR2}S literal 0 HcmV?d00001 diff --git a/app/src/main/res/layout/photo_video_item_list.xml b/app/src/main/res/layout/photo_video_item_list.xml index 8fd7e34f3..dd1e17da8 100644 --- a/app/src/main/res/layout/photo_video_item_list.xml +++ b/app/src/main/res/layout/photo_video_item_list.xml @@ -47,7 +47,7 @@ android:layout_alignParentRight="true" android:layout_marginRight="@dimen/small_margin" android:paddingBottom="6dp" - android:src="@drawable/img_play_outline" + android:src="@drawable/img_play_outline_empty" android:visibility="gone"/> Date: Sat, 30 Sep 2017 18:07:26 +0200 Subject: [PATCH 135/207] update kotlin to 1.1.51 --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 1b8f6288b..15c7c312c 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -52,7 +52,7 @@ dependencies { } buildscript { - ext.kotlin_version = '1.1.50' + ext.kotlin_version = '1.1.51' repositories { mavenCentral() } From 73bcad0f682fdb16b0a105a8c285c91a41edb691 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 30 Sep 2017 20:24:18 +0200 Subject: [PATCH 136/207] try using adapterPosition instead of layoutPosition in recyclerView adapters --- .../gallery/adapters/DirectoryAdapter.kt | 8 ++++---- .../simplemobiletools/gallery/adapters/MediaAdapter.kt | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt index 875115514..6c6077fab 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt @@ -420,8 +420,8 @@ class DirectoryAdapter(val activity: SimpleActivity, var dirs: MutableList, private fun viewClicked(medium: Medium) { if (multiSelector.isSelectable) { - val isSelected = adapterListener.getSelectedPositions().contains(layoutPosition) - adapterListener.toggleItemSelectionAdapter(!isSelected, layoutPosition) + val isSelected = adapterListener.getSelectedPositions().contains(adapterPosition) + adapterListener.toggleItemSelectionAdapter(!isSelected, adapterPosition) } else { itemClick(medium) } @@ -346,10 +346,10 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList, if (listener != null) { if (!multiSelector.isSelectable) { activity.startSupportActionMode(multiSelectorCallback) - adapterListener.toggleItemSelectionAdapter(true, layoutPosition) + adapterListener.toggleItemSelectionAdapter(true, adapterPosition) } - listener.itemLongClicked(layoutPosition) + listener.itemLongClicked(adapterPosition) } } From 3d674c65ba4a822c8dbacd038986703c0f600630 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 30 Sep 2017 20:32:58 +0200 Subject: [PATCH 137/207] properly update text color at list view, if it changes --- .../gallery/activities/MainActivity.kt | 13 ++++++++++--- .../gallery/activities/MediaActivity.kt | 13 ++++++++++--- .../gallery/adapters/DirectoryAdapter.kt | 5 +++++ .../gallery/adapters/MediaAdapter.kt | 5 +++++ 4 files changed, 30 insertions(+), 6 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 57d7dff6c..d9997a500 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -57,6 +57,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { private var mStoredAnimateGifs = true private var mStoredCropThumbnails = true private var mStoredScrollHorizontally = true + private var mStoredTextColor = 0 private var mLoadedInitialPhotos = false private var mLatestMediaId = 0L private var mLastMediaHandler = Handler() @@ -82,6 +83,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { mStoredAnimateGifs = config.animateGifs mStoredCropThumbnails = config.cropThumbnails mStoredScrollHorizontally = config.scrollHorizontally + mStoredTextColor = config.textColor storeStoragePaths() checkWhatsNewDialog() @@ -134,13 +136,17 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { } if (mStoredScrollHorizontally != config.scrollHorizontally) { - directories_grid.adapter?.let { - (it as DirectoryAdapter).scrollVertically = config.viewTypeFolders == VIEW_TYPE_LIST || !config.scrollHorizontally - it.notifyDataSetChanged() + (directories_grid.adapter as? DirectoryAdapter)?.apply { + scrollVertically = config.viewTypeFolders == VIEW_TYPE_LIST || !config.scrollHorizontally + notifyDataSetChanged() } setupScrollDirection() } + if (mStoredTextColor != config.textColor) { + (directories_grid.adapter as? DirectoryAdapter)?.updateTextColor(config.textColor) + } + tryloadGallery() invalidateOptionsMenu() directories_empty_text_label.setTextColor(config.textColor) @@ -155,6 +161,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { mStoredAnimateGifs = config.animateGifs mStoredCropThumbnails = config.cropThumbnails mStoredScrollHorizontally = config.scrollHorizontally + mStoredTextColor = config.textColor directories_grid.listener = null mLastMediaHandler.removeCallbacksAndMessages(null) } 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 66a4eb984..e6efe5776 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -51,6 +51,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { private var mStoredAnimateGifs = true private var mStoredCropThumbnails = true private var mStoredScrollHorizontally = true + private var mStoredTextColor = 0 private var mLastDrawnHashCode = 0 private var mLatestMediaId = 0L private var mLastMediaHandler = Handler() @@ -73,6 +74,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { mStoredAnimateGifs = config.animateGifs mStoredCropThumbnails = config.cropThumbnails mStoredScrollHorizontally = config.scrollHorizontally + mStoredTextColor = config.textColor mShowAll = config.showAll if (mShowAll) supportActionBar?.setDisplayHomeAsUpEnabled(false) @@ -93,13 +95,17 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { } if (mStoredScrollHorizontally != config.scrollHorizontally) { - media_grid.adapter?.let { - (it as MediaAdapter).scrollVertically = config.viewTypeFiles == VIEW_TYPE_LIST || !config.scrollHorizontally - it.notifyDataSetChanged() + (media_grid.adapter as? MediaAdapter)?.apply { + scrollVertically = config.viewTypeFiles == VIEW_TYPE_LIST || !config.scrollHorizontally + notifyDataSetChanged() } setupScrollDirection() } + if (mStoredTextColor != config.textColor) { + (media_grid.adapter as? MediaAdapter)?.updateTextColor(config.textColor) + } + tryloadGallery() invalidateOptionsMenu() media_empty_text_label.setTextColor(config.textColor) @@ -113,6 +119,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { mStoredAnimateGifs = config.animateGifs mStoredCropThumbnails = config.cropThumbnails mStoredScrollHorizontally = config.scrollHorizontally + mStoredTextColor = config.textColor media_grid.listener = null mLastMediaHandler.removeCallbacksAndMessages(null) } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt index 6c6077fab..2cfff88c5 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt @@ -353,6 +353,11 @@ class DirectoryAdapter(val activity: SimpleActivity, var dirs: MutableList, notifyDataSetChanged() } + fun updateTextColor(textColor: Int) { + this.textColor = textColor + notifyDataSetChanged() + } + fun selectItem(pos: Int) { toggleItemSelection(true, pos) } From 50a693d5e66ad6ac012afa9b6f9c713d0abf58fe Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 30 Sep 2017 20:49:08 +0200 Subject: [PATCH 138/207] do not trigger click event at swiping at videos --- .../simplemobiletools/gallery/fragments/VideoFragment.kt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt index 1828912e7..1e945a15e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt @@ -165,7 +165,9 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee mLastTouchY = event.y } MotionEvent.ACTION_UP, MotionEvent.ACTION_CANCEL -> { - if (System.currentTimeMillis() - mTouchDownTime < CLICK_MAX_DURATION) { + val diffX = Math.abs(event.x - mTouchDownX) + val diffY = Math.abs(event.y - mTouchDownY) + if (System.currentTimeMillis() - mTouchDownTime < CLICK_MAX_DURATION && diffX < 20 && diffY < 20) { mView.video_holder.performClick() } } @@ -201,7 +203,9 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee mLastTouchY = event.y } MotionEvent.ACTION_UP, MotionEvent.ACTION_CANCEL -> { - if (System.currentTimeMillis() - mTouchDownTime < CLICK_MAX_DURATION) { + val diffX = Math.abs(event.x - mTouchDownX) + val diffY = Math.abs(event.y - mTouchDownY) + if (System.currentTimeMillis() - mTouchDownTime < CLICK_MAX_DURATION && diffX < 20 && diffY < 20) { mView.video_holder.performClick() } mTouchDownBrightness = mTempBrightness From e67253ccaed5974527e9abec1e9d9bd048525dbd Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 30 Sep 2017 21:04:21 +0200 Subject: [PATCH 139/207] clear selection at folders and media, if content changes --- .../com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt | 1 + .../com/simplemobiletools/gallery/adapters/MediaAdapter.kt | 1 + 2 files changed, 2 insertions(+) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt index 2cfff88c5..cf0a6fad1 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt @@ -351,6 +351,7 @@ class DirectoryAdapter(val activity: SimpleActivity, var dirs: MutableList) { dirs = newDirs notifyDataSetChanged() + actMode?.finish() } fun updateTextColor(textColor: Int) { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt index 0096275ce..50a03e7ca 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt @@ -266,6 +266,7 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList, fun updateMedia(newMedia: ArrayList) { media = newMedia notifyDataSetChanged() + actMode?.finish() } fun updateDisplayFilenames(display: Boolean) { From 1390d9541cf520b1efd87d8d1a8681d35a3f743c Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 30 Sep 2017 21:05:20 +0200 Subject: [PATCH 140/207] try caching 100 items per folder, up from 40 --- .../com/simplemobiletools/gallery/activities/MediaActivity.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 e6efe5776..feda91d45 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -38,7 +38,7 @@ import java.io.File import java.io.IOException class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { - private val SAVE_MEDIA_CNT = 40 + private val SAVE_MEDIA_CNT = 100 private val LAST_MEDIA_CHECK_PERIOD = 3000L private var mPath = "" From 7cc1a9ce178e6009b63ef3f854469284895de55b Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 30 Sep 2017 22:06:32 +0200 Subject: [PATCH 141/207] move the media fetching related functions in a separate class --- .../asynctasks/GetDirectoriesAsynctask.kt | 4 +- .../gallery/asynctasks/GetMediaAsynctask.kt | 7 +- .../gallery/extensions/context.kt | 302 +---------------- .../gallery/helpers/MediaFetcher.kt | 311 ++++++++++++++++++ 4 files changed, 318 insertions(+), 306 deletions(-) create mode 100644 app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt index a6450aac1..44a1921dc 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt @@ -10,8 +10,8 @@ import com.simplemobiletools.commons.helpers.SORT_DESCENDING import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.extensions.config import com.simplemobiletools.gallery.extensions.containsNoMedia -import com.simplemobiletools.gallery.extensions.getMediaByDirectories import com.simplemobiletools.gallery.extensions.sumByLong +import com.simplemobiletools.gallery.helpers.MediaFetcher import com.simplemobiletools.gallery.models.Directory import com.simplemobiletools.gallery.models.Medium import java.io.File @@ -24,7 +24,7 @@ class GetDirectoriesAsynctask(val context: Context, val isPickVideo: Boolean, va return ArrayList() val config = context.config - val groupedMedia = context.getMediaByDirectories(isPickVideo, isPickImage) + val groupedMedia = MediaFetcher(context).getMediaByDirectories(isPickVideo, isPickImage) val directories = ArrayList() val hidden = context.resources.getString(R.string.hidden) val albumCovers = config.parseAlbumCovers() diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetMediaAsynctask.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetMediaAsynctask.kt index 13002eb86..f0016b7f1 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetMediaAsynctask.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetMediaAsynctask.kt @@ -3,8 +3,7 @@ package com.simplemobiletools.gallery.asynctasks import android.content.Context import android.os.AsyncTask import com.simplemobiletools.gallery.extensions.config -import com.simplemobiletools.gallery.extensions.getFilesFrom -import com.simplemobiletools.gallery.extensions.getMediaByDirectories +import com.simplemobiletools.gallery.helpers.MediaFetcher import com.simplemobiletools.gallery.models.Medium import java.util.* @@ -14,7 +13,7 @@ class GetMediaAsynctask(val context: Context, val mPath: String, val isPickVideo override fun doInBackground(vararg params: Void): ArrayList { return if (showAll) { - val mediaMap = context.getMediaByDirectories(isPickVideo, isPickImage) + val mediaMap = MediaFetcher(context).getMediaByDirectories(isPickVideo, isPickImage) val media = ArrayList() for ((path, curMedia) in mediaMap) { media.addAll(curMedia) @@ -24,7 +23,7 @@ class GetMediaAsynctask(val context: Context, val mPath: String, val isPickVideo media.sort() media } else { - context.getFilesFrom(mPath, isPickImage, isPickVideo) + MediaFetcher(context).getFilesFrom(mPath, isPickImage, isPickVideo) } } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt index ac943fe25..c04c3371e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt @@ -10,20 +10,10 @@ import android.net.Uri import android.os.Build import android.provider.MediaStore import android.view.WindowManager -import com.simplemobiletools.commons.extensions.* -import com.simplemobiletools.commons.helpers.SORT_BY_DATE_MODIFIED -import com.simplemobiletools.commons.helpers.SORT_BY_NAME -import com.simplemobiletools.commons.helpers.SORT_BY_SIZE -import com.simplemobiletools.commons.helpers.SORT_DESCENDING +import com.simplemobiletools.commons.extensions.humanizePath import com.simplemobiletools.gallery.activities.SettingsActivity -import com.simplemobiletools.gallery.helpers.* +import com.simplemobiletools.gallery.helpers.Config import com.simplemobiletools.gallery.models.Directory -import com.simplemobiletools.gallery.models.Medium -import java.io.File -import java.util.LinkedHashMap -import kotlin.collections.ArrayList -import kotlin.collections.component1 -import kotlin.collections.component2 val Context.portrait get() = resources.configuration.orientation == Configuration.ORIENTATION_PORTRAIT val Context.audioManager get() = getSystemService(Context.AUDIO_SERVICE) as AudioManager @@ -81,225 +71,6 @@ fun Context.launchSettings() { val Context.config: Config get() = Config.newInstance(this) -fun Context.getFilesFrom(curPath: String, isPickImage: Boolean, isPickVideo: Boolean): ArrayList { - val projection = arrayOf(MediaStore.Images.Media._ID, - MediaStore.Images.Media.DISPLAY_NAME, - MediaStore.Images.Media.DATE_TAKEN, - MediaStore.Images.Media.DATE_MODIFIED, - MediaStore.Images.Media.DATA, - MediaStore.Images.Media.SIZE) - val uri = MediaStore.Files.getContentUri("external") - val selection = getSelectionQuery(curPath) - val selectionArgs = getSelectionArgsQuery(curPath) - - return try { - val cur = contentResolver.query(uri, projection, selection, selectionArgs, getSortingForFolder(curPath)) - parseCursor(this, cur, isPickImage, isPickVideo, curPath) - } catch (e: Exception) { - ArrayList() - } -} - -fun Context.getSelectionQuery(path: String): String { - val dataQuery = "${MediaStore.Images.Media.DATA} LIKE ?" - return if (path.isEmpty()) { - var query = "($dataQuery)" - if (hasExternalSDCard()) { - query += " OR ($dataQuery)" - } - query - } else { - "($dataQuery AND ${MediaStore.Images.Media.DATA} NOT LIKE ?)" - } -} - -fun Context.getSelectionArgsQuery(path: String): Array { - return if (path.isEmpty()) { - if (hasExternalSDCard()) arrayOf("$internalStoragePath/%", "$sdCardPath/%") else arrayOf("$internalStoragePath/%") - } else { - arrayOf("$path/%", "$path/%/%") - } -} - -private fun parseCursor(context: Context, cur: Cursor, isPickImage: Boolean, isPickVideo: Boolean, curPath: String): ArrayList { - val curMedia = ArrayList() - val config = context.config - val filterMedia = config.filterMedia - val showHidden = config.shouldShowHidden - val includedFolders = config.includedFolders.map { "${it.trimEnd('/')}/" } - val excludedFolders = config.excludedFolders.map { "${it.trimEnd('/')}/" } - val noMediaFolders = context.getNoMediaFolders() - val isThirdPartyIntent = config.isThirdPartyIntent - - cur.use { - if (cur.moveToFirst()) { - do { - try { - val path = cur.getStringValue(MediaStore.Images.Media.DATA) - - var filename = cur.getStringValue(MediaStore.Images.Media.DISPLAY_NAME) ?: "" - if (filename.isEmpty()) - filename = path.getFilenameFromPath() - - val isImage = filename.isImageFast() - val isVideo = if (isImage) false else filename.isVideoFast() - val isGif = if (isImage || isVideo) false else filename.isGif() - - if (!isImage && !isVideo && !isGif) - continue - - if (isVideo && (isPickImage || filterMedia and VIDEOS == 0)) - continue - - if (isImage && (isPickVideo || filterMedia and IMAGES == 0)) - continue - - if (isGif && filterMedia and GIFS == 0) - continue - - if (!showHidden && filename.startsWith('.')) - continue - - var size = cur.getLongValue(MediaStore.Images.Media.SIZE) - val file = File(path) - if (size == 0L) { - size = file.length() - } - - if (size <= 0L) - continue - - var isExcluded = false - excludedFolders.forEach { - if (path.startsWith(it)) { - isExcluded = true - includedFolders.forEach { - if (path.startsWith(it)) { - isExcluded = false - } - } - } - } - - if (!isExcluded && !showHidden) { - noMediaFolders.forEach { - if (path.startsWith(it)) { - isExcluded = true - } - } - } - - if (!isExcluded && !showHidden && path.contains("/.")) { - isExcluded = true - } - - if (!isExcluded || isThirdPartyIntent) { - if (!file.exists()) - continue - - val dateTaken = cur.getLongValue(MediaStore.Images.Media.DATE_TAKEN) - val dateModified = cur.getIntValue(MediaStore.Images.Media.DATE_MODIFIED) * 1000L - - val medium = Medium(filename, path, isVideo, dateModified, dateTaken, size) - curMedia.add(medium) - } - } catch (e: Exception) { - continue - } - } while (cur.moveToNext()) - } - } - - config.includedFolders.filter { it.isNotEmpty() && (curPath.isEmpty() || it == curPath) }.forEach { - getMediaInFolder(it, curMedia, isPickImage, isPickVideo, filterMedia) - } - - if (isThirdPartyIntent && curPath.isNotEmpty() && curMedia.isEmpty()) { - getMediaInFolder(curPath, curMedia, isPickImage, isPickVideo, filterMedia) - } - - Medium.sorting = config.getFileSorting(curPath) - curMedia.sort() - - return curMedia -} - -private fun getMediaInFolder(folder: String, curMedia: ArrayList, isPickImage: Boolean, isPickVideo: Boolean, filterMedia: Int) { - val files = File(folder).listFiles() ?: return - for (file in files) { - val filename = file.name - val isImage = filename.isImageFast() - val isVideo = if (isImage) false else filename.isVideoFast() - val isGif = if (isImage || isVideo) false else filename.isGif() - - if (!isImage && !isVideo) - continue - - if (isVideo && (isPickImage || filterMedia and VIDEOS == 0)) - continue - - if (isImage && (isPickVideo || filterMedia and IMAGES == 0)) - continue - - if (isGif && filterMedia and GIFS == 0) - continue - - val size = file.length() - if (size <= 0L) - continue - - val dateTaken = file.lastModified() - val dateModified = file.lastModified() - - val medium = Medium(filename, file.absolutePath, isVideo, dateModified, dateTaken, size) - val isAlreadyAdded = curMedia.any { it.path == file.absolutePath } - if (!isAlreadyAdded) - curMedia.add(medium) - } -} - -fun Context.getSortingForFolder(path: String): String { - val sorting = config.getFileSorting(path) - val sortValue = when { - sorting and SORT_BY_NAME > 0 -> MediaStore.Images.Media.DISPLAY_NAME - sorting and SORT_BY_SIZE > 0 -> MediaStore.Images.Media.SIZE - sorting and SORT_BY_DATE_MODIFIED > 0 -> MediaStore.Images.Media.DATE_MODIFIED - else -> MediaStore.Images.Media.DATE_TAKEN - } - - return if (sorting and SORT_DESCENDING > 0) - "$sortValue DESC" - else - "$sortValue ASC" -} - -fun Context.getNoMediaFolders(): ArrayList { - val folders = ArrayList() - val noMediaCondition = "${MediaStore.Files.FileColumns.MEDIA_TYPE} = ${MediaStore.Files.FileColumns.MEDIA_TYPE_NONE}" - - val uri = MediaStore.Files.getContentUri("external") - val columns = arrayOf(MediaStore.Files.FileColumns.DATA) - val where = "$noMediaCondition AND ${MediaStore.Files.FileColumns.TITLE} LIKE ?" - val args = arrayOf("%$NOMEDIA%") - var cursor: Cursor? = null - - try { - cursor = contentResolver.query(uri, columns, where, args, null) - if (cursor?.moveToFirst() == true) { - do { - val path = cursor.getString(cursor.getColumnIndex(MediaStore.Files.FileColumns.DATA)) ?: continue - val noMediaFile = File(path) - if (noMediaFile.exists()) - folders.add("${noMediaFile.parent}/") - } while (cursor.moveToNext()) - } - } finally { - cursor?.close() - } - - return folders -} - fun Context.movePinnedDirectoriesToFront(dirs: ArrayList): ArrayList { val foundFolders = ArrayList() val pinnedFolders = config.pinnedFolders @@ -310,75 +81,6 @@ fun Context.movePinnedDirectoriesToFront(dirs: ArrayList): ArrayList< return dirs } -fun Context.getMediaByDirectories(isPickVideo: Boolean, isPickImage: Boolean): HashMap> { - val media = getFilesFrom("", isPickImage, isPickVideo) - val excludedPaths = config.excludedFolders - val includedPaths = config.includedFolders - val showHidden = config.shouldShowHidden - val directories = groupDirectories(media) - - val removePaths = ArrayList() - for ((path, curMedia) in directories) { - // make sure the path has uppercase letters wherever appropriate - val groupPath = File(curMedia.first().path).parent - if (!File(groupPath).exists() || !shouldFolderBeVisible(groupPath, excludedPaths, includedPaths, showHidden)) { - removePaths.add(groupPath.toLowerCase()) - } - } - - removePaths.forEach { - directories.remove(it) - } - - return directories -} - -private fun groupDirectories(media: ArrayList): HashMap> { - val directories = LinkedHashMap>() - for (medium in media) { - val parentDir = File(medium.path).parent?.toLowerCase() ?: continue - if (directories.containsKey(parentDir)) { - directories[parentDir]!!.add(medium) - } else { - directories.put(parentDir, arrayListOf(medium)) - } - } - return directories -} - -private fun shouldFolderBeVisible(path: String, excludedPaths: MutableSet, includedPaths: MutableSet, showHidden: Boolean): Boolean { - val file = File(path) - return if (includedPaths.contains(path)) { - true - } else if (isThisOrParentExcluded(path, excludedPaths, includedPaths)) { - false - } else if (!showHidden && file.isDirectory && file.canonicalFile == file.absoluteFile) { - var containsNoMediaOrDot = file.containsNoMedia() || path.contains("/.") - if (!containsNoMediaOrDot) { - containsNoMediaOrDot = checkParentHasNoMedia(file.parentFile) - } - !containsNoMediaOrDot - } else { - true - } -} - -private fun checkParentHasNoMedia(file: File): Boolean { - var curFile = file - while (true) { - if (curFile.containsNoMedia()) { - return true - } - curFile = curFile.parentFile - if (curFile.absolutePath == "/") - break - } - return false -} - -private fun isThisOrParentExcluded(path: String, excludedPaths: MutableSet, includedPaths: MutableSet) = - includedPaths.none { path.startsWith(it) } && excludedPaths.any { path.startsWith(it) } - @Suppress("UNCHECKED_CAST") fun Context.getSortedDirectories(source: ArrayList): ArrayList { Directory.sorting = config.directorySorting diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt new file mode 100644 index 000000000..7bb0d0e8f --- /dev/null +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt @@ -0,0 +1,311 @@ +package com.simplemobiletools.gallery.helpers + +import android.content.Context +import android.database.Cursor +import android.provider.MediaStore +import android.util.Log +import com.simplemobiletools.commons.extensions.* +import com.simplemobiletools.commons.helpers.SORT_BY_DATE_MODIFIED +import com.simplemobiletools.commons.helpers.SORT_BY_NAME +import com.simplemobiletools.commons.helpers.SORT_BY_SIZE +import com.simplemobiletools.commons.helpers.SORT_DESCENDING +import com.simplemobiletools.gallery.extensions.config +import com.simplemobiletools.gallery.extensions.containsNoMedia +import com.simplemobiletools.gallery.models.Medium +import java.io.File +import java.util.LinkedHashMap +import kotlin.collections.ArrayList +import kotlin.collections.component1 +import kotlin.collections.component2 + +class MediaFetcher(val context: Context) { + fun getMediaByDirectories(isPickVideo: Boolean, isPickImage: Boolean): HashMap> { + val media = getFilesFrom("", isPickImage, isPickVideo) + val excludedPaths = context.config.excludedFolders + val includedPaths = context.config.includedFolders + val showHidden = context.config.shouldShowHidden + val directories = groupDirectories(media) + + val removePaths = ArrayList() + for ((path, curMedia) in directories) { + // make sure the path has uppercase letters wherever appropriate + val groupPath = File(curMedia.first().path).parent + if (!File(groupPath).exists() || !shouldFolderBeVisible(groupPath, excludedPaths, includedPaths, showHidden)) { + removePaths.add(groupPath.toLowerCase()) + } + } + + removePaths.forEach { + directories.remove(it) + } + + return directories + } + + fun getFilesFrom(curPath: String, isPickImage: Boolean, isPickVideo: Boolean): ArrayList { + val projection = arrayOf(MediaStore.Images.Media._ID, + MediaStore.Images.Media.DISPLAY_NAME, + MediaStore.Images.Media.DATE_TAKEN, + MediaStore.Images.Media.DATE_MODIFIED, + MediaStore.Images.Media.DATA, + MediaStore.Images.Media.SIZE) + val uri = MediaStore.Files.getContentUri("external") + val selection = getSelectionQuery(curPath) + val selectionArgs = getSelectionArgsQuery(curPath) + + return try { + val cur = context.contentResolver.query(uri, projection, selection, selectionArgs, getSortingForFolder(curPath)) + parseCursor(context, cur, isPickImage, isPickVideo, curPath) + } catch (e: Exception) { + ArrayList() + } + } + + private fun getSelectionQuery(path: String): String { + val dataQuery = "${MediaStore.Images.Media.DATA} LIKE ?" + return if (path.isEmpty()) { + var query = "($dataQuery)" + if (context.hasExternalSDCard()) { + query += " OR ($dataQuery)" + } + query + } else { + "($dataQuery AND ${MediaStore.Images.Media.DATA} NOT LIKE ?)" + } + } + + private fun getSelectionArgsQuery(path: String): Array { + return if (path.isEmpty()) { + if (context.hasExternalSDCard()) arrayOf("${context.internalStoragePath}/%", "${context.sdCardPath}/%") else arrayOf("${context.internalStoragePath}/%") + } else { + arrayOf("$path/%", "$path/%/%") + } + } + + private fun parseCursor(context: Context, cur: Cursor, isPickImage: Boolean, isPickVideo: Boolean, curPath: String): ArrayList { + val curMedia = ArrayList() + val config = context.config + val filterMedia = config.filterMedia + val showHidden = config.shouldShowHidden + val includedFolders = config.includedFolders.map { "${it.trimEnd('/')}/" } + val excludedFolders = config.excludedFolders.map { "${it.trimEnd('/')}/" } + val noMediaFolders = getNoMediaFolders() + val isThirdPartyIntent = config.isThirdPartyIntent + + cur.use { + if (cur.moveToFirst()) { + do { + try { + val path = cur.getStringValue(MediaStore.Images.Media.DATA) + + Log.e("DEBUG", "checking $path") + var filename = cur.getStringValue(MediaStore.Images.Media.DISPLAY_NAME) ?: "" + if (filename.isEmpty()) + filename = path.getFilenameFromPath() + + val isImage = filename.isImageFast() + val isVideo = if (isImage) false else filename.isVideoFast() + val isGif = if (isImage || isVideo) false else filename.isGif() + + if (!isImage && !isVideo && !isGif) + continue + + if (isVideo && (isPickImage || filterMedia and VIDEOS == 0)) + continue + + if (isImage && (isPickVideo || filterMedia and IMAGES == 0)) + continue + + if (isGif && filterMedia and GIFS == 0) + continue + + if (!showHidden && filename.startsWith('.')) + continue + + var size = cur.getLongValue(MediaStore.Images.Media.SIZE) + val file = File(path) + if (size == 0L) { + size = file.length() + } + + if (size <= 0L) + continue + + var isExcluded = false + excludedFolders.forEach { + if (path.startsWith(it)) { + isExcluded = true + includedFolders.forEach { + if (path.startsWith(it)) { + isExcluded = false + } + } + } + } + + if (!isExcluded && !showHidden) { + noMediaFolders.forEach { + if (path.startsWith(it)) { + isExcluded = true + } + } + } + + if (!isExcluded && !showHidden && path.contains("/.")) { + isExcluded = true + } + + if (!isExcluded || isThirdPartyIntent) { + if (!file.exists()) + continue + + val dateTaken = cur.getLongValue(MediaStore.Images.Media.DATE_TAKEN) + val dateModified = cur.getIntValue(MediaStore.Images.Media.DATE_MODIFIED) * 1000L + + val medium = Medium(filename, path, isVideo, dateModified, dateTaken, size) + curMedia.add(medium) + } + } catch (e: Exception) { + continue + } + } while (cur.moveToNext()) + } + } + + config.includedFolders.filter { it.isNotEmpty() && (curPath.isEmpty() || it == curPath) }.forEach { + getMediaInFolder(it, curMedia, isPickImage, isPickVideo, filterMedia) + } + + if (isThirdPartyIntent && curPath.isNotEmpty() && curMedia.isEmpty()) { + getMediaInFolder(curPath, curMedia, isPickImage, isPickVideo, filterMedia) + } + + Medium.sorting = config.getFileSorting(curPath) + curMedia.sort() + + return curMedia + } + + private fun groupDirectories(media: ArrayList): HashMap> { + val directories = LinkedHashMap>() + for (medium in media) { + val parentDir = File(medium.path).parent?.toLowerCase() ?: continue + if (directories.containsKey(parentDir)) { + directories[parentDir]!!.add(medium) + } else { + directories.put(parentDir, arrayListOf(medium)) + } + } + return directories + } + + private fun shouldFolderBeVisible(path: String, excludedPaths: MutableSet, includedPaths: MutableSet, showHidden: Boolean): Boolean { + val file = File(path) + return if (includedPaths.contains(path)) { + true + } else if (isThisOrParentExcluded(path, excludedPaths, includedPaths)) { + false + } else if (!showHidden && file.isDirectory && file.canonicalFile == file.absoluteFile) { + var containsNoMediaOrDot = file.containsNoMedia() || path.contains("/.") + if (!containsNoMediaOrDot) { + containsNoMediaOrDot = checkParentHasNoMedia(file.parentFile) + } + !containsNoMediaOrDot + } else { + true + } + } + + private fun checkParentHasNoMedia(file: File): Boolean { + var curFile = file + while (true) { + if (curFile.containsNoMedia()) { + return true + } + curFile = curFile.parentFile + if (curFile.absolutePath == "/") + break + } + return false + } + + private fun isThisOrParentExcluded(path: String, excludedPaths: MutableSet, includedPaths: MutableSet) = + includedPaths.none { path.startsWith(it) } && excludedPaths.any { path.startsWith(it) } + + + private fun getMediaInFolder(folder: String, curMedia: ArrayList, isPickImage: Boolean, isPickVideo: Boolean, filterMedia: Int) { + val files = File(folder).listFiles() ?: return + for (file in files) { + val filename = file.name + val isImage = filename.isImageFast() + val isVideo = if (isImage) false else filename.isVideoFast() + val isGif = if (isImage || isVideo) false else filename.isGif() + + if (!isImage && !isVideo) + continue + + if (isVideo && (isPickImage || filterMedia and VIDEOS == 0)) + continue + + if (isImage && (isPickVideo || filterMedia and IMAGES == 0)) + continue + + if (isGif && filterMedia and GIFS == 0) + continue + + val size = file.length() + if (size <= 0L) + continue + + val dateTaken = file.lastModified() + val dateModified = file.lastModified() + + val medium = Medium(filename, file.absolutePath, isVideo, dateModified, dateTaken, size) + val isAlreadyAdded = curMedia.any { it.path == file.absolutePath } + if (!isAlreadyAdded) + curMedia.add(medium) + } + } + + private fun getSortingForFolder(path: String): String { + val sorting = context.config.getFileSorting(path) + val sortValue = when { + sorting and SORT_BY_NAME > 0 -> MediaStore.Images.Media.DISPLAY_NAME + sorting and SORT_BY_SIZE > 0 -> MediaStore.Images.Media.SIZE + sorting and SORT_BY_DATE_MODIFIED > 0 -> MediaStore.Images.Media.DATE_MODIFIED + else -> MediaStore.Images.Media.DATE_TAKEN + } + + return if (sorting and SORT_DESCENDING > 0) + "$sortValue DESC" + else + "$sortValue ASC" + } + + private fun getNoMediaFolders(): ArrayList { + val folders = ArrayList() + val noMediaCondition = "${MediaStore.Files.FileColumns.MEDIA_TYPE} = ${MediaStore.Files.FileColumns.MEDIA_TYPE_NONE}" + + val uri = MediaStore.Files.getContentUri("external") + val columns = arrayOf(MediaStore.Files.FileColumns.DATA) + val where = "$noMediaCondition AND ${MediaStore.Files.FileColumns.TITLE} LIKE ?" + val args = arrayOf("%$NOMEDIA%") + var cursor: Cursor? = null + + try { + cursor = context.contentResolver.query(uri, columns, where, args, null) + if (cursor?.moveToFirst() == true) { + do { + val path = cursor.getString(cursor.getColumnIndex(MediaStore.Files.FileColumns.DATA)) ?: continue + val noMediaFile = File(path) + if (noMediaFile.exists()) + folders.add("${noMediaFile.parent}/") + } while (cursor.moveToNext()) + } + } finally { + cursor?.close() + } + + return folders + } +} From 5c7dfb87be8b893201a5a03d9b21b39987f28165 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 30 Sep 2017 22:23:28 +0200 Subject: [PATCH 142/207] stop media fetching on the calling activity pause --- .../gallery/activities/MainActivity.kt | 2 +- .../gallery/activities/MediaActivity.kt | 7 +++++-- .../gallery/asynctasks/GetDirectoriesAsynctask.kt | 8 +++++++- .../gallery/asynctasks/GetMediaAsynctask.kt | 10 ++++++++-- .../gallery/helpers/MediaFetcher.kt | 14 +++++++++++--- 5 files changed, 32 insertions(+), 9 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 d9997a500..0694bbc53 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -61,7 +61,6 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { private var mLoadedInitialPhotos = false private var mLatestMediaId = 0L private var mLastMediaHandler = Handler() - private var mCurrAsyncTask: GetDirectoriesAsynctask? = null override fun onCreate(savedInstanceState: Bundle?) { @@ -164,6 +163,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { mStoredTextColor = config.textColor directories_grid.listener = null mLastMediaHandler.removeCallbacksAndMessages(null) + mCurrAsyncTask?.stopFetching() } override fun onDestroy() { 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 feda91d45..678db7f7f 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -55,6 +55,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { private var mLastDrawnHashCode = 0 private var mLatestMediaId = 0L private var mLastMediaHandler = Handler() + private var mCurrAsyncTask: GetMediaAsynctask? = null companion object { var mMedia = ArrayList() @@ -122,6 +123,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { mStoredTextColor = config.textColor media_grid.listener = null mLastMediaHandler.removeCallbacksAndMessages(null) + mCurrAsyncTask?.stopFetching() } override fun onDestroy() { @@ -344,9 +346,10 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { } mLoadedInitialPhotos = true - GetMediaAsynctask(applicationContext, mPath, mIsGetVideoIntent, mIsGetImageIntent, mShowAll) { + mCurrAsyncTask = GetMediaAsynctask(applicationContext, mPath, mIsGetVideoIntent, mIsGetImageIntent, mShowAll) { gotMedia(it) - }.execute() + } + mCurrAsyncTask!!.execute() } private fun isDirEmpty(): Boolean { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt index 44a1921dc..676b45f8b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt @@ -18,13 +18,14 @@ import java.io.File class GetDirectoriesAsynctask(val context: Context, val isPickVideo: Boolean, val isPickImage: Boolean, val callback: (dirs: ArrayList) -> Unit) : AsyncTask>() { + val mediaFetcher = MediaFetcher(context) override fun doInBackground(vararg params: Void): ArrayList { if (!context.hasWriteStoragePermission()) return ArrayList() val config = context.config - val groupedMedia = MediaFetcher(context).getMediaByDirectories(isPickVideo, isPickImage) + val groupedMedia = mediaFetcher.getMediaByDirectories(isPickVideo, isPickImage) val directories = ArrayList() val hidden = context.resources.getString(R.string.hidden) val albumCovers = config.parseAlbumCovers() @@ -66,4 +67,9 @@ class GetDirectoriesAsynctask(val context: Context, val isPickVideo: Boolean, va super.onPostExecute(dirs) callback(dirs) } + + fun stopFetching() { + mediaFetcher.shouldStop = true + cancel(true) + } } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetMediaAsynctask.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetMediaAsynctask.kt index f0016b7f1..2c99f54d6 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetMediaAsynctask.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetMediaAsynctask.kt @@ -10,10 +10,11 @@ import java.util.* class GetMediaAsynctask(val context: Context, val mPath: String, val isPickVideo: Boolean = false, val isPickImage: Boolean = false, val showAll: Boolean, val callback: (media: ArrayList) -> Unit) : AsyncTask>() { + val mediaFetcher = MediaFetcher(context) override fun doInBackground(vararg params: Void): ArrayList { return if (showAll) { - val mediaMap = MediaFetcher(context).getMediaByDirectories(isPickVideo, isPickImage) + val mediaMap = mediaFetcher.getMediaByDirectories(isPickVideo, isPickImage) val media = ArrayList() for ((path, curMedia) in mediaMap) { media.addAll(curMedia) @@ -23,7 +24,7 @@ class GetMediaAsynctask(val context: Context, val mPath: String, val isPickVideo media.sort() media } else { - MediaFetcher(context).getFilesFrom(mPath, isPickImage, isPickVideo) + mediaFetcher.getFilesFrom(mPath, isPickImage, isPickVideo) } } @@ -31,4 +32,9 @@ class GetMediaAsynctask(val context: Context, val mPath: String, val isPickVideo super.onPostExecute(media) callback(media) } + + fun stopFetching() { + mediaFetcher.shouldStop = true + cancel(true) + } } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt index 7bb0d0e8f..210e44258 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt @@ -3,7 +3,6 @@ package com.simplemobiletools.gallery.helpers import android.content.Context import android.database.Cursor import android.provider.MediaStore -import android.util.Log import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.helpers.SORT_BY_DATE_MODIFIED import com.simplemobiletools.commons.helpers.SORT_BY_NAME @@ -19,6 +18,8 @@ import kotlin.collections.component1 import kotlin.collections.component2 class MediaFetcher(val context: Context) { + var shouldStop = false + fun getMediaByDirectories(isPickVideo: Boolean, isPickImage: Boolean): HashMap> { val media = getFilesFrom("", isPickImage, isPickVideo) val excludedPaths = context.config.excludedFolders @@ -96,9 +97,10 @@ class MediaFetcher(val context: Context) { if (cur.moveToFirst()) { do { try { - val path = cur.getStringValue(MediaStore.Images.Media.DATA) + if (shouldStop) + break - Log.e("DEBUG", "checking $path") + val path = cur.getStringValue(MediaStore.Images.Media.DATA) var filename = cur.getStringValue(MediaStore.Images.Media.DISPLAY_NAME) ?: "" if (filename.isEmpty()) filename = path.getFilenameFromPath() @@ -189,6 +191,9 @@ class MediaFetcher(val context: Context) { private fun groupDirectories(media: ArrayList): HashMap> { val directories = LinkedHashMap>() for (medium in media) { + if (shouldStop) + break + val parentDir = File(medium.path).parent?.toLowerCase() ?: continue if (directories.containsKey(parentDir)) { directories[parentDir]!!.add(medium) @@ -236,6 +241,9 @@ class MediaFetcher(val context: Context) { private fun getMediaInFolder(folder: String, curMedia: ArrayList, isPickImage: Boolean, isPickVideo: Boolean, filterMedia: Int) { val files = File(folder).listFiles() ?: return for (file in files) { + if (shouldStop) + break + val filename = file.name val isImage = filename.isImageFast() val isVideo = if (isImage) false else filename.isVideoFast() From 0ef9ff06bf9583583052cf4d4068e37fecc4ec5a Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 30 Sep 2017 22:33:58 +0200 Subject: [PATCH 143/207] refresh directories instantly after un/pinning --- .../simplemobiletools/gallery/activities/MainActivity.kt | 4 ++++ .../simplemobiletools/gallery/adapters/DirectoryAdapter.kt | 4 +++- .../com/simplemobiletools/gallery/extensions/context.kt | 6 +++++- 3 files changed, 12 insertions(+), 2 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 0694bbc53..0ca8e74a9 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -552,6 +552,10 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { directories_grid.setDragSelectActive(position) } + override fun recheckPinnedFolders() { + gotDirectories(movePinnedDirectoriesToFront(mDirs), true) + } + private fun checkWhatsNewDialog() { arrayListOf().apply { add(Release(46, R.string.release_46)) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt index cf0a6fad1..9454f0ca4 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt @@ -221,7 +221,7 @@ class DirectoryAdapter(val activity: SimpleActivity, var dirs: MutableList) fun itemLongClicked(position: Int) + + fun recheckPinnedFolders() } } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt index c04c3371e..f7cd61529 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt @@ -75,7 +75,11 @@ fun Context.movePinnedDirectoriesToFront(dirs: ArrayList): ArrayList< val foundFolders = ArrayList() val pinnedFolders = config.pinnedFolders - dirs.forEach { if (pinnedFolders.contains(it.path)) foundFolders.add(it) } + dirs.forEach { + if (pinnedFolders.contains(it.path)) + foundFolders.add(it) + } + dirs.removeAll(foundFolders) dirs.addAll(0, foundFolders) return dirs From b7cb6a5364281bdd19689afd8d22989da654f027 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 30 Sep 2017 22:55:25 +0200 Subject: [PATCH 144/207] make viewPager nullable during fake drag --- .../simplemobiletools/gallery/activities/ViewPagerActivity.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt index 8b1150d40..9fe6db7fd 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -327,7 +327,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View val dragPosition = animation.animatedValue as Int val dragOffset = dragPosition - oldDragPosition oldDragPosition = dragPosition - view_pager.fakeDragBy(dragOffset * (if (forward) 1f else -1f)) + view_pager?.fakeDragBy(dragOffset * (if (forward) 1f else -1f)) } }) From 6e6af530bfd28eb83ad5f3e35011c59b35a0dcca Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 30 Sep 2017 23:39:04 +0200 Subject: [PATCH 145/207] do not clear mMedia if the intent came from the gallery itself --- .../gallery/activities/PhotoVideoActivity.kt | 4 ++++ .../gallery/activities/ViewPagerActivity.kt | 5 ++++- .../com/simplemobiletools/gallery/extensions/activity.kt | 8 +++++--- .../com/simplemobiletools/gallery/helpers/Constants.kt | 1 + 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt index 96fc44b10..4a5b48097 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt @@ -21,6 +21,7 @@ import com.simplemobiletools.gallery.extensions.* import com.simplemobiletools.gallery.fragments.PhotoFragment import com.simplemobiletools.gallery.fragments.VideoFragment import com.simplemobiletools.gallery.fragments.ViewPagerFragment +import com.simplemobiletools.gallery.helpers.IS_FROM_GALLERY import com.simplemobiletools.gallery.helpers.IS_VIEW_INTENT import com.simplemobiletools.gallery.helpers.MEDIUM import com.simplemobiletools.gallery.models.Medium @@ -31,6 +32,7 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList private val STORAGE_PERMISSION = 1 private var mMedium: Medium? = null private var mIsFullScreen = false + private var mIsFromGallery = false private var mFragment: ViewPagerFragment? = null lateinit var mUri: Uri @@ -52,6 +54,7 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList private fun checkIntent(savedInstanceState: Bundle? = null) { mUri = intent.data ?: return + mIsFromGallery = intent.getBooleanExtra(IS_FROM_GALLERY, false) if (mUri.scheme == "file") { scanPath(mUri.path) {} @@ -126,6 +129,7 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList private fun sendViewPagerIntent(path: String) { Intent(this, ViewPagerActivity::class.java).apply { putExtra(IS_VIEW_INTENT, true) + putExtra(IS_FROM_GALLERY, mIsFromGallery) putExtra(MEDIUM, path) startActivity(this) } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt index 9fe6db7fd..7aacc2376 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -160,8 +160,11 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View } if (config.isThirdPartyIntent) { - mMedia.clear() config.isThirdPartyIntent = false + + if (intent.extras == null || !intent.getBooleanExtra(IS_FROM_GALLERY, false)) { + mMedia.clear() + } } } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt index a7fc915a2..756f9578b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt @@ -24,6 +24,7 @@ import com.simplemobiletools.commons.helpers.* import com.simplemobiletools.gallery.BuildConfig import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.activities.SimpleActivity +import com.simplemobiletools.gallery.helpers.IS_FROM_GALLERY import com.simplemobiletools.gallery.helpers.NOMEDIA import com.simplemobiletools.gallery.helpers.REQUEST_EDIT_IMAGE import com.simplemobiletools.gallery.helpers.REQUEST_SET_AS @@ -91,14 +92,14 @@ fun Activity.setAs(uri: Uri, file: File, showToast: Boolean = true): Boolean { addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) val chooser = Intent.createChooser(this, getString(R.string.set_as)) - if (resolveActivity(packageManager) != null) { + success = if (resolveActivity(packageManager) != null) { startActivityForResult(chooser, REQUEST_SET_AS) - success = true + true } else { if (showToast) { toast(R.string.no_capable_app_found) } - success = false + false } } @@ -130,6 +131,7 @@ fun Activity.openWith(file: File, forceChooser: Boolean = true) { action = Intent.ACTION_VIEW setDataAndType(uri, file.getMimeType()) addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) + putExtra(IS_FROM_GALLERY, true) if (resolveActivity(packageManager) != null) { val chooser = Intent.createChooser(this, getString(R.string.open_with)) 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 691031eb3..18bf6ac29 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt @@ -62,6 +62,7 @@ val GET_ANY_INTENT = "get_any_intent" val SET_WALLPAPER_INTENT = "set_wallpaper_intent" val DIRECTORIES = "directories2" val IS_VIEW_INTENT = "is_view_intent" +val IS_FROM_GALLERY = "is_from_gallery" val REQUEST_EDIT_IMAGE = 1 val REQUEST_SET_AS = 2 From e4b77eacb01d8d82da94dc320edce70e111b2e38 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 30 Sep 2017 23:56:28 +0200 Subject: [PATCH 146/207] fixing some fastscroller glitches --- .../simplemobiletools/gallery/activities/MainActivity.kt | 7 ++++--- .../simplemobiletools/gallery/activities/MediaActivity.kt | 7 ++++--- .../gallery/dialogs/PickDirectoryDialog.kt | 8 +++++--- 3 files changed, 13 insertions(+), 9 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 0ca8e74a9..bbde246e1 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -509,15 +509,16 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { } private fun setupScrollDirection() { + val allowHorizontalScroll = config.scrollHorizontally && config.viewTypeFolders == VIEW_TYPE_GRID directories_refresh_layout.isEnabled = !config.scrollHorizontally directories_vertical_fastscroller.isHorizontal = false - directories_vertical_fastscroller.beGoneIf(config.scrollHorizontally) + directories_vertical_fastscroller.beGoneIf(allowHorizontalScroll) directories_horizontal_fastscroller.isHorizontal = true - directories_horizontal_fastscroller.beVisibleIf(config.scrollHorizontally) + directories_horizontal_fastscroller.beVisibleIf(allowHorizontalScroll) - if (config.scrollHorizontally) { + if (allowHorizontalScroll) { directories_horizontal_fastscroller.setViews(directories_grid, directories_refresh_layout) } else { directories_vertical_fastscroller.setViews(directories_grid, directories_refresh_layout) 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 678db7f7f..79baeed6a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -169,15 +169,16 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { } private fun setupScrollDirection() { + val allowHorizontalScroll = config.scrollHorizontally && config.viewTypeFiles == VIEW_TYPE_GRID media_refresh_layout.isEnabled = !config.scrollHorizontally media_vertical_fastscroller.isHorizontal = false - media_vertical_fastscroller.beGoneIf(config.scrollHorizontally) + media_vertical_fastscroller.beGoneIf(allowHorizontalScroll) media_horizontal_fastscroller.isHorizontal = true - media_horizontal_fastscroller.beVisibleIf(config.scrollHorizontally) + media_horizontal_fastscroller.beVisibleIf(allowHorizontalScroll) - if (config.scrollHorizontally) { + if (allowHorizontalScroll) { media_horizontal_fastscroller.setViews(media_grid, media_refresh_layout) } else { media_vertical_fastscroller.setViews(media_grid, media_refresh_layout) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickDirectoryDialog.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickDirectoryDialog.kt index a4e877bad..1d53684cb 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickDirectoryDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickDirectoryDialog.kt @@ -16,6 +16,7 @@ import com.simplemobiletools.gallery.asynctasks.GetDirectoriesAsynctask import com.simplemobiletools.gallery.extensions.config import com.simplemobiletools.gallery.extensions.getCachedDirectories import com.simplemobiletools.gallery.extensions.getSortedDirectories +import com.simplemobiletools.gallery.helpers.VIEW_TYPE_GRID import com.simplemobiletools.gallery.models.Directory import kotlinx.android.synthetic.main.dialog_directory_picker.view.* @@ -23,11 +24,12 @@ class PickDirectoryDialog(val activity: SimpleActivity, val sourcePath: String, var dialog: AlertDialog var shownDirectories: ArrayList = ArrayList() var view: View = LayoutInflater.from(activity).inflate(R.layout.dialog_directory_picker, null) + var isGridViewType = activity.config.viewTypeFolders == VIEW_TYPE_GRID init { (view.directories_grid.layoutManager as GridLayoutManager).apply { - orientation = if (activity.config.scrollHorizontally) GridLayoutManager.HORIZONTAL else GridLayoutManager.VERTICAL - spanCount = activity.config.dirColumnCnt + orientation = if (activity.config.scrollHorizontally && isGridViewType) GridLayoutManager.HORIZONTAL else GridLayoutManager.VERTICAL + spanCount = if (isGridViewType) activity.config.dirColumnCnt else 1 } dialog = AlertDialog.Builder(activity) @@ -71,7 +73,7 @@ class PickDirectoryDialog(val activity: SimpleActivity, val sourcePath: String, } } - val scrollHorizontally = activity.config.scrollHorizontally + val scrollHorizontally = activity.config.scrollHorizontally && isGridViewType view.apply { directories_grid.adapter = adapter From 80b6279f83d4d1498e467efa02e1578c4433e3ca Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 1 Oct 2017 00:03:17 +0200 Subject: [PATCH 147/207] fix some layout manager glitch at list view with horizontal scrolling --- .../com/simplemobiletools/gallery/activities/MainActivity.kt | 2 ++ .../com/simplemobiletools/gallery/activities/MediaActivity.kt | 2 ++ 2 files changed, 4 insertions(+) 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 bbde246e1..b5498cccc 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -357,6 +357,8 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { val layoutManager = directories_grid.layoutManager as GridLayoutManager layoutManager.spanCount = 1 + layoutManager.orientation = GridLayoutManager.VERTICAL + directories_refresh_layout.layoutParams = FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT) } private fun createNewFolder() { 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 79baeed6a..f9816269f 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -431,6 +431,8 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { val layoutManager = media_grid.layoutManager as GridLayoutManager layoutManager.spanCount = 1 + layoutManager.orientation = GridLayoutManager.VERTICAL + media_refresh_layout.layoutParams = FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT) } private fun increaseColumnCount() { From 95f26a13cf0e22709d6b2da36b58e2276fffb045 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 1 Oct 2017 00:07:22 +0200 Subject: [PATCH 148/207] updating Whats new --- .../com/simplemobiletools/gallery/activities/MainActivity.kt | 1 + app/src/main/res/values/donottranslate.xml | 4 ++++ 2 files changed, 5 insertions(+) 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 b5498cccc..76d0303a3 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -596,6 +596,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { add(Release(123, R.string.release_123)) add(Release(125, R.string.release_125)) add(Release(127, R.string.release_127)) + add(Release(133, R.string.release_133)) checkWhatsNew(this, BuildConfig.VERSION_CODE) } } diff --git a/app/src/main/res/values/donottranslate.xml b/app/src/main/res/values/donottranslate.xml index b880748b9..10ac92ba7 100644 --- a/app/src/main/res/values/donottranslate.xml +++ b/app/src/main/res/values/donottranslate.xml @@ -2,6 +2,10 @@ + + Added fingerprint to hidden item protection\n + Added a new List view type + Added a switch for disabling video gestures\n Added a switch for deleting empty folders after deleting content From cd9f3912e053558a96755167547b6872cf528f74 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 1 Oct 2017 00:10:36 +0200 Subject: [PATCH 149/207] update version to 2.15.0 --- app/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 15c7c312c..2c49a9298 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,8 +10,8 @@ android { applicationId "com.simplemobiletools.gallery" minSdkVersion 16 targetSdkVersion 23 - versionCode 132 - versionName "2.14.4" + versionCode 133 + versionName "2.15.0" } signingConfigs { From b19cf9a6ac02455a98fd9a765b50eb225eb889f0 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 1 Oct 2017 00:11:02 +0200 Subject: [PATCH 150/207] updating changelog --- CHANGELOG.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 19b5481bd..ea35d3112 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,16 @@ Changelog ========== +Version 2.15.0 *(2017-10-01)* +---------------------------- + + * Added fingerprint to hidden item protection + * Added a new List view type + * Fixed an issue with some hidden items being shown at "Show all folders content" + * Fixed typing in color hex codes manually with some keyboards + * Do not autosave rotated images in any case + * Tons of other performance, stability and UX improvements + Version 2.14.4 *(2017-09-18)* ---------------------------- From 3a0579c2e880a72a92bc80a88dd31faea0c2d2ac Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 1 Oct 2017 08:16:00 +0200 Subject: [PATCH 151/207] update commons to 2.29.0 --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 2c49a9298..c12f5fb84 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,7 +37,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.28.9' + compile 'com.simplemobiletools:commons:2.29.0' compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.6.0' compile 'com.theartofdev.edmodo:android-image-cropper:2.4.0' compile 'com.bignerdranch.android:recyclerview-multiselect:0.2' From cd75718d56b0491769c15361689da12ca9463f4b Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 1 Oct 2017 09:16:31 +0200 Subject: [PATCH 152/207] try adding missing media files in the mediastore by scanning it --- .../com/simplemobiletools/gallery/helpers/MediaFetcher.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt index 210e44258..ac3178dc7 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt @@ -270,8 +270,10 @@ class MediaFetcher(val context: Context) { val medium = Medium(filename, file.absolutePath, isVideo, dateModified, dateTaken, size) val isAlreadyAdded = curMedia.any { it.path == file.absolutePath } - if (!isAlreadyAdded) + if (!isAlreadyAdded) { curMedia.add(medium) + context.scanPath(file.absolutePath) {} + } } } From 0ef76d857c8d2e6473b8c356b974e1e9edb60c2e Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 1 Oct 2017 09:34:03 +0200 Subject: [PATCH 153/207] update version to 2.15.1 --- app/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index c12f5fb84..44cc83b52 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,8 +10,8 @@ android { applicationId "com.simplemobiletools.gallery" minSdkVersion 16 targetSdkVersion 23 - versionCode 133 - versionName "2.15.0" + versionCode 134 + versionName "2.15.1" } signingConfigs { From a8b64a6587402f561e250ef2a346fb1c335d0707 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 1 Oct 2017 09:34:32 +0200 Subject: [PATCH 154/207] updating changelog --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ea35d3112..ce87f8506 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ Changelog ========== +Version 2.15.1 *(2017-10-01)* +---------------------------- + + * Updated commons library with minor fixes + Version 2.15.0 *(2017-10-01)* ---------------------------- From 1d9fadf58e6ee6536f1cc78f69a790b3e31034f2 Mon Sep 17 00:00:00 2001 From: gregory678 Date: Mon, 2 Oct 2017 12:44:26 +0200 Subject: [PATCH 155/207] Updates and fixes for 2.15.1 --- app/src/main/res/values-pl/strings.xml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index 0c8b066f8..1e4c90da8 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -57,7 +57,7 @@ Szerokość Wysokość Zachowaj proporcje - Wpisz poprawną rozdzielczość +    Podaj poprawną rozdzielczość Edycja @@ -98,14 +98,14 @@ Losowa kolejność Używaj płynnych przejść    Odwrotna kolejność - Loop slideshow +    Zapętlaj Pokaz slajdów zakończony Nie znalazłem multimediów do pokazu slajdów - Change view type - Grid - List +    Zmień typ widoku +    Siatka +    Lista Pokazuj ukryte foldery From 4203939d628c81e8d271157771fc68ccabad7bae Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 2 Oct 2017 18:27:42 +0200 Subject: [PATCH 156/207] fix #378, allow adding multiple items as email attachments --- app/build.gradle | 2 +- .../gallery/activities/MainActivity.kt | 78 ++++++++++++------- .../gallery/activities/MediaActivity.kt | 12 ++- .../gallery/adapters/MediaAdapter.kt | 18 ++++- .../gallery/dialogs/PickMediumDialog.kt | 2 +- .../gallery/helpers/Constants.kt | 1 + app/src/main/res/menu/cab_media.xml | 5 ++ 7 files changed, 84 insertions(+), 34 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 44cc83b52..41c499e1e 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,7 +37,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.29.0' + compile 'com.simplemobiletools:commons:2.29.1' compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.6.0' compile 'com.theartofdev.edmodo:android-image-cropper:2.4.0' compile 'com.bignerdranch.android:recyclerview-multiselect:0.2' 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 76d0303a3..8a9da9d4a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -2,6 +2,7 @@ package com.simplemobiletools.gallery.activities import android.Manifest import android.app.Activity +import android.content.ClipData import android.content.Intent import android.content.pm.PackageManager import android.net.Uri @@ -412,36 +413,22 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { override fun onActivityResult(requestCode: Int, resultCode: Int, resultData: Intent?) { if (resultCode == Activity.RESULT_OK) { - if (requestCode == PICK_MEDIA && resultData?.data != null) { - Intent().apply { + if (requestCode == PICK_MEDIA && resultData != null) { + val resultIntent = Intent() + if (mIsGetImageContentIntent || mIsGetVideoContentIntent || mIsGetAnyContentIntent) { + when { + intent.extras?.containsKey(MediaStore.EXTRA_OUTPUT) == true -> fillExtraOutput(resultData) + resultData.extras?.containsKey(PICKED_PATHS) == true -> fillPickedPaths(resultData, resultIntent) + else -> fillIntentPath(resultData, resultIntent) + } + } else if ((mIsPickImageIntent || mIsPickVideoIntent)) { val path = resultData.data.path val uri = Uri.fromFile(File(path)) - if (mIsGetImageContentIntent || mIsGetVideoContentIntent || mIsGetAnyContentIntent) { - if (intent.extras?.containsKey(MediaStore.EXTRA_OUTPUT) == true) { - var inputStream: InputStream? = null - var outputStream: OutputStream? = null - try { - val output = intent.extras.get(MediaStore.EXTRA_OUTPUT) as Uri - inputStream = FileInputStream(File(path)) - outputStream = contentResolver.openOutputStream(output) - inputStream.copyTo(outputStream) - } catch (ignored: FileNotFoundException) { - } finally { - inputStream?.close() - outputStream?.close() - } - } else { - val type = File(path).getMimeType("image/jpeg") - setDataAndTypeAndNormalize(uri, type) - flags = Intent.FLAG_GRANT_READ_URI_PERMISSION or Intent.FLAG_GRANT_WRITE_URI_PERMISSION - } - } else if (mIsPickImageIntent || mIsPickVideoIntent) { - data = uri - flags = Intent.FLAG_GRANT_READ_URI_PERMISSION - } - - setResult(Activity.RESULT_OK, this) + resultIntent.data = uri + resultIntent.flags = Intent.FLAG_GRANT_READ_URI_PERMISSION } + + setResult(Activity.RESULT_OK, resultIntent) finish() } else if (requestCode == PICK_WALLPAPER) { setResult(Activity.RESULT_OK) @@ -451,6 +438,42 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { super.onActivityResult(requestCode, resultCode, resultData) } + private fun fillExtraOutput(resultData: Intent) { + val path = resultData.data.path + var inputStream: InputStream? = null + var outputStream: OutputStream? = null + try { + val output = intent.extras.get(MediaStore.EXTRA_OUTPUT) as Uri + inputStream = FileInputStream(File(path)) + outputStream = contentResolver.openOutputStream(output) + inputStream.copyTo(outputStream) + } catch (ignored: FileNotFoundException) { + } finally { + inputStream?.close() + outputStream?.close() + } + } + + private fun fillPickedPaths(resultData: Intent, resultIntent: Intent) { + val paths = resultData.extras.getStringArrayList(PICKED_PATHS) + val uris = paths.map { Uri.fromFile(File(it)) } as ArrayList + val clipData = ClipData("Attachment", arrayOf("image/*", "video/*"), ClipData.Item(uris.removeAt(0))) + + uris.forEach { + clipData.addItem(ClipData.Item(it)) + } + + resultIntent.clipData = clipData + } + + private fun fillIntentPath(resultData: Intent, resultIntent: Intent) { + val path = resultData.data.path + val uri = Uri.fromFile(File(path)) + val type = File(path).getMimeType("image/jpeg") + resultIntent.setDataAndTypeAndNormalize(uri, type) + resultIntent.flags = Intent.FLAG_GRANT_READ_URI_PERMISSION or Intent.FLAG_GRANT_WRITE_URI_PERMISSION + } + private fun itemClicked(path: String) { Intent(this, MediaActivity::class.java).apply { putExtra(DIRECTORY, path) @@ -462,6 +485,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { putExtra(GET_IMAGE_INTENT, mIsPickImageIntent || mIsGetImageContentIntent) putExtra(GET_VIDEO_INTENT, mIsPickVideoIntent || mIsGetVideoContentIntent) putExtra(GET_ANY_INTENT, mIsGetAnyContentIntent) + putExtra(Intent.EXTRA_ALLOW_MULTIPLE, intent.getBooleanExtra(Intent.EXTRA_ALLOW_MULTIPLE, false)) startActivityForResult(this, PICK_MEDIA) } } 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 f9816269f..4851c7305 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -46,6 +46,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { private var mIsGetVideoIntent = false private var mIsGetAnyIntent = false private var mIsGettingMedia = false + private var mAllowPickingMultiple = false private var mShowAll = false private var mLoadedInitialPhotos = false private var mStoredAnimateGifs = true @@ -68,6 +69,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { mIsGetImageIntent = getBooleanExtra(GET_IMAGE_INTENT, false) mIsGetVideoIntent = getBooleanExtra(GET_VIDEO_INTENT, false) mIsGetAnyIntent = getBooleanExtra(GET_ANY_INTENT, false) + mAllowPickingMultiple = getBooleanExtra(Intent.EXTRA_ALLOW_MULTIPLE, false) } media_refresh_layout.setOnRefreshListener({ getMedia() }) @@ -159,7 +161,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { val currAdapter = media_grid.adapter if (currAdapter == null) { - media_grid.adapter = MediaAdapter(this, mMedia, this, mIsGetAnyIntent) { + media_grid.adapter = MediaAdapter(this, mMedia, this, mIsGetAnyIntent, mAllowPickingMultiple) { itemClicked(it.path) } } else { @@ -561,4 +563,12 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { override fun itemLongClicked(position: Int) { media_grid.setDragSelectActive(position) } + + override fun selectedPaths(paths: ArrayList) { + Intent().apply { + putExtra(PICKED_PATHS, paths) + setResult(Activity.RESULT_OK, this) + } + finish() + } } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt index 50a03e7ca..7296f51d7 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt @@ -25,7 +25,7 @@ import java.io.File import java.util.* class MediaAdapter(val activity: SimpleActivity, var media: MutableList, val listener: MediaOperationsListener?, val isPickIntent: Boolean, - val itemClick: (Medium) -> Unit) : RecyclerView.Adapter() { + val allowMultiplePicks: Boolean, val itemClick: (Medium) -> Unit) : RecyclerView.Adapter() { val multiSelector = MultiSelector() val config = activity.config @@ -72,6 +72,7 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList, private val multiSelectorMode = object : ModalMultiSelectorCallback(multiSelector) { override fun onActionItemClicked(mode: ActionMode, item: MenuItem): Boolean { when (item.itemId) { + R.id.cab_confirm_selection -> confirmSelection() R.id.cab_properties -> showProperties() R.id.cab_rename -> renameFile() R.id.cab_edit -> editFile() @@ -97,6 +98,7 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList, override fun onPrepareActionMode(actionMode: ActionMode?, menu: Menu): Boolean { menu.findItem(R.id.cab_rename).isVisible = selectedPositions.size <= 1 menu.findItem(R.id.cab_edit).isVisible = selectedPositions.size == 1 && media.size > selectedPositions.first() && media[selectedPositions.first()].isImage() + menu.findItem(R.id.cab_confirm_selection).isVisible = isPickIntent && allowMultiplePicks && selectedPositions.size > 0 checkHideBtnVisibility(menu) @@ -127,6 +129,11 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList, } } + private fun confirmSelection() { + val paths = getSelectedMedia().map { it.path } as ArrayList + listener?.selectedPaths(paths) + } + private fun showProperties() { if (selectedPositions.size <= 1) { PropertiesDialog(activity, media[selectedPositions.first()].path, config.shouldShowHidden) @@ -247,7 +254,7 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList, override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): ViewHolder { val layoutType = if (isListViewType) R.layout.photo_video_item_list else R.layout.photo_video_item_grid val view = LayoutInflater.from(parent?.context).inflate(layoutType, parent, false) - return ViewHolder(view, adapterListener, activity, multiSelectorMode, multiSelector, listener, isPickIntent, itemClick) + return ViewHolder(view, adapterListener, activity, multiSelectorMode, multiSelector, listener, allowMultiplePicks || !isPickIntent, itemClick) } override fun onBindViewHolder(holder: ViewHolder, position: Int) { @@ -319,7 +326,8 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList, } class ViewHolder(val view: View, val adapterListener: MyAdapterListener, val activity: SimpleActivity, val multiSelectorCallback: ModalMultiSelectorCallback, - val multiSelector: MultiSelector, val listener: MediaOperationsListener?, val isPickIntent: Boolean, val itemClick: (Medium) -> (Unit)) : + val multiSelector: MultiSelector, val listener: MediaOperationsListener?, val allowMultiplePicks: Boolean, + val itemClick: (Medium) -> (Unit)) : SwappingHolder(view, MultiSelector()) { fun bindView(medium: Medium, displayFilenames: Boolean, scrollVertically: Boolean, isListViewType: Boolean, textColor: Int): View { itemView.apply { @@ -334,7 +342,7 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList, } setOnClickListener { viewClicked(medium) } - setOnLongClickListener { if (isPickIntent) viewClicked(medium) else viewLongClicked(); true } + setOnLongClickListener { if (allowMultiplePicks) viewLongClicked() else viewClicked(medium); true } } return itemView } @@ -377,5 +385,7 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList, fun deleteFiles(files: ArrayList) fun itemLongClicked(position: Int) + + fun selectedPaths(paths: ArrayList) } } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickMediumDialog.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickMediumDialog.kt index 4c57c68f1..fe0a86add 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickMediumDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickMediumDialog.kt @@ -47,7 +47,7 @@ class PickMediumDialog(val activity: SimpleActivity, val path: String, val callb return shownMedia = media - val adapter = MediaAdapter(activity, media, null, true) { + val adapter = MediaAdapter(activity, media, null, true, false) { callback(it.path) dialog.dismiss() } 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 18bf6ac29..d875a0f18 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt @@ -63,6 +63,7 @@ val SET_WALLPAPER_INTENT = "set_wallpaper_intent" val DIRECTORIES = "directories2" val IS_VIEW_INTENT = "is_view_intent" val IS_FROM_GALLERY = "is_from_gallery" +val PICKED_PATHS = "picked_paths" val REQUEST_EDIT_IMAGE = 1 val REQUEST_SET_AS = 2 diff --git a/app/src/main/res/menu/cab_media.xml b/app/src/main/res/menu/cab_media.xml index 4b47e6025..fa787d520 100644 --- a/app/src/main/res/menu/cab_media.xml +++ b/app/src/main/res/menu/cab_media.xml @@ -1,6 +1,11 @@ + Date: Mon, 2 Oct 2017 22:47:23 +0200 Subject: [PATCH 157/207] fix #381, handle media pick intents in Show All Folders content view --- .../gallery/activities/MainActivity.kt | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 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 8a9da9d4a..b25521bb1 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -252,9 +252,14 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { config.showAll = true Intent(this, MediaActivity::class.java).apply { putExtra(DIRECTORY, "/") - startActivity(this) + + if (mIsThirdPartyIntent) { + handleMediaIntent(this) + } else { + startActivity(this) + finish() + } } - finish() } private fun changeViewType() { @@ -477,7 +482,12 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { private fun itemClicked(path: String) { Intent(this, MediaActivity::class.java).apply { putExtra(DIRECTORY, path) + handleMediaIntent(this) + } + } + private fun handleMediaIntent(intent: Intent) { + intent.apply { if (mIsSetWallpaperIntent) { putExtra(SET_WALLPAPER_INTENT, true) startActivityForResult(this, PICK_WALLPAPER) From 95cfb018285db301c91bed2c13559644c4349561 Mon Sep 17 00:00:00 2001 From: solokot Date: Tue, 3 Oct 2017 16:43:27 +0300 Subject: [PATCH 158/207] Update strings.xml --- app/src/main/res/values-ru/strings.xml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index f0ff4a8df..4623d94b3 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -35,7 +35,7 @@ Изменить фильтры - Эта функция скрывает папку, добавляя в неё файл \'.nomedia\'; будут скрыты все подпапки. Можно показывать их, переключая \'Показать скрытые папки\' в настройках. Продолжить? + Эта функция скрывает папку, добавляя в неё файл \'.nomedia\'; будут скрыты все подпапки. Можно показывать их, переключая \'Показывать скрытые папки\' в настройках. Продолжить? Исключить Исключённые папки Управление исключёнными папками @@ -49,7 +49,7 @@ Включённые папки Управление включёнными папками Добавление папки - Если у вас есть папки содержащие медиа, но не распознанные Simple Gallery. Вы можете добавить их вручную. + Если у вас есть папки, содержащие медиафайлы, но не распознанные Simple Gallery. Вы можете добавить их вручную. Изменить размер @@ -103,9 +103,9 @@ Никаких медиафайлов для слайдшоу не было найдено. - Change view type - Grid - List + Режим отображения + Сетка + Список Показать скрытые папки From a7bfe814c9e8d118c1e1300103fef4329e05d1a2 Mon Sep 17 00:00:00 2001 From: solokot Date: Tue, 3 Oct 2017 17:08:26 +0300 Subject: [PATCH 159/207] Update strings.xml --- app/src/main/res/values-ru/strings.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 4623d94b3..7cdae2f86 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -22,7 +22,7 @@ Изменить обложку Выбрать изображение Использовать по умолчанию - Установить как + Установить как... Громкость Яркость @@ -108,7 +108,7 @@ Список - Показать скрытые папки + Показывать скрытые папки Воспроизводить видео автоматически Переключить отображение имени файла Повторять видео From fa7b95e0afd41505f6c90fcbe76f7d0e81516859 Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 3 Oct 2017 20:29:26 +0200 Subject: [PATCH 160/207] fix displaying some special cases of third party images, like Bluemail attachment --- .../gallery/activities/PhotoVideoActivity.kt | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt index 4a5b48097..61fab13e4 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt @@ -63,11 +63,13 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList return } else { val path = applicationContext.getRealPathFromURI(mUri) ?: "" - scanPath(mUri.path) {} - if (path.isNotEmpty()) { - sendViewPagerIntent(path) - finish() - return + if (path != mUri.toString()) { + scanPath(mUri.path) {} + if (path.isNotEmpty()) { + sendViewPagerIntent(path) + finish() + return + } } } From 56f513beca1e9e033bbe28f5bbc1070de5064ebe Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 3 Oct 2017 20:40:07 +0200 Subject: [PATCH 161/207] fix a glitch at allowing adding multiple items to an email attachment --- .../com/simplemobiletools/gallery/activities/MainActivity.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 b25521bb1..881e50c9f 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -53,6 +53,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { private var mIsGetVideoContentIntent = false private var mIsGetAnyContentIntent = false private var mIsSetWallpaperIntent = false + private var mAllowPickingMultiple = false private var mIsThirdPartyIntent = false private var mIsGettingDirs = false private var mStoredAnimateGifs = true @@ -74,6 +75,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { mIsGetVideoContentIntent = isGetVideoContentIntent(intent) mIsGetAnyContentIntent = isGetAnyContentIntent(intent) mIsSetWallpaperIntent = isSetWallpaperIntent(intent) + mAllowPickingMultiple = intent.getBooleanExtra(Intent.EXTRA_ALLOW_MULTIPLE, false) mIsThirdPartyIntent = mIsPickImageIntent || mIsPickVideoIntent || mIsGetImageContentIntent || mIsGetVideoContentIntent || mIsGetAnyContentIntent || mIsSetWallpaperIntent @@ -495,7 +497,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { putExtra(GET_IMAGE_INTENT, mIsPickImageIntent || mIsGetImageContentIntent) putExtra(GET_VIDEO_INTENT, mIsPickVideoIntent || mIsGetVideoContentIntent) putExtra(GET_ANY_INTENT, mIsGetAnyContentIntent) - putExtra(Intent.EXTRA_ALLOW_MULTIPLE, intent.getBooleanExtra(Intent.EXTRA_ALLOW_MULTIPLE, false)) + putExtra(Intent.EXTRA_ALLOW_MULTIPLE, mAllowPickingMultiple) startActivityForResult(this, PICK_MEDIA) } } From c2ea3ad4bb97e4ce9d8bc3218053631714b88814 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 4 Oct 2017 18:53:45 +0200 Subject: [PATCH 162/207] stop media fetching on pause only if its not our first time there --- .../com/simplemobiletools/gallery/activities/MainActivity.kt | 5 ++++- .../simplemobiletools/gallery/activities/MediaActivity.kt | 5 ++++- 2 files changed, 8 insertions(+), 2 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 881e50c9f..4c1ce7725 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -166,7 +166,10 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { mStoredTextColor = config.textColor directories_grid.listener = null mLastMediaHandler.removeCallbacksAndMessages(null) - mCurrAsyncTask?.stopFetching() + + if (!mDirs.isEmpty()) { + mCurrAsyncTask?.stopFetching() + } } override fun onDestroy() { 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 4851c7305..760d1e90a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -125,7 +125,10 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { mStoredTextColor = config.textColor media_grid.listener = null mLastMediaHandler.removeCallbacksAndMessages(null) - mCurrAsyncTask?.stopFetching() + + if (!mMedia.isEmpty()) { + mCurrAsyncTask?.stopFetching() + } } override fun onDestroy() { From dd9bef298fd968d1b80b185c362d2c7d0f74fc0f Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 4 Oct 2017 19:03:43 +0200 Subject: [PATCH 163/207] minor code cleanup --- .../gallery/asynctasks/GetMediaAsynctask.kt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetMediaAsynctask.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetMediaAsynctask.kt index 2c99f54d6..a3b8a2b5d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetMediaAsynctask.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetMediaAsynctask.kt @@ -10,14 +10,15 @@ import java.util.* class GetMediaAsynctask(val context: Context, val mPath: String, val isPickVideo: Boolean = false, val isPickImage: Boolean = false, val showAll: Boolean, val callback: (media: ArrayList) -> Unit) : AsyncTask>() { - val mediaFetcher = MediaFetcher(context) + private val mediaFetcher = MediaFetcher(context) override fun doInBackground(vararg params: Void): ArrayList { return if (showAll) { val mediaMap = mediaFetcher.getMediaByDirectories(isPickVideo, isPickImage) val media = ArrayList() - for ((path, curMedia) in mediaMap) { - media.addAll(curMedia) + + mediaMap.values.forEach { + media.addAll(it) } Medium.sorting = context.config.getFileSorting("") From 9af74b9096560b89f2026c707e2dd30a5406278c Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 4 Oct 2017 19:27:32 +0200 Subject: [PATCH 164/207] fetch storage paths asap --- .../com/simplemobiletools/gallery/activities/MainActivity.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 4c1ce7725..7908a9258 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -68,6 +68,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) + storeStoragePaths() mIsPickImageIntent = isPickImageIntent(intent) mIsPickVideoIntent = isPickVideoIntent(intent) @@ -86,7 +87,6 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { mStoredCropThumbnails = config.cropThumbnails mStoredScrollHorizontally = config.scrollHorizontally mStoredTextColor = config.textColor - storeStoragePaths() checkWhatsNewDialog() directories_empty_text.setOnClickListener { From 71fa5ec235cdd59ecc4906114eab28d601fdae18 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 5 Oct 2017 19:12:04 +0200 Subject: [PATCH 165/207] minor style update --- .../com/simplemobiletools/gallery/helpers/MediaFetcher.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt index ac3178dc7..5b8a27a13 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt @@ -77,7 +77,11 @@ class MediaFetcher(val context: Context) { private fun getSelectionArgsQuery(path: String): Array { return if (path.isEmpty()) { - if (context.hasExternalSDCard()) arrayOf("${context.internalStoragePath}/%", "${context.sdCardPath}/%") else arrayOf("${context.internalStoragePath}/%") + if (context.hasExternalSDCard()) { + arrayOf("${context.internalStoragePath}/%", "${context.sdCardPath}/%") + } else { + arrayOf("${context.internalStoragePath}/%") + } } else { arrayOf("$path/%", "$path/%/%") } From 15fddac3b14b558e7978080d858bfb029674bf89 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 5 Oct 2017 22:03:32 +0200 Subject: [PATCH 166/207] try making the Included Folders placeholders clearer --- app/src/main/res/values-ca/strings.xml | 2 +- app/src/main/res/values-hu/strings.xml | 2 +- app/src/main/res/values-sk/strings.xml | 2 +- app/src/main/res/values/strings.xml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/res/values-ca/strings.xml b/app/src/main/res/values-ca/strings.xml index ddc156702..383de4003 100644 --- a/app/src/main/res/values-ca/strings.xml +++ b/app/src/main/res/values-ca/strings.xml @@ -49,7 +49,7 @@ Included folders Manage included folders Add folder - If you have some folders which contain media, but were not recognized by the app, you can add them manually here. + If you have some folders which contain media, but were not recognized by the app, you can add them manually here.\n\nAdding some items here will not exclude any other folder. Resize diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index c42d41e12..7a012c98c 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -49,7 +49,7 @@ Included folders Manage included folders Add folder - If you have some folders which contain media, but were not recognized by the app, you can add them manually here. + If you have some folders which contain media, but were not recognized by the app, you can add them manually here.\n\nAdding some items here will not exclude any other folder. Resize diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index 89a8fe5bb..11ef7bbc6 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -49,7 +49,7 @@ Pridané priečinky Spravovať pridané priečinky Pridať priečinok - Ak máte nejaké priečinky obsahujúce médiá, ale neboli rozpoznané aplikáciou, môžete ich tu manuálne pridať. + Ak máte nejaké priečinky obsahujúce médiá, ale neboli rozpoznané aplikáciou, môžete ich tu manuálne pridať.\n\nPridanie nových položiek sem nevylúči žiadny iný priečinok. Zmeniť veľkosť diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index ddc156702..383de4003 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -49,7 +49,7 @@ Included folders Manage included folders Add folder - If you have some folders which contain media, but were not recognized by the app, you can add them manually here. + If you have some folders which contain media, but were not recognized by the app, you can add them manually here.\n\nAdding some items here will not exclude any other folder. Resize From 51fb913d0cabeea4d2fd5681cd3ef37d071b3ed6 Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 6 Oct 2017 18:00:39 +0200 Subject: [PATCH 167/207] update Commons and Build tools --- app/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 41c499e1e..904f633f3 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -4,7 +4,7 @@ apply plugin: 'kotlin-android-extensions' android { compileSdkVersion 25 - buildToolsVersion "25.0.2" + buildToolsVersion "25.0.3" defaultConfig { applicationId "com.simplemobiletools.gallery" @@ -37,7 +37,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.29.1' + compile 'com.simplemobiletools:commons:2.29.11' compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.6.0' compile 'com.theartofdev.edmodo:android-image-cropper:2.4.0' compile 'com.bignerdranch.android:recyclerview-multiselect:0.2' From f48d408b18d4e80d05f5569f2dc0609ee0033801 Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 6 Oct 2017 18:20:13 +0200 Subject: [PATCH 168/207] lets show SD card images to Android 4 users too --- .../com/simplemobiletools/gallery/helpers/MediaFetcher.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt index 5b8a27a13..2fddf4c94 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt @@ -80,7 +80,8 @@ class MediaFetcher(val context: Context) { if (context.hasExternalSDCard()) { arrayOf("${context.internalStoragePath}/%", "${context.sdCardPath}/%") } else { - arrayOf("${context.internalStoragePath}/%") + val internalPath = if (context.isAndroidFour()) "" else context.internalStoragePath + arrayOf("$internalPath/%") } } else { arrayOf("$path/%", "$path/%/%") From 0286df51022846b9d00f4fa02b257559c74fe5a4 Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 6 Oct 2017 18:22:39 +0200 Subject: [PATCH 169/207] update version to 2.15.2 --- app/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 904f633f3..17db9f135 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,8 +10,8 @@ android { applicationId "com.simplemobiletools.gallery" minSdkVersion 16 targetSdkVersion 23 - versionCode 134 - versionName "2.15.1" + versionCode 135 + versionName "2.15.2" } signingConfigs { From d4d80b4b47471b4db64936ae167a881165d4df3d Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 6 Oct 2017 18:22:44 +0200 Subject: [PATCH 170/207] updating changelog --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ce87f8506..740237b87 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,13 @@ Changelog ========== +Version 2.15.2 *(2017-10-06)* +---------------------------- + + * Properly display SD card content to Android 4 users + * Fix displaying some third party media, like Bluemail attachments + * Fix media picking intents if "Show all folders content" is enabled + Version 2.15.1 *(2017-10-01)* ---------------------------- From 55476790046dea8fcc95725764884953df5335a5 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 7 Oct 2017 16:58:56 +0200 Subject: [PATCH 171/207] improve the hack for proper displaying of media on Android 4 --- .../gallery/helpers/MediaFetcher.kt | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt index 2fddf4c94..949419c3b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt @@ -62,9 +62,12 @@ class MediaFetcher(val context: Context) { } } - private fun getSelectionQuery(path: String): String { + private fun getSelectionQuery(path: String): String? { val dataQuery = "${MediaStore.Images.Media.DATA} LIKE ?" return if (path.isEmpty()) { + if (context.isAndroidFour()) + return null + var query = "($dataQuery)" if (context.hasExternalSDCard()) { query += " OR ($dataQuery)" @@ -75,13 +78,15 @@ class MediaFetcher(val context: Context) { } } - private fun getSelectionArgsQuery(path: String): Array { + private fun getSelectionArgsQuery(path: String): Array? { return if (path.isEmpty()) { + if (context.isAndroidFour()) + return null + if (context.hasExternalSDCard()) { arrayOf("${context.internalStoragePath}/%", "${context.sdCardPath}/%") } else { - val internalPath = if (context.isAndroidFour()) "" else context.internalStoragePath - arrayOf("$internalPath/%") + arrayOf("${context.internalStoragePath}/%") } } else { arrayOf("$path/%", "$path/%/%") From 589b0d3a75d8be2941939adb97c37d17572b8cd9 Mon Sep 17 00:00:00 2001 From: ameneghello Date: Wed, 11 Oct 2017 16:08:34 +0200 Subject: [PATCH 172/207] Updated italian --- app/src/main/res/values-it/strings.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index e77d073ef..d7310939f 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -103,9 +103,9 @@ Nessun media trovato per la presentazione - Change view type - Grid - List + Cambia modalità visualizzazione + Griglia + Elenco Mostra cartelle nascoste From 9f1e41d4712c7c974e6e7dd7b9cff0abac1e902a Mon Sep 17 00:00:00 2001 From: xin Date: Fri, 13 Oct 2017 16:51:13 +0000 Subject: [PATCH 173/207] Update French translation --- app/src/main/res/values-fr/strings.xml | 46 +++++++++++++------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index ca60589f2..ebec6ea34 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -7,7 +7,7 @@ Ouvrir avec Aucune application valide trouvée (caché) - Épingler les dossiers + Épingler le dossier Désépingler le dossier Afficher le contenu de tous les dossiers Tous les dossiers @@ -15,22 +15,22 @@ Autre dossier Afficher sur la carte Position inconnue - Aucune application de cartes n\'a été trouvée - Aucune application d\\appareil photo n\'a été trouvée + Aucune application de carte n\'a été trouvée + Aucune application d\'appareil photo n\'a été trouvée Augmenter le nombre de colonnes Réduire le nombre de colonnes - Change cover image + Changer l\'image de couverture Sélectionner une photo - Use default - Set as + Utiliser par défaut + Définir comme Volume Luminosité - Filtrer medias + Filtrer les médias Images Vidéos - GIFs + GIF Aucun fichier média trouvé avec les filtres sélectionnés. Changer les filtres @@ -49,7 +49,7 @@ Dossiers inclus Gérer les dossiers inclus Ajouter un dossier - Si vous avez des dossiers contenant du media et qui ne sont pas reconnus par l\'application alors, vous pouvez les ajouter manuellement ici. + Si vous avez des dossiers contenant des medias et qui ne sont pas reconnus par l\'application alors, vous pouvez les ajouter manuellement ici. Redimensionner @@ -57,7 +57,7 @@ Largeur Hauteur Garder le ratio - Veuillez entrez une résolution valide + Veuillez entrer une résolution valide Éditeur @@ -86,33 +86,33 @@ Aucune application trouvée pour continuer cette action Paramètres de fond d\'écran… Fond d\'écran défini avec succès - Ratio aspect Portrait - Ratio aspect Paysage + Ratio d\'aspect portrait + Ratio d\'aspect paysage Diaporama - Intervalle​ (secondes): + Intervalle (secondes) : Inclure photos Inclure vidéos - Inclure GIFs + Inclure GIF Ordre aléatoire Utiliser un fondu Revenir en arrière - Loop slideshow + Diaporama en boucle Diaporama terminé Aucun média trouvé pour le diaporama - Change view type - Grid - List + Changer le type de vue + Grille + Liste Afficher les dossiers cachés Lecture automatique des vidéos Permuter la visibilité des noms de fichier - Tourner en boucle les vidéos - GIFs animés sur les miniatures + Lire en boucle les vidéos + GIF animés sur les miniatures Luminosité maximale lors de l\'affichage de media Rogner les miniatures en carrés Pivoter les medias plein écran selon @@ -120,7 +120,7 @@ Rotation de l\'appareil Ratio d\'aspect Arrière-plan sombre pour média plein écran - Défilement des mignatures horizontalement + Défilement des miniatures horizontalement Masquer automatiquement l\'interface utilisateur si média plein écran Supprimer les dossiers vides après avoir supprimé leur contenu Permettre le contrôle du volume vidéo et de la luminosité avec des gestes verticaux @@ -132,9 +132,9 @@ Un simple outil pour visionner les photos et les vidéos. Elles peuvent être triées par dates, tailles, noms dans les deux sens (alphabétique comme désalphabétique), il est possible de zoomer sur les photos. Les fichiers sont affichés sur de multiple colonnes en fonction de la taille de l\'écran, vous pouvez changer le nombre de colonnes par pincement. Elles peuvent être renommées, partagées, supprimées, copiées et déplacées. Les images peuvent en plus être tournées, rognées ou être définies comme fond d\'écran directement depuis l\'application. - La galerie est aussi offerte pour l\'utiliser comme une tierce partie pour de la prévisualisation des images/vidéos, joindre aux clients mail etc. C\'est parfait pour un usage au quotidien. + La galerie est également proposée pour une utilisation comme tierce partie pour la prévisualisation des images/vidéos, ajouter des pièces jointes aux clients email etc. C\'est parfait pour un usage au quotidien. - L\'application ne contient ni de publicité ni d\'autorisation inutile. Elle est totalement OpenSource et est aussi fournie avec un thème sombre. + L\'application ne contient ni publicité ni autorisation inutile. Elle est totalement opensource et est aussi fournie avec des couleurs personnalisables. Cette application est juste l\'une des applications d\'une plus grande suite. Vous pouvez trouver les autres sur http://www.simplemobiletools.com From 678d8b2d8e9324ff7289bfb671c266647d06816a Mon Sep 17 00:00:00 2001 From: datzuma Date: Sat, 14 Oct 2017 19:32:37 +0300 Subject: [PATCH 174/207] Added Finnish translations --- app/src/main/res/values-fi/strings.xml | 146 +++++++++++++++++++++++++ 1 file changed, 146 insertions(+) create mode 100644 app/src/main/res/values-fi/strings.xml diff --git a/app/src/main/res/values-fi/strings.xml b/app/src/main/res/values-fi/strings.xml new file mode 100644 index 000000000..b0198f6ce --- /dev/null +++ b/app/src/main/res/values-fi/strings.xml @@ -0,0 +1,146 @@ + + + Simple Gallery + Galleria + Muokkaa + Avaa kamera + Avaa + Sovelluksia ei löydetty + (piilotettu) + Kiinnitä kansio + Poista kiinnitys + Näytä kaikkien kansioiden sisältö + Kaikki kansiot + Vaihda kansionäkymään + Muu kansio + Näytä kartalla + Tuntematon sijainti + Karttasovellusta ei löytynyt + Kamerasovellusta ei löytynyt + Increase column count + Reduce column count + Vaihda kansikuva + Valitse kuva + Käytä oletuksia + Aseta + Äänenvoimakkuus + Kirkkaus + + + Suodata media + Kuvat + Videot + GIFit + Mediaa ei löytynyt valituilla suotimilla. + Muuta suotimia + + + Tämä piilottaa kansion ja alikansiot lisäämällä \'.nomedia\' tiedoston kansioon. Näet ne valitsemalla \'Näytä piilotetut kansiot\' asetuksissa. Continue? + Poissulje + Poissuljetut kansiot + Hallitse poissuljettuja kansioita + Tämä poissulkee valitun ja alikansiot vain Simple Gallerysta. Voit hallinnoida poissuljettuja kansioita asetuksista. + Poissulje yläkansio tämän sijaan? + Kansion poissulkeminen piilottaa kansion alikansioineen vain Simple Galleryssa, ne jäävät näkyviin muihin sovelluksiin.\n\nJos haluat piilottaa kansion myös muissa sovelluksissa, käytä piilota-funktiota. + Poista kaikki + Poista kaikki kansiot poissuljettujen listasta? Tämä ei poista kansioita. + + + Sisällytä kansiot + Hallitse sisällettyjä kansioita + Lisää kansio + Jos sinulla on kansioita, jotka sisältää mediaa, mutta sovellus ei tunnistanut, voit lisätä ne manuaalisesti tähän.\n\Lisääminen ei poissulje muita kansioita. + + + Rajaa + Rajaa valinta ja tallenna + Leveys + Korkeus + Säilytä kuvasuhde + Aseta oikea resoluutio. + + + Editori + Tallenna + Käännä + Polku + Kuvan polkua ei ole + Kuvan muokkaus epäonnistui + Muokkaa kuvaa: + Kuvamuokkainta ei löytynyt + Tuntematon tiedostosijainti + Lähdetiedoston ylikirjoitus epäonnistui + Käännä vasemmalle + Käännä oikealle + Käännä 180º + Pyöräytä + Pyöräytä vaakasuoraan + Pyöräytä pystysuoraan + Muokkaa sovelluksella + + + Simple Wallpaper + Aseta taustakuvaksi + Taustakuvan asetus epäonnistui + Aseta taustakuvaksi sovelluksella: + Toimivaa sovellusta ei löydetty + Asetetaan taustakuvaa… + Taustakuva asetettu onnistuneesti + Kuvasuhde pystyssä + Kuvasuhde vaakatasossa + + + Diaesitys + Aikaväli (sekunteja): + Sisällytä Kuvat + Sisällytä Videot + Sisällytä GIFit + Satunnainen järjestys + Käytä häivitys-animaatiota + Liiku takaisinpäin + Jatkuva diaesitys + Diaesitys päättyi + Mediaa diaesitykseen ei löytynyt + + + Vaihda näkymää + Ruudukko + Lista + + + Näytä piilotettu media + Toista videot automaattisesti + Tiedostonimien näkyvyys + Jatkuvat videot + Animoi GIFit pienoiskuvissa + Täysi kirkkaus mediaa katsoessa + Leikkaa pienoiskuvat neliöiksi + Käännä koko ruudun mediaa + Järjestelmän asetukset + Laitteen kierto + Kuvasuhde + Tumma tausta koko ruudun medioissa + Vieritä pienoiskuvia vaakasuorassa + Piilota järjestelmän UI automaattisesti koko näytön mediassa + Poista tyhjät kansiot kansion tyhjennyksen jälkeen + Salli videon äänenvoimakkuuden ja kirkkauden säätö pystysuorilla eleillä + Korvaa jakaminen kääntämisellä koko näytön tilassa + + + + Galleria kuvien ja videoiden katsomiseen ilman mainoksia. + + Yksinkertainen työkalu kuvien ja videoiden katsomiseen. Kohteita voidaan lajitella päivän, koon, nimen mukaan, nousevassa ja laskevassa järjestyksessä. Kuvia voidaan zoomata. Mediatiedostot näkyvät useissa sarakkeissa joiden määrää muutetaan nipistys-eleellä. Tiedostoja voidaan uudelleennimetä, jakaa, poistaa, kopioida. Kuvia voi rajata, pyörittää tai asettaa taustakuvaksi suoraan sovelluksesta. + + Galleriaa tarjotaan myös kolmansille osapuolille kuvien / videoiden tarkasteluun, liitteiden lisäämiseksi sähköpostiin yms. Täydellinen jokapäiväiseen käyttöön. + + Ei sisällä mainoksia tai turhia käyttöoikeuksia. Täysin avointa lähdekoodia, tarjoaa muokattavat värit. + + Tämä sovellus on vain yksi osa suurempaa kokoelmaa. Löydät loput osoitteesta http://www.simplemobiletools.com + + + + From d0aca1024c3328ddec7ced5b3f1a2a3dbb819aef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Marques?= Date: Sun, 15 Oct 2017 23:10:58 +0100 Subject: [PATCH 175/207] Update strings.xml --- app/src/main/res/values-pt/strings.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index 5128dfaf4..4da70dedb 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -19,7 +19,7 @@ Não existe uma aplicação adequeada Aumentar número de colunas Diminuir número de colunas - Alterar imagem da capa + Alterar imagem de capa Selecionar foto Predefinição Definir como @@ -103,9 +103,9 @@ Não foram encontrados ficheiros para a apresentação - Change view type - Grid - List + Tipo de exibição + Grelha + Lista Mostrar pastas ocultas From e9cc9852064fcceabf10e46a7869800319aa39d4 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 18 Oct 2017 17:33:43 +0200 Subject: [PATCH 176/207] update Commons to 2.29.17 to update Glide to 4.2.0 --- app/build.gradle | 2 +- build.gradle | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 17db9f135..33905432d 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,7 +37,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.29.11' + compile 'com.simplemobiletools:commons:2.29.17' compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.6.0' compile 'com.theartofdev.edmodo:android-image-cropper:2.4.0' compile 'com.bignerdranch.android:recyclerview-multiselect:0.2' diff --git a/build.gradle b/build.gradle index 0a26ece58..633d20306 100644 --- a/build.gradle +++ b/build.gradle @@ -16,6 +16,7 @@ allprojects { repositories { jcenter() maven { url "https://jitpack.io" } + maven { url "https://maven.google.com" } } } From f0159843851dc965e4769ccff4034510f09521ed Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 18 Oct 2017 17:41:20 +0200 Subject: [PATCH 177/207] remove a Directory helper function addSize --- .../com/simplemobiletools/gallery/models/Directory.kt | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/models/Directory.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/models/Directory.kt index 7271dc2e8..4f102e380 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/models/Directory.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/models/Directory.kt @@ -4,16 +4,12 @@ import com.simplemobiletools.commons.helpers.* import java.io.Serializable data class Directory(val path: String, val tmb: String, val name: String, var mediaCnt: Int, val modified: Long, val taken: Long, - var size: Long) : Serializable, Comparable { + val size: Long) : Serializable, Comparable { companion object { private val serialVersionUID = -6553345863555455L var sorting: Int = 0 } - fun addSize(bytes: Long) { - size += bytes - } - override fun compareTo(other: Directory): Int { var result: Int when { From f85fc7c20b9ec7e2ab1539b9c26e61a9cdbdc714 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 18 Oct 2017 17:42:30 +0200 Subject: [PATCH 178/207] update commons to 2.29.18 --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 33905432d..5ed3e1770 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,7 +37,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.29.17' + compile 'com.simplemobiletools:commons:2.29.18' compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.6.0' compile 'com.theartofdev.edmodo:android-image-cropper:2.4.0' compile 'com.bignerdranch.android:recyclerview-multiselect:0.2' From 3033f611a1f497a7f332a05e194508840206cd1f Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 18 Oct 2017 17:56:14 +0200 Subject: [PATCH 179/207] allow sorting items by path --- .../gallery/dialogs/ChangeSortingDialog.kt | 13 +++++++------ .../simplemobiletools/gallery/models/Directory.kt | 1 + app/src/main/res/layout/dialog_change_sorting.xml | 8 ++++++++ 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/ChangeSortingDialog.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/ChangeSortingDialog.kt index f7020498d..95513a98e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/ChangeSortingDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/ChangeSortingDialog.kt @@ -42,12 +42,12 @@ class ChangeSortingDialog(val activity: SimpleActivity, val isDirectorySorting: val sortingRadio = view.sorting_dialog_radio_sorting var sortBtn = sortingRadio.sorting_dialog_radio_name - if (currSorting and SORT_BY_SIZE != 0) { - sortBtn = sortingRadio.sorting_dialog_radio_size - } else if (currSorting and SORT_BY_DATE_MODIFIED != 0) { - sortBtn = sortingRadio.sorting_dialog_radio_last_modified - } else if (currSorting and SORT_BY_DATE_TAKEN != 0) - sortBtn = sortingRadio.sorting_dialog_radio_date_taken + when { + currSorting and SORT_BY_PATH != 0 -> sortBtn = sortingRadio.sorting_dialog_radio_path + currSorting and SORT_BY_SIZE != 0 -> sortBtn = sortingRadio.sorting_dialog_radio_size + currSorting and SORT_BY_DATE_MODIFIED != 0 -> sortBtn = sortingRadio.sorting_dialog_radio_last_modified + currSorting and SORT_BY_DATE_TAKEN != 0 -> sortBtn = sortingRadio.sorting_dialog_radio_date_taken + } sortBtn.isChecked = true } @@ -65,6 +65,7 @@ class ChangeSortingDialog(val activity: SimpleActivity, val isDirectorySorting: val sortingRadio = view.sorting_dialog_radio_sorting var sorting = when (sortingRadio.checkedRadioButtonId) { R.id.sorting_dialog_radio_name -> SORT_BY_NAME + R.id.sorting_dialog_radio_path -> SORT_BY_PATH R.id.sorting_dialog_radio_size -> SORT_BY_SIZE R.id.sorting_dialog_radio_last_modified -> SORT_BY_DATE_MODIFIED else -> SORT_BY_DATE_TAKEN diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/models/Directory.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/models/Directory.kt index 4f102e380..d03b4d1be 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/models/Directory.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/models/Directory.kt @@ -14,6 +14,7 @@ data class Directory(val path: String, val tmb: String, val name: String, var me var result: Int when { sorting and SORT_BY_NAME != 0 -> result = AlphanumericComparator().compare(name.toLowerCase(), other.name.toLowerCase()) + sorting and SORT_BY_PATH != 0 -> result = AlphanumericComparator().compare(path.toLowerCase(), other.path.toLowerCase()) sorting and SORT_BY_SIZE != 0 -> result = when { size == other.size -> 0 size > other.size -> 1 diff --git a/app/src/main/res/layout/dialog_change_sorting.xml b/app/src/main/res/layout/dialog_change_sorting.xml index d0ab9b36f..e0e642acc 100644 --- a/app/src/main/res/layout/dialog_change_sorting.xml +++ b/app/src/main/res/layout/dialog_change_sorting.xml @@ -28,6 +28,14 @@ android:paddingTop="@dimen/medium_margin" android:text="@string/name"/> + + Date: Wed, 18 Oct 2017 19:34:31 +0200 Subject: [PATCH 180/207] add a toggle for showing extended details over fullscreen media --- .../gallery/activities/SettingsActivity.kt | 9 +++++++++ .../gallery/dialogs/PickMediumDialog.kt | 2 +- .../gallery/helpers/Config.kt | 4 ++++ .../gallery/helpers/Constants.kt | 1 + app/src/main/res/layout/activity_settings.xml | 20 +++++++++++++++++++ app/src/main/res/values-ca/strings.xml | 1 + app/src/main/res/values-cs/strings.xml | 1 + app/src/main/res/values-de/strings.xml | 1 + app/src/main/res/values-es/strings.xml | 1 + app/src/main/res/values-fi/strings.xml | 1 + app/src/main/res/values-fr/strings.xml | 1 + app/src/main/res/values-hu/strings.xml | 1 + app/src/main/res/values-it/strings.xml | 1 + app/src/main/res/values-ja/strings.xml | 1 + app/src/main/res/values-pl/strings.xml | 1 + app/src/main/res/values-pt-rBR/strings.xml | 1 + app/src/main/res/values-pt/strings.xml | 1 + app/src/main/res/values-ru/strings.xml | 1 + app/src/main/res/values-sk/strings.xml | 1 + app/src/main/res/values-sv/strings.xml | 1 + app/src/main/res/values-tr/strings.xml | 1 + app/src/main/res/values-zh-rCN/strings.xml | 1 + app/src/main/res/values-zh-rTW/strings.xml | 1 + app/src/main/res/values/strings.xml | 1 + 24 files changed, 54 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt index 8ba896f00..8d8b37c52 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt @@ -47,6 +47,7 @@ class SettingsActivity : SimpleActivity() { setupPasswordProtection() setupDeleteEmptyFolders() setupAllowVideoGestures() + setupShowExtendedDetails() updateTextColors(settings_holder) } @@ -214,4 +215,12 @@ class SettingsActivity : SimpleActivity() { ROTATE_BY_DEVICE_ROTATION -> R.string.screen_rotation_device_rotation else -> R.string.screen_rotation_aspect_ratio }) + + private fun setupShowExtendedDetails() { + settings_show_extended_details.isChecked = config.showExtendedDetails + settings_show_extended_details_holder.setOnClickListener { + settings_show_extended_details.toggle() + config.showExtendedDetails = settings_show_extended_details.isChecked + } + } } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickMediumDialog.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickMediumDialog.kt index fe0a86add..f89fae804 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickMediumDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickMediumDialog.kt @@ -30,7 +30,7 @@ class PickMediumDialog(val activity: SimpleActivity, val path: String, val callb activity.setupDialogStuff(view, this, R.string.select_photo) val token = object : TypeToken>() {}.type - val media = Gson().fromJson>(activity.config.loadFolderMedia(path), token) ?: ArrayList(1) + val media = Gson().fromJson>(activity.config.loadFolderMedia(path), token) ?: ArrayList(1) if (media.isNotEmpty()) { gotMedia(media) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt index 26f679028..fee7e2ff2 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt @@ -288,4 +288,8 @@ class Config(context: Context) : BaseConfig(context) { var viewTypeFiles: Int get() = prefs.getInt(VIEW_TYPE_FILES, VIEW_TYPE_GRID) set(viewTypeFiles) = prefs.edit().putInt(VIEW_TYPE_FILES, viewTypeFiles).apply() + + var showExtendedDetails: Boolean + get() = prefs.getBoolean(SHOW_EXTENDED_DETAILS, false) + set(showExtendedDetails) = prefs.edit().putBoolean(SHOW_EXTENDED_DETAILS, showExtendedDetails).apply() } 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 d875a0f18..5b88534f3 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt @@ -39,6 +39,7 @@ val ALLOW_VIDEO_GESTURES = "allow_video_gestures" val TEMP_FOLDER_PATH = "temp_folder_path" val VIEW_TYPE_FOLDERS = "view_type_folders" val VIEW_TYPE_FILES = "view_type_files" +val SHOW_EXTENDED_DETAILS = "show_extended_details" // slideshow val SLIDESHOW_INTERVAL = "slideshow_interval" diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index ab5bd8f0e..944390ec8 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -328,6 +328,26 @@ + + + + + + Delete empty folders after deleting their content Allow controlling video volume and brightness with vertical gestures Replace Share with Rotate at fullscreen menu + Show extended details over fullscreen media diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index af7703ab4..b47de3c07 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -125,6 +125,7 @@ Delete empty folders after deleting their content Allow controlling video volume and brightness with vertical gestures Replace Share with Rotate at fullscreen menu + Show extended details over fullscreen media diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 96580f927..45ed9184f 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -125,6 +125,7 @@ Nach Löschen leere Ordner löschen Gesten für Videolautstärke/Helligkeit Teilen/Drehen im Vollbild-Menü vertauschen + Show extended details over fullscreen media diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 5b5350d6c..029534ffa 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -125,6 +125,7 @@ Delete empty folders after deleting their content Allow controlling video volume and brightness with vertical gestures Reemplazar Compartir con Girar en el menú de pantalla completa + Show extended details over fullscreen media diff --git a/app/src/main/res/values-fi/strings.xml b/app/src/main/res/values-fi/strings.xml index b0198f6ce..1164fb3db 100644 --- a/app/src/main/res/values-fi/strings.xml +++ b/app/src/main/res/values-fi/strings.xml @@ -125,6 +125,7 @@ Poista tyhjät kansiot kansion tyhjennyksen jälkeen Salli videon äänenvoimakkuuden ja kirkkauden säätö pystysuorilla eleillä Korvaa jakaminen kääntämisellä koko näytön tilassa + Show extended details over fullscreen media diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index ebec6ea34..7281df1ee 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -125,6 +125,7 @@ Supprimer les dossiers vides après avoir supprimé leur contenu Permettre le contrôle du volume vidéo et de la luminosité avec des gestes verticaux Remplacer Partager par Pivoter si menu en plein écran + Show extended details over fullscreen media diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index 7a012c98c..3a1ae7d43 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -125,6 +125,7 @@ Delete empty folders after deleting their content Allow controlling video volume and brightness with vertical gestures Replace Share with Rotate at fullscreen menu + Show extended details over fullscreen media diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index d7310939f..59dca231f 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -125,6 +125,7 @@ Elimina cartelle vuote dopo averne eliminato il contenuto Gestisci il volume e la luminosità dei video con gesti verticali Sostituisci Condividi con Ruota a schermo intero + Show extended details over fullscreen media diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index ef90a0d11..ebc34b95d 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -125,6 +125,7 @@ メディアの削除後にフォルダーが空になった場合、そのフォルダーを削除する ビデオ再生中に、音量と明るさを縦方向のジェスチャーで変更する フルスクリーンメニューの「共有」を「回転」に置き換える + Show extended details over fullscreen media diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index 1e4c90da8..d4308631d 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -125,6 +125,7 @@ Usuwaj puste foldery po usunięciu ich zawartości Zezwalaj na kontrolę jasności i głośności filmów pionowymi gestami Zamień funkcję udostępniania na obracanie w menu pełnoekranowym + Show extended details over fullscreen media diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index e549de037..ffdd2b2d2 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -125,6 +125,7 @@ Delete empty folders after deleting their content Allow controlling video volume and brightness with vertical gestures Replace Share with Rotate at fullscreen menu + Show extended details over fullscreen media diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index 4da70dedb..88f3db323 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -125,6 +125,7 @@ Apagar as pastas vazias depois de remover o seu conteúdo Permitir controlo do volume e brilho dos vídeos através de gestos verticais Substituir a opção Partilhar pela opção Rodar se em ecrã completo + Show extended details over fullscreen media diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 7cdae2f86..c1ab240a6 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -125,6 +125,7 @@ Удалять пустые папки после удаления их содержимого Управлять громкостью и яркостью видео с помощью вертикальных жестов Заменить \'Поделиться\' на \'Повернуть\' в меню полноэкранного режима + Show extended details over fullscreen media diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index 11ef7bbc6..03f404c28 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -125,6 +125,7 @@ Odstrániť prázdne priečinky po vymazaní ich obsahu Povoliť ovládanie hlasitosti a jasu videí vertikálnymi ťahmi Nahradiť Zdieľanie s Otočením v celoobrazovkovom menu + Zobraziť rozšírené vlastnosti ponad celoobrazovkové médiá diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index 834755adf..22c827185 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -125,6 +125,7 @@ Ta bort tomma mappar när deras innehåll tas bort Tillåt styrning av videovolym och videoljusstyrka med vertikala gester Ersätt Dela med Rotera i helskärmsmenyn + Show extended details over fullscreen media diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index e98004c41..b24c0198c 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -125,6 +125,7 @@ Delete empty folders after deleting their content Allow controlling video volume and brightness with vertical gestures Replace Share with Rotate at fullscreen menu + Show extended details over fullscreen media diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 1b6a61f9e..859dc941e 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -125,6 +125,7 @@ Delete empty folders after deleting their content Allow controlling video volume and brightness with vertical gestures 替换全屏时菜单栏的“分享”为“旋转” + Show extended details over fullscreen media diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 6f7ec0dc1..8b186d229 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -125,6 +125,7 @@ 刪除內容後刪除空白資料夾 允許用上下手勢來控制影片的音量和亮度 將全螢幕選單的分享取代為旋轉 + Show extended details over fullscreen media diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 383de4003..43594c96c 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -125,6 +125,7 @@ Delete empty folders after deleting their content Allow controlling video volume and brightness with vertical gestures Replace Share with Rotate at fullscreen menu + Show extended details over fullscreen media From 2e339f08e4b5265d9ca77988e3e31d511eb986e4 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 18 Oct 2017 21:54:08 +0200 Subject: [PATCH 181/207] show extended details at photos/videos if appropriate --- app/build.gradle | 2 +- .../gallery/fragments/PhotoFragment.kt | 35 ++++++++--- .../gallery/fragments/VideoFragment.kt | 58 ++++++++++++++----- app/src/main/res/layout/pager_photo_item.xml | 15 +++++ app/src/main/res/layout/pager_video_item.xml | 15 +++++ 5 files changed, 102 insertions(+), 23 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 5ed3e1770..a35f18b9f 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,7 +37,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.29.18' + compile 'com.simplemobiletools:commons:2.29.20' compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.6.0' compile 'com.theartofdev.edmodo:android-image-cropper:2.4.0' compile 'com.bignerdranch.android:recyclerview-multiselect:0.2' diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt index 108cf9bc9..f5d278619 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt @@ -12,6 +12,7 @@ import android.os.Bundle import android.view.LayoutInflater import android.view.View import android.view.ViewGroup +import android.widget.RelativeLayout import com.bumptech.glide.Glide import com.bumptech.glide.Priority import com.bumptech.glide.load.DataSource @@ -24,15 +25,10 @@ import com.bumptech.glide.request.RequestOptions import com.bumptech.glide.request.target.Target import com.davemorrissey.labs.subscaleview.ImageSource import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView -import com.simplemobiletools.commons.extensions.beGone -import com.simplemobiletools.commons.extensions.beVisible -import com.simplemobiletools.commons.extensions.toast +import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.activities.ViewPagerActivity -import com.simplemobiletools.gallery.extensions.config -import com.simplemobiletools.gallery.extensions.getFileSignature -import com.simplemobiletools.gallery.extensions.getRealPathFromURI -import com.simplemobiletools.gallery.extensions.portrait +import com.simplemobiletools.gallery.extensions.* import com.simplemobiletools.gallery.helpers.GlideRotateTransformation import com.simplemobiletools.gallery.helpers.MEDIUM import com.simplemobiletools.gallery.models.Medium @@ -101,6 +97,7 @@ class PhotoFragment : ViewPagerFragment() { } } loadImage() + checkExtendedDetails() wasInit = true @@ -258,6 +255,29 @@ class PhotoFragment : ViewPagerFragment() { loadBitmap(degrees) } + private fun checkExtendedDetails() { + if (context.config.showExtendedDetails) { + val file = File(medium.path) + val name = medium.name + val path = "${File(medium.path).parent.trimEnd('/')}/" + val exif = android.media.ExifInterface(medium.path) + val size = file.length().formatSize() + val resolution = file.getResolution().formatAsResolution() + val lastModified = file.lastModified().formatLastModified() + val dateTaken = path.getExifDateTaken(exif) + val cameraModel = path.getExifCameraModel(exif) + val exifProperties = path.getExifProperties(exif) + view.photo_details.apply { + beVisible() + setTextColor(context.config.textColor) + text = "$name\n$path\n$size\n$resolution\n$lastModified\n$dateTaken\n$cameraModel\n$exifProperties" + (layoutParams as RelativeLayout.LayoutParams).bottomMargin = (resources.getDimension(R.dimen.small_margin) + context.navigationBarHeight).toInt() + } + } else { + view.photo_details.beGone() + } + } + override fun onDestroyView() { super.onDestroyView() if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 && !activity.isDestroyed) { @@ -268,6 +288,7 @@ class PhotoFragment : ViewPagerFragment() { override fun onConfigurationChanged(newConfig: Configuration) { super.onConfigurationChanged(newConfig) loadImage() + checkExtendedDetails() } private fun photoClicked() { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt index 1e945a15e..4c36de74a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt @@ -14,16 +14,17 @@ import android.view.* import android.view.animation.AnimationUtils import android.widget.SeekBar import android.widget.TextView -import com.simplemobiletools.commons.extensions.beVisibleIf -import com.simplemobiletools.commons.extensions.getFormattedDuration -import com.simplemobiletools.commons.extensions.toast -import com.simplemobiletools.commons.extensions.updateTextColors +import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.activities.ViewPagerActivity -import com.simplemobiletools.gallery.extensions.* +import com.simplemobiletools.gallery.extensions.audioManager +import com.simplemobiletools.gallery.extensions.config +import com.simplemobiletools.gallery.extensions.hasNavBar +import com.simplemobiletools.gallery.extensions.navigationBarHeight import com.simplemobiletools.gallery.helpers.MEDIUM import com.simplemobiletools.gallery.models.Medium import kotlinx.android.synthetic.main.pager_video_item.view.* +import java.io.File import java.io.IOException class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSeekBarChangeListener { @@ -36,7 +37,6 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee private var mCurrTimeView: TextView? = null private var mTimerHandler: Handler? = null private var mSeekBar: SeekBar? = null - private var mTimeHolder: View? = null private var mIsPlaying = false private var mIsDragged = false @@ -59,6 +59,7 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee lateinit var mView: View lateinit var medium: Medium + lateinit var mTimeHolder: View companion object { private val TAG = VideoFragment::class.java.simpleName @@ -67,9 +68,10 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { mView = inflater.inflate(R.layout.pager_video_item, container, false) - setupPlayer() - + mTimeHolder = mView.video_time_holder medium = arguments.getSerializable(MEDIUM) as Medium + + setupPlayer() if (savedInstanceState != null) { mCurrTime = savedInstanceState.getInt(PROGRESS) } @@ -109,6 +111,7 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee } initTimeHolder() + checkExtendedDetails() } override fun setMenuVisibility(menuVisible: Boolean) { @@ -131,6 +134,7 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee super.onConfigurationChanged(newConfig) setVideoSize() initTimeHolder() + checkExtendedDetails() } private fun toggleFullscreen() { @@ -261,11 +265,10 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee } private fun initTimeHolder() { - mTimeHolder = mView.video_time_holder val res = resources - val height = res.getNavBarHeight() - val left = mTimeHolder!!.paddingLeft - val top = mTimeHolder!!.paddingTop + val height = context.navigationBarHeight + val left = mTimeHolder.paddingLeft + val top = mTimeHolder.paddingTop var right = res.getDimension(R.dimen.timer_padding).toInt() var bottom = 0 @@ -276,7 +279,7 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee right += height bottom += context.navigationBarHeight } - mTimeHolder!!.setPadding(left, top, right, bottom) + mTimeHolder.setPadding(left, top, right, bottom) } mCurrTimeView = mView.video_curr_time @@ -284,7 +287,7 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee mSeekBar!!.setOnSeekBarChangeListener(this) if (mIsFullscreen) - mTimeHolder!!.visibility = View.INVISIBLE + mTimeHolder.beInvisible() } private fun setupTimeHolder() { @@ -328,7 +331,7 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee AnimationUtils.loadAnimation(activity, anim).apply { duration = 150 fillAfter = true - mTimeHolder!!.startAnimation(this) + mTimeHolder.startAnimation(this) } } @@ -494,6 +497,31 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee } } + private fun checkExtendedDetails() { + if (context.config.showExtendedDetails) { + val file = File(medium.path) + val name = medium.name + val path = "${File(medium.path).parent.trimEnd('/')}/" + val exif = android.media.ExifInterface(medium.path) + val size = file.length().formatSize() + val resolution = file.getResolution().formatAsResolution() + val duration = file.getDuration() + val artist = file.getArtist() ?: "" + val album = file.getAlbum() ?: "" + val lastModified = file.lastModified().formatLastModified() + val dateTaken = path.getExifDateTaken(exif) + val cameraModel = path.getExifCameraModel(exif) + val exifProperties = path.getExifProperties(exif) + mView.video_details.apply { + beVisible() + setTextColor(context.config.textColor) + text = "$name\n$path\n$size\n$resolution\n$duration\n$artist\n$album\n$lastModified\n$dateTaken\n$cameraModel\n$exifProperties" + } + } else { + mView.video_details.beGone() + } + } + override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) { if (mMediaPlayer != null && fromUser) { setProgress(progress) diff --git a/app/src/main/res/layout/pager_photo_item.xml b/app/src/main/res/layout/pager_photo_item.xml index 1c4d2d76a..6a8b21a47 100644 --- a/app/src/main/res/layout/pager_photo_item.xml +++ b/app/src/main/res/layout/pager_photo_item.xml @@ -1,6 +1,7 @@ @@ -16,4 +17,18 @@ android:layout_height="match_parent" android:visibility="gone"/> + + diff --git a/app/src/main/res/layout/pager_video_item.xml b/app/src/main/res/layout/pager_video_item.xml index 3d88f52f7..5a104f2ef 100644 --- a/app/src/main/res/layout/pager_video_item.xml +++ b/app/src/main/res/layout/pager_video_item.xml @@ -1,6 +1,7 @@ @@ -50,6 +51,20 @@ android:textColor="@android:color/white" android:textSize="@dimen/extra_big_text_size"/> + + Date: Wed, 18 Oct 2017 22:00:27 +0200 Subject: [PATCH 182/207] properly show/hide extended details after toggle --- .../gallery/fragments/PhotoFragment.kt | 18 +++++++++-- .../gallery/fragments/VideoFragment.kt | 32 +++++++++++-------- 2 files changed, 35 insertions(+), 15 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt index f5d278619..b5efcc49c 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt @@ -39,10 +39,12 @@ import java.io.FileOutputStream import java.io.IOException class PhotoFragment : ViewPagerFragment() { - lateinit var medium: Medium - lateinit var view: ViewGroup private var isFragmentVisible = false private var wasInit = false + private var storedShowExtendedDetails = false + + lateinit var view: ViewGroup + lateinit var medium: Medium override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View { view = inflater.inflate(R.layout.pager_photo_item, container, false) as ViewGroup @@ -104,6 +106,18 @@ class PhotoFragment : ViewPagerFragment() { return view } + override fun onPause() { + super.onPause() + storedShowExtendedDetails = context.config.showExtendedDetails + } + + override fun onResume() { + super.onResume() + if (wasInit && context.config.showExtendedDetails != storedShowExtendedDetails) { + checkExtendedDetails() + } + } + override fun setMenuVisibility(menuVisible: Boolean) { super.setMenuVisibility(menuVisible) isFragmentVisible = menuVisible diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt index 4c36de74a..c457e08fd 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt @@ -43,6 +43,7 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee private var mIsFullscreen = false private var mIsFragmentVisible = false private var mPlayOnPrepare = false + private var mStoredShowExtendedDetails = false private var mCurrTime = 0 private var mDuration = 0 @@ -87,6 +88,24 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee activity.updateTextColors(mView.video_holder) mView.video_volume_controller.beVisibleIf(context.config.allowVideoGestures) mView.video_brightness_controller.beVisibleIf(context.config.allowVideoGestures) + + if (context.config.showExtendedDetails != mStoredShowExtendedDetails) { + checkExtendedDetails() + } + } + + override fun onPause() { + super.onPause() + pauseVideo() + mIsFragmentVisible = false + mStoredShowExtendedDetails = context.config.showExtendedDetails + } + + override fun onDestroy() { + super.onDestroy() + if (activity?.isChangingConfigurations == false) { + cleanup() + } } private fun setupPlayer() { @@ -396,19 +415,6 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee mMediaPlayer!!.pause() } - override fun onPause() { - super.onPause() - pauseVideo() - mIsFragmentVisible = false - } - - override fun onDestroy() { - super.onDestroy() - if (activity?.isChangingConfigurations == false) { - cleanup() - } - } - private fun cleanup() { pauseVideo() mCurrTimeView?.text = 0.getFormattedDuration() From 3f008960dee26af71fc77da95f73b4030b7faf5f Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 18 Oct 2017 23:38:35 +0200 Subject: [PATCH 183/207] add the dialog for customizing extended details --- .../gallery/activities/SettingsActivity.kt | 15 +++ .../dialogs/ManageExtendedDetailsDialog.kt | 70 +++++++++++ .../gallery/helpers/Config.kt | 4 + .../gallery/helpers/Constants.kt | 14 +++ app/src/main/res/layout/activity_settings.xml | 19 +++ .../layout/dialog_manage_extended_details.xml | 113 ++++++++++++++++++ app/src/main/res/values-ca/strings.xml | 1 + app/src/main/res/values-cs/strings.xml | 1 + app/src/main/res/values-de/strings.xml | 1 + app/src/main/res/values-es/strings.xml | 1 + app/src/main/res/values-fi/strings.xml | 1 + app/src/main/res/values-fr/strings.xml | 1 + app/src/main/res/values-hu/strings.xml | 1 + app/src/main/res/values-it/strings.xml | 1 + app/src/main/res/values-ja/strings.xml | 1 + app/src/main/res/values-pl/strings.xml | 1 + app/src/main/res/values-pt-rBR/strings.xml | 1 + app/src/main/res/values-pt/strings.xml | 1 + app/src/main/res/values-ru/strings.xml | 1 + app/src/main/res/values-sk/strings.xml | 3 +- app/src/main/res/values-sv/strings.xml | 1 + app/src/main/res/values-tr/strings.xml | 1 + app/src/main/res/values-zh-rCN/strings.xml | 1 + app/src/main/res/values-zh-rTW/strings.xml | 1 + app/src/main/res/values/strings.xml | 1 + 25 files changed, 255 insertions(+), 1 deletion(-) create mode 100644 app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/ManageExtendedDetailsDialog.kt create mode 100644 app/src/main/res/layout/dialog_manage_extended_details.xml diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt index 8d8b37c52..8851b6bd3 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt @@ -6,12 +6,14 @@ import android.os.Bundle import com.simplemobiletools.commons.dialogs.ConfirmationDialog import com.simplemobiletools.commons.dialogs.RadioGroupDialog import com.simplemobiletools.commons.dialogs.SecurityDialog +import com.simplemobiletools.commons.extensions.beVisibleIf import com.simplemobiletools.commons.extensions.handleHiddenFolderPasswordProtection import com.simplemobiletools.commons.extensions.updateTextColors import com.simplemobiletools.commons.helpers.PROTECTION_FINGERPRINT import com.simplemobiletools.commons.helpers.SHOW_ALL_TABS import com.simplemobiletools.commons.models.RadioItem import com.simplemobiletools.gallery.R +import com.simplemobiletools.gallery.dialogs.ManageExtendedDetailsDialog import com.simplemobiletools.gallery.extensions.config import com.simplemobiletools.gallery.helpers.ROTATE_BY_ASPECT_RATIO import com.simplemobiletools.gallery.helpers.ROTATE_BY_DEVICE_ROTATION @@ -48,6 +50,7 @@ class SettingsActivity : SimpleActivity() { setupDeleteEmptyFolders() setupAllowVideoGestures() setupShowExtendedDetails() + setupManageExtendedDetails() updateTextColors(settings_holder) } @@ -221,6 +224,18 @@ class SettingsActivity : SimpleActivity() { settings_show_extended_details_holder.setOnClickListener { settings_show_extended_details.toggle() config.showExtendedDetails = settings_show_extended_details.isChecked + settings_manage_extended_details_holder.beVisibleIf(config.showExtendedDetails) + } + } + + private fun setupManageExtendedDetails() { + settings_manage_extended_details_holder.beVisibleIf(config.showExtendedDetails) + settings_manage_extended_details_holder.setOnClickListener { + ManageExtendedDetailsDialog(this) { + if (config.extendedDetails == 0) { + settings_show_extended_details_holder.callOnClick() + } + } } } } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/ManageExtendedDetailsDialog.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/ManageExtendedDetailsDialog.kt new file mode 100644 index 000000000..3d8c5e3a7 --- /dev/null +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/ManageExtendedDetailsDialog.kt @@ -0,0 +1,70 @@ +package com.simplemobiletools.gallery.dialogs + +import android.support.v7.app.AlertDialog +import android.view.LayoutInflater +import android.view.View +import com.simplemobiletools.commons.extensions.setupDialogStuff +import com.simplemobiletools.gallery.R +import com.simplemobiletools.gallery.activities.SimpleActivity +import com.simplemobiletools.gallery.extensions.config +import com.simplemobiletools.gallery.helpers.* +import kotlinx.android.synthetic.main.dialog_manage_extended_details.view.* + +class ManageExtendedDetailsDialog(val activity: SimpleActivity, val callback: (result: Int) -> Unit) { + private var view: View = LayoutInflater.from(activity).inflate(R.layout.dialog_manage_extended_details, null) + + init { + val details = activity.config.extendedDetails + view.apply { + manage_extended_details_name.isChecked = details and EXT_NAME != 0 + manage_extended_details_path.isChecked = details and EXT_PATH != 0 + manage_extended_details_size.isChecked = details and EXT_SIZE != 0 + manage_extended_details_resolution.isChecked = details and EXT_RESOLUTION != 0 + manage_extended_details_last_modified.isChecked = details and EXT_LAST_MODIFIED != 0 + manage_extended_details_date_taken.isChecked = details and EXT_DATE_TAKEN != 0 + manage_extended_details_camera.isChecked = details and EXT_CAMERA_MODEL != 0 + manage_extended_details_exif.isChecked = details and EXT_EXIF_PROPERTIES != 0 + manage_extended_details_duration.isChecked = details and EXT_DURATION != 0 + manage_extended_details_artist.isChecked = details and EXT_ARTIST != 0 + manage_extended_details_album.isChecked = details and EXT_ALBUM != 0 + } + + AlertDialog.Builder(activity) + .setPositiveButton(R.string.ok, { dialog, which -> dialogConfirmed() }) + .setNegativeButton(R.string.cancel, null) + .create().apply { + activity.setupDialogStuff(view, this) + } + } + + private fun dialogConfirmed() { + var result = 0 + view.apply { + if (manage_extended_details_name.isChecked) + result += EXT_NAME + if (manage_extended_details_path.isChecked) + result += EXT_PATH + if (manage_extended_details_size.isChecked) + result += EXT_SIZE + if (manage_extended_details_resolution.isChecked) + result += EXT_RESOLUTION + if (manage_extended_details_last_modified.isChecked) + result += EXT_LAST_MODIFIED + if (manage_extended_details_date_taken.isChecked) + result += EXT_DATE_TAKEN + if (manage_extended_details_camera.isChecked) + result += EXT_CAMERA_MODEL + if (manage_extended_details_exif.isChecked) + result += EXT_EXIF_PROPERTIES + if (manage_extended_details_duration.isChecked) + result += EXT_DURATION + if (manage_extended_details_artist.isChecked) + result += EXT_ARTIST + if (manage_extended_details_album.isChecked) + result += EXT_ALBUM + } + + activity.config.extendedDetails = result + callback(result) + } +} diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt index fee7e2ff2..7302b3491 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt @@ -292,4 +292,8 @@ class Config(context: Context) : BaseConfig(context) { var showExtendedDetails: Boolean get() = prefs.getBoolean(SHOW_EXTENDED_DETAILS, false) set(showExtendedDetails) = prefs.edit().putBoolean(SHOW_EXTENDED_DETAILS, showExtendedDetails).apply() + + var extendedDetails: Int + get() = prefs.getInt(EXTENDED_DETAILS, EXT_RESOLUTION or EXT_LAST_MODIFIED or EXT_EXIF_PROPERTIES) + set(extendedDetails) = prefs.edit().putInt(EXTENDED_DETAILS, extendedDetails).apply() } 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 5b88534f3..0ccfacf64 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt @@ -40,6 +40,7 @@ val TEMP_FOLDER_PATH = "temp_folder_path" val VIEW_TYPE_FOLDERS = "view_type_folders" val VIEW_TYPE_FILES = "view_type_files" val SHOW_EXTENDED_DETAILS = "show_extended_details" +val EXTENDED_DETAILS = "extended_details" // slideshow val SLIDESHOW_INTERVAL = "slideshow_interval" @@ -86,3 +87,16 @@ val GIFS = 4 // view types val VIEW_TYPE_GRID = 1 val VIEW_TYPE_LIST = 2 + +// extended details values +val EXT_NAME = 1 +val EXT_PATH = 2 +val EXT_SIZE = 4 +val EXT_RESOLUTION = 8 +val EXT_LAST_MODIFIED = 16 +val EXT_DATE_TAKEN = 32 +val EXT_CAMERA_MODEL = 64 +val EXT_EXIF_PROPERTIES = 128 +val EXT_DURATION = 256 +val EXT_ARTIST = 512 +val EXT_ALBUM = 1024 diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index 944390ec8..c003f76f5 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -348,6 +348,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/values-ca/strings.xml b/app/src/main/res/values-ca/strings.xml index 43594c96c..f4ee43fa2 100644 --- a/app/src/main/res/values-ca/strings.xml +++ b/app/src/main/res/values-ca/strings.xml @@ -126,6 +126,7 @@ Allow controlling video volume and brightness with vertical gestures Replace Share with Rotate at fullscreen menu Show extended details over fullscreen media + Manage extended details diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index b47de3c07..b49c84832 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -126,6 +126,7 @@ Allow controlling video volume and brightness with vertical gestures Replace Share with Rotate at fullscreen menu Show extended details over fullscreen media + Manage extended details diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 45ed9184f..137d5a5f0 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -126,6 +126,7 @@ Gesten für Videolautstärke/Helligkeit Teilen/Drehen im Vollbild-Menü vertauschen Show extended details over fullscreen media + Manage extended details diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 029534ffa..25cb4c167 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -126,6 +126,7 @@ Allow controlling video volume and brightness with vertical gestures Reemplazar Compartir con Girar en el menú de pantalla completa Show extended details over fullscreen media + Manage extended details diff --git a/app/src/main/res/values-fi/strings.xml b/app/src/main/res/values-fi/strings.xml index 1164fb3db..fad746e5d 100644 --- a/app/src/main/res/values-fi/strings.xml +++ b/app/src/main/res/values-fi/strings.xml @@ -126,6 +126,7 @@ Salli videon äänenvoimakkuuden ja kirkkauden säätö pystysuorilla eleillä Korvaa jakaminen kääntämisellä koko näytön tilassa Show extended details over fullscreen media + Manage extended details diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 7281df1ee..50844b18b 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -126,6 +126,7 @@ Permettre le contrôle du volume vidéo et de la luminosité avec des gestes verticaux Remplacer Partager par Pivoter si menu en plein écran Show extended details over fullscreen media + Manage extended details diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index 3a1ae7d43..f6b77cf01 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -126,6 +126,7 @@ Allow controlling video volume and brightness with vertical gestures Replace Share with Rotate at fullscreen menu Show extended details over fullscreen media + Manage extended details diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 59dca231f..a70c5ae7f 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -126,6 +126,7 @@ Gestisci il volume e la luminosità dei video con gesti verticali Sostituisci Condividi con Ruota a schermo intero Show extended details over fullscreen media + Manage extended details diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index ebc34b95d..c85011c6e 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -126,6 +126,7 @@ ビデオ再生中に、音量と明るさを縦方向のジェスチャーで変更する フルスクリーンメニューの「共有」を「回転」に置き換える Show extended details over fullscreen media + Manage extended details diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index d4308631d..fd9567d52 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -126,6 +126,7 @@ Zezwalaj na kontrolę jasności i głośności filmów pionowymi gestami Zamień funkcję udostępniania na obracanie w menu pełnoekranowym Show extended details over fullscreen media + Manage extended details diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index ffdd2b2d2..e70507a49 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -126,6 +126,7 @@ Allow controlling video volume and brightness with vertical gestures Replace Share with Rotate at fullscreen menu Show extended details over fullscreen media + Manage extended details diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index 88f3db323..56b0b7819 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -126,6 +126,7 @@ Permitir controlo do volume e brilho dos vídeos através de gestos verticais Substituir a opção Partilhar pela opção Rodar se em ecrã completo Show extended details over fullscreen media + Manage extended details diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index c1ab240a6..35520e679 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -126,6 +126,7 @@ Управлять громкостью и яркостью видео с помощью вертикальных жестов Заменить \'Поделиться\' на \'Повернуть\' в меню полноэкранного режима Show extended details over fullscreen media + Manage extended details diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index 03f404c28..7844e7df6 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -126,12 +126,13 @@ Povoliť ovládanie hlasitosti a jasu videí vertikálnymi ťahmi Nahradiť Zdieľanie s Otočením v celoobrazovkovom menu Zobraziť rozšírené vlastnosti ponad celoobrazovkové médiá + Spravovať rozšírené vlastnosti Galéria na prezeranie obrázkov a videí bez reklám. - Jednoduchá nástroj použiteľný na prezeranie obrázkov a videí. Položky môžu byť zoradené podľa dátumu, veľkosti, názvu oboma smermi, obrázky je možné aj priblížiť. Položky sú zobrazované vo viacerých stĺpcoch v závislosti od veľkosti displeja, počet stĺpcov je možné meniť pomocou gesta prstami. Súbory môžete premenovať, zdieľať, mazať, kopírovať, premiestňovaŤ. Obrázky môžete orezať, otočiť, alebo nastaviť ako tapeta priamo v aplikácií. + Jednoduchá nástroj použiteľný na prezeranie obrázkov a videí. Položky môžu byť zoradené podľa dátumu, veľkosti, názvu oboma smermi, obrázky je možné aj priblížiť. Položky sú zobrazované vo viacerých stĺpcoch v závislosti od veľkosti displeja, počet stĺpcov je možné meniť pomocou gesta prstami. Súbory môžete premenovať, zdieľať, mazať, kopírovať, premiestňovať. Obrázky môžete orezať, otočiť, alebo nastaviť ako tapeta priamo v aplikácií. Galéria je tiež poskytovaná pre použitie treťou stranou pre prehliadanie fotiek a videí, pridávanie príloh v emailových klientoch. Je perfektná na každodenné použitie. diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index 22c827185..2c05e7437 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -126,6 +126,7 @@ Tillåt styrning av videovolym och videoljusstyrka med vertikala gester Ersätt Dela med Rotera i helskärmsmenyn Show extended details over fullscreen media + Manage extended details diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index b24c0198c..350a1cc73 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -126,6 +126,7 @@ Allow controlling video volume and brightness with vertical gestures Replace Share with Rotate at fullscreen menu Show extended details over fullscreen media + Manage extended details diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 859dc941e..299b82fe9 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -126,6 +126,7 @@ Allow controlling video volume and brightness with vertical gestures 替换全屏时菜单栏的“分享”为“旋转” Show extended details over fullscreen media + Manage extended details diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 8b186d229..1f454c722 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -126,6 +126,7 @@ 允許用上下手勢來控制影片的音量和亮度 將全螢幕選單的分享取代為旋轉 Show extended details over fullscreen media + Manage extended details diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 43594c96c..f4ee43fa2 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -126,6 +126,7 @@ Allow controlling video volume and brightness with vertical gestures Replace Share with Rotate at fullscreen menu Show extended details over fullscreen media + Manage extended details From d78068d6978261e8d078d28b17fb9ffa320a57d9 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 19 Oct 2017 14:14:09 +0200 Subject: [PATCH 184/207] display only the wanted extended details fields --- .../gallery/fragments/PhotoFragment.kt | 16 ++----- .../gallery/fragments/VideoFragment.kt | 16 +------ .../gallery/fragments/ViewPagerFragment.kt | 45 +++++++++++++++++++ .../gallery/helpers/MediaFetcher.kt | 4 +- 4 files changed, 52 insertions(+), 29 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt index b5efcc49c..d50d3e62f 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt @@ -25,7 +25,9 @@ import com.bumptech.glide.request.RequestOptions import com.bumptech.glide.request.target.Target import com.davemorrissey.labs.subscaleview.ImageSource import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView -import com.simplemobiletools.commons.extensions.* +import com.simplemobiletools.commons.extensions.beGone +import com.simplemobiletools.commons.extensions.beVisible +import com.simplemobiletools.commons.extensions.toast import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.activities.ViewPagerActivity import com.simplemobiletools.gallery.extensions.* @@ -271,20 +273,10 @@ class PhotoFragment : ViewPagerFragment() { private fun checkExtendedDetails() { if (context.config.showExtendedDetails) { - val file = File(medium.path) - val name = medium.name - val path = "${File(medium.path).parent.trimEnd('/')}/" - val exif = android.media.ExifInterface(medium.path) - val size = file.length().formatSize() - val resolution = file.getResolution().formatAsResolution() - val lastModified = file.lastModified().formatLastModified() - val dateTaken = path.getExifDateTaken(exif) - val cameraModel = path.getExifCameraModel(exif) - val exifProperties = path.getExifProperties(exif) view.photo_details.apply { beVisible() setTextColor(context.config.textColor) - text = "$name\n$path\n$size\n$resolution\n$lastModified\n$dateTaken\n$cameraModel\n$exifProperties" + text = getMediumExtendedDetails(medium) (layoutParams as RelativeLayout.LayoutParams).bottomMargin = (resources.getDimension(R.dimen.small_margin) + context.navigationBarHeight).toInt() } } else { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt index c457e08fd..4cfba5eab 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt @@ -24,7 +24,6 @@ import com.simplemobiletools.gallery.extensions.navigationBarHeight import com.simplemobiletools.gallery.helpers.MEDIUM import com.simplemobiletools.gallery.models.Medium import kotlinx.android.synthetic.main.pager_video_item.view.* -import java.io.File import java.io.IOException class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSeekBarChangeListener { @@ -505,23 +504,10 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee private fun checkExtendedDetails() { if (context.config.showExtendedDetails) { - val file = File(medium.path) - val name = medium.name - val path = "${File(medium.path).parent.trimEnd('/')}/" - val exif = android.media.ExifInterface(medium.path) - val size = file.length().formatSize() - val resolution = file.getResolution().formatAsResolution() - val duration = file.getDuration() - val artist = file.getArtist() ?: "" - val album = file.getAlbum() ?: "" - val lastModified = file.lastModified().formatLastModified() - val dateTaken = path.getExifDateTaken(exif) - val cameraModel = path.getExifCameraModel(exif) - val exifProperties = path.getExifProperties(exif) mView.video_details.apply { beVisible() setTextColor(context.config.textColor) - text = "$name\n$path\n$size\n$resolution\n$duration\n$artist\n$album\n$lastModified\n$dateTaken\n$cameraModel\n$exifProperties" + text = getMediumExtendedDetails(medium) } } else { mView.video_details.beGone() diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/ViewPagerFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/ViewPagerFragment.kt index 6121151ba..31a2888c4 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/ViewPagerFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/ViewPagerFragment.kt @@ -1,6 +1,11 @@ package com.simplemobiletools.gallery.fragments import android.support.v4.app.Fragment +import com.simplemobiletools.commons.extensions.* +import com.simplemobiletools.gallery.extensions.config +import com.simplemobiletools.gallery.helpers.* +import com.simplemobiletools.gallery.models.Medium +import java.io.File abstract class ViewPagerFragment : Fragment() { var listener: FragmentListener? = null @@ -12,4 +17,44 @@ abstract class ViewPagerFragment : Fragment() { fun videoEnded(): Boolean } + + fun getMediumExtendedDetails(medium: Medium): String { + val file = File(medium.path) + val path = "${file.parent.trimEnd('/')}/" + val exif = android.media.ExifInterface(medium.path) + val details = StringBuilder() + val detailsFlag = context.config.extendedDetails + if (detailsFlag and EXT_NAME != 0) { + medium.name.let { if (it.isNotEmpty()) details.appendln(it) } + } + + if (detailsFlag and EXT_PATH != 0) { + path.let { if (it.isNotEmpty()) details.appendln(it) } + } + + if (detailsFlag and EXT_SIZE != 0) { + file.length().formatSize().let { if (it.isNotEmpty()) details.appendln(it) } + } + + if (detailsFlag and EXT_RESOLUTION != 0) { + file.getResolution().formatAsResolution().let { if (it.isNotEmpty()) details.appendln(it) } + } + + if (detailsFlag and EXT_LAST_MODIFIED != 0) { + file.lastModified().formatLastModified().let { if (it.isNotEmpty()) details.appendln(it) } + } + + if (detailsFlag and EXT_DATE_TAKEN != 0) { + path.getExifDateTaken(exif).let { if (it.isNotEmpty()) details.appendln(it) } + } + + if (detailsFlag and EXT_CAMERA_MODEL != 0) { + path.getExifCameraModel(exif).let { if (it.isNotEmpty()) details.appendln(it) } + } + + if (detailsFlag and EXT_EXIF_PROPERTIES != 0) { + path.getExifProperties(exif).let { if (it.isNotEmpty()) details.appendln(it) } + } + return details.toString().trim() + } } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt index 949419c3b..c42db1b4e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt @@ -110,8 +110,8 @@ class MediaFetcher(val context: Context) { if (shouldStop) break - val path = cur.getStringValue(MediaStore.Images.Media.DATA) - var filename = cur.getStringValue(MediaStore.Images.Media.DISPLAY_NAME) ?: "" + val path = cur.getStringValue(MediaStore.Images.Media.DATA).trim() + var filename = cur.getStringValue(MediaStore.Images.Media.DISPLAY_NAME)?.trim() ?: "" if (filename.isEmpty()) filename = path.getFilenameFromPath() From bb9b194d2cef9028890cc7e5b9956d7d1ed146f4 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 19 Oct 2017 14:17:38 +0200 Subject: [PATCH 185/207] recheck extended details if some fields changed --- .../com/simplemobiletools/gallery/fragments/PhotoFragment.kt | 4 +++- .../com/simplemobiletools/gallery/fragments/VideoFragment.kt | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt index d50d3e62f..1ca989a5b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt @@ -44,6 +44,7 @@ class PhotoFragment : ViewPagerFragment() { private var isFragmentVisible = false private var wasInit = false private var storedShowExtendedDetails = false + private var storedExtendedDetails = 0 lateinit var view: ViewGroup lateinit var medium: Medium @@ -111,11 +112,12 @@ class PhotoFragment : ViewPagerFragment() { override fun onPause() { super.onPause() storedShowExtendedDetails = context.config.showExtendedDetails + storedExtendedDetails = context.config.extendedDetails } override fun onResume() { super.onResume() - if (wasInit && context.config.showExtendedDetails != storedShowExtendedDetails) { + if (wasInit && (context.config.showExtendedDetails != storedShowExtendedDetails || context.config.extendedDetails != storedExtendedDetails)) { checkExtendedDetails() } } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt index 4cfba5eab..4efa3b8d1 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt @@ -43,6 +43,7 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee private var mIsFragmentVisible = false private var mPlayOnPrepare = false private var mStoredShowExtendedDetails = false + private var mStoredExtendedDetails = 0 private var mCurrTime = 0 private var mDuration = 0 @@ -88,7 +89,7 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee mView.video_volume_controller.beVisibleIf(context.config.allowVideoGestures) mView.video_brightness_controller.beVisibleIf(context.config.allowVideoGestures) - if (context.config.showExtendedDetails != mStoredShowExtendedDetails) { + if (context.config.showExtendedDetails != mStoredShowExtendedDetails || context.config.extendedDetails != mStoredExtendedDetails) { checkExtendedDetails() } } @@ -98,6 +99,7 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee pauseVideo() mIsFragmentVisible = false mStoredShowExtendedDetails = context.config.showExtendedDetails + mStoredExtendedDetails = context.config.extendedDetails } override fun onDestroy() { From 7fe9a27b844636382f4630a59ca952582605a370 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 19 Oct 2017 15:49:27 +0200 Subject: [PATCH 186/207] fix #141, properly handle extended details view at toggling fullscreen --- .../gallery/fragments/PhotoFragment.kt | 26 +++++++++++++------ .../gallery/fragments/VideoFragment.kt | 25 +++++++++++++----- app/src/main/res/layout/pager_photo_item.xml | 1 - app/src/main/res/layout/pager_video_item.xml | 1 - 4 files changed, 37 insertions(+), 16 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt index 1ca989a5b..a96db9a4a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt @@ -12,7 +12,6 @@ import android.os.Bundle import android.view.LayoutInflater import android.view.View import android.view.ViewGroup -import android.widget.RelativeLayout import com.bumptech.glide.Glide import com.bumptech.glide.Priority import com.bumptech.glide.load.DataSource @@ -25,9 +24,7 @@ import com.bumptech.glide.request.RequestOptions import com.bumptech.glide.request.target.Target import com.davemorrissey.labs.subscaleview.ImageSource import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView -import com.simplemobiletools.commons.extensions.beGone -import com.simplemobiletools.commons.extensions.beVisible -import com.simplemobiletools.commons.extensions.toast +import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.activities.ViewPagerActivity import com.simplemobiletools.gallery.extensions.* @@ -276,10 +273,15 @@ class PhotoFragment : ViewPagerFragment() { private fun checkExtendedDetails() { if (context.config.showExtendedDetails) { view.photo_details.apply { - beVisible() - setTextColor(context.config.textColor) text = getMediumExtendedDetails(medium) - (layoutParams as RelativeLayout.LayoutParams).bottomMargin = (resources.getDimension(R.dimen.small_margin) + context.navigationBarHeight).toInt() + setTextColor(context.config.textColor) + beVisible() + onGlobalLayout { + if (height != 0) { + val smallMargin = resources.getDimension(R.dimen.small_margin) + y = context.usableScreenSize.y - height - if (context.navigationBarHeight == 0) smallMargin else 0f + } + } } } else { view.photo_details.beGone() @@ -288,6 +290,7 @@ class PhotoFragment : ViewPagerFragment() { override fun onDestroyView() { super.onDestroyView() + context.isKitkatPlus() if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 && !activity.isDestroyed) { Glide.with(context).clear(view.photo_view) } @@ -304,6 +307,13 @@ class PhotoFragment : ViewPagerFragment() { } override fun fullscreenToggled(isFullscreen: Boolean) { - + view.photo_details.apply { + if (visibility == View.VISIBLE) { + val smallMargin = resources.getDimension(R.dimen.small_margin) + val fullscreenOffset = context.navigationBarHeight.toFloat() - smallMargin + val newY = context.usableScreenSize.y - height + if (isFullscreen) fullscreenOffset else -(if (context.navigationBarHeight == 0) smallMargin else 0f) + animate().y(newY) + } + } } } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt index 4efa3b8d1..9d2e395f1 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt @@ -17,10 +17,7 @@ import android.widget.TextView import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.activities.ViewPagerActivity -import com.simplemobiletools.gallery.extensions.audioManager -import com.simplemobiletools.gallery.extensions.config -import com.simplemobiletools.gallery.extensions.hasNavBar -import com.simplemobiletools.gallery.extensions.navigationBarHeight +import com.simplemobiletools.gallery.extensions.* import com.simplemobiletools.gallery.helpers.MEDIUM import com.simplemobiletools.gallery.models.Medium import kotlinx.android.synthetic.main.pager_video_item.view.* @@ -507,9 +504,16 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee private fun checkExtendedDetails() { if (context.config.showExtendedDetails) { mView.video_details.apply { - beVisible() - setTextColor(context.config.textColor) text = getMediumExtendedDetails(medium) + setTextColor(context.config.textColor) + beVisible() + onGlobalLayout { + if (height != 0) { + val smallMargin = resources.getDimension(R.dimen.small_margin) + val timeHolderHeight = mTimeHolder.height - context.navigationBarHeight + y = context.usableScreenSize.y - height - timeHolderHeight - if (context.navigationBarHeight == 0) smallMargin else 0f + } + } } } else { mView.video_details.beGone() @@ -544,5 +548,14 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee override fun fullscreenToggled(isFullscreen: Boolean) { mIsFullscreen = isFullscreen checkFullscreen() + mView.video_details.apply { + if (visibility == View.VISIBLE) { + val smallMargin = resources.getDimension(R.dimen.small_margin) + val timeHolderHeight = mTimeHolder.height - context.navigationBarHeight.toFloat() + val fullscreenOffset = context.navigationBarHeight.toFloat() - smallMargin + val newY = context.usableScreenSize.y - height + if (mIsFullscreen) fullscreenOffset else -(timeHolderHeight + if (context.navigationBarHeight == 0) smallMargin else 0f) + animate().y(newY) + } + } } } diff --git a/app/src/main/res/layout/pager_photo_item.xml b/app/src/main/res/layout/pager_photo_item.xml index 6a8b21a47..e48b6b90a 100644 --- a/app/src/main/res/layout/pager_photo_item.xml +++ b/app/src/main/res/layout/pager_photo_item.xml @@ -21,7 +21,6 @@ android:id="@+id/photo_details" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_alignParentBottom="true" android:layout_alignParentLeft="true" android:layout_marginLeft="@dimen/small_margin" android:layout_marginRight="@dimen/small_margin" diff --git a/app/src/main/res/layout/pager_video_item.xml b/app/src/main/res/layout/pager_video_item.xml index 5a104f2ef..d0be9b3d2 100644 --- a/app/src/main/res/layout/pager_video_item.xml +++ b/app/src/main/res/layout/pager_video_item.xml @@ -55,7 +55,6 @@ android:id="@+id/video_details" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_above="@+id/video_time_holder" android:layout_alignParentLeft="true" android:layout_marginLeft="@dimen/small_margin" android:layout_marginRight="@dimen/small_margin" From 199dbb8cd3c9defa8b5bf774b229971667d276b0 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 19 Oct 2017 16:06:54 +0200 Subject: [PATCH 187/207] adding some glide related proguard rules --- app/proguard-rules.pro | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index 0816ea160..b2691ade2 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -3,3 +3,8 @@ -renamesourcefileattribute SourceFile -keepattributes SourceFile,LineNumberTable + +-dontwarn com.bumptech.glide.load.engine.bitmap_recycle.LruBitmapPool +-dontwarn com.bumptech.glide.load.resource.bitmap.Downsampler +-dontwarn com.bumptech.glide.load.resource.bitmap.HardwareConfigState +-dontwarn com.bumptech.glide.manager.RequestManagerRetriever From ebe0ed68fdb578b008dbc410c4210c6020fbcbdb Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 19 Oct 2017 16:55:31 +0200 Subject: [PATCH 188/207] update commons to 2.30.0 --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index a35f18b9f..a34c69d65 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,7 +37,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.29.20' + compile 'com.simplemobiletools:commons:2.30.0' compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.6.0' compile 'com.theartofdev.edmodo:android-image-cropper:2.4.0' compile 'com.bignerdranch.android:recyclerview-multiselect:0.2' From 906168c6b52479241add6f9491764068e98f3042 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 19 Oct 2017 17:05:59 +0200 Subject: [PATCH 189/207] filter out videos from directory cover images immediately --- .../com/simplemobiletools/gallery/dialogs/PickMediumDialog.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickMediumDialog.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickMediumDialog.kt index f89fae804..9d58425ce 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickMediumDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickMediumDialog.kt @@ -30,7 +30,8 @@ class PickMediumDialog(val activity: SimpleActivity, val path: String, val callb activity.setupDialogStuff(view, this, R.string.select_photo) val token = object : TypeToken>() {}.type - val media = Gson().fromJson>(activity.config.loadFolderMedia(path), token) ?: ArrayList(1) + var media = Gson().fromJson>(activity.config.loadFolderMedia(path), token) ?: ArrayList(1) + media = media.filter { !it.video } as ArrayList if (media.isNotEmpty()) { gotMedia(media) From 021a1cbf74270afba1f8f9b3ee7e21385e94e10b Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 19 Oct 2017 17:24:14 +0200 Subject: [PATCH 190/207] rewrite the mediapicker dialog, make it work like picking directories --- .../gallery/activities/MediaActivity.kt | 4 +- .../gallery/dialogs/PickDirectoryDialog.kt | 5 +- .../gallery/dialogs/PickMediumDialog.kt | 42 ++++++++++---- .../gallery/extensions/activity.kt | 5 ++ .../main/res/layout/dialog_medium_picker.xml | 56 +++++++++++++++++-- 5 files changed, 88 insertions(+), 24 deletions(-) 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 760d1e90a..63dfd8c62 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -18,7 +18,6 @@ import com.bumptech.glide.request.RequestOptions import com.bumptech.glide.request.target.SimpleTarget import com.bumptech.glide.request.transition.Transition import com.google.gson.Gson -import com.google.gson.reflect.TypeToken import com.simplemobiletools.commons.dialogs.ConfirmationDialog import com.simplemobiletools.commons.dialogs.RadioGroupDialog import com.simplemobiletools.commons.extensions.* @@ -343,8 +342,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { return mIsGettingMedia = true - val token = object : TypeToken>() {}.type - val media = Gson().fromJson>(config.loadFolderMedia(mPath), token) ?: ArrayList(1) + val media = getCachedMedia(mPath) if (media.isNotEmpty() && !mLoadedInitialPhotos) { gotMedia(media, true) } else { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickDirectoryDialog.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickDirectoryDialog.kt index 1d53684cb..e60443001 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickDirectoryDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickDirectoryDialog.kt @@ -3,7 +3,6 @@ package com.simplemobiletools.gallery.dialogs import android.support.v7.app.AlertDialog import android.support.v7.widget.GridLayoutManager import android.view.LayoutInflater -import android.view.View import com.simplemobiletools.commons.dialogs.FilePickerDialog import com.simplemobiletools.commons.extensions.beGoneIf import com.simplemobiletools.commons.extensions.beVisibleIf @@ -22,8 +21,8 @@ import kotlinx.android.synthetic.main.dialog_directory_picker.view.* class PickDirectoryDialog(val activity: SimpleActivity, val sourcePath: String, val callback: (path: String) -> Unit) { var dialog: AlertDialog - var shownDirectories: ArrayList = ArrayList() - var view: View = LayoutInflater.from(activity).inflate(R.layout.dialog_directory_picker, null) + var shownDirectories = ArrayList() + var view = LayoutInflater.from(activity).inflate(R.layout.dialog_directory_picker, null) var isGridViewType = activity.config.viewTypeFolders == VIEW_TYPE_GRID init { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickMediumDialog.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickMediumDialog.kt index 9d58425ce..5770685ad 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickMediumDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickMediumDialog.kt @@ -1,27 +1,32 @@ package com.simplemobiletools.gallery.dialogs import android.support.v7.app.AlertDialog -import android.support.v7.widget.RecyclerView +import android.support.v7.widget.GridLayoutManager import android.view.LayoutInflater -import com.google.gson.Gson -import com.google.gson.reflect.TypeToken +import com.simplemobiletools.commons.extensions.beGoneIf +import com.simplemobiletools.commons.extensions.beVisibleIf import com.simplemobiletools.commons.extensions.setupDialogStuff import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.activities.SimpleActivity import com.simplemobiletools.gallery.adapters.MediaAdapter import com.simplemobiletools.gallery.asynctasks.GetMediaAsynctask import com.simplemobiletools.gallery.extensions.config +import com.simplemobiletools.gallery.extensions.getCachedMedia +import com.simplemobiletools.gallery.helpers.VIEW_TYPE_GRID import com.simplemobiletools.gallery.models.Medium import kotlinx.android.synthetic.main.dialog_medium_picker.view.* class PickMediumDialog(val activity: SimpleActivity, val path: String, val callback: (path: String) -> Unit) { var dialog: AlertDialog - var mediaGrid: RecyclerView - var shownMedia: ArrayList = ArrayList() + var shownMedia = ArrayList() + val view = LayoutInflater.from(activity).inflate(R.layout.dialog_medium_picker, null) + var isGridViewType = activity.config.viewTypeFiles == VIEW_TYPE_GRID init { - val view = LayoutInflater.from(activity).inflate(R.layout.dialog_medium_picker, null) - mediaGrid = view.media_grid + (view.media_grid.layoutManager as GridLayoutManager).apply { + orientation = if (activity.config.scrollHorizontally && isGridViewType) GridLayoutManager.HORIZONTAL else GridLayoutManager.VERTICAL + spanCount = if (isGridViewType) activity.config.mediaColumnCnt else 1 + } dialog = AlertDialog.Builder(activity) .setPositiveButton(R.string.ok, null) @@ -29,10 +34,7 @@ class PickMediumDialog(val activity: SimpleActivity, val path: String, val callb .create().apply { activity.setupDialogStuff(view, this, R.string.select_photo) - val token = object : TypeToken>() {}.type - var media = Gson().fromJson>(activity.config.loadFolderMedia(path), token) ?: ArrayList(1) - media = media.filter { !it.video } as ArrayList - + val media = activity.getCachedMedia(path).filter { !it.video } as ArrayList if (media.isNotEmpty()) { gotMedia(media) } @@ -52,6 +54,22 @@ class PickMediumDialog(val activity: SimpleActivity, val path: String, val callb callback(it.path) dialog.dismiss() } - mediaGrid.adapter = adapter + + val scrollHorizontally = activity.config.scrollHorizontally && isGridViewType + view.apply { + media_grid.adapter = adapter + + media_vertical_fastscroller.isHorizontal = false + media_vertical_fastscroller.beGoneIf(scrollHorizontally) + + media_horizontal_fastscroller.isHorizontal = true + media_horizontal_fastscroller.beVisibleIf(scrollHorizontally) + + if (scrollHorizontally) { + media_horizontal_fastscroller.setViews(media_grid) + } else { + media_vertical_fastscroller.setViews(media_grid) + } + } } } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt index 756f9578b..5b182f5ea 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt @@ -337,3 +337,8 @@ fun Activity.getCachedDirectories(): ArrayList { val token = object : TypeToken>() {}.type return Gson().fromJson>(config.directories, token) ?: ArrayList(1) } + +fun Activity.getCachedMedia(path: String): ArrayList { + val token = object : TypeToken>() {}.type + return Gson().fromJson>(config.loadFolderMedia(path), token) ?: ArrayList(1) +} diff --git a/app/src/main/res/layout/dialog_medium_picker.xml b/app/src/main/res/layout/dialog_medium_picker.xml index 60207b4c9..f3c41d8f0 100644 --- a/app/src/main/res/layout/dialog_medium_picker.xml +++ b/app/src/main/res/layout/dialog_medium_picker.xml @@ -1,10 +1,54 @@ - - + android:paddingTop="@dimen/activity_margin"> + + + + + + + + + + + + + + + From 7132e090479fd96475c527db2d30a08c41f985a9 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 19 Oct 2017 18:08:37 +0200 Subject: [PATCH 191/207] allow selecting Cover photo from any folder --- .../gallery/adapters/DirectoryAdapter.kt | 25 +++++++++++++------ .../gallery/dialogs/PickDirectoryDialog.kt | 18 ++++++------- .../gallery/dialogs/PickMediumDialog.kt | 22 ++++++++++------ 3 files changed, 42 insertions(+), 23 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt index 9454f0ca4..490e9a14f 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt @@ -215,10 +215,11 @@ class DirectoryAdapter(val activity: SimpleActivity, var dirs: MutableList) { activity.config.albumCovers = Gson().toJson(albumCovers) actMode?.finish() diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickDirectoryDialog.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickDirectoryDialog.kt index e60443001..e72a3395c 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickDirectoryDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickDirectoryDialog.kt @@ -37,16 +37,16 @@ class PickDirectoryDialog(val activity: SimpleActivity, val sourcePath: String, .setNeutralButton(R.string.other_folder, { dialogInterface, i -> showOtherFolder() }) .create().apply { activity.setupDialogStuff(view, this, R.string.select_destination) - - val dirs = activity.getCachedDirectories() - if (dirs.isNotEmpty()) { - gotDirectories(activity.addTempFolderIfNeeded(dirs)) - } - - GetDirectoriesAsynctask(activity, false, false) { - gotDirectories(activity.addTempFolderIfNeeded(it)) - }.execute() } + + val dirs = activity.getCachedDirectories() + if (dirs.isNotEmpty()) { + gotDirectories(activity.addTempFolderIfNeeded(dirs)) + } + + GetDirectoriesAsynctask(activity, false, false) { + gotDirectories(activity.addTempFolderIfNeeded(it)) + }.execute() } private fun showOtherFolder() { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickMediumDialog.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickMediumDialog.kt index 5770685ad..3596a6907 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickMediumDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickMediumDialog.kt @@ -31,17 +31,25 @@ class PickMediumDialog(val activity: SimpleActivity, val path: String, val callb dialog = AlertDialog.Builder(activity) .setPositiveButton(R.string.ok, null) .setNegativeButton(R.string.cancel, null) + .setNeutralButton(R.string.other_folder, { dialogInterface, i -> showOtherFolder() }) .create().apply { activity.setupDialogStuff(view, this, R.string.select_photo) + } - val media = activity.getCachedMedia(path).filter { !it.video } as ArrayList - if (media.isNotEmpty()) { - gotMedia(media) - } + val media = activity.getCachedMedia(path).filter { !it.video } as ArrayList + if (media.isNotEmpty()) { + gotMedia(media) + } - GetMediaAsynctask(activity, path, false, true, false) { - gotMedia(it) - }.execute() + GetMediaAsynctask(activity, path, false, true, false) { + gotMedia(it) + }.execute() + } + + private fun showOtherFolder() { + PickDirectoryDialog(activity, path) { + callback(it) + dialog.dismiss() } } From 2dbbc2bbdb384a93643ae12afabfed1f3fd8ef78 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 19 Oct 2017 19:13:12 +0200 Subject: [PATCH 192/207] add an extra check at creating .nomedia file on the SD card --- .../gallery/adapters/DirectoryAdapter.kt | 10 ++++++---- .../simplemobiletools/gallery/extensions/activity.kt | 8 ++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt index 490e9a14f..175f729ce 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt @@ -123,10 +123,11 @@ class DirectoryAdapter(val activity: SimpleActivity, var dirs: MutableList 0 @@ -138,10 +139,11 @@ class DirectoryAdapter(val activity: SimpleActivity, var dirs: MutableList 0 diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt index 5b182f5ea..59d4f2b52 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt @@ -224,11 +224,11 @@ fun SimpleActivity.addNoMedia(path: String, callback: () -> Unit) { if (needsStupidWritePermissions(path)) { handleSAFDialog(file) { - try { - getFileDocument(path)?.createFile("", NOMEDIA) - } catch (e: Exception) { + val fileDocument = getFileDocument(path) + if (fileDocument?.exists() == true && fileDocument.isDirectory) { + fileDocument.createFile("", NOMEDIA) + } else toast(R.string.unknown_error_occurred) - } } } else { try { From 1d56b2ac8bddf659388d2182318666b83f32ec69 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 19 Oct 2017 19:18:36 +0200 Subject: [PATCH 193/207] show a more specific error message when creating .nomedia file fails --- .../com/simplemobiletools/gallery/extensions/activity.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt index 59d4f2b52..0a2140a6d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt @@ -227,16 +227,18 @@ fun SimpleActivity.addNoMedia(path: String, callback: () -> Unit) { val fileDocument = getFileDocument(path) if (fileDocument?.exists() == true && fileDocument.isDirectory) { fileDocument.createFile("", NOMEDIA) - } else + } else { toast(R.string.unknown_error_occurred) + } } } else { try { file.createNewFile() } catch (e: Exception) { - toast(R.string.unknown_error_occurred) + showErrorToast(e) } } + scanFile(file) { callback() } From 544145761158ec84dcbf7f052c761c77650aaf59 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 19 Oct 2017 20:25:56 +0200 Subject: [PATCH 194/207] do not finish the actionmode right after a delete attempt, because of saf --- .../gallery/adapters/DirectoryAdapter.kt | 5 +++-- .../gallery/adapters/MediaAdapter.kt | 12 +++++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt index 175f729ce..54565ee11 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt @@ -46,8 +46,9 @@ class DirectoryAdapter(val activity: SimpleActivity, var dirs: MutableList newItems.put(curIndex, itemViews[i]) } itemViews = newItems + actMode?.finish() } } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt index 7296f51d7..f01a50a52 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt @@ -43,8 +43,9 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList, if (select) { itemViews[pos]?.medium_check?.background?.setColorFilter(primaryColor, PorterDuff.Mode.SRC_IN) selectedPositions.add(pos) - } else + } else { selectedPositions.remove(pos) + } itemViews[pos]?.medium_check?.beVisibleIf(select) @@ -118,10 +119,11 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList, var hiddenCnt = 0 var unhiddenCnt = 0 selectedPositions.mapNotNull { media.getOrNull(it) }.forEach { - if (it.name.startsWith('.')) + if (it.name.startsWith('.')) { hiddenCnt++ - else + } else { unhiddenCnt++ + } } menu.findItem(R.id.cab_hide).isVisible = unhiddenCnt > 0 @@ -205,15 +207,15 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList, private fun askConfirmDelete() { ConfirmationDialog(activity) { deleteFiles() - actMode?.finish() } } private fun getCurrentFile() = File(media[selectedPositions.first()].path) private fun deleteFiles() { - if (selectedPositions.isEmpty()) + if (selectedPositions.isEmpty()) { return + } val files = ArrayList(selectedPositions.size) val removeMedia = ArrayList(selectedPositions.size) From 0c408f6cf07537eccc68ef145525acb1b3872bcd Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 19 Oct 2017 21:03:19 +0200 Subject: [PATCH 195/207] add a checkbox for skiping confirmation dialog at delete in a session --- .../gallery/activities/ViewPagerActivity.kt | 29 ++++++++++++++----- .../gallery/adapters/MediaAdapter.kt | 25 ++++++++++++---- .../dialogs/DeleteWithRememberDialog.kt | 28 ++++++++++++++++++ .../layout/dialog_delete_with_remember.xml | 26 +++++++++++++++++ app/src/main/res/values-ca/strings.xml | 1 + app/src/main/res/values-cs/strings.xml | 1 + app/src/main/res/values-de/strings.xml | 1 + app/src/main/res/values-es/strings.xml | 1 + app/src/main/res/values-fi/strings.xml | 1 + app/src/main/res/values-fr/strings.xml | 1 + app/src/main/res/values-hu/strings.xml | 1 + app/src/main/res/values-it/strings.xml | 1 + app/src/main/res/values-ja/strings.xml | 1 + app/src/main/res/values-pl/strings.xml | 1 + app/src/main/res/values-pt-rBR/strings.xml | 1 + app/src/main/res/values-pt/strings.xml | 1 + app/src/main/res/values-ru/strings.xml | 5 ++-- app/src/main/res/values-sk/strings.xml | 1 + app/src/main/res/values-sv/strings.xml | 1 + app/src/main/res/values-tr/strings.xml | 1 + app/src/main/res/values-zh-rCN/strings.xml | 1 + app/src/main/res/values-zh-rTW/strings.xml | 1 + app/src/main/res/values/strings.xml | 1 + 23 files changed, 117 insertions(+), 14 deletions(-) create mode 100644 app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/DeleteWithRememberDialog.kt create mode 100644 app/src/main/res/layout/dialog_delete_with_remember.xml diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt index 7aacc2376..68a5908c3 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -23,7 +23,6 @@ import android.support.v4.view.ViewPager import android.util.DisplayMetrics import android.view.* import android.view.animation.DecelerateInterpolator -import com.simplemobiletools.commons.dialogs.ConfirmationDialog import com.simplemobiletools.commons.dialogs.PropertiesDialog import com.simplemobiletools.commons.dialogs.RenameItemDialog import com.simplemobiletools.commons.extensions.* @@ -31,6 +30,7 @@ import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.activities.MediaActivity.Companion.mMedia import com.simplemobiletools.gallery.adapters.MyPagerAdapter import com.simplemobiletools.gallery.asynctasks.GetMediaAsynctask +import com.simplemobiletools.gallery.dialogs.DeleteWithRememberDialog import com.simplemobiletools.gallery.dialogs.SaveAsDialog import com.simplemobiletools.gallery.dialogs.SlideshowDialog import com.simplemobiletools.gallery.extensions.* @@ -53,6 +53,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View private var mPos = -1 private var mShowAll = false private var mIsSlideshowActive = false + private var mSkipConfirmationDialog = false private var mRotationDegrees = 0f private var mLastHandledOrientation = 0 private var mPrevHashcode = 0 @@ -250,7 +251,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View R.id.menu_unhide -> toggleFileVisibility(false) R.id.menu_share_1 -> shareMedium(getCurrentMedium()!!) R.id.menu_share_2 -> shareMedium(getCurrentMedium()!!) - R.id.menu_delete -> askConfirmDelete() + R.id.menu_delete -> checkDeleteConfirmation() R.id.menu_rename -> renameFile() R.id.menu_edit -> openFileEditor(getCurrentFile()) R.id.menu_properties -> showProperties() @@ -590,11 +591,24 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View super.onActivityResult(requestCode, resultCode, resultData) } + private fun checkDeleteConfirmation() { + if (mSkipConfirmationDialog) { + deleteConfirmed() + } else { + askConfirmDelete() + } + } + private fun askConfirmDelete() { - ConfirmationDialog(this) { - deleteFileBg(File(getCurrentMedia()[mPos].path)) { - reloadViewPager() - } + DeleteWithRememberDialog(this) { + mSkipConfirmationDialog = it + deleteConfirmed() + } + } + + private fun deleteConfirmed() { + deleteFileBg(File(getCurrentMedia()[mPos].path)) { + reloadViewPager() } } @@ -603,8 +617,9 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View deleteDirectoryIfEmpty() finish() true - } else + } else { false + } } private fun renameFile() { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt index f01a50a52..875609abd 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt @@ -10,13 +10,13 @@ import com.bignerdranch.android.multiselector.ModalMultiSelectorCallback import com.bignerdranch.android.multiselector.MultiSelector import com.bignerdranch.android.multiselector.SwappingHolder import com.bumptech.glide.Glide -import com.simplemobiletools.commons.dialogs.ConfirmationDialog import com.simplemobiletools.commons.dialogs.PropertiesDialog import com.simplemobiletools.commons.dialogs.RenameItemDialog import com.simplemobiletools.commons.extensions.beGone import com.simplemobiletools.commons.extensions.beVisibleIf import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.activities.SimpleActivity +import com.simplemobiletools.gallery.dialogs.DeleteWithRememberDialog import com.simplemobiletools.gallery.extensions.* import com.simplemobiletools.gallery.helpers.VIEW_TYPE_LIST import com.simplemobiletools.gallery.models.Medium @@ -30,6 +30,7 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList, val multiSelector = MultiSelector() val config = activity.config val isListViewType = config.viewTypeFiles == VIEW_TYPE_LIST + var skipConfirmationDialog = false var actMode: ActionMode? = null var itemViews = SparseArray() @@ -83,7 +84,7 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList, R.id.cab_copy_to -> copyMoveTo(true) R.id.cab_move_to -> copyMoveTo(false) R.id.cab_select_all -> selectAll() - R.id.cab_delete -> askConfirmDelete() + R.id.cab_delete -> checkDeleteConfirmation() else -> return false } return true @@ -204,12 +205,25 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList, updateTitle(cnt) } - private fun askConfirmDelete() { - ConfirmationDialog(activity) { - deleteFiles() + private fun checkDeleteConfirmation() { + if (skipConfirmationDialog) { + deleteConfirmed() + } else { + askConfirmDelete() } } + private fun askConfirmDelete() { + DeleteWithRememberDialog(activity) { + skipConfirmationDialog = it + deleteConfirmed() + } + } + + private fun deleteConfirmed() { + deleteFiles() + } + private fun getCurrentFile() = File(media[selectedPositions.first()].path) private fun deleteFiles() { @@ -244,6 +258,7 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList, .forEachIndexed { curIndex, i -> newItems.put(curIndex, itemViews[i]) } itemViews = newItems + actMode?.finish() } } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/DeleteWithRememberDialog.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/DeleteWithRememberDialog.kt new file mode 100644 index 000000000..2a5a91d24 --- /dev/null +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/DeleteWithRememberDialog.kt @@ -0,0 +1,28 @@ +package com.simplemobiletools.gallery.dialogs + +import android.content.Context +import android.support.v7.app.AlertDialog +import android.view.LayoutInflater +import com.simplemobiletools.commons.extensions.setupDialogStuff +import com.simplemobiletools.gallery.R +import kotlinx.android.synthetic.main.dialog_delete_with_remember.view.* + +class DeleteWithRememberDialog(val context: Context, val callback: (Boolean) -> Unit) { + var dialog: AlertDialog + val view = LayoutInflater.from(context).inflate(R.layout.dialog_delete_with_remember, null) + + init { + val builder = AlertDialog.Builder(context) + .setPositiveButton(R.string.yes, { dialog, which -> dialogConfirmed() }) + .setNegativeButton(R.string.no, null) + + dialog = builder.create().apply { + context.setupDialogStuff(view, this) + } + } + + private fun dialogConfirmed() { + dialog.dismiss() + callback(view.delete_remember_checkbox.isChecked) + } +} diff --git a/app/src/main/res/layout/dialog_delete_with_remember.xml b/app/src/main/res/layout/dialog_delete_with_remember.xml new file mode 100644 index 000000000..df4ea5519 --- /dev/null +++ b/app/src/main/res/layout/dialog_delete_with_remember.xml @@ -0,0 +1,26 @@ + + + + + + + + diff --git a/app/src/main/res/values-ca/strings.xml b/app/src/main/res/values-ca/strings.xml index f4ee43fa2..fac61048c 100644 --- a/app/src/main/res/values-ca/strings.xml +++ b/app/src/main/res/values-ca/strings.xml @@ -25,6 +25,7 @@ Set as Volume Brightness + Do not ask again in this session Filter media diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index b49c84832..c6ba60327 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -25,6 +25,7 @@ Nastavit jako Volume Brightness + Do not ask again in this session Filter media diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 137d5a5f0..a3cd8cbdb 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -25,6 +25,7 @@ Festlegen als Lautstärke Helligkeit + Do not ask again in this session Medienfilter diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 25cb4c167..8a364e187 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -25,6 +25,7 @@ Establecer como Volume Brightness + Do not ask again in this session Filter media diff --git a/app/src/main/res/values-fi/strings.xml b/app/src/main/res/values-fi/strings.xml index fad746e5d..a4edf365a 100644 --- a/app/src/main/res/values-fi/strings.xml +++ b/app/src/main/res/values-fi/strings.xml @@ -25,6 +25,7 @@ Aseta Äänenvoimakkuus Kirkkaus + Do not ask again in this session Suodata media diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 50844b18b..3ae6e9716 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -25,6 +25,7 @@ Définir comme Volume Luminosité + Do not ask again in this session Filtrer les médias diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index f6b77cf01..b04301122 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -25,6 +25,7 @@ Set as Volume Brightness + Do not ask again in this session Filter media diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index a70c5ae7f..2b187ae34 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -25,6 +25,7 @@ Imposta come Volume Luminosità + Do not ask again in this session Filtra i media diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index c85011c6e..93b6e616e 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -25,6 +25,7 @@ 他で使う 音量 明るさ + Do not ask again in this session 表示メディア種 diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index fd9567d52..a148c3a0e 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -25,6 +25,7 @@ Ustaw jako Głośność Jasność + Do not ask again in this session Filtruj multimedia diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index e70507a49..30662f1d9 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -25,6 +25,7 @@ Set as Volume Brightness + Do not ask again in this session Filter media diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index 56b0b7819..51ba03b5c 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -25,6 +25,7 @@ Definir como Volume Brilho + Do not ask again in this session Filtrar multimédia diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 35520e679..34ffc082c 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -22,9 +22,10 @@ Изменить обложку Выбрать изображение Использовать по умолчанию - Установить как... + Установить как… Громкость Яркость + Do not ask again in this session Фильтр медиа @@ -84,7 +85,7 @@ Установить не удалось Установить в качестве обоев в: Приложение не найдено - Установка обоев… + Установка обоев… Обои успешно установлены Формат изображения Пейзажное соотношение сторон diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index 7844e7df6..50eeece79 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -25,6 +25,7 @@ Nastaviť ako Hlasitosť Jas + Nepýtať sa už v tomto spustení Filter médií diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index 2c05e7437..2ba4fc87d 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -25,6 +25,7 @@ Ange som Volym Ljusstyrka + Do not ask again in this session Filtrera media diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index 350a1cc73..6263ca620 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -25,6 +25,7 @@ Set as Volume Brightness + Do not ask again in this session Filter media diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 299b82fe9..b43f3c294 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -25,6 +25,7 @@ 设置为 音量 亮度 + Do not ask again in this session Filter media diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 1f454c722..1ec71fd20 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -25,6 +25,7 @@ 設為 音量 亮度 + Do not ask again in this session 篩選媒體檔案 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index f4ee43fa2..fac61048c 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -25,6 +25,7 @@ Set as Volume Brightness + Do not ask again in this session Filter media From fd6f709aac196b21b6bce9cb04a4ef0e163322e6 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 19 Oct 2017 21:07:24 +0200 Subject: [PATCH 196/207] add a variable name for delete confirmation callback return value --- .../gallery/dialogs/DeleteWithRememberDialog.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/DeleteWithRememberDialog.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/DeleteWithRememberDialog.kt index 2a5a91d24..05a240577 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/DeleteWithRememberDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/DeleteWithRememberDialog.kt @@ -7,7 +7,7 @@ import com.simplemobiletools.commons.extensions.setupDialogStuff import com.simplemobiletools.gallery.R import kotlinx.android.synthetic.main.dialog_delete_with_remember.view.* -class DeleteWithRememberDialog(val context: Context, val callback: (Boolean) -> Unit) { +class DeleteWithRememberDialog(val context: Context, val callback: (remember: Boolean) -> Unit) { var dialog: AlertDialog val view = LayoutInflater.from(context).inflate(R.layout.dialog_delete_with_remember, null) From 0400612f8649676b5ccc491d9b3a4784c720f266 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 19 Oct 2017 21:24:32 +0200 Subject: [PATCH 197/207] replace some GlobalLayoutListeners with the helper view extension --- .../gallery/activities/ViewPagerActivity.kt | 20 ++++++------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt index 68a5908c3..bdf472480 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -123,17 +123,13 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View mDirectory = File(mPath).parent title = mPath.getFilenameFromPath() - view_pager.viewTreeObserver.addOnGlobalLayoutListener(object : ViewTreeObserver.OnGlobalLayoutListener { - override fun onGlobalLayout() { - view_pager.viewTreeObserver.removeOnGlobalLayoutListener(this) - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 && isDestroyed) - return - + view_pager.onGlobalLayout { + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1 || !isDestroyed) { if (mMedia.isNotEmpty()) { gotMedia(mMedia) } } - }) + } reloadViewPager() scanPath(mPath) {} @@ -284,12 +280,8 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View private fun startSlideshow() { if (getMediaForSlideshow()) { - view_pager.viewTreeObserver.addOnGlobalLayoutListener(object : ViewTreeObserver.OnGlobalLayoutListener { - override fun onGlobalLayout() { - view_pager.viewTreeObserver.removeOnGlobalLayoutListener(this) - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 && isDestroyed) - return - + view_pager.onGlobalLayout { + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1 || !isDestroyed) { hideSystemUI() mSlideshowInterval = config.slideshowInterval mSlideshowMoveBackwards = config.slideshowMoveBackwards @@ -297,7 +289,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) scheduleSwipe() } - }) + } } } From a8169c412867b81cc1653c72da890429d2cf77ea Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 19 Oct 2017 21:26:37 +0200 Subject: [PATCH 198/207] update commons to 2.30.1 --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index a34c69d65..7f86829d9 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,7 +37,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.30.0' + compile 'com.simplemobiletools:commons:2.30.1' compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.6.0' compile 'com.theartofdev.edmodo:android-image-cropper:2.4.0' compile 'com.bignerdranch.android:recyclerview-multiselect:0.2' From f2538baceb787e3851bea1824683ec9679f2b74c Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 19 Oct 2017 21:31:23 +0200 Subject: [PATCH 199/207] updating release notes --- .../com/simplemobiletools/gallery/activities/MainActivity.kt | 1 + app/src/main/res/values/donottranslate.xml | 1 + 2 files changed, 2 insertions(+) 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 7908a9258..deb5ebe3a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -636,6 +636,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { add(Release(125, R.string.release_125)) add(Release(127, R.string.release_127)) add(Release(133, R.string.release_133)) + add(Release(136, R.string.release_136)) checkWhatsNew(this, BuildConfig.VERSION_CODE) } } diff --git a/app/src/main/res/values/donottranslate.xml b/app/src/main/res/values/donottranslate.xml index 10ac92ba7..6aa0e6205 100644 --- a/app/src/main/res/values/donottranslate.xml +++ b/app/src/main/res/values/donottranslate.xml @@ -2,6 +2,7 @@ + Added an option to show customizable extended details over fullscreen media Added fingerprint to hidden item protection\n Added a new List view type From e23154d79c21cd3344d3f007f67568c7e438349b Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 19 Oct 2017 21:32:22 +0200 Subject: [PATCH 200/207] update version to 2.16.0 --- app/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 7f86829d9..825b06a02 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,8 +10,8 @@ android { applicationId "com.simplemobiletools.gallery" minSdkVersion 16 targetSdkVersion 23 - versionCode 135 - versionName "2.15.2" + versionCode 136 + versionName "2.16.0" } signingConfigs { From f859aabd6e5e4015f7816225ca36aa0e53735c52 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 19 Oct 2017 21:32:27 +0200 Subject: [PATCH 201/207] updating changelog --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 740237b87..07b808103 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,14 @@ Changelog ========== +Version 2.16.0 *(2017-10-19)* +---------------------------- + + * Added sorting by path + * Added an option to show customizable extended details over fullscreen media + * Allow selecting Album cover photos from any folders + * Added a checkbox for skipping Delete confirmation dialog + Version 2.15.2 *(2017-10-06)* ---------------------------- From 8759de02279dd57d9e3ed09d1d22a665ab3e0a2e Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 19 Oct 2017 21:48:16 +0200 Subject: [PATCH 202/207] update commons to 2.30.4 --- app/build.gradle | 2 +- app/proguard-rules.pro | 8 -------- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 825b06a02..df7b69e08 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,7 +37,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.30.1' + compile 'com.simplemobiletools:commons:2.30.4' compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.6.0' compile 'com.theartofdev.edmodo:android-image-cropper:2.4.0' compile 'com.bignerdranch.android:recyclerview-multiselect:0.2' diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index b2691ade2..a9c0f371b 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -1,10 +1,2 @@ -keep class com.simplemobiletools.** { *; } -dontwarn com.simplemobiletools.** - --renamesourcefileattribute SourceFile --keepattributes SourceFile,LineNumberTable - --dontwarn com.bumptech.glide.load.engine.bitmap_recycle.LruBitmapPool --dontwarn com.bumptech.glide.load.resource.bitmap.Downsampler --dontwarn com.bumptech.glide.load.resource.bitmap.HardwareConfigState --dontwarn com.bumptech.glide.manager.RequestManagerRetriever From 83d4e75f0e051f0de16952b938bfa0262e31c94a Mon Sep 17 00:00:00 2001 From: Pzqqt <821026875@qq.com> Date: Fri, 20 Oct 2017 23:14:45 +0800 Subject: [PATCH 203/207] Chinese translation for v2.16.0 --- app/src/main/res/values-zh-rCN/strings.xml | 452 +++++++++++++++------ 1 file changed, 322 insertions(+), 130 deletions(-) diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index b43f3c294..0e0abe1b6 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -1,149 +1,341 @@ - Simple Gallery - 简约图库 - 编辑 - 打开相机 - 打开方式 - 未找到可用应用 - (隐藏) - 锁定目录 - 解除锁定目录 - 文件视图 + 转到主屏幕 + %1$s:%2$s + %1$s - %2$s:%3$s + 转到上一层级 + 更多选项 + 完成 + 查看全部 + 选择应用 + 关闭 + 开启 + 搜索… + 清除查询 + 搜索查询 + 搜索 + 提交查询 + 语音搜索 + 分享方式 + 通过%s分享 + 收起 + 指纹传感器有脏污。请擦拭干净,然后重试。 + 无法处理指纹,请重试。 + 仅检测到部分指纹,请重试。 + 手指移动太快,请重试。 + 手指移动太慢,请重试。 + 指纹操作已取消。 + 指纹硬件无法使用。 + 尝试次数过多,请稍后重试。 + 无法存储指纹。请移除一个现有的指纹。 + 指纹录入操作超时,请重试。 + 请重试。 + 无法识别 + 指纹: + 搜索 + 999+ + 关于 + 添加指纹 + 添加目录 + 额外信息 + 专辑 所有目录 - 目录视图 - 其他目录 - 在地图中显示 - 未知位置 - 未找到地图应用 - 未找到相机应用 - 增加一栏 - 减少一栏 - 更改封面图片 - 选择图片 - 使用默认 - 设置为 - 音量 + 使用纵向滑动手势控制视频音量和亮度 + 啊哦,出错啦: %s + GIF 缩略图 + 图库 + 一个观看照片和视频的简单实用工具。项目可以根据日期、大小、名称来递增或递减排序,照片可以缩放。媒体文件根据屏幕的大小排列在多个方格中,您可以使用缩放手势来调整每一列的方格数量。媒体文件可以被重命名、分享、删除、复制以及移动。照片亦可被剪切、旋转或是直接在应用中设为壁纸。 相册亦提供能让第三方应用预览图片/视频、向电子邮件客户端添加附件等的功能。非常适合日常使用。 应用不包含广告与不必要的权限。它是完全开放源代码的,并内置自定义颜色主题。 这个应用只是一系列应用中的一小部份。您可以在 http://www.simplemobiletools.com 找到其余的应用。 + 简约图库 + 一个没有广告,用来观看照片及视频的相册。 + 应用版本:%1$s + "应用到 '_1'" + 应用到全部冲突项 + 艺术家 + 递增 + 验证已被阻止,请稍后再试 + 验证失败 + 自动播放 + 背景色 亮度 - Do not ask again in this session + 相机 + 取消 + 更改封面图片 + 更改过滤器 + 更改视图类型 + 更改颜色将切换到自定义主题 + 点击此处以设置目标路径 + 确认选择 + 请选择 SD 卡根目录并授予写权限 + 如果您未找到 SD 卡目录,请尝试 + 确认外部存储器访问权限 + 复制 + 无法复制文件 + 复制/移动 + 操作失败 + 复制到 + 正在复制… + 复制成功 + 无法复制相同文件 + v %1$s Copyright © Simple Mobile Tools %2$d + 创建文件 %s 失败 + 创建文件夹 %s 失败 + 新建 + 新建文件夹 + 裁剪缩略图 + Android Image Cropper(图像裁剪和旋转) + 自定义 + 自定义颜色 + 全屏时黑色背景 + 深色主题 + 拍摄日期 + 删除 + 删除没有内容的空文件夹 + 递减 + 目标路径 + 设备系统:%1$s + 子目录数 + 丢弃 + 不再询问 + 捐赠 + "您已使用此应用一段时间了。 - - Filter media - Images - Videos - GIFs - No media files have been found with the selected filters. - Change filters +可您知道么,我并不就职于一个大公司。开发应用耗时耗力,且我想依旧保持免费,您的捐赠会给我更多动力。 - - 通过添加文件 \'.nomedia\' 到目录,可以防止目录及其子目录下的所有媒体被扫描。您可以通过设置中的 \'显示隐藏目录\' 选项改变设置,是否继续? +您可以通过购买付费应用 Simple Thank You 或捐赠比特币来支持我。 + +更多信息请查阅 http://simplemobiletools.com/donate. + +非常感谢!" + 捐赠 + 时长 + 编辑 + 编辑方式: + 编辑方式 + 编辑器 + 发送反馈 + 请输入名称 + 输入密码 + 不能覆盖源文件 排除 - 排除目录 - 管理排除目录 目录及其子目录中的媒体将不会在 Simple Gallery 中显示,您可以在设置更改。 是否排除父目录? 此目录及其子目录中的媒体将不会在 Simple Gallery 中显示,但是其它应用可以访问。如果您想对其它应用隐藏,请使用隐藏功能。 - 移除全部 - 是否移除列表中的全部目录?目录不会被物理删除。 - - - 包含目录 - 管理包含目录 - 添加目录 - 如果您还有应用未扫描到的媒体文件,请添加所在目录路径。 - - - 缩放 - 缩放选定区域并保存 - 宽度 - 高度 - 保持纵横比 - 请输入有效分辨率 - - - 编辑器 - 保存 - 旋转 - 路径 - 无效图片路径 - 图片编辑失败 - 编辑方式: - 未找到可用图片编辑器 - 未知的文件路径 - 不能覆盖源文件 - 向左旋转 - 向右旋转 - 旋转 180º + 排除目录 + EXIF + 曝光时间 + 扩展名 + 扩展名不能为空 + 超大 + 光圈 + 文件 + 文件 %1$s 已存在 + 文件 %1$s 已存在。是否覆盖? + 文件保存成功 + 文件名 + 文件名不能为空 + 文件名包含非法字符 + 总文件数 + 要显示的媒体文件 + 指纹 + 保护设置成功。请重新安装本应用,以防复位时出现问题。 翻转 水平翻转 垂直翻转 - 编辑方式 - - - Simple Wallpaper + 焦距 + 文件夹 + 目录视图 + 关注我们: + 字体大小 + GIFs + 滑动(图像加载和缓存) + 去设置 + + 你在寻找一个简单而匿名的视频通话应用吗?请尝试我的另一个项目\n(简体中文翻译补全+魔改 By Pzqqt) + 高度 + (隐藏) + 隐藏 + 隐藏文件夹 + "通过添加文件 '.nomedia' 到目录,可以防止目录及其子目录下的所有媒体被扫描。您可以通过设置中的 '显示隐藏目录' 选项改变设置,是否继续?" + 全屏时自动隐藏状态栏 + 图片编辑失败 + 图片 + 包含目录 + 包含 GIFs + 包含照片 + 包含视频 + 如果您还有应用未扫描到的媒体文件,请添加所在目录路径。 + 增加一栏 + 绘制图案 + 内部存储器 + 间隔(秒): + 无法写入到选中目标路径 + 无效文件格式 + 无效图片路径 + 名称包含非法字符 + 请输入有效分辨率 + 分享给好友 + 分享到 + ISO 速度 + 已选择项目 + Joda-Time(Java日期替换) + 保持纵横比 + Kotlin(编程语言) + 横向长宽比 + + 修改日期 + 浅色主题 + 列表 + 循环幻灯片 + 循环播放视频 + 管理排除目录 + 要显示的详细信息项目 + 管理包含目录 + 浏览时最大亮度 + + 更多应用 + 移动 + 倒播 + 移动到 + 正在移动… + 文件移动成功 + 无法移动相同文件 + RecyclerView MultiSelect(选择多个列表项) + 名称 + 同名文件夹或文件已存在 + + 未找到可用应用 + 未找到相机应用 + 未找到可用应用 + 未找到可用图片编辑器 + 未选择文件 + 您还没有注册指纹,请先给你的设备添加一些指纹 + 未找到地图应用 + 未发现可用媒体 + 所选的过滤器没有找到的媒体文件。 + 请授予权限以访问您的存储器 + 此应用使用了以下三方库。谢谢。 + 确认 + 打开相机 + 打开方式 + 其他目录 + Otto (event bus) + 内存不足 + 覆盖 + 使用密码保护隐藏项 + 路径 + 图案 + PatternLockView(图案保护) + PhotoView(可缩放 gifs) + Picasso(图像加载和缓存) + 密码 + 锁定目录 + 请将手指放在指纹传感器上 + 请输入密码 + 请选择目标路径 + 纵向长宽比 + 主体色 + 是否执行此删除操作? + 属性 + 密码设置成功。为防止遗忘,请重新安装本应用。 + 随机顺序 + 为我们打分 + 减少一栏 + 移除全部 + 是否移除列表中的全部目录?目录不会被物理删除。 + 重命名 + 重命名文件 + 无法重命名文件 + 重命名文件夹 + 文件夹名不能为空 + 无法重命名文件夹 + 文件夹名已存在 + 文件夹重命名成功 + 无法重命名存储器的根目录 + 重命名中... + 重复图案 + 重复密码 + 替换全屏时菜单栏的“分享”为“旋转” + 缩放 + 缩放选定区域并保存 + 分辨率 + 恢复默认 + 根目录 + 旋转 + 向左旋转 + 旋转 180º + 向右旋转 + RtlViewPager(从右到左滑动) + 保存 + 保存 + 您尚未保存更改,是否保存? + 正在保存… + 根据长宽比 + 全屏方向 + 设备方向 + 系统设置 + 水平滚动缩略图 + SD 卡 + 搜索 + 全选 + 选择操作 + 选择目标路径 + 选择文件 + 选择文件夹 + 选择图片 + 选择存储器 + 设置为 设为壁纸 壁纸设置失败 设为壁纸... - 未找到可用应用 - 正在设置壁纸… - 壁纸设置成功 - 纵向长宽比 - 横向长宽比 - - - 幻灯片 - 间隔(秒): - Include photos - 包含视频 - Include GIFs - 随机顺序 - 使用渐变动画 - 倒播 - Loop slideshow - 幻灯片结束 - 未发现可用媒体 - - - Change view type - Grid - List - - + 正在设置壁纸… + 设置 + 分享 + 请前往 %2$s 看看我们的 %1$s 吧! + 分享到 + 文件视图 + 全屏浏览媒体时显示详细信息 + 显示隐藏文件和文件夹 显示所有 - 自动播放 + 在地图中显示 + 简约壁纸 + 大小 + 跳过 + 幻灯片 + 幻灯片结束 + + 排序方式 + 原始路径 + 原始路径和目标路径不能相同 + Stetho(调试数据库) + 不显示隐藏的媒体文件 + Subsampling Scale Image View(可缩放图像浏览) + 显示/隐藏缓存内容 + 文本颜色 + 主题 + 开放源代码 + 开放源代码 + 标题 显示文件名 - 循环播放视频 - GIF 缩略图 - 浏览时最大亮度 - 裁剪缩略图 - 全屏时方向 - 系统设置 - 设备方向 - 根据长宽比 - 全屏时黑色背景 - 水平滚动缩略图 - 全屏时自动隐藏状态栏 - Delete empty folders after deleting their content - Allow controlling video volume and brightness with vertical gestures - 替换全屏时菜单栏的“分享”为“旋转” - Show extended details over fullscreen media - Manage extended details - - - - 一个没有广告,用来观看照片及视频的相册。 - - 一个观看照片和视频的简单实用工具。项目可以根据日期、大小、名称来递增或递减排序,照片可以缩放。媒体文件根据屏幕的大小排列在多个方格中,您可以使用缩放手势来调整每一列的方格数量。媒体文件可以被重命名、分享、删除、复制以及移动。照片亦可被剪切、旋转或是直接在应用中设为壁纸。 - - 相册亦提供能让第三方应用预览图片/视频、向电子邮件客户端添加附件等的功能。非常适合日常使用。 - - 应用不包含广告与不必要的权限。它是完全开放源代码的,并内置自定义颜色主题。 - - 这个应用只是一系列应用中的一小部份。您可以在 http://www.simplemobiletools.com 找到其余的应用。 - - - + 撤销更改 + 是否撤销您的更改? + 取消隐藏 + 取消隐藏文件夹 + 未知错误 + 未知的文件路径 + 未知位置 + 解除锁定目录 + 使用默认 + 使用渐变动画 + 仅应用于此文件夹 + 视频 + 音量 + 壁纸设置成功 + 应用源码 + 更新日志 + * 此处仅列举了重大更新,更多修正可在使用中体验 + 宽度 + 图案错误 + 密码错误 + 目录选择错误,请选择 SD 卡 + From f0d46fbf768c2f4ebc0b1daaf07382e9779aecb8 Mon Sep 17 00:00:00 2001 From: Pzqqt <821026875@qq.com> Date: Fri, 20 Oct 2017 23:30:30 +0800 Subject: [PATCH 204/207] New chinese translation for v2.16.0 --- app/src/main/res/values-zh-rCN/strings.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 0e0abe1b6..2a6d8d78e 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -43,7 +43,7 @@ 使用纵向滑动手势控制视频音量和亮度 啊哦,出错啦: %s GIF 缩略图 - 图库 + 简约图库 一个观看照片和视频的简单实用工具。项目可以根据日期、大小、名称来递增或递减排序,照片可以缩放。媒体文件根据屏幕的大小排列在多个方格中,您可以使用缩放手势来调整每一列的方格数量。媒体文件可以被重命名、分享、删除、复制以及移动。照片亦可被剪切、旋转或是直接在应用中设为壁纸。 相册亦提供能让第三方应用预览图片/视频、向电子邮件客户端添加附件等的功能。非常适合日常使用。 应用不包含广告与不必要的权限。它是完全开放源代码的,并内置自定义颜色主题。 这个应用只是一系列应用中的一小部份。您可以在 http://www.simplemobiletools.com 找到其余的应用。 简约图库 一个没有广告,用来观看照片及视频的相册。 @@ -150,7 +150,7 @@ 滑动(图像加载和缓存) 去设置 - 你在寻找一个简单而匿名的视频通话应用吗?请尝试我的另一个项目\n(简体中文翻译补全+魔改 By Pzqqt) + 你在寻找一个简单而匿名的视频通话应用吗?请尝试我的另一个项目 高度 (隐藏) 隐藏 From 801c7329f5cd8eed086f38599343c9bd76f662dd Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 20 Oct 2017 23:30:34 +0200 Subject: [PATCH 205/207] updating some German strings --- app/src/main/res/values-de/strings.xml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index a3cd8cbdb..3a524eca2 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -25,10 +25,10 @@ Festlegen als Lautstärke Helligkeit - Do not ask again in this session + Nicht erneut fragen (in dieser Session) - Medienfilter + Filter Bilder Videos GIFs @@ -36,11 +36,11 @@ Filter ändern - Diese Funktion versteckt ausgewählte Ordner (auch für andere Apps), indem dort im Dateisystem eine \'.nomedia\'-Datei abgelegt wird. Dadurch werden auch deren Unterordner versteckt. Solche Ordner werden nur gezeigt, wenn die Einstellung \'Versteckte Ordner zeigen\' aktiv ist (auch andere Apps bieten üblicherweise eine solche Option). Fortfahren? + Diese Funktion versteckt die ausgewählten Ordner (auch für andere Apps), indem dort im Dateisystem eine \'.nomedia\'-Datei abgelegt wird. Dadurch werden auch deren Unterordner versteckt. Solche Ordner werden nur gezeigt, wenn die Einstellung \'Versteckte Ordner zeigen\' aktiv ist (auch andere Apps bieten üblicherweise eine solche Option). Fortfahren? Ordner ausblenden Ausgeblendete Ordner Ausgeblendete Ordner verwalten - Diese Funktion blendet ausgewählte Ordner und deren Unterordner aus (nur in dieser App). Ausgeblendete Ordner können in den Einstellungen verwaltet werden. + Diese Funktion blendet die ausgewählten Ordner und deren Unterordner aus (nur in dieser App). Ausgeblendete Ordner können in den Einstellungen verwaltet werden. Möchten Sie stattdessen einen höherliegenden Ordner ausblenden? \'Ordner ausblenden\' wird ausgewählte Ordner und deren Unterordner nur in dieser App ausblenden. Andere Apps werden solche Ordner weiterhin anzeigen.\\n\\nWenn Sie Ordner auch für andere Apps verstecken wollen, verwenden Sie dafür die Funktion \'Ordner verstecken\'. Alle entfernen @@ -104,9 +104,9 @@ Keine Medien für Diashow gefunden - Change view type - Grid - List + Darstellung ändern + Gitter + Liste Versteckte Ordner zeigen @@ -126,8 +126,8 @@ Nach Löschen leere Ordner löschen Gesten für Videolautstärke/Helligkeit Teilen/Drehen im Vollbild-Menü vertauschen - Show extended details over fullscreen media - Manage extended details + Eigenschaften anzeigen im Vollbild + Eigenschaften auswählen From 38e978a024f264c820e0c9d1914bd99ec7036725 Mon Sep 17 00:00:00 2001 From: xin Date: Sat, 21 Oct 2017 11:18:52 +0000 Subject: [PATCH 206/207] Update French translation --- app/src/main/res/values-fr/strings.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 3ae6e9716..4fd96a948 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -25,7 +25,7 @@ Définir comme Volume Luminosité - Do not ask again in this session + Ne pas redemander pour cette session Filtrer les médias @@ -50,7 +50,7 @@ Dossiers inclus Gérer les dossiers inclus Ajouter un dossier - Si vous avez des dossiers contenant des medias et qui ne sont pas reconnus par l\'application alors, vous pouvez les ajouter manuellement ici. + Si vous avez des dossiers contenant des médias et qui ne sont pas reconnus par l\'application alors, vous pouvez les ajouter manuellement ici. Redimensionner @@ -126,8 +126,8 @@ Supprimer les dossiers vides après avoir supprimé leur contenu Permettre le contrôle du volume vidéo et de la luminosité avec des gestes verticaux Remplacer Partager par Pivoter si menu en plein écran - Show extended details over fullscreen media - Manage extended details + Afficher les détails supplémentaires par dessus le média en plein écran + Gérer les détails supplémentaires From a4b24a7deb584dd3ba31ddd2f46bcf1803884fb4 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 21 Oct 2017 19:40:46 +0200 Subject: [PATCH 207/207] update Commons for easy runtime permissions handling --- app/build.gradle | 2 +- .../gallery/activities/MainActivity.kt | 31 ++++++------------- .../gallery/activities/MediaActivity.kt | 20 +++++++----- .../gallery/activities/PhotoVideoActivity.kt | 31 +++++-------------- .../gallery/activities/ViewPagerActivity.kt | 16 +++++++--- .../asynctasks/GetDirectoriesAsynctask.kt | 5 +-- 6 files changed, 45 insertions(+), 60 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index df7b69e08..d09181550 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,7 +37,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.30.4' + compile 'com.simplemobiletools:commons:2.30.6' compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.6.0' compile 'com.theartofdev.edmodo:android-image-cropper:2.4.0' compile 'com.bignerdranch.android:recyclerview-multiselect:0.2' 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 deb5ebe3a..8baa4fa20 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -1,16 +1,13 @@ package com.simplemobiletools.gallery.activities -import android.Manifest import android.app.Activity import android.content.ClipData import android.content.Intent -import android.content.pm.PackageManager import android.net.Uri import android.os.Build import android.os.Bundle import android.os.Handler import android.provider.MediaStore -import android.support.v4.app.ActivityCompat import android.support.v7.widget.GridLayoutManager import android.view.Menu import android.view.MenuItem @@ -21,6 +18,7 @@ import com.simplemobiletools.commons.dialogs.CreateNewFolderDialog import com.simplemobiletools.commons.dialogs.FilePickerDialog import com.simplemobiletools.commons.dialogs.RadioGroupDialog import com.simplemobiletools.commons.extensions.* +import com.simplemobiletools.commons.helpers.PERMISSION_WRITE_STORAGE import com.simplemobiletools.commons.helpers.SORT_BY_DATE_MODIFIED import com.simplemobiletools.commons.helpers.SORT_BY_DATE_TAKEN import com.simplemobiletools.commons.models.RadioItem @@ -40,7 +38,6 @@ import java.io.* import java.util.* class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { - private val STORAGE_PERMISSION = 1 private val PICK_MEDIA = 2 private val PICK_WALLPAPER = 3 private val LAST_MEDIA_CHECK_PERIOD = 3000L @@ -189,25 +186,15 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { } private fun tryloadGallery() { - if (hasWriteStoragePermission()) { - if (config.showAll) - showAllMedia() - else - getDirectories() + handlePermission(PERMISSION_WRITE_STORAGE) { + if (it) { + if (config.showAll) + showAllMedia() + else + getDirectories() - setupLayoutManager() - checkIfColorChanged() - } else { - ActivityCompat.requestPermissions(this, arrayOf(Manifest.permission.WRITE_EXTERNAL_STORAGE), STORAGE_PERMISSION) - } - } - - override fun onRequestPermissionsResult(requestCode: Int, permissions: Array, grantResults: IntArray) { - super.onRequestPermissionsResult(requestCode, permissions, grantResults) - - if (requestCode == STORAGE_PERMISSION) { - if (grantResults.isNotEmpty() && grantResults[0] == PackageManager.PERMISSION_GRANTED) { - getDirectories() + setupLayoutManager() + checkIfColorChanged() } else { toast(R.string.no_storage_permissions) finish() 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 63dfd8c62..f8e79448f 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -21,6 +21,7 @@ import com.google.gson.Gson import com.simplemobiletools.commons.dialogs.ConfirmationDialog import com.simplemobiletools.commons.dialogs.RadioGroupDialog import com.simplemobiletools.commons.extensions.* +import com.simplemobiletools.commons.helpers.PERMISSION_WRITE_STORAGE import com.simplemobiletools.commons.models.RadioItem import com.simplemobiletools.commons.views.MyScalableRecyclerView import com.simplemobiletools.gallery.R @@ -138,14 +139,17 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { } private fun tryloadGallery() { - if (hasWriteStoragePermission()) { - val dirName = getHumanizedFilename(mPath) - title = if (mShowAll) resources.getString(R.string.all_folders) else dirName - getMedia() - setupLayoutManager() - checkIfColorChanged() - } else { - finish() + handlePermission(PERMISSION_WRITE_STORAGE) { + if (it) { + val dirName = getHumanizedFilename(mPath) + title = if (mShowAll) resources.getString(R.string.all_folders) else dirName + getMedia() + setupLayoutManager() + checkIfColorChanged() + } else { + toast(R.string.no_storage_permissions) + finish() + } } } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt index 61fab13e4..eb6c13fb2 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt @@ -1,21 +1,18 @@ package com.simplemobiletools.gallery.activities -import android.Manifest import android.content.Intent -import android.content.pm.PackageManager import android.database.Cursor import android.graphics.Color import android.graphics.drawable.ColorDrawable import android.net.Uri import android.os.Bundle import android.provider.MediaStore -import android.support.v4.app.ActivityCompat import android.view.Menu import android.view.MenuItem import android.view.View -import com.simplemobiletools.commons.extensions.hasWriteStoragePermission import com.simplemobiletools.commons.extensions.scanPath import com.simplemobiletools.commons.extensions.toast +import com.simplemobiletools.commons.helpers.PERMISSION_WRITE_STORAGE import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.extensions.* import com.simplemobiletools.gallery.fragments.PhotoFragment @@ -29,7 +26,6 @@ import kotlinx.android.synthetic.main.fragment_holder.* import java.io.File open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentListener { - private val STORAGE_PERMISSION = 1 private var mMedium: Medium? = null private var mIsFullScreen = false private var mIsFromGallery = false @@ -44,11 +40,13 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList public override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.fragment_holder) - - if (hasWriteStoragePermission()) { - checkIntent(savedInstanceState) - } else { - ActivityCompat.requestPermissions(this, arrayOf(Manifest.permission.WRITE_EXTERNAL_STORAGE), STORAGE_PERMISSION) + handlePermission(PERMISSION_WRITE_STORAGE) { + if (it) { + checkIntent(savedInstanceState) + } else { + toast(R.string.no_storage_permissions) + finish() + } } } @@ -115,19 +113,6 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList supportActionBar?.setBackgroundDrawable(resources.getDrawable(R.drawable.actionbar_gradient_background)) } - override fun onRequestPermissionsResult(requestCode: Int, permissions: Array, grantResults: IntArray) { - super.onRequestPermissionsResult(requestCode, permissions, grantResults) - - if (requestCode == STORAGE_PERMISSION) { - if (grantResults.isNotEmpty() && grantResults[0] == PackageManager.PERMISSION_GRANTED) { - checkIntent() - } else { - toast(R.string.no_storage_permissions) - finish() - } - } - } - private fun sendViewPagerIntent(path: String) { Intent(this, ViewPagerActivity::class.java).apply { putExtra(IS_VIEW_INTENT, true) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt index bdf472480..64c315ba4 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -26,6 +26,7 @@ import android.view.animation.DecelerateInterpolator import com.simplemobiletools.commons.dialogs.PropertiesDialog import com.simplemobiletools.commons.dialogs.RenameItemDialog import com.simplemobiletools.commons.extensions.* +import com.simplemobiletools.commons.helpers.PERMISSION_WRITE_STORAGE import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.activities.MediaActivity.Companion.mMedia import com.simplemobiletools.gallery.adapters.MyPagerAdapter @@ -73,11 +74,17 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View super.onCreate(savedInstanceState) setContentView(R.layout.activity_medium) - if (!hasWriteStoragePermission()) { - finish() - return + handlePermission(PERMISSION_WRITE_STORAGE) { + if (it) { + initViewPager() + } else { + toast(R.string.no_storage_permissions) + finish() + } } + } + private fun initViewPager() { measureScreen() val uri = intent.data if (uri != null) { @@ -189,8 +196,9 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View override fun onResume() { super.onResume() - if (!hasWriteStoragePermission()) { + if (!hasPermission(PERMISSION_WRITE_STORAGE)) { finish() + return } supportActionBar?.setBackgroundDrawable(resources.getDrawable(R.drawable.actionbar_gradient_background)) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt index 676b45f8b..d1767ce4a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt @@ -3,9 +3,10 @@ package com.simplemobiletools.gallery.asynctasks import android.content.Context import android.os.AsyncTask import com.simplemobiletools.commons.extensions.getFilenameFromPath -import com.simplemobiletools.commons.extensions.hasWriteStoragePermission +import com.simplemobiletools.commons.extensions.hasPermission import com.simplemobiletools.commons.extensions.internalStoragePath import com.simplemobiletools.commons.extensions.sdCardPath +import com.simplemobiletools.commons.helpers.PERMISSION_WRITE_STORAGE import com.simplemobiletools.commons.helpers.SORT_DESCENDING import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.extensions.config @@ -21,7 +22,7 @@ class GetDirectoriesAsynctask(val context: Context, val isPickVideo: Boolean, va val mediaFetcher = MediaFetcher(context) override fun doInBackground(vararg params: Void): ArrayList { - if (!context.hasWriteStoragePermission()) + if (!context.hasPermission(PERMISSION_WRITE_STORAGE)) return ArrayList() val config = context.config