From fa7b95e0afd41505f6c90fcbe76f7d0e81516859 Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 3 Oct 2017 20:29:26 +0200 Subject: [PATCH 001/188] 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 002/188] 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 003/188] 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 004/188] 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 005/188] 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 006/188] 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 007/188] 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 008/188] 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 009/188] 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 010/188] 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 011/188] 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 012/188] 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 013/188] 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 014/188] 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 015/188] 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 016/188] 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 017/188] 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 018/188] 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 019/188] 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 020/188] 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 021/188] 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 022/188] 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 023/188] 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 024/188] 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 025/188] 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 026/188] 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 027/188] 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 028/188] 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 029/188] 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 030/188] 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 031/188] 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 032/188] 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 033/188] 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 034/188] 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 035/188] 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 036/188] 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 037/188] 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 038/188] 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 039/188] 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 040/188] 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 041/188] 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 042/188] 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 043/188] 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 044/188] 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 045/188] 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 046/188] 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 047/188] 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 048/188] 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 From 608292a357e9870952c3b798a3df2cec11c3f810 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 22 Oct 2017 22:57:53 +0200 Subject: [PATCH 049/188] update Commons and use its way of getting mimetype of multiple uris --- app/build.gradle | 2 +- .../kotlin/com/simplemobiletools/gallery/extensions/activity.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index d09181550..3d9d663c6 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,7 +37,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.30.6' + compile 'com.simplemobiletools:commons:2.30.13' 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/extensions/activity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt index 0a2140a6d..75e291505 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt @@ -65,7 +65,7 @@ fun Activity.shareMedia(media: List) { Intent().apply { action = Intent.ACTION_SEND_MULTIPLE - type = "image/* video/*" + type = uris.getMimeType() addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris) startActivity(Intent.createChooser(this, shareTitle)) From c39ad62fbf1c27fdac0d13481cb7b7559c3ace32 Mon Sep 17 00:00:00 2001 From: Rodrigo Date: Sun, 22 Oct 2017 23:10:55 -0200 Subject: [PATCH 050/188] Update strings.xml --- app/src/main/res/values-pt-rBR/strings.xml | 56 +++++++++++----------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 30662f1d9..df37a70f0 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -22,18 +22,18 @@ Trocar imagem de capa Selecionar foto Usar padrão - Set as + Definir como Volume - Brightness - Do not ask again in this session + Brilho + Não perguntar novamente por enquanto - Filter media - Images - Videos + Filtrar mídia + Imagens + Vídeos GIFs - No media files have been found with the selected filters. - Change filters + Nenhum arquivo de mídia encontrado a partir dos filtros selecionados. + Mudar filtros 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? @@ -77,7 +77,7 @@ Inverter Horizontalmente Verticalmente - Edit with + Editar com Simple Wallpaper @@ -92,21 +92,21 @@ 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 + Intervalo (segundos): + Incluir fotos + Incluir videos + Incluir GIFs + Ordem aleatória + Usar animação de esmaecimento + Retroceder + Apresentação em ciclo + Fim da apresentação + Nenhuma mídia encontrada para a apresentação - Change view type - Grid - List + Mudar tipo da vista + Grade + Lista Mostrar pastas ocultas @@ -122,12 +122,12 @@ Proporção da mídia 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 - 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 + Esconder interface do sistema automaticamente quando em tela cheia + Apagar pastas vazias após deleter seu conteúdo + Permitir controle do volume e brilho com gestos na vertical + Substituir botão "Compartilhar" por "Rotação de tela" quando em tela cheia + Exibir detalhes extendidos quando em tela cheia + Gerenciar detalhes extendidos From 4738d833401dcd97ff778bc62a267137f7bacae4 Mon Sep 17 00:00:00 2001 From: Rodrigo Date: Sun, 22 Oct 2017 23:29:46 -0200 Subject: [PATCH 051/188] Update strings.xml --- app/src/main/res/values-pt-rBR/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 30662f1d9..23cecc9f1 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -104,7 +104,7 @@ No media for the slideshow have been found - Change view type + Alterar modo de visualização Grid List From 208d005139de8ed1fc8329aedbc8b9b3b8a57bc3 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 23 Oct 2017 12:09:55 +0200 Subject: [PATCH 052/188] update commons to 2.31.1 --- app/build.gradle | 2 +- .../gallery/activities/EditActivity.kt | 6 +----- .../gallery/activities/PhotoVideoActivity.kt | 1 + .../gallery/extensions/context.kt | 19 ------------------- 4 files changed, 3 insertions(+), 25 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 3d9d663c6..5d0a8fe7d 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,7 +37,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.30.13' + compile 'com.simplemobiletools:commons:2.31.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/EditActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/EditActivity.kt index 0da6c4bef..dc09ee11e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/EditActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/EditActivity.kt @@ -10,14 +10,10 @@ import android.provider.MediaStore import android.util.Log import android.view.Menu import android.view.MenuItem -import com.simplemobiletools.commons.extensions.getCompressionFormat -import com.simplemobiletools.commons.extensions.getFileOutputStream -import com.simplemobiletools.commons.extensions.scanPath -import com.simplemobiletools.commons.extensions.toast +import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.dialogs.ResizeDialog import com.simplemobiletools.gallery.dialogs.SaveAsDialog -import com.simplemobiletools.gallery.extensions.getRealPathFromURI import com.simplemobiletools.gallery.extensions.openEditor import com.theartofdev.edmodo.cropper.CropImageView import kotlinx.android.synthetic.main.view_crop_image.* 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 eb6c13fb2..97b3e12c5 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt @@ -10,6 +10,7 @@ import android.provider.MediaStore import android.view.Menu import android.view.MenuItem import android.view.View +import com.simplemobiletools.commons.extensions.getRealPathFromURI import com.simplemobiletools.commons.extensions.scanPath import com.simplemobiletools.commons.extensions.toast import com.simplemobiletools.commons.helpers.PERMISSION_WRITE_STORAGE 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 f7cd61529..cdda71ab7 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt @@ -3,12 +3,9 @@ package com.simplemobiletools.gallery.extensions 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.humanizePath import com.simplemobiletools.gallery.activities.SettingsActivity @@ -44,22 +41,6 @@ val Context.realScreenSize: Point return size } -fun Context.getRealPathFromURI(uri: Uri): String? { - var cursor: Cursor? = null - try { - val projection = arrayOf(MediaStore.Images.Media.DATA) - cursor = contentResolver.query(uri, projection, null, null, null) - if (cursor?.moveToFirst() == true) { - val index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA) - return cursor.getString(index) - } - } catch (e: Exception) { - } finally { - cursor?.close() - } - return null -} - fun Context.getHumanizedFilename(path: String): String { val humanized = humanizePath(path) return humanized.substring(humanized.lastIndexOf("/") + 1) From 11e60390cf9d3fc1ec62cf1e9a977ac144c49cba Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 23 Oct 2017 17:03:20 +0200 Subject: [PATCH 053/188] revert a chinese translation, it messes the string order This reverts commit 83d4e75f0e051f0de16952b938bfa0262e31c94a. --- app/src/main/res/values-zh-rCN/strings.xml | 458 ++++++--------------- 1 file changed, 133 insertions(+), 325 deletions(-) diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 2a6d8d78e..b43f3c294 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -1,341 +1,149 @@ - 转到主屏幕 - %1$s:%2$s - %1$s - %2$s:%3$s - 转到上一层级 - 更多选项 - 完成 - 查看全部 - 选择应用 - 关闭 - 开启 - 搜索… - 清除查询 - 搜索查询 - 搜索 - 提交查询 - 语音搜索 - 分享方式 - 通过%s分享 - 收起 - 指纹传感器有脏污。请擦拭干净,然后重试。 - 无法处理指纹,请重试。 - 仅检测到部分指纹,请重试。 - 手指移动太快,请重试。 - 手指移动太慢,请重试。 - 指纹操作已取消。 - 指纹硬件无法使用。 - 尝试次数过多,请稍后重试。 - 无法存储指纹。请移除一个现有的指纹。 - 指纹录入操作超时,请重试。 - 请重试。 - 无法识别 - 指纹: - 搜索 - 999+ - 关于 - 添加指纹 - 添加目录 - 额外信息 - 专辑 - 所有目录 - 使用纵向滑动手势控制视频音量和亮度 - 啊哦,出错啦: %s - GIF 缩略图 + Simple Gallery 简约图库 - 一个观看照片和视频的简单实用工具。项目可以根据日期、大小、名称来递增或递减排序,照片可以缩放。媒体文件根据屏幕的大小排列在多个方格中,您可以使用缩放手势来调整每一列的方格数量。媒体文件可以被重命名、分享、删除、复制以及移动。照片亦可被剪切、旋转或是直接在应用中设为壁纸。 相册亦提供能让第三方应用预览图片/视频、向电子邮件客户端添加附件等的功能。非常适合日常使用。 应用不包含广告与不必要的权限。它是完全开放源代码的,并内置自定义颜色主题。 这个应用只是一系列应用中的一小部份。您可以在 http://www.simplemobiletools.com 找到其余的应用。 - 简约图库 - 一个没有广告,用来观看照片及视频的相册。 - 应用版本:%1$s - "应用到 '_1'" - 应用到全部冲突项 - 艺术家 - 递增 - 验证已被阻止,请稍后再试 - 验证失败 - 自动播放 - 背景色 - 亮度 - 相机 - 取消 - 更改封面图片 - 更改过滤器 - 更改视图类型 - 更改颜色将切换到自定义主题 - 点击此处以设置目标路径 - 确认选择 - 请选择 SD 卡根目录并授予写权限 - 如果您未找到 SD 卡目录,请尝试 - 确认外部存储器访问权限 - 复制 - 无法复制文件 - 复制/移动 - 操作失败 - 复制到 - 正在复制… - 复制成功 - 无法复制相同文件 - v %1$s Copyright © Simple Mobile Tools %2$d - 创建文件 %s 失败 - 创建文件夹 %s 失败 - 新建 - 新建文件夹 - 裁剪缩略图 - Android Image Cropper(图像裁剪和旋转) - 自定义 - 自定义颜色 - 全屏时黑色背景 - 深色主题 - 拍摄日期 - 删除 - 删除没有内容的空文件夹 - 递减 - 目标路径 - 设备系统:%1$s - 子目录数 - 丢弃 - 不再询问 - 捐赠 - "您已使用此应用一段时间了。 - -可您知道么,我并不就职于一个大公司。开发应用耗时耗力,且我想依旧保持免费,您的捐赠会给我更多动力。 - -您可以通过购买付费应用 Simple Thank You 或捐赠比特币来支持我。 - -更多信息请查阅 http://simplemobiletools.com/donate. - -非常感谢!" - 捐赠 - 时长 编辑 - 编辑方式: - 编辑方式 - 编辑器 - 发送反馈 - 请输入名称 - 输入密码 - 不能覆盖源文件 + 打开相机 + 打开方式 + 未找到可用应用 + (隐藏) + 锁定目录 + 解除锁定目录 + 文件视图 + 所有目录 + 目录视图 + 其他目录 + 在地图中显示 + 未知位置 + 未找到地图应用 + 未找到相机应用 + 增加一栏 + 减少一栏 + 更改封面图片 + 选择图片 + 使用默认 + 设置为 + 音量 + 亮度 + Do not ask again in this session + + + Filter media + Images + Videos + GIFs + No media files have been found with the selected filters. + Change filters + + + 通过添加文件 \'.nomedia\' 到目录,可以防止目录及其子目录下的所有媒体被扫描。您可以通过设置中的 \'显示隐藏目录\' 选项改变设置,是否继续? 排除 + 排除目录 + 管理排除目录 目录及其子目录中的媒体将不会在 Simple Gallery 中显示,您可以在设置更改。 是否排除父目录? 此目录及其子目录中的媒体将不会在 Simple Gallery 中显示,但是其它应用可以访问。如果您想对其它应用隐藏,请使用隐藏功能。 - 排除目录 - EXIF - 曝光时间 - 扩展名 - 扩展名不能为空 - 超大 - 光圈 - 文件 - 文件 %1$s 已存在 - 文件 %1$s 已存在。是否覆盖? - 文件保存成功 - 文件名 - 文件名不能为空 - 文件名包含非法字符 - 总文件数 - 要显示的媒体文件 - 指纹 - 保护设置成功。请重新安装本应用,以防复位时出现问题。 + 移除全部 + 是否移除列表中的全部目录?目录不会被物理删除。 + + + 包含目录 + 管理包含目录 + 添加目录 + 如果您还有应用未扫描到的媒体文件,请添加所在目录路径。 + + + 缩放 + 缩放选定区域并保存 + 宽度 + 高度 + 保持纵横比 + 请输入有效分辨率 + + + 编辑器 + 保存 + 旋转 + 路径 + 无效图片路径 + 图片编辑失败 + 编辑方式: + 未找到可用图片编辑器 + 未知的文件路径 + 不能覆盖源文件 + 向左旋转 + 向右旋转 + 旋转 180º 翻转 水平翻转 垂直翻转 - 焦距 - 文件夹 - 目录视图 - 关注我们: - 字体大小 - GIFs - 滑动(图像加载和缓存) - 去设置 - - 你在寻找一个简单而匿名的视频通话应用吗?请尝试我的另一个项目 - 高度 - (隐藏) - 隐藏 - 隐藏文件夹 - "通过添加文件 '.nomedia' 到目录,可以防止目录及其子目录下的所有媒体被扫描。您可以通过设置中的 '显示隐藏目录' 选项改变设置,是否继续?" - 全屏时自动隐藏状态栏 - 图片编辑失败 - 图片 - 包含目录 - 包含 GIFs - 包含照片 - 包含视频 - 如果您还有应用未扫描到的媒体文件,请添加所在目录路径。 - 增加一栏 - 绘制图案 - 内部存储器 - 间隔(秒): - 无法写入到选中目标路径 - 无效文件格式 - 无效图片路径 - 名称包含非法字符 - 请输入有效分辨率 - 分享给好友 - 分享到 - ISO 速度 - 已选择项目 - Joda-Time(Java日期替换) - 保持纵横比 - Kotlin(编程语言) - 横向长宽比 - - 修改日期 - 浅色主题 - 列表 - 循环幻灯片 - 循环播放视频 - 管理排除目录 - 要显示的详细信息项目 - 管理包含目录 - 浏览时最大亮度 - - 更多应用 - 移动 - 倒播 - 移动到 - 正在移动… - 文件移动成功 - 无法移动相同文件 - RecyclerView MultiSelect(选择多个列表项) - 名称 - 同名文件夹或文件已存在 - - 未找到可用应用 - 未找到相机应用 - 未找到可用应用 - 未找到可用图片编辑器 - 未选择文件 - 您还没有注册指纹,请先给你的设备添加一些指纹 - 未找到地图应用 - 未发现可用媒体 - 所选的过滤器没有找到的媒体文件。 - 请授予权限以访问您的存储器 - 此应用使用了以下三方库。谢谢。 - 确认 - 打开相机 - 打开方式 - 其他目录 - Otto (event bus) - 内存不足 - 覆盖 - 使用密码保护隐藏项 - 路径 - 图案 - PatternLockView(图案保护) - PhotoView(可缩放 gifs) - Picasso(图像加载和缓存) - 密码 - 锁定目录 - 请将手指放在指纹传感器上 - 请输入密码 - 请选择目标路径 - 纵向长宽比 - 主体色 - 是否执行此删除操作? - 属性 - 密码设置成功。为防止遗忘,请重新安装本应用。 - 随机顺序 - 为我们打分 - 减少一栏 - 移除全部 - 是否移除列表中的全部目录?目录不会被物理删除。 - 重命名 - 重命名文件 - 无法重命名文件 - 重命名文件夹 - 文件夹名不能为空 - 无法重命名文件夹 - 文件夹名已存在 - 文件夹重命名成功 - 无法重命名存储器的根目录 - 重命名中... - 重复图案 - 重复密码 - 替换全屏时菜单栏的“分享”为“旋转” - 缩放 - 缩放选定区域并保存 - 分辨率 - 恢复默认 - 根目录 - 旋转 - 向左旋转 - 旋转 180º - 向右旋转 - RtlViewPager(从右到左滑动) - 保存 - 保存 - 您尚未保存更改,是否保存? - 正在保存… - 根据长宽比 - 全屏方向 - 设备方向 - 系统设置 - 水平滚动缩略图 - SD 卡 - 搜索 - 全选 - 选择操作 - 选择目标路径 - 选择文件 - 选择文件夹 - 选择图片 - 选择存储器 - 设置为 + 编辑方式 + + + Simple Wallpaper 设为壁纸 壁纸设置失败 设为壁纸... - 正在设置壁纸… - 设置 - 分享 - 请前往 %2$s 看看我们的 %1$s 吧! - 分享到 - 文件视图 - 全屏浏览媒体时显示详细信息 - 显示隐藏文件和文件夹 - 显示所有 - 在地图中显示 - 简约壁纸 - 大小 - 跳过 - 幻灯片 - 幻灯片结束 - - 排序方式 - 原始路径 - 原始路径和目标路径不能相同 - Stetho(调试数据库) - 不显示隐藏的媒体文件 - Subsampling Scale Image View(可缩放图像浏览) - 显示/隐藏缓存内容 - 文本颜色 - 主题 - 开放源代码 - 开放源代码 - 标题 - 显示文件名 - 撤销更改 - 是否撤销您的更改? - 取消隐藏 - 取消隐藏文件夹 - 未知错误 - 未知的文件路径 - 未知位置 - 解除锁定目录 - 使用默认 - 使用渐变动画 - 仅应用于此文件夹 - 视频 - 音量 + 未找到可用应用 + 正在设置壁纸… 壁纸设置成功 - 应用源码 - 更新日志 - * 此处仅列举了重大更新,更多修正可在使用中体验 - 宽度 - 图案错误 - 密码错误 - 目录选择错误,请选择 SD 卡 - + 纵向长宽比 + 横向长宽比 + + + 幻灯片 + 间隔(秒): + Include photos + 包含视频 + Include GIFs + 随机顺序 + 使用渐变动画 + 倒播 + Loop slideshow + 幻灯片结束 + 未发现可用媒体 + + + Change view type + Grid + List + + + 显示所有 + 自动播放 + 显示文件名 + 循环播放视频 + 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 找到其余的应用。 + + + From 2a2b77fc6b12953530f008a7cdc7f0c10d356c42 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 23 Oct 2017 17:04:44 +0200 Subject: [PATCH 054/188] add a string for toggling media count visibility on main screen --- 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 + 19 files changed, 19 insertions(+) diff --git a/app/src/main/res/values-ca/strings.xml b/app/src/main/res/values-ca/strings.xml index fac61048c..b2b1b6986 100644 --- a/app/src/main/res/values-ca/strings.xml +++ b/app/src/main/res/values-ca/strings.xml @@ -125,6 +125,7 @@ Automatically hide system UI at fullscreen media Delete empty folders after deleting their content Allow controlling video volume and brightness with vertical gestures + Show folder media count on the main view 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 c6ba60327..48f819337 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -125,6 +125,7 @@ Automatically hide system UI at fullscreen media Delete empty folders after deleting their content Allow controlling video volume and brightness with vertical gestures + Show folder media count on the main view 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 3a524eca2..da95fadc3 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -125,6 +125,7 @@ Systemleisten ausblenden im Vollbild Nach Löschen leere Ordner löschen Gesten für Videolautstärke/Helligkeit + Show folder media count on the main view Teilen/Drehen im Vollbild-Menü vertauschen Eigenschaften anzeigen im Vollbild Eigenschaften auswählen diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 8a364e187..8f9bb7813 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -125,6 +125,7 @@ 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 + Show folder media count on the main view 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 a4edf365a..57e76daec 100644 --- a/app/src/main/res/values-fi/strings.xml +++ b/app/src/main/res/values-fi/strings.xml @@ -125,6 +125,7 @@ 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ä + Show folder media count on the main view 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 4fd96a948..efa023339 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -125,6 +125,7 @@ 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 + Show folder media count on the main view Remplacer Partager par Pivoter si menu en plein écran Afficher les détails supplémentaires par dessus le média en plein écran Gérer les détails supplémentaires diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index b04301122..2eb9d22d0 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -125,6 +125,7 @@ Automatically hide system UI at fullscreen media Delete empty folders after deleting their content Allow controlling video volume and brightness with vertical gestures + Show folder media count on the main view 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 2b187ae34..66c2fd1f3 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -125,6 +125,7 @@ Nascondi UI di sistema con media a schermo intero Elimina cartelle vuote dopo averne eliminato il contenuto Gestisci il volume e la luminosità dei video con gesti verticali + Show folder media count on the main view 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 93b6e616e..dc2413462 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -125,6 +125,7 @@ フルスクリーン時にシステムUIを非表示にする メディアの削除後にフォルダーが空になった場合、そのフォルダーを削除する ビデオ再生中に、音量と明るさを縦方向のジェスチャーで変更する + Show folder media count on the main view フルスクリーンメニューの「共有」を「回転」に置き換える 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 a148c3a0e..45144c60c 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -125,6 +125,7 @@ Ukrywaj interfejs przy pełnoekranowym podglądzie Usuwaj puste foldery po usunięciu ich zawartości Zezwalaj na kontrolę jasności i głośności filmów pionowymi gestami + Show folder media count on the main view 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 61b8ab94f..8c391f4b7 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 @@ Esconder interface do sistema automaticamente quando em tela cheia Apagar pastas vazias após deleter seu conteúdo Permitir controle do volume e brilho com gestos na vertical + Show folder media count on the main view Substituir botão "Compartilhar" por "Rotação de tela" quando em tela cheia Exibir detalhes extendidos quando em tela cheia Gerenciar detalhes extendidos diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index 51ba03b5c..bdbf21597 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -125,6 +125,7 @@ Ocultar interface do sistema se em ecrã completo 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 + Show folder media count on the main view 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 34ffc082c..d62e8711d 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -125,6 +125,7 @@ Автоматически скрывать системный интерфейс в полноэкранном режиме Удалять пустые папки после удаления их содержимого Управлять громкостью и яркостью видео с помощью вертикальных жестов + Show folder media count on the main view Заменить \'Поделиться\' на \'Повернуть\' в меню полноэкранного режима 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 50eeece79..f562dff8d 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -125,6 +125,7 @@ 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 + Zobraziť počet médií v priečinku na hlavnej obrazovke Nahradiť Zdieľanie s Otočením v celoobrazovkovom menu Zobraziť rozšírené vlastnosti ponad celoobrazovkové médiá Spravovať rozšírené vlastnosti diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index 2ba4fc87d..106063a54 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -125,6 +125,7 @@ Dölj systemanvändargränssnittet automatiskt när media visas i helskärmsläge Ta bort tomma mappar när deras innehåll tas bort Tillåt styrning av videovolym och videoljusstyrka med vertikala gester + Show folder media count on the main view 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 6263ca620..a9ac2f748 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -125,6 +125,7 @@ Automatically hide system UI at fullscreen media Delete empty folders after deleting their content Allow controlling video volume and brightness with vertical gestures + Show folder media count on the main view 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 b43f3c294..deb5176e0 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 folder media count on the main view 替换全屏时菜单栏的“分享”为“旋转” 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 1ec71fd20..bc5042450 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 folder media count on the main view 將全螢幕選單的分享取代為旋轉 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 fac61048c..b2b1b6986 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -125,6 +125,7 @@ Automatically hide system UI at fullscreen media Delete empty folders after deleting their content Allow controlling video volume and brightness with vertical gestures + Show folder media count on the main view Replace Share with Rotate at fullscreen menu Show extended details over fullscreen media Manage extended details From 5cd3fdf57f3ee86574ee2f51bb34a8f611e80b2f Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 23 Oct 2017 17:26:33 +0200 Subject: [PATCH 055/188] implement the Show Media Count toggle functionality --- .../gallery/activities/MainActivity.kt | 38 +++++++++++++------ .../gallery/activities/SettingsActivity.kt | 9 +++++ .../gallery/adapters/DirectoryAdapter.kt | 20 +++++----- .../gallery/helpers/Config.kt | 4 ++ .../gallery/helpers/Constants.kt | 1 + app/src/main/res/layout/activity_settings.xml | 20 ++++++++++ 6 files changed, 71 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 8baa4fa20..ef6cae120 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -56,6 +56,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { private var mStoredAnimateGifs = true private var mStoredCropThumbnails = true private var mStoredScrollHorizontally = true + private var mStoredShowMediaCount = true private var mStoredTextColor = 0 private var mLoadedInitialPhotos = false private var mLatestMediaId = 0L @@ -80,10 +81,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { removeTempFolder() directories_refresh_layout.setOnRefreshListener({ getDirectories() }) mDirs = ArrayList() - mStoredAnimateGifs = config.animateGifs - mStoredCropThumbnails = config.cropThumbnails - mStoredScrollHorizontally = config.scrollHorizontally - mStoredTextColor = config.textColor + storeStateVariables() checkWhatsNewDialog() directories_empty_text.setOnClickListener { @@ -134,6 +132,13 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { directories_grid.adapter?.notifyDataSetChanged() } + if (mStoredShowMediaCount != config.showMediaCount) { + (directories_grid.adapter as? DirectoryAdapter)?.apply { + showMediaCount = config.showMediaCount + notifyDataSetChanged() + } + } + if (mStoredScrollHorizontally != config.scrollHorizontally) { (directories_grid.adapter as? DirectoryAdapter)?.apply { scrollVertically = config.viewTypeFolders == VIEW_TYPE_LIST || !config.scrollHorizontally @@ -157,10 +162,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { storeDirectories() directories_refresh_layout.isRefreshing = false mIsGettingDirs = false - mStoredAnimateGifs = config.animateGifs - mStoredCropThumbnails = config.cropThumbnails - mStoredScrollHorizontally = config.scrollHorizontally - mStoredTextColor = config.textColor + storeStateVariables() directories_grid.listener = null mLastMediaHandler.removeCallbacksAndMessages(null) @@ -175,6 +177,16 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { removeTempFolder() } + private fun storeStateVariables() { + config.apply { + mStoredAnimateGifs = animateGifs + mStoredCropThumbnails = cropThumbnails + mStoredScrollHorizontally = scrollHorizontally + mStoredShowMediaCount = showMediaCount + mStoredTextColor = textColor + } + } + private fun removeTempFolder() { val newFolder = File(config.tempFolderPath) if (newFolder.exists() && newFolder.isDirectory) { @@ -188,10 +200,11 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { private fun tryloadGallery() { handlePermission(PERMISSION_WRITE_STORAGE) { if (it) { - if (config.showAll) + if (config.showAll) { showAllMedia() - else + } else { getDirectories() + } setupLayoutManager() checkIfColorChanged() @@ -305,10 +318,11 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { private fun getRecyclerAdapter() = (directories_grid.adapter as DirectoryAdapter) private fun setupLayoutManager() { - if (config.viewTypeFolders == VIEW_TYPE_GRID) + if (config.viewTypeFolders == VIEW_TYPE_GRID) { setupGridLayoutManager() - else + } else { setupListLayoutManager() + } } private fun setupGridLayoutManager() { 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 8851b6bd3..7c0b7b60b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt @@ -49,6 +49,7 @@ class SettingsActivity : SimpleActivity() { setupPasswordProtection() setupDeleteEmptyFolders() setupAllowVideoGestures() + setupShowMediaCount() setupShowExtendedDetails() setupManageExtendedDetails() updateTextColors(settings_holder) @@ -198,6 +199,14 @@ class SettingsActivity : SimpleActivity() { } } + private fun setupShowMediaCount() { + settings_show_media_count.isChecked = config.showMediaCount + settings_show_media_count_holder.setOnClickListener { + settings_show_media_count.toggle() + config.showMediaCount = settings_show_media_count.isChecked + } + } + private fun setupScreenRotation() { settings_screen_rotation.text = getScreenRotationText() settings_screen_rotation_holder.setOnClickListener { 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 54565ee11..8edb4c9b5 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt @@ -30,17 +30,18 @@ import java.util.* class DirectoryAdapter(val activity: SimpleActivity, var dirs: MutableList, val listener: DirOperationsListener?, val isPickIntent: Boolean, val itemClick: (Directory) -> Unit) : RecyclerView.Adapter() { - val multiSelector = MultiSelector() val config = activity.config - val isListViewType = config.viewTypeFolders == VIEW_TYPE_LIST - var actMode: ActionMode? = null - var itemViews = SparseArray() - val selectedPositions = HashSet() var primaryColor = config.primaryColor - var textColor = config.textColor - var pinnedFolders = config.pinnedFolders var scrollVertically = !config.scrollHorizontally + var showMediaCount = config.showMediaCount + + private val multiSelector = MultiSelector() + private val isListViewType = config.viewTypeFolders == VIEW_TYPE_LIST + private var itemViews = SparseArray() + private val selectedPositions = HashSet() + private var textColor = config.textColor + private var pinnedFolders = config.pinnedFolders fun toggleItemSelection(select: Boolean, pos: Int) { if (select) { @@ -350,7 +351,7 @@ class DirectoryAdapter(val activity: SimpleActivity, var dirs: MutableList (Unit)) : SwappingHolder(view, MultiSelector()) { - fun bindView(directory: Directory, isPinned: Boolean, scrollVertically: Boolean, isListView: Boolean, textColor: Int): View { + fun bindView(directory: Directory, isPinned: Boolean, scrollVertically: Boolean, isListView: Boolean, textColor: Int, showMediaCount: Boolean): View { itemView.apply { dir_name.text = directory.name dir_path?.text = "${directory.path.substringBeforeLast("/")}/" @@ -423,6 +424,7 @@ class DirectoryAdapter(val activity: SimpleActivity, var dirs: MutableList + + + + + + Date: Tue, 24 Oct 2017 01:16:52 +0800 Subject: [PATCH 056/188] Update strings.xml --- app/src/main/res/values-zh-rCN/strings.xml | 46 +++++++++++----------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index deb5176e0..90412da97 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -1,6 +1,6 @@ - Simple Gallery + 简约图库 简约图库 编辑 打开相机 @@ -25,26 +25,26 @@ 设置为 音量 亮度 - Do not ask again in this session + 不再提醒 - Filter media - Images - Videos + 要显示的媒体文件 + 图片 + 适配 GIFs - No media files have been found with the selected filters. - Change filters + 所选的过滤器没有找到媒体文件。 + 更改过滤器 通过添加文件 \'.nomedia\' 到目录,可以防止目录及其子目录下的所有媒体被扫描。您可以通过设置中的 \'显示隐藏目录\' 选项改变设置,是否继续? 排除 排除目录 管理排除目录 - 目录及其子目录中的媒体将不会在 Simple Gallery 中显示,您可以在设置更改。 + 目录及其子目录中的媒体将不会在“简约图库”中显示,您可以在设置更改。 是否排除父目录? - 此目录及其子目录中的媒体将不会在 Simple Gallery 中显示,但是其它应用可以访问。如果您想对其它应用隐藏,请使用隐藏功能。 + 此目录及其子目录中的媒体将不会在“简约图库”中显示,但是其它应用可以访问。如果您想对其它应用隐藏,请使用隐藏功能。 移除全部 - 是否移除列表中的全部目录?目录不会被物理删除。 + 是否删除排除列表中的所有文件夹?此操作不会删除文件夹。 包含目录 @@ -80,7 +80,7 @@ 编辑方式 - Simple Wallpaper + 简约壁纸 设为壁纸 壁纸设置失败 设为壁纸... @@ -93,20 +93,20 @@ 幻灯片 间隔(秒): - Include photos - 包含视频 - Include GIFs + 包括照片 + 包括视频 + 包括 GIFs 随机顺序 使用渐变动画 倒播 - Loop slideshow + 循环幻灯片 幻灯片结束 未发现可用媒体 - Change view type - Grid - List + 更改视图类型 + 网格 + 列表 显示所有 @@ -123,12 +123,12 @@ 全屏时黑色背景 水平滚动缩略图 全屏时自动隐藏状态栏 - Delete empty folders after deleting their content - Allow controlling video volume and brightness with vertical gestures - Show folder media count on the main view + 删除没有内容的空文件夹 + 使用纵向滑动手势控制视频音量和亮度 + 在主界面显示文件夹媒体计数 替换全屏时菜单栏的“分享”为“旋转” - Show extended details over fullscreen media - Manage extended details + 全屏浏览媒体时显示详细信息 + 要显示的详细信息项目 From 012e091349994ab76c073c60df75b8581eedd6f2 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 23 Oct 2017 19:39:43 +0200 Subject: [PATCH 057/188] minor code cleanup at videofragment --- .../gallery/activities/ViewPagerActivity.kt | 1 - .../simplemobiletools/gallery/fragments/VideoFragment.kt | 8 +------- 2 files changed, 1 insertion(+), 8 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 64c315ba4..df2a14722 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -273,7 +273,6 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1 || !isDestroyed) { view_pager.apply { adapter = pagerAdapter - adapter!!.notifyDataSetChanged() currentItem = mPos addOnPageChangeListener(this@ViewPagerActivity) } 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 9d2e395f1..86db872a9 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt @@ -9,7 +9,6 @@ import android.os.Bundle import android.os.Handler import android.provider.Settings import android.util.DisplayMetrics -import android.util.Log import android.view.* import android.view.animation.AnimationUtils import android.widget.SeekBar @@ -26,6 +25,7 @@ import java.io.IOException class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSeekBarChangeListener { private val CLICK_MAX_DURATION = 150 private val SLIDE_INFO_FADE_DELAY = 1000L + private val PROGRESS = "progress" private var mMediaPlayer: MediaPlayer? = null private var mSurfaceView: SurfaceView? = null @@ -59,11 +59,6 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee lateinit var medium: Medium lateinit var mTimeHolder: View - companion object { - private val TAG = VideoFragment::class.java.simpleName - private val PROGRESS = "progress" - } - override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { mView = inflater.inflate(R.layout.pager_video_item, container, false) mTimeHolder = mView.video_time_holder @@ -397,7 +392,6 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee prepareAsync() } } catch (e: IOException) { - Log.e(TAG, "init media player failed $e") releaseMediaPlayer() } } From baed126550cb14467a3109d3a0f482b4cada9ee8 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 23 Oct 2017 21:30:24 +0200 Subject: [PATCH 058/188] fix some video playback issues on Android 7 --- .../gallery/activities/ViewPagerActivity.kt | 4 +-- .../gallery/fragments/VideoFragment.kt | 31 +++++++++++-------- 2 files changed, 19 insertions(+), 16 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 df2a14722..cc996366f 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -742,9 +742,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View private fun getCurrentFile() = File(getCurrentPath()) - override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) { - - } + override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {} override fun onPageSelected(position: Int) { if (view_pager.offscreenPageLimit == 1) { 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 86db872a9..af1f02067 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt @@ -20,7 +20,6 @@ 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.* -import java.io.IOException class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSeekBarChangeListener { private val CLICK_MAX_DURATION = 150 @@ -40,6 +39,7 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee private var mIsFragmentVisible = false private var mPlayOnPrepare = false private var mStoredShowExtendedDetails = false + private var wasInit = false private var mStoredExtendedDetails = 0 private var mCurrTime = 0 private var mDuration = 0 @@ -71,6 +71,7 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee mIsFullscreen = activity.window.decorView.systemUiVisibility and View.SYSTEM_UI_FLAG_FULLSCREEN == View.SYSTEM_UI_FLAG_FULLSCREEN checkFullscreen() + wasInit = true return mView } @@ -124,21 +125,21 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee initTimeHolder() checkExtendedDetails() + initMediaPlayer() } override fun setMenuVisibility(menuVisible: Boolean) { super.setMenuVisibility(menuVisible) + if (mIsFragmentVisible && !menuVisible) { + pauseVideo() + releaseMediaPlayer() + } mIsFragmentVisible = menuVisible - if (menuVisible) { - if (mSurfaceView != null && mSurfaceHolder!!.surface.isValid) { - initMediaPlayer() - } - + if (menuVisible && wasInit) { + initMediaPlayer() if (context?.config?.autoplayVideos == true) { playVideo() } - } else if (mIsPlaying) { - pauseVideo() } } @@ -351,6 +352,8 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee if (activity == null || !isAdded) return + initMediaPlayer() + mIsPlaying = !mIsPlaying if (mIsPlaying) { playVideo() @@ -378,8 +381,9 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee } private fun initMediaPlayer() { - if (mMediaPlayer != null) + if (mMediaPlayer != null || !mIsFragmentVisible) { return + } try { mMediaPlayer = MediaPlayer().apply { @@ -389,9 +393,9 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee setOnVideoSizeChangedListener({ mediaPlayer, width, height -> setVideoSize() }) setOnPreparedListener { videoPrepared(it) } setAudioStreamType(AudioManager.STREAM_MUSIC) - prepareAsync() + prepare() } - } catch (e: IOException) { + } catch (e: Exception) { releaseMediaPlayer() } } @@ -441,7 +445,9 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee } override fun surfaceCreated(holder: SurfaceHolder) { - + mSurfaceHolder = holder + if (mIsFragmentVisible) + initMediaPlayer() } override fun surfaceChanged(holder: SurfaceHolder, format: Int, width: Int, height: Int) { @@ -462,7 +468,6 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee initMediaPlayer() if (mMediaPlayer == null) { - activity.toast(R.string.unknown_error_occurred) return } From 06b3c728ce27848794381df8d10e3b46682b5791 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 23 Oct 2017 23:52:37 +0200 Subject: [PATCH 059/188] no need to update last modified manually afer renaming on internal storage --- app/build.gradle | 2 +- .../kotlin/com/simplemobiletools/gallery/extensions/activity.kt | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 5d0a8fe7d..44b5233f4 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,7 +37,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.31.1' + compile 'com.simplemobiletools:commons:2.31.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/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt index 75e291505..a856ca11f 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt @@ -261,7 +261,6 @@ fun SimpleActivity.toggleFileVisibility(oldFile: File, hide: Boolean, callback: } val newFile = File(path, filename) renameFile(oldFile, newFile) { - newFile.setLastModified(System.currentTimeMillis()) callback(newFile) } } From aca83d7fadf3dde5864a0dce76f00aecba4b4e27 Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 24 Oct 2017 21:18:33 +0200 Subject: [PATCH 060/188] hide the Extended details if text is empty --- .../com/simplemobiletools/gallery/fragments/PhotoFragment.kt | 2 +- .../com/simplemobiletools/gallery/fragments/VideoFragment.kt | 2 +- 2 files changed, 2 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 a96db9a4a..b865282d3 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt @@ -275,7 +275,7 @@ class PhotoFragment : ViewPagerFragment() { view.photo_details.apply { text = getMediumExtendedDetails(medium) setTextColor(context.config.textColor) - beVisible() + beVisibleIf(text.isNotEmpty()) onGlobalLayout { if (height != 0) { val smallMargin = resources.getDimension(R.dimen.small_margin) 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 af1f02067..e271e0b90 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt @@ -505,7 +505,7 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee mView.video_details.apply { text = getMediumExtendedDetails(medium) setTextColor(context.config.textColor) - beVisible() + beVisibleIf(text.isNotEmpty()) onGlobalLayout { if (height != 0) { val smallMargin = resources.getDimension(R.dimen.small_margin) From 498cd10ba6016a37264e38de6d956a3fd4adaf6d Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 24 Oct 2017 21:53:28 +0200 Subject: [PATCH 061/188] add a medium null check at scrollStateChanged trigger --- .../gallery/activities/ViewPagerActivity.kt | 7 ++++--- 1 file changed, 4 insertions(+), 3 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 cc996366f..e9af326b0 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -730,10 +730,11 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View } private fun getCurrentMedium(): Medium? { - return if (getCurrentMedia().isEmpty() || mPos == -1) + return if (getCurrentMedia().isEmpty() || mPos == -1) { null - else + } else { getCurrentMedia()[Math.min(mPos, getCurrentMedia().size - 1)] + } } private fun getCurrentMedia() = if (mAreSlideShowMediaVisible) mSlideshowMedia else mMedia @@ -756,7 +757,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View } override fun onPageScrollStateChanged(state: Int) { - if (state == ViewPager.SCROLL_STATE_IDLE) { + if (state == ViewPager.SCROLL_STATE_IDLE && getCurrentMedium() != null) { checkOrientation() } } From 7ad578ec2e13587011e8213aabe03b3d698d607f Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 24 Oct 2017 22:20:50 +0200 Subject: [PATCH 062/188] make sure we are selecting existing indexes at media and directory adapters --- .../simplemobiletools/gallery/adapters/DirectoryAdapter.kt | 6 ++++-- .../com/simplemobiletools/gallery/adapters/MediaAdapter.kt | 6 ++++-- 2 files changed, 8 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 8edb4c9b5..7f36dfd26 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt @@ -45,8 +45,10 @@ class DirectoryAdapter(val activity: SimpleActivity, var dirs: MutableList, fun toggleItemSelection(select: Boolean, pos: Int) { if (select) { - itemViews[pos]?.medium_check?.background?.setColorFilter(primaryColor, PorterDuff.Mode.SRC_IN) - selectedPositions.add(pos) + if (itemViews[pos] != null) { + itemViews[pos].medium_check?.background?.setColorFilter(primaryColor, PorterDuff.Mode.SRC_IN) + selectedPositions.add(pos) + } } else { selectedPositions.remove(pos) } From 3e7d67a3a2317b98ff3db5901f9c6fdcdc62e362 Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 24 Oct 2017 22:57:04 +0200 Subject: [PATCH 063/188] update commons, use our custom map for determining file mimetype --- app/build.gradle | 2 +- .../com/simplemobiletools/gallery/activities/MainActivity.kt | 2 +- .../com/simplemobiletools/gallery/extensions/activity.kt | 2 +- .../kotlin/com/simplemobiletools/gallery/models/Medium.kt | 5 ++--- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 44b5233f4..4296e2ac2 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,7 +37,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.31.4' + compile 'com.simplemobiletools:commons:2.31.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' 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 ef6cae120..08a8aafbd 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -480,7 +480,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { 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") + val type = path.getMimeTypeFromPath() resultIntent.setDataAndTypeAndNormalize(uri, type) resultIntent.flags = Intent.FLAG_GRANT_READ_URI_PERMISSION or Intent.FLAG_GRANT_WRITE_URI_PERMISSION } 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 a856ca11f..4fe4d6180 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt @@ -88,7 +88,7 @@ fun Activity.setAs(uri: Uri, file: File, showToast: Boolean = true): Boolean { var success = false Intent().apply { action = Intent.ACTION_ATTACH_DATA - setDataAndType(uri, file.getMimeType("image/*")) + setDataAndType(uri, file.getMimeType()) addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) val chooser = Intent.createChooser(this, getString(R.string.set_as)) 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 fadf715ea..bf15cd20c 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/models/Medium.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/models/Medium.kt @@ -1,10 +1,9 @@ package com.simplemobiletools.gallery.models -import com.simplemobiletools.commons.extensions.getMimeType +import com.simplemobiletools.commons.extensions.getMimeTypeFromPath import com.simplemobiletools.commons.extensions.isGif import com.simplemobiletools.commons.extensions.isPng import com.simplemobiletools.commons.helpers.* -import java.io.File import java.io.Serializable data class Medium(var name: String, var path: String, val video: Boolean, val modified: Long, val taken: Long, val size: Long) : Serializable, Comparable { @@ -21,7 +20,7 @@ data class Medium(var name: String, var path: String, val video: Boolean, val mo fun isImage() = !isGif() && !video - fun getMimeType() = File(path).getMimeType() + fun getMimeType() = path.getMimeTypeFromPath() override fun compareTo(other: Medium): Int { var result: Int From fc9cb7565258848cc3106c55b4eed3fa9f1fca78 Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 24 Oct 2017 23:33:15 +0200 Subject: [PATCH 064/188] update commons to 2.31.11 --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 4296e2ac2..4375ae451 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,7 +37,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.31.10' + compile 'com.simplemobiletools:commons:2.31.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 54515b47d8bb470d7b50213c707933944a715696 Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 24 Oct 2017 23:36:44 +0200 Subject: [PATCH 065/188] adding the Folder media count toggle to 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 08a8aafbd..62f6ffa6f 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -638,6 +638,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { add(Release(127, R.string.release_127)) add(Release(133, R.string.release_133)) add(Release(136, R.string.release_136)) + add(Release(137, R.string.release_137)) checkWhatsNew(this, BuildConfig.VERSION_CODE) } } diff --git a/app/src/main/res/values/donottranslate.xml b/app/src/main/res/values/donottranslate.xml index 6aa0e6205..de109b996 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 hide folder media count on the main screen Added an option to show customizable extended details over fullscreen media Added fingerprint to hidden item protection\n From b225e2a5e588111be1208392a506f954b9679388 Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 24 Oct 2017 23:39:35 +0200 Subject: [PATCH 066/188] updated version to 2.16.1 --- app/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 4375ae451..f63fcf375 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,8 +10,8 @@ android { applicationId "com.simplemobiletools.gallery" minSdkVersion 16 targetSdkVersion 23 - versionCode 136 - versionName "2.16.0" + versionCode 137 + versionName "2.16.1" } signingConfigs { From 97b24509f1abef1c1f4565546c68aaaac7621089 Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 24 Oct 2017 23:39:40 +0200 Subject: [PATCH 067/188] updating changelog --- CHANGELOG.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 07b808103..11500d8ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,15 @@ Changelog ========== +Version 2.16.1 *(2017-10-24)* +---------------------------- + + * Added a toggle for hiding folder media count on the main screen + * Fixed SD card folders not being visible on some devices + * Fixed videos not playing properly in some cases + * Do not modify last_modified at copy/move/rename + * Added support for 3gpp videos + Version 2.16.0 *(2017-10-19)* ---------------------------- From 0140d222dd64c5d84065469f4e69b539cd234405 Mon Sep 17 00:00:00 2001 From: gregory678 Date: Wed, 25 Oct 2017 00:28:28 +0200 Subject: [PATCH 068/188] Updates for 2.16 --- app/src/main/res/values-pl/strings.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index 45144c60c..977281918 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -25,7 +25,7 @@ Ustaw jako Głośność Jasność - Do not ask again in this session + Nie pytaj więcej w tej sesji Filtruj multimedia @@ -125,10 +125,10 @@ Ukrywaj interfejs przy pełnoekranowym podglądzie Usuwaj puste foldery po usunięciu ich zawartości Zezwalaj na kontrolę jasności i głośności filmów pionowymi gestami - Show folder media count on the main view + Pokazuj liczbę elementów w folderach w głównym widoku Zamień funkcję udostępniania na obracanie w menu pełnoekranowym - Show extended details over fullscreen media - Manage extended details + Dodatkowe szczegóły przy podglądzie pełnoekranowym< + Zarządzaj dodatkowymi szczegółami From 4220d32bfcbfd8feead70cafea15d2b7df0481cc Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 25 Oct 2017 09:38:22 +0200 Subject: [PATCH 069/188] remove a double closing tag at polish translation --- app/src/main/res/values-pl/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index 977281918..c77a32cad 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -127,7 +127,7 @@ Zezwalaj na kontrolę jasności i głośności filmów pionowymi gestami Pokazuj liczbę elementów w folderach w głównym widoku Zamień funkcję udostępniania na obracanie w menu pełnoekranowym - Dodatkowe szczegóły przy podglądzie pełnoekranowym< + Dodatkowe szczegóły przy podglądzie pełnoekranowym Zarządzaj dodatkowymi szczegółami From f3d1feb141e0f2e1dabc1b6d8dec5d04d526775a Mon Sep 17 00:00:00 2001 From: gcalzo <26879397+gcalzo@users.noreply.github.com> Date: Wed, 25 Oct 2017 11:27:52 +0200 Subject: [PATCH 070/188] Update strings.xml Translated the newest strings --- app/src/main/res/values-it/strings.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 66c2fd1f3..f6c210722 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -25,7 +25,7 @@ Imposta come Volume Luminosità - Do not ask again in this session + Non chiedere nuovamente in questa sessione Filtra i media @@ -125,10 +125,10 @@ Nascondi UI di sistema con media a schermo intero Elimina cartelle vuote dopo averne eliminato il contenuto Gestisci il volume e la luminosità dei video con gesti verticali - Show folder media count on the main view + Mostra numero elementi nella cartella Sostituisci Condividi con Ruota a schermo intero - Show extended details over fullscreen media - Manage extended details + Mostra informazioni estese su media a schermo intero + Gestisci le informazioni estese From ba014d329354af2a40e1bbe36e957bf90f7dedfb Mon Sep 17 00:00:00 2001 From: fiepi Date: Wed, 25 Oct 2017 18:17:58 +0800 Subject: [PATCH 071/188] add oreo adaptive icon --- app/build.gradle | 6 +++--- .../main/res/mipmap-anydpi-v26/ic_launcher.xml | 5 +++++ .../res/mipmap-anydpi-v26/ic_launcher_round.xml | 5 +++++ .../res/mipmap-nodpi/ic_launcher_foreground.png | Bin 0 -> 2304 bytes app/src/main/res/values/colors.xml | 2 ++ 5 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml create mode 100644 app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml create mode 100644 app/src/main/res/mipmap-nodpi/ic_launcher_foreground.png diff --git a/app/build.gradle b/app/build.gradle index f63fcf375..2cb3f22b5 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -3,13 +3,13 @@ apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' android { - compileSdkVersion 25 - buildToolsVersion "25.0.3" + compileSdkVersion 26 + buildToolsVersion "26.0.1" defaultConfig { applicationId "com.simplemobiletools.gallery" minSdkVersion 16 - targetSdkVersion 23 + targetSdkVersion 26 versionCode 137 versionName "2.16.1" } diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 000000000..f4091292b --- /dev/null +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 000000000..f4091292b --- /dev/null +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/app/src/main/res/mipmap-nodpi/ic_launcher_foreground.png b/app/src/main/res/mipmap-nodpi/ic_launcher_foreground.png new file mode 100644 index 0000000000000000000000000000000000000000..24b7f2986dcc07995d09f09e72083440da827ca3 GIT binary patch literal 2304 zcmc&$`8U-28~;qEvCkyNmNjE5ds7kP>ssPtY`KW6*#|MkZrn1Ii5B^c-B7ajRp_E9 z#*iuFDW)g}0DvUu zVCxP5F!;|DK?s<)B91=`@C0knLqrf6BB56WSd{4ClK=q7mp>C$bQF0=Kq@5Kc_;oF z7oM1Mo)iY8q@)-SVxtp6&J)87;z$t{%NB|NAo3e%`-?{^o%i8FW0c*-jhxGo_{oNFTlJ21494y z8FtH5Wk>^v74Um>dbJC38$CoGQOeLD&8q) z+LOElrNfm_7Jx;E%VBTA%rKcD5%XUh5>$r8`IMtAP6nHJ$09oqO?r_npgwrFV(ML+ z!``v5Ezx(QDkZg2FkcFlg2QRTBTG%vSssk;7N6T~M&bl=wBdf?Joeeqs@ZlGLA z7yq_Qg{yN#~Iz{ZU3O115K7Zmxb$(tAgCu5 zO?_9y*$EX|Ei!X9lTX=3vN*b&Qx^JQ`9)?jhl&qe`b`6q)j$~X+=}EGJA76k%C7X+ zy=)!-_}qn^?b#w65MUn5o0oC!5elGf94JE7_JE&CF+-R%3ziTVi(mU%PjK{qQn+pr zB+mJe1s&wznYStK{dBM#fnVI(uDf)*MLECLF;caC=k@QEyJ>gU<0Bv~sg>ga-l$g8 zmNwCWH;IuHNi}bh6V?Z28kKL?QULSJ{_)P`|Dd{ilj#rwnC`|(d%vMEjXOe$JPr__ zxsT1HSHUiNnFoMZ0DJu(f6X+SafaFP_#;4P_WL1?QlSiyJS;x*+R082Zvu*_>SgTM zM%j?aGUzYi^&L4)I05t`WX&<~NJG0SAF>{F3NVQ1u6yn%(2Yo#-fIY5v1pR7Bfw+! z?b<%ooz(sbg#3Q#ZOi`aesE#^exl-HiB`&abPcqn^Eg*nsgP?AK9XGukA@Oj^UjpV zFvk+fbI)`HS}ioOFOvnZCExVAb>~o8rl{CoBlB(e!Zo<9T2z8eb16=}nXwh)z;xU+_CE#+3#6F!>1t)OVo zEK0cxNdZreu|UBERBBND_QLTMD?S7Qr{ga%@>Zp57zN1+L|^E|iIuerV6$=uiZHkG z93M}M;vPB88EJn*xv};>p{Ogg@%o0r3o4`(U|yWG=Oi7Bd*Dz5ZT`j{jXqq)9tA((uxCe_pjraLN-?2Y< zRHbt6Qzlkx@Lrg;ygV@qGQ>=sF)zM}1WD5TCixa;k~@2_pP^L1O~5^BNJ^cGw`%XN z{!qdlUFW~L7iP@DfeeV-|B2z@J!s8-b1Ppa()VcT0R-HyD7nih7o9s>?piVZ2px6F z6`H|1e_gibMJq@@x5^x$eK!c(%^N@czl+6lG{0%=pz?mco0CYkH(Q>p#>!odux#F| z?b#+UlGWM)icI*`Igu$vReP_MEB zVs{^Wx}?L3?+7WA;tvPZrA3cmN0H&OU7#_>WUVGamya}7;ejL2%y7trZ;7K$YK3&AEBz&2l zFq(t98H95CXkim^y81f26U#C)R*>LvFcTBVU@udf1sKtqO-4^U+z+v230Kr_d-AO6 zD@Cg{*wljWCsu=ZR6rBJ7 literal 0 HcmV?d00001 diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 8cb25a2bb..9a1b0498f 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -7,4 +7,6 @@ @color/default_dark_theme_text_color @color/default_dark_theme_background_color + + #f68630 From c6c0fe92366801f65dbcfdf44d2ce795236081c8 Mon Sep 17 00:00:00 2001 From: Guillaume Date: Wed, 25 Oct 2017 13:44:20 +0200 Subject: [PATCH 072/188] Dutch translation --- app/src/main/res/values-nl/strings.xml | 150 +++++++++++++++++++++++++ 1 file changed, 150 insertions(+) create mode 100644 app/src/main/res/values-nl/strings.xml diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml new file mode 100644 index 000000000..7f5988441 --- /dev/null +++ b/app/src/main/res/values-nl/strings.xml @@ -0,0 +1,150 @@ + + + Simple Gallery + Gallerij + Bewerken + Camera + Openen met + Geen app gevonden om dit bestand mee te openen + (verborgen) + Map vastzetten + Map losmaken + Inhoud van mappen recursief weergeven + Alle mappen + Mapweergave + Andere map + Op kaart tonen + Locatie onbekend + Geen app voor kaarten gevonden + Geen app voor camera gevonden + Meer kolommen + Minder kolommen + Afbeelding voor omslag veranderen + Foto selecteren + Standaard gebruiken + Instellen als + Volume + Helderheid + Onthouden voor deze sessie + + + Media kiezen + Afbeeldingen + Video\'s + GIF-bestanden + Geen bestanden gevonden met de huidige filters. + Media kiezen + + + Deze functie verbergt de map door het bestand \'.nomedia\' toe te voegen. Alle submappen zullen ook worden verborgen. Kies \'Verborgen mappen tonen\' in de instellingen om toch verborgen mappen te kunnen inzien. Doorgaan? + Uitsluiten + Uitgesloten mappen + Uitgesloten mappen beheren + De selectie en submappen uitsluiten van deze gallerij. Uitgesloten mappen kunnen worden beheerd in de instellingen. + Map die dit item bevat uitsluiten? + Uitsluiten zal mappen en hun submappen verbergen voor deze gallerij, maar niet voor andere apps.\n\nAls u de mappen ook in andere apps wilt verbergen, kies dan voor de functie Verbergen. + Alles verwijderen + Verwijder alles uit de lijst van uitgesloten mappen? Dit zal de mappen zelf niet verwijderen. + + + Ingesloten mappen + Ingesloten mappen beheren + Map toevoegen + Als er mappen zijn die wel media bevatten, maar niet niet door de gallerij worden herkend, voeg deze mappen dan hier handmatig toe.\n\nHet hier toevoegen van mappen zal andere mappen niet uitsluiten. + + + Grootte aanpassen + Grootte aanpassen en opslaan + Breedte + Hoogte + Verhouding vergrendelen + Voer geldige afmetingen in + + + Bewerken + Opslaan + Draaien + Pad + Ongeldig pad naar afbeelding + Fout bij bewerken van afbeelding + Afbeelding bewerken met: + Geen app gevonden voor bewerking + Onbekende bestandslocatie + Kan het bronbestand niet overschrijven + Linksom draaien + Rechtsom draaien + 180º draaien + Kantelen + Horizontaal kantelen + Verticaal kantelen + Bewerken met + + + Achtergrond + Als achtergrond instellen + Achtergrond instellen mislukt + Achtergrond instellen met: + Geen app gevonden voor instellen achtergrond + Achtergrond instellen… + Achtergrond is ingesteld + Verhouding in portretmodus + Verhouding in landschapsmodus + + + Diavoorstelling + Interval (seconden): + Afbeeldingen weergeven + Video\'s weergeven + GIF-bestanden weergeven + Willekeurige volgorde + Animaties gebruiken (vervagen) + Omgekeerde volgorde + Voorstelling herhalen + De diavoorstelling is beëindigd + Geen media gevonden voor diavoorstelling + + + Weergave + Rooster + Lijst + + + Verborgen mappen tonen + Video\'s automatisch afspelen + Bestandsnamen tonen + Video\'s herhalen + GIF-bestanden afspelen in overzicht + Maximale helderheid in volledige weergave + Voorbeelden vierkant bijsnijden + Media in volledige weergave roteren volgens + Systeeminstelling + Rotatie van apparaat + Afmetingen van bestand + Donkere achtergrond bij volledige weergave + Horizontaal scrollen + Automatisch de statusbalk verbergen in volledige weergave + Lege mappen verwijderen na het verwijderen van hun inhoud + Volume en helderheid aanpassen met verticale sleepgebaren + Aantallen in mappen tonen + Menu-item Draaien vastzetten in volledige weergave (in plaats van Delen) + Uitgebreide informatie tonen in volledige weergave + Uitgebreide informatie + + + + Een gallerij voor afbeeldingen en video\'s, zonder advertenties. + + Een simpele gallerij voor afbeeldingen en video\'s. Bestanden kunnen worden gesorteerd op datum, grootte en naam. Afbeeldingen kunnen in- en uitgezoomd worden. Bestanden worden afhankelijk van de schermgrootte weergegeven in kolommen, waarbij het aantal kolommen kan worden aangepast via knijpgebaren. Bestanden kunnen worden gedeeld, hernoemd, gekopieerd, verplaatst en verwijderd. Afbeeldingen kunnen ook worden bijgesneden, gedraaid, gekanteld of direct vanuit de app als achtergrond worden ingesteld. + + De gallerij kan ook worden gebruikt voor het bekijken van afbeeldingen of video\'s vanuit andere apps, om bijlagen toe te voegen in e-mail, etc. Perfect voor dagelijks gebruik. + + Bevat geen advertenties of onnodige permissies. Volledig open-source. Kleuren van de app kunnen worden aangepast. + + Deze app is onderdeel van een grotere verzameling. Vind de andere apps op http://www.simplemobiletools.com + + + + \ No newline at end of file From ed74780a5047c76dc96084e36256a0cda7752acd Mon Sep 17 00:00:00 2001 From: fiepi Date: Wed, 25 Oct 2017 22:57:04 +0800 Subject: [PATCH 073/188] back target sdk 23 --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 2cb3f22b5..54a7bb0ef 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -9,7 +9,7 @@ android { defaultConfig { applicationId "com.simplemobiletools.gallery" minSdkVersion 16 - targetSdkVersion 26 + targetSdkVersion 23 versionCode 137 versionName "2.16.1" } From 57be5717a1ada47d06f8acc5daee2378dcc49ef7 Mon Sep 17 00:00:00 2001 From: Tibor Kaputa Date: Wed, 25 Oct 2017 17:54:18 +0200 Subject: [PATCH 074/188] do not update the build tools and compile sdk version --- app/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 54a7bb0ef..f63fcf375 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -3,8 +3,8 @@ apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' android { - compileSdkVersion 26 - buildToolsVersion "26.0.1" + compileSdkVersion 25 + buildToolsVersion "25.0.3" defaultConfig { applicationId "com.simplemobiletools.gallery" From e8645f34b72e43b008a8474d37e5f08fcf74e7f4 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 25 Oct 2017 17:57:10 +0200 Subject: [PATCH 075/188] use a color constant for setting adaptive icon background color --- app/src/main/res/values/colors.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 9a1b0498f..ee1e5614a 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -8,5 +8,5 @@ @color/default_dark_theme_text_color @color/default_dark_theme_background_color - #f68630 + @color/color_primary From 65f147bc016f70136d7a3df1b6baf32a76d93f08 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 25 Oct 2017 22:06:34 +0200 Subject: [PATCH 076/188] updating Show Media Count german trnaslation --- app/src/main/res/values-de/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index da95fadc3..4f3e23a51 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -125,7 +125,7 @@ Systemleisten ausblenden im Vollbild Nach Löschen leere Ordner löschen Gesten für Videolautstärke/Helligkeit - Show folder media count on the main view + Medienanzahl bei Ordnern anzeigen Teilen/Drehen im Vollbild-Menü vertauschen Eigenschaften anzeigen im Vollbild Eigenschaften auswählen From 8e99cd5364527f4e97c3dc1f9ca4ff4e3e7bebfa Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 26 Oct 2017 09:34:26 +0200 Subject: [PATCH 077/188] update commons to 2.32.0 --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index f63fcf375..e5b802d48 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,7 +37,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.31.11' + compile 'com.simplemobiletools:commons:2.32.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 7f10f67c7b42771fbcd30176715bef8b710c01d9 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 26 Oct 2017 10:10:11 +0200 Subject: [PATCH 078/188] fix #386, automatically append "_1" after the filename when saving in editor --- .../simplemobiletools/gallery/activities/EditActivity.kt | 4 ++-- .../gallery/activities/ViewPagerActivity.kt | 2 +- .../com/simplemobiletools/gallery/dialogs/SaveAsDialog.kt | 6 +++++- 3 files changed, 8 insertions(+), 4 deletions(-) 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 dc09ee11e..61359be9e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/EditActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/EditActivity.kt @@ -141,13 +141,13 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener setResult(RESULT_OK) finish() } else if (uri.scheme == "file") { - SaveAsDialog(this, uri.path) { + SaveAsDialog(this, uri.path, true) { saveBitmapToFile(result.bitmap, it) } } else if (uri.scheme == "content") { val newPath = applicationContext.getRealPathFromURI(uri) ?: "" if (!newPath.isEmpty()) { - SaveAsDialog(this, newPath) { + SaveAsDialog(this, newPath, true) { saveBitmapToFile(result.bitmap, it) } } else { 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 e9af326b0..c56d37d31 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -446,7 +446,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View private fun saveImageAs() { val currPath = getCurrentPath() - SaveAsDialog(this, currPath) { + SaveAsDialog(this, currPath, false) { Thread({ toast(R.string.saving) val selectedFile = File(it) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/SaveAsDialog.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/SaveAsDialog.kt index 503e0f741..f97e2fb99 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/SaveAsDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/SaveAsDialog.kt @@ -11,7 +11,7 @@ import com.simplemobiletools.gallery.activities.SimpleActivity import kotlinx.android.synthetic.main.dialog_save_as.view.* import java.io.File -class SaveAsDialog(val activity: SimpleActivity, val path: String, val callback: (savePath: String) -> Unit) { +class SaveAsDialog(val activity: SimpleActivity, val path: String, val appendFilename: Boolean, val callback: (savePath: String) -> Unit) { init { var realPath = File(path).parent.trimEnd('/') @@ -28,6 +28,10 @@ class SaveAsDialog(val activity: SimpleActivity, val path: String, val callback: save_as_extension.setText(extension) } + if (appendFilename) { + name += "_1" + } + save_as_name.setText(name) save_as_path.setOnClickListener { FilePickerDialog(activity, realPath, false, false, true) { From 1d3ac6afb9998f5f7a5c8807363f66b32abe6c57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Marques?= Date: Thu, 26 Oct 2017 13:28:01 +0100 Subject: [PATCH 079/188] Update strings.xml --- app/src/main/res/values-pt/strings.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index bdbf21597..09e7a83d3 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -25,7 +25,7 @@ Definir como Volume Brilho - Do not ask again in this session + Não perguntar de novo para esta sessão Filtrar multimédia @@ -127,8 +127,8 @@ Permitir controlo do volume e brilho dos vídeos através de gestos verticais Show folder media count on the main view Substituir a opção Partilhar pela opção Rodar se em ecrã completo - Show extended details over fullscreen media - Manage extended details + Mostrar detalhes se em ecrã completo + Gerir detalhes exibidos From 8686022c8995a01129c6a1cfa4e3ec73bcfa903c Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 26 Oct 2017 17:24:52 +0200 Subject: [PATCH 080/188] set initial mIsFragmentVisible to true at third party intents --- .../com/simplemobiletools/gallery/fragments/VideoFragment.kt | 2 ++ 1 file changed, 2 insertions(+) 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 e271e0b90..f5603c222 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt @@ -15,6 +15,7 @@ import android.widget.SeekBar import android.widget.TextView import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.gallery.R +import com.simplemobiletools.gallery.activities.VideoActivity import com.simplemobiletools.gallery.activities.ViewPagerActivity import com.simplemobiletools.gallery.extensions.* import com.simplemobiletools.gallery.helpers.MEDIUM @@ -64,6 +65,7 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee mTimeHolder = mView.video_time_holder medium = arguments.getSerializable(MEDIUM) as Medium + mIsFragmentVisible = activity is VideoActivity // setMenuVisibility is not called at VideoActivity (third party intent) setupPlayer() if (savedInstanceState != null) { mCurrTime = savedInstanceState.getInt(PROGRESS) From fa2a237593967760cecb4e5ff1ef7cdc821da360 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 26 Oct 2017 23:43:13 +0200 Subject: [PATCH 081/188] update target SDK to 26 and handle fileprovider --- app/build.gradle | 8 +- app/src/main/AndroidManifest.xml | 10 +- .../gallery/activities/EditActivity.kt | 7 +- .../gallery/activities/MainActivity.kt | 6 +- .../gallery/activities/MediaActivity.kt | 4 +- .../gallery/activities/PhotoActivity.kt | 2 +- .../gallery/activities/PhotoVideoActivity.kt | 34 ++---- .../gallery/activities/VideoActivity.kt | 2 +- .../gallery/activities/ViewPagerActivity.kt | 6 +- .../gallery/adapters/MediaAdapter.kt | 3 +- .../gallery/extensions/activity.kt | 108 +++--------------- .../gallery/extensions/context.kt | 24 ++++ .../gallery/fragments/PhotoFragment.kt | 10 +- .../gallery/fragments/VideoFragment.kt | 32 +++++- 14 files changed, 110 insertions(+), 146 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index e5b802d48..784e54418 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -3,13 +3,13 @@ apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' android { - compileSdkVersion 25 - buildToolsVersion "25.0.3" + compileSdkVersion 26 + buildToolsVersion "26.0.2" defaultConfig { applicationId "com.simplemobiletools.gallery" minSdkVersion 16 - targetSdkVersion 23 + targetSdkVersion 26 versionCode 137 versionName "2.16.1" } @@ -37,7 +37,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.32.0' + compile 'com.simplemobiletools:commons:2.32.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/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index fb8ba91aa..ff7ff3399 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -83,16 +83,16 @@ android:label="@string/third_party_licences" android:parentActivityName="com.simplemobiletools.commons.activities.AboutActivity"/> - - + + @@ -137,10 +121,10 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList return true when (item.itemId) { - R.id.menu_set_as -> trySetAs(File(mMedium!!.path)) - R.id.menu_open_with -> openWith(File(mMedium!!.path)) - R.id.menu_share -> shareUri(mMedium!!, mUri) - R.id.menu_edit -> openFileEditor(File(mMedium!!.path)) + R.id.menu_set_as -> setAs(mUri) + R.id.menu_open_with -> openFile(mUri) + R.id.menu_share -> shareUri(mUri) + R.id.menu_edit -> openEditor(mUri) else -> return super.onOptionsItemSelected(item) } return true diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/VideoActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/VideoActivity.kt index fa38734e3..7ca92e902 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/VideoActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/VideoActivity.kt @@ -5,7 +5,7 @@ import android.os.Bundle class VideoActivity : PhotoVideoActivity() { override fun onCreate(savedInstanceState: Bundle?) { - PhotoVideoActivity.mIsVideo = true + mIsVideo = true super.onCreate(savedInstanceState) } } 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 c56d37d31..5db29688f 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -246,18 +246,18 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View return true when (item.itemId) { - R.id.menu_set_as -> trySetAs(getCurrentFile()) + R.id.menu_set_as -> setAs(Uri.fromFile(getCurrentFile())) R.id.slideshow -> initSlideshow() R.id.menu_copy_to -> copyMoveTo(true) R.id.menu_move_to -> copyMoveTo(false) - R.id.menu_open_with -> openWith(getCurrentFile()) + R.id.menu_open_with -> openFile(Uri.fromFile(getCurrentFile())) R.id.menu_hide -> toggleFileVisibility(true) R.id.menu_unhide -> toggleFileVisibility(false) R.id.menu_share_1 -> shareMedium(getCurrentMedium()!!) R.id.menu_share_2 -> shareMedium(getCurrentMedium()!!) R.id.menu_delete -> checkDeleteConfirmation() R.id.menu_rename -> renameFile() - R.id.menu_edit -> openFileEditor(getCurrentFile()) + R.id.menu_edit -> openEditor(Uri.fromFile(getCurrentFile())) R.id.menu_properties -> showProperties() R.id.show_on_map -> showOnMap() R.id.menu_rotate -> rotateImage() 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 d1918aaad..1be8d7856 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.net.Uri import android.os.Build import android.support.v7.view.ActionMode import android.support.v7.widget.RecyclerView @@ -159,7 +160,7 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList, } private fun editFile() { - activity.openFileEditor(getCurrentFile()) + activity.openEditor(Uri.fromFile(getCurrentFile())) actMode?.finish() } 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 4fe4d6180..32cd94836 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt @@ -2,16 +2,10 @@ package com.simplemobiletools.gallery.extensions import android.app.Activity import android.content.Intent -import android.database.Cursor import android.net.Uri -import android.os.Build import android.provider.MediaStore import android.support.v7.app.AppCompatActivity -import android.util.DisplayMetrics -import android.view.KeyCharacterMap -import android.view.KeyEvent import android.view.View -import android.view.ViewConfiguration import com.bumptech.glide.Glide import com.bumptech.glide.load.DecodeFormat import com.bumptech.glide.load.engine.DiskCacheStrategy @@ -34,12 +28,12 @@ import com.simplemobiletools.gallery.views.MySquareImageView import java.io.File import java.util.* -fun Activity.shareUri(medium: Medium, uri: Uri) { +fun Activity.shareUri(uri: Uri) { val shareTitle = resources.getString(R.string.share_via) Intent().apply { action = Intent.ACTION_SEND - putExtra(Intent.EXTRA_STREAM, uri) - type = medium.getMimeType() + putExtra(Intent.EXTRA_STREAM, ensurePublicUri(uri)) + type = getMimeTypeFromUri(uri) addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) startActivity(Intent.createChooser(this, shareTitle)) } @@ -48,12 +42,12 @@ fun Activity.shareUri(medium: Medium, uri: Uri) { fun Activity.shareMedium(medium: Medium) { val shareTitle = resources.getString(R.string.share_via) val file = File(medium.path) - val uri = Uri.fromFile(file) + val uri = getFilePublicUri(file, BuildConfig.APPLICATION_ID) Intent().apply { action = Intent.ACTION_SEND putExtra(Intent.EXTRA_STREAM, uri) - type = medium.getMimeType() + type = getMimeTypeFromUri(uri) addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) startActivity(Intent.createChooser(this, shareTitle)) } @@ -61,7 +55,7 @@ fun Activity.shareMedium(medium: Medium) { fun Activity.shareMedia(media: List) { val shareTitle = resources.getString(R.string.share_via) - val uris = media.map { Uri.fromFile(File(it.path)) } as ArrayList + val uris = media.map { getFilePublicUri(File(it.path), BuildConfig.APPLICATION_ID) } as ArrayList Intent().apply { action = Intent.ACTION_SEND_MULTIPLE @@ -72,119 +66,55 @@ fun Activity.shareMedia(media: List) { } } -fun Activity.trySetAs(file: File) { - try { - var uri = Uri.fromFile(file) - if (!setAs(uri, file)) { - uri = getFileContentUri(file) - setAs(uri, file, false) - } - } catch (e: Exception) { - toast(R.string.unknown_error_occurred) - } -} - -fun Activity.setAs(uri: Uri, file: File, showToast: Boolean = true): Boolean { - var success = false +fun Activity.setAs(uri: Uri) { + val newUri = ensurePublicUri(uri) Intent().apply { action = Intent.ACTION_ATTACH_DATA - setDataAndType(uri, file.getMimeType()) + setDataAndType(newUri, getMimeTypeFromUri(newUri)) addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) val chooser = Intent.createChooser(this, getString(R.string.set_as)) - success = if (resolveActivity(packageManager) != null) { + if (resolveActivity(packageManager) != null) { startActivityForResult(chooser, REQUEST_SET_AS) - true } else { - if (showToast) { - toast(R.string.no_capable_app_found) - } - false + toast(R.string.no_capable_app_found) } } - - return success } -fun Activity.getFileContentUri(file: File): Uri? { - val uri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI - val projection = arrayOf(MediaStore.Images.Media._ID) - val selection = "${MediaStore.Images.Media.DATA} = ?" - val selectionArgs = arrayOf(file.absolutePath) - - var cursor: Cursor? = null - try { - cursor = contentResolver.query(uri, projection, selection, selectionArgs, null) - if (cursor?.moveToFirst() == true) { - val id = cursor.getIntValue(MediaStore.Images.Media._ID) - return Uri.withAppendedPath(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, "$id") - } - } finally { - cursor?.close() - } - return null -} - -fun Activity.openWith(file: File, forceChooser: Boolean = true) { - val uri = Uri.fromFile(file) +fun Activity.openFile(uri: Uri) { + val newUri = ensurePublicUri(uri) Intent().apply { action = Intent.ACTION_VIEW - setDataAndType(uri, file.getMimeType()) + setDataAndType(newUri, getMimeTypeFromUri(newUri)) 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)) - startActivity(if (forceChooser) chooser else this) + startActivity(chooser) } else { toast(R.string.no_app_found) } } } -fun Activity.openFileEditor(file: File) { - openEditor(Uri.fromFile(file)) -} - -fun Activity.openEditor(uri: Uri, forceChooser: Boolean = false) { +fun Activity.openEditor(uri: Uri) { + val newUri = ensurePublicUri(uri) Intent().apply { action = Intent.ACTION_EDIT - setDataAndType(uri, "image/*") + setDataAndType(newUri, getMimeTypeFromUri(newUri)) addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) if (resolveActivity(packageManager) != null) { val chooser = Intent.createChooser(this, getString(R.string.edit_image_with)) - startActivityForResult(if (forceChooser) chooser else this, REQUEST_EDIT_IMAGE) + startActivityForResult(chooser, REQUEST_EDIT_IMAGE) } else { toast(R.string.no_editor_found) } } } -fun Activity.hasNavBar(): Boolean { - return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { - val display = windowManager.defaultDisplay - - val realDisplayMetrics = DisplayMetrics() - display.getRealMetrics(realDisplayMetrics) - - val realHeight = realDisplayMetrics.heightPixels - val realWidth = realDisplayMetrics.widthPixels - - val displayMetrics = DisplayMetrics() - display.getMetrics(displayMetrics) - - val displayHeight = displayMetrics.heightPixels - val displayWidth = displayMetrics.widthPixels - - realWidth - displayWidth > 0 || realHeight - displayHeight > 0 - } else { - val hasMenuKey = ViewConfiguration.get(applicationContext).hasPermanentMenuKey() - val hasBackKey = KeyCharacterMap.deviceHasKey(KeyEvent.KEYCODE_BACK) - !hasMenuKey && !hasBackKey - } -} - fun Activity.launchCamera() { val intent = Intent(MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA) if (intent.resolveActivity(packageManager) != null) { 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 cdda71ab7..82c101a89 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt @@ -5,12 +5,18 @@ import android.content.Intent import android.content.res.Configuration import android.graphics.Point import android.media.AudioManager +import android.net.Uri import android.os.Build import android.view.WindowManager +import com.simplemobiletools.commons.extensions.getFilePublicUri +import com.simplemobiletools.commons.extensions.getMimeTypeFromPath +import com.simplemobiletools.commons.extensions.getRealPathFromURI import com.simplemobiletools.commons.extensions.humanizePath +import com.simplemobiletools.gallery.BuildConfig import com.simplemobiletools.gallery.activities.SettingsActivity import com.simplemobiletools.gallery.helpers.Config import com.simplemobiletools.gallery.models.Directory +import java.io.File val Context.portrait get() = resources.configuration.orientation == Configuration.ORIENTATION_PORTRAIT val Context.audioManager get() = getSystemService(Context.AUDIO_SERVICE) as AudioManager @@ -73,3 +79,21 @@ fun Context.getSortedDirectories(source: ArrayList): ArrayList= Build.VERSION_CODES.JELLY_BEAN_MR1) { + val display = context.windowManager.defaultDisplay + + val realDisplayMetrics = DisplayMetrics() + display.getRealMetrics(realDisplayMetrics) + + val realHeight = realDisplayMetrics.heightPixels + val realWidth = realDisplayMetrics.widthPixels + + val displayMetrics = DisplayMetrics() + display.getMetrics(displayMetrics) + + val displayHeight = displayMetrics.heightPixels + val displayWidth = displayMetrics.widthPixels + + realWidth - displayWidth > 0 || realHeight - displayHeight > 0 + } else { + val hasMenuKey = ViewConfiguration.get(context).hasPermanentMenuKey() + val hasBackKey = KeyCharacterMap.deviceHasKey(KeyEvent.KEYCODE_BACK) + !hasMenuKey && !hasBackKey + } + } + private fun setupTimeHolder() { mSeekBar!!.max = mDuration mView.video_duration.text = mDuration.getFormattedDuration() From 8e8c0b127d1fea0a7e8a2ef7bc531ee6abeccc27 Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 27 Oct 2017 09:33:17 +0200 Subject: [PATCH 082/188] add an Open With menu button to media thumbnails view --- .../com/simplemobiletools/gallery/adapters/MediaAdapter.kt | 4 +++- app/src/main/res/menu/cab_media.xml | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) 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 1be8d7856..64ea45c2a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt @@ -87,6 +87,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_open_with -> activity.openFile(Uri.fromFile(getCurrentFile())) R.id.cab_delete -> checkDeleteConfirmation() else -> return false } @@ -101,7 +102,8 @@ 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_rename).isVisible = selectedPositions.size == 1 + menu.findItem(R.id.cab_open_with).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 diff --git a/app/src/main/res/menu/cab_media.xml b/app/src/main/res/menu/cab_media.xml index fa787d520..bcf08f106 100644 --- a/app/src/main/res/menu/cab_media.xml +++ b/app/src/main/res/menu/cab_media.xml @@ -46,6 +46,10 @@ android:icon="@drawable/ic_select_all" android:title="@string/select_all" app:showAsAction="ifRoom"/> + Date: Fri, 27 Oct 2017 09:36:41 +0200 Subject: [PATCH 083/188] add Set As to the media thumbnails view --- .../com/simplemobiletools/gallery/adapters/MediaAdapter.kt | 6 +++++- app/src/main/res/menu/cab_media.xml | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) 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 64ea45c2a..b71a694a7 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt @@ -88,6 +88,7 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList, R.id.cab_move_to -> copyMoveTo(false) R.id.cab_select_all -> selectAll() R.id.cab_open_with -> activity.openFile(Uri.fromFile(getCurrentFile())) + R.id.cab_set_as -> activity.setAs(Uri.fromFile(getCurrentFile())) R.id.cab_delete -> checkDeleteConfirmation() else -> return false } @@ -104,7 +105,8 @@ 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_open_with).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_edit).isVisible = isOneImageSelected() + menu.findItem(R.id.cab_set_as).isVisible = isOneImageSelected() menu.findItem(R.id.cab_confirm_selection).isVisible = isPickIntent && allowMultiplePicks && selectedPositions.size > 0 checkHideBtnVisibility(menu) @@ -135,6 +137,8 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList, menu.findItem(R.id.cab_hide).isVisible = unhiddenCnt > 0 menu.findItem(R.id.cab_unhide).isVisible = hiddenCnt > 0 } + + private fun isOneImageSelected() = selectedPositions.size == 1 && media.size > selectedPositions.first() && media[selectedPositions.first()].isImage() } private fun confirmSelection() { diff --git a/app/src/main/res/menu/cab_media.xml b/app/src/main/res/menu/cab_media.xml index bcf08f106..8ebb87f08 100644 --- a/app/src/main/res/menu/cab_media.xml +++ b/app/src/main/res/menu/cab_media.xml @@ -50,6 +50,10 @@ android:id="@+id/cab_open_with" android:title="@string/open_with" app:showAsAction="never"/> + Date: Fri, 27 Oct 2017 10:07:58 +0200 Subject: [PATCH 084/188] send the real file path with edit intent --- .../gallery/activities/EditActivity.kt | 36 ++++++++++--------- .../gallery/extensions/activity.kt | 9 ++--- .../gallery/extensions/context.kt | 2 -- .../gallery/helpers/Constants.kt | 1 + 4 files changed, 25 insertions(+), 23 deletions(-) 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 2f02fd847..b0391e7a8 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/EditActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/EditActivity.kt @@ -7,7 +7,6 @@ import android.graphics.Point import android.net.Uri import android.os.Bundle import android.provider.MediaStore -import android.util.Log import android.view.Menu import android.view.MenuItem import com.simplemobiletools.commons.extensions.* @@ -15,15 +14,15 @@ import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.dialogs.ResizeDialog import com.simplemobiletools.gallery.dialogs.SaveAsDialog import com.simplemobiletools.gallery.extensions.openEditor +import com.simplemobiletools.gallery.helpers.REAL_FILE_PATH import com.theartofdev.edmodo.cropper.CropImageView import kotlinx.android.synthetic.main.view_crop_image.* import java.io.* class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener { - val TAG = EditActivity::class.java.simpleName - val ASPECT_X = "aspectX" - val ASPECT_Y = "aspectY" - val CROP = "crop" + private val ASPECT_X = "aspectX" + private val ASPECT_Y = "aspectY" + private val CROP = "crop" lateinit var uri: Uri var resizeWidth = 0 @@ -41,18 +40,24 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener return } - uri = intent.data - if (uri.scheme != "file" && uri.scheme != "content") { - toast(R.string.unknown_file_location) - finish() - return + val realPath = intent.extras?.get(REAL_FILE_PATH)?.toString() ?: "" + if (realPath.isNotEmpty()) { + val file = File(realPath) + uri = Uri.fromFile(file) + } else { + uri = intent.data + if (uri.scheme != "file" && uri.scheme != "content") { + toast(R.string.unknown_file_location) + finish() + return + } } isCropIntent = intent.extras?.get(CROP) == "true" crop_image_view.apply { setOnCropImageCompleteListener(this@EditActivity) - setImageUriAsync(intent.data) + setImageUriAsync(uri) if (isCropIntent && shouldCropSquare()) setFixedAspectRatio(true) @@ -66,8 +71,9 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener override fun onStop() { super.onStop() - if (isEditingWithThirdParty) + if (isEditingWithThirdParty) { finish() + } } override fun onCreateOptionsMenu(menu: Menu): Boolean { @@ -152,11 +158,9 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener } } else { toast(R.string.image_editing_failed) - finish() } } else { toast(R.string.unknown_file_location) - finish() } } else { toast("${getString(R.string.image_editing_failed)}: ${result.error.message}") @@ -175,9 +179,7 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener } } } catch (e: Exception) { - Log.e(TAG, "Crop compressing failed $path $e") - toast(R.string.image_editing_failed) - finish() + showErrorToast(e) } catch (e: OutOfMemoryError) { toast(R.string.out_of_memory_error) } 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 32cd94836..84165cca9 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt @@ -18,10 +18,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 +import com.simplemobiletools.gallery.helpers.* import com.simplemobiletools.gallery.models.Directory import com.simplemobiletools.gallery.models.Medium import com.simplemobiletools.gallery.views.MySquareImageView @@ -106,6 +103,10 @@ fun Activity.openEditor(uri: Uri) { setDataAndType(newUri, getMimeTypeFromUri(newUri)) addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) + if (uri.scheme == "file" && isNougatPlus()) { + putExtra(REAL_FILE_PATH, uri.path) + } + if (resolveActivity(packageManager) != null) { val chooser = Intent.createChooser(this, getString(R.string.edit_image_with)) startActivityForResult(chooser, REQUEST_EDIT_IMAGE) 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 82c101a89..922ad88ff 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt @@ -10,7 +10,6 @@ import android.os.Build import android.view.WindowManager import com.simplemobiletools.commons.extensions.getFilePublicUri import com.simplemobiletools.commons.extensions.getMimeTypeFromPath -import com.simplemobiletools.commons.extensions.getRealPathFromURI import com.simplemobiletools.commons.extensions.humanizePath import com.simplemobiletools.gallery.BuildConfig import com.simplemobiletools.gallery.activities.SettingsActivity @@ -81,7 +80,6 @@ fun Context.getSortedDirectories(source: ArrayList): ArrayList Date: Fri, 27 Oct 2017 10:34:16 +0200 Subject: [PATCH 085/188] replace sending real_file_path with extra_output at the editor --- .../gallery/activities/EditActivity.kt | 35 +++++++++---------- .../gallery/extensions/activity.kt | 9 +++-- 2 files changed, 22 insertions(+), 22 deletions(-) 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 b0391e7a8..db8277eba 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/EditActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/EditActivity.kt @@ -14,7 +14,6 @@ import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.dialogs.ResizeDialog import com.simplemobiletools.gallery.dialogs.SaveAsDialog import com.simplemobiletools.gallery.extensions.openEditor -import com.simplemobiletools.gallery.helpers.REAL_FILE_PATH import com.theartofdev.edmodo.cropper.CropImageView import kotlinx.android.synthetic.main.view_crop_image.* import java.io.* @@ -25,6 +24,7 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener private val CROP = "crop" lateinit var uri: Uri + var saveUri: Uri? = null var resizeWidth = 0 var resizeHeight = 0 var isCropIntent = false @@ -40,17 +40,15 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener return } - val realPath = intent.extras?.get(REAL_FILE_PATH)?.toString() ?: "" - if (realPath.isNotEmpty()) { - val file = File(realPath) - uri = Uri.fromFile(file) - } else { - uri = intent.data - if (uri.scheme != "file" && uri.scheme != "content") { - toast(R.string.unknown_file_location) - finish() - return - } + uri = intent.data + if (uri.scheme != "file" && uri.scheme != "content") { + toast(R.string.unknown_file_location) + finish() + return + } + + if (intent.extras?.containsKey(MediaStore.EXTRA_OUTPUT) == true) { + saveUri = intent.extras!!.get(MediaStore.EXTRA_OUTPUT) as Uri } isCropIntent = intent.extras?.get(CROP) == "true" @@ -130,15 +128,14 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener override fun onCropImageComplete(view: CropImageView, result: CropImageView.CropResult) { if (result.error == null) { - if (isCropIntent && intent.extras?.containsKey(MediaStore.EXTRA_OUTPUT) == true) { - val targetUri = intent.extras!!.get(MediaStore.EXTRA_OUTPUT) as Uri + if (isCropIntent && saveUri != null) { var inputStream: InputStream? = null var outputStream: OutputStream? = null try { val stream = ByteArrayOutputStream() result.bitmap.compress(CompressFormat.JPEG, 100, stream) inputStream = ByteArrayInputStream(stream.toByteArray()) - outputStream = contentResolver.openOutputStream(targetUri) + outputStream = contentResolver.openOutputStream(saveUri) inputStream.copyTo(outputStream) } finally { inputStream?.close() @@ -146,12 +143,12 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener } setResult(RESULT_OK) finish() - } else if (uri.scheme == "file") { - SaveAsDialog(this, uri.path, true) { + } else if (saveUri?.scheme == "file") { + SaveAsDialog(this, saveUri!!.path, true) { saveBitmapToFile(result.bitmap, it) } - } else if (uri.scheme == "content") { - val newPath = applicationContext.getRealPathFromURI(uri) ?: "" + } else if (saveUri?.scheme == "content") { + val newPath = applicationContext.getRealPathFromURI(saveUri!!) ?: "" if (!newPath.isEmpty()) { SaveAsDialog(this, newPath, true) { saveBitmapToFile(result.bitmap, it) 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 84165cca9..454c05955 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt @@ -18,7 +18,10 @@ 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.* +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 import com.simplemobiletools.gallery.models.Directory import com.simplemobiletools.gallery.models.Medium import com.simplemobiletools.gallery.views.MySquareImageView @@ -103,8 +106,8 @@ fun Activity.openEditor(uri: Uri) { setDataAndType(newUri, getMimeTypeFromUri(newUri)) addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) - if (uri.scheme == "file" && isNougatPlus()) { - putExtra(REAL_FILE_PATH, uri.path) + if (isNougatPlus()) { + putExtra(MediaStore.EXTRA_OUTPUT, uri) } if (resolveActivity(packageManager) != null) { From 4c0b773e94905e73c4c7bda2e5e49295e7d6918c Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 27 Oct 2017 10:40:21 +0200 Subject: [PATCH 086/188] handle sd card files with the fileprovider too --- app/src/main/res/xml/provider_paths.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/main/res/xml/provider_paths.xml b/app/src/main/res/xml/provider_paths.xml index 8d13fa177..ad4a8140d 100644 --- a/app/src/main/res/xml/provider_paths.xml +++ b/app/src/main/res/xml/provider_paths.xml @@ -1,4 +1,5 @@ + From c520c8c557ae10846920fbab46cac785ab78981f Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 27 Oct 2017 10:54:49 +0200 Subject: [PATCH 087/188] send real filepath as an extra with View intent --- .../gallery/activities/MediaActivity.kt | 4 +--- .../gallery/activities/PhotoVideoActivity.kt | 5 +++++ .../com/simplemobiletools/gallery/extensions/activity.kt | 9 +++++---- 3 files changed, 11 insertions(+), 7 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 3c262657d..f20aa4c39 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -24,7 +24,6 @@ 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.BuildConfig import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.adapters.MediaAdapter import com.simplemobiletools.gallery.asynctasks.GetMediaAsynctask @@ -505,8 +504,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { val file = File(path) val isVideo = file.isVideoFast() if (isVideo) { - val uri = getFilePublicUri(file, BuildConfig.APPLICATION_ID) - openFile(uri) + openFile(Uri.fromFile(file)) } else { Intent(this, ViewPagerActivity::class.java).apply { putExtra(MEDIUM, path) 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 1f79262f0..732ca17a6 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.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.helpers.REAL_FILE_PATH import com.simplemobiletools.gallery.models.Medium import kotlinx.android.synthetic.main.fragment_holder.* import java.io.File @@ -50,6 +51,10 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList private fun checkIntent(savedInstanceState: Bundle? = null) { mUri = intent.data ?: return + if (intent.extras.containsKey(REAL_FILE_PATH)) { + mUri = intent.extras.get(REAL_FILE_PATH) as Uri + } + mIsFromGallery = intent.getBooleanExtra(IS_FROM_GALLERY, false) if (mUri.scheme == "file") { 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 454c05955..b2b64e339 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt @@ -18,10 +18,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 +import com.simplemobiletools.gallery.helpers.* import com.simplemobiletools.gallery.models.Directory import com.simplemobiletools.gallery.models.Medium import com.simplemobiletools.gallery.views.MySquareImageView @@ -90,6 +87,10 @@ fun Activity.openFile(uri: Uri) { addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) putExtra(IS_FROM_GALLERY, true) + if (isNougatPlus()) { + putExtra(REAL_FILE_PATH, uri) + } + if (resolveActivity(packageManager) != null) { val chooser = Intent.createChooser(this, getString(R.string.open_with)) startActivity(chooser) From 0b352f1bc09da6cf88d834f346dfa7342648f67b Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 27 Oct 2017 10:56:36 +0200 Subject: [PATCH 088/188] add a null check to intent extras at photovideoactivity --- .../simplemobiletools/gallery/activities/PhotoVideoActivity.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 732ca17a6..e50d61f99 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt @@ -51,7 +51,7 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList private fun checkIntent(savedInstanceState: Bundle? = null) { mUri = intent.data ?: return - if (intent.extras.containsKey(REAL_FILE_PATH)) { + if (intent.extras?.containsKey(REAL_FILE_PATH) == true) { mUri = intent.extras.get(REAL_FILE_PATH) as Uri } From b3427c57abd1ff38333d91eee0c8728449cc9dd5 Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 27 Oct 2017 11:47:00 +0200 Subject: [PATCH 089/188] adding a properties menu button to photovideoactivity --- app/build.gradle | 2 +- .../gallery/activities/PhotoVideoActivity.kt | 8 ++++++++ .../gallery/activities/ViewPagerActivity.kt | 3 ++- app/src/main/res/menu/photo_video_menu.xml | 5 +++++ 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 784e54418..4b5446f43 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,7 +37,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.32.4' + compile 'com.simplemobiletools:commons:2.32.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/PhotoVideoActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt index e50d61f99..cd2bf4902 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt @@ -8,6 +8,7 @@ import android.os.Bundle import android.view.Menu import android.view.MenuItem import android.view.View +import com.simplemobiletools.commons.dialogs.PropertiesDialog import com.simplemobiletools.commons.extensions.getFilenameFromUri import com.simplemobiletools.commons.extensions.getRealPathFromURI import com.simplemobiletools.commons.extensions.scanPath @@ -26,6 +27,7 @@ import com.simplemobiletools.gallery.models.Medium import kotlinx.android.synthetic.main.fragment_holder.* import java.io.File + open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentListener { private var mMedium: Medium? = null private var mIsFullScreen = false @@ -117,6 +119,7 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList menu.findItem(R.id.menu_set_as).isVisible = mMedium?.isImage() == true menu.findItem(R.id.menu_edit).isVisible = mMedium?.isImage() == true + menu.findItem(R.id.menu_edit).isVisible = mUri.scheme == "file" return true } @@ -130,11 +133,16 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList R.id.menu_open_with -> openFile(mUri) R.id.menu_share -> shareUri(mUri) R.id.menu_edit -> openEditor(mUri) + R.id.menu_properties -> showProperties() else -> return super.onOptionsItemSelected(item) } return true } + private fun showProperties() { + PropertiesDialog(this, mUri.path) + } + override fun fragmentClicked() { mIsFullScreen = !mIsFullScreen if (mIsFullScreen) { 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 5db29688f..7214b6a00 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -515,8 +515,9 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View private fun getCurrentFragment() = (view_pager.adapter as MyPagerAdapter).getCurrentFragment(view_pager.currentItem) private fun showProperties() { - if (getCurrentMedium() != null) + if (getCurrentMedium() != null) { PropertiesDialog(this, getCurrentPath(), false) + } } private fun showOnMap() { diff --git a/app/src/main/res/menu/photo_video_menu.xml b/app/src/main/res/menu/photo_video_menu.xml index 5911eebf5..584e40c29 100644 --- a/app/src/main/res/menu/photo_video_menu.xml +++ b/app/src/main/res/menu/photo_video_menu.xml @@ -6,6 +6,11 @@ android:icon="@drawable/ic_share" android:title="@string/share" app:showAsAction="ifRoom"/> + Date: Fri, 27 Oct 2017 14:02:11 +0200 Subject: [PATCH 090/188] always set saveUri at editor activity --- .../gallery/activities/EditActivity.kt | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) 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 db8277eba..53c278d5e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/EditActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/EditActivity.kt @@ -24,7 +24,7 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener private val CROP = "crop" lateinit var uri: Uri - var saveUri: Uri? = null + lateinit var saveUri: Uri var resizeWidth = 0 var resizeHeight = 0 var isCropIntent = false @@ -47,8 +47,10 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener return } - if (intent.extras?.containsKey(MediaStore.EXTRA_OUTPUT) == true) { - saveUri = intent.extras!!.get(MediaStore.EXTRA_OUTPUT) as Uri + saveUri = if (intent.extras?.containsKey(MediaStore.EXTRA_OUTPUT) == true) { + intent.extras!!.get(MediaStore.EXTRA_OUTPUT) as Uri + } else { + uri } isCropIntent = intent.extras?.get(CROP) == "true" @@ -128,7 +130,7 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener override fun onCropImageComplete(view: CropImageView, result: CropImageView.CropResult) { if (result.error == null) { - if (isCropIntent && saveUri != null) { + if (isCropIntent) { var inputStream: InputStream? = null var outputStream: OutputStream? = null try { @@ -143,12 +145,12 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener } setResult(RESULT_OK) finish() - } else if (saveUri?.scheme == "file") { - SaveAsDialog(this, saveUri!!.path, true) { + } else if (saveUri.scheme == "file") { + SaveAsDialog(this, saveUri.path, true) { saveBitmapToFile(result.bitmap, it) } - } else if (saveUri?.scheme == "content") { - val newPath = applicationContext.getRealPathFromURI(saveUri!!) ?: "" + } else if (saveUri.scheme == "content") { + val newPath = applicationContext.getRealPathFromURI(saveUri) ?: "" if (!newPath.isEmpty()) { SaveAsDialog(this, newPath, true) { saveBitmapToFile(result.bitmap, it) From c9f6668fc1a0df8dd1cdaeb1836533c718bda8f7 Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 27 Oct 2017 14:08:33 +0200 Subject: [PATCH 091/188] force an app chooser at some openFile intents --- .../com/simplemobiletools/gallery/activities/MediaActivity.kt | 2 +- .../gallery/activities/PhotoVideoActivity.kt | 2 +- .../simplemobiletools/gallery/activities/ViewPagerActivity.kt | 2 +- .../com/simplemobiletools/gallery/adapters/MediaAdapter.kt | 2 +- .../com/simplemobiletools/gallery/extensions/activity.kt | 4 ++-- 5 files changed, 6 insertions(+), 6 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 f20aa4c39..facb606a7 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -504,7 +504,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { val file = File(path) val isVideo = file.isVideoFast() if (isVideo) { - openFile(Uri.fromFile(file)) + openFile(Uri.fromFile(file), false) } else { Intent(this, ViewPagerActivity::class.java).apply { putExtra(MEDIUM, path) 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 cd2bf4902..ca6d1c0a0 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt @@ -130,7 +130,7 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList when (item.itemId) { R.id.menu_set_as -> setAs(mUri) - R.id.menu_open_with -> openFile(mUri) + R.id.menu_open_with -> openFile(mUri, true) R.id.menu_share -> shareUri(mUri) R.id.menu_edit -> openEditor(mUri) R.id.menu_properties -> showProperties() 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 7214b6a00..18eb2f5df 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -250,7 +250,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View R.id.slideshow -> initSlideshow() R.id.menu_copy_to -> copyMoveTo(true) R.id.menu_move_to -> copyMoveTo(false) - R.id.menu_open_with -> openFile(Uri.fromFile(getCurrentFile())) + R.id.menu_open_with -> openFile(Uri.fromFile(getCurrentFile()), true) R.id.menu_hide -> toggleFileVisibility(true) R.id.menu_unhide -> toggleFileVisibility(false) R.id.menu_share_1 -> shareMedium(getCurrentMedium()!!) 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 b71a694a7..6ede29e0d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt @@ -87,7 +87,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_open_with -> activity.openFile(Uri.fromFile(getCurrentFile())) + R.id.cab_open_with -> activity.openFile(Uri.fromFile(getCurrentFile()), true) R.id.cab_set_as -> activity.setAs(Uri.fromFile(getCurrentFile())) R.id.cab_delete -> checkDeleteConfirmation() else -> return false 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 b2b64e339..b721d60cf 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt @@ -79,7 +79,7 @@ fun Activity.setAs(uri: Uri) { } } -fun Activity.openFile(uri: Uri) { +fun Activity.openFile(uri: Uri, forceChooser: Boolean) { val newUri = ensurePublicUri(uri) Intent().apply { action = Intent.ACTION_VIEW @@ -93,7 +93,7 @@ fun Activity.openFile(uri: Uri) { if (resolveActivity(packageManager) != null) { val chooser = Intent.createChooser(this, getString(R.string.open_with)) - startActivity(chooser) + startActivity(if (forceChooser) chooser else this) } else { toast(R.string.no_app_found) } From 84263a3b10551a474776983dbcff341c542f42ca Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 27 Oct 2017 14:08:50 +0200 Subject: [PATCH 092/188] never force chooser at Edit intent --- .../com/simplemobiletools/gallery/extensions/activity.kt | 3 +-- 1 file changed, 1 insertion(+), 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 b721d60cf..513aaca5d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt @@ -112,8 +112,7 @@ fun Activity.openEditor(uri: Uri) { } if (resolveActivity(packageManager) != null) { - val chooser = Intent.createChooser(this, getString(R.string.edit_image_with)) - startActivityForResult(chooser, REQUEST_EDIT_IMAGE) + startActivityForResult(this, REQUEST_EDIT_IMAGE) } else { toast(R.string.no_editor_found) } From 9468a006577685312a8158356e3c42bb9db8d1ec Mon Sep 17 00:00:00 2001 From: Guillaume Date: Sat, 28 Oct 2017 05:45:30 +0200 Subject: [PATCH 093/188] 1 correction (was too long) --- app/src/main/res/values-nl/strings.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index 7f5988441..ec4df3365 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -9,7 +9,7 @@ (verborgen) Map vastzetten Map losmaken - Inhoud van mappen recursief weergeven + Platte weergave Alle mappen Mapweergave Andere map @@ -147,4 +147,4 @@ Haven't found some strings? There's more at https://github.com/SimpleMobileTools/Simple-Commons/tree/master/commons/src/main/res --> - \ No newline at end of file + From 286955ab831bd8fa295aa2e93081bfbdc37a617f Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 28 Oct 2017 11:02:02 +0200 Subject: [PATCH 094/188] replace PhotoView with GifDrawable it will replace zoomable gifs with smooth gifs --- app/build.gradle | 4 +- .../gallery/extensions/activity.kt | 2 +- .../gallery/fragments/PhotoFragment.kt | 67 ++++++++++--------- app/src/main/res/layout/pager_photo_item.xml | 4 +- 4 files changed, 39 insertions(+), 38 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 4b5446f43..0bd65828a 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,13 +37,13 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.32.5' + compile 'com.simplemobiletools:commons:2.32.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' compile 'com.google.code.gson:gson:2.8.0' - compile 'com.github.chrisbanes:PhotoView:2.1.2' compile 'it.sephiroth.android.exif:library:1.0.1' + compile 'pl.droidsonroids.gif:android-gif-drawable:1.2.8' compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" debugCompile 'com.squareup.leakcanary:leakcanary-android:1.5.1' 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 513aaca5d..7d76be8a3 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt @@ -130,7 +130,7 @@ fun Activity.launchCamera() { fun SimpleActivity.launchAbout() { startAboutActivity(R.string.app_name, LICENSE_KOTLIN or LICENSE_GLIDE or LICENSE_CROPPER or LICENSE_MULTISELECT or LICENSE_RTL - or LICENSE_PHOTOVIEW or LICENSE_SUBSAMPLING or LICENSE_PATTERN, BuildConfig.VERSION_NAME) + or LICENSE_SUBSAMPLING or LICENSE_PATTERN or LICENSE_REPRINT or LICENSE_GIF_DRAWABLE, BuildConfig.VERSION_NAME) } fun AppCompatActivity.showSystemUI() { 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 c1d9090d7..20037228e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt @@ -13,12 +13,10 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import com.bumptech.glide.Glide -import com.bumptech.glide.Priority import com.bumptech.glide.load.DataSource import com.bumptech.glide.load.DecodeFormat import com.bumptech.glide.load.engine.DiskCacheStrategy import com.bumptech.glide.load.engine.GlideException -import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions import com.bumptech.glide.request.RequestListener import com.bumptech.glide.request.RequestOptions import com.bumptech.glide.request.target.Target @@ -33,6 +31,7 @@ import com.simplemobiletools.gallery.helpers.MEDIUM import com.simplemobiletools.gallery.models.Medium import it.sephiroth.android.library.exif2.ExifInterface import kotlinx.android.synthetic.main.pager_photo_item.view.* +import pl.droidsonroids.gif.GifDrawable import java.io.File import java.io.FileOutputStream @@ -41,6 +40,7 @@ class PhotoFragment : ViewPagerFragment() { private var wasInit = false private var storedShowExtendedDetails = false private var storedExtendedDetails = 0 + private var gifDrawable: GifDrawable? = null lateinit var view: ViewGroup lateinit var medium: Medium @@ -80,18 +80,8 @@ class PhotoFragment : ViewPagerFragment() { } } - view.subsampling_view.setOnClickListener({ photoClicked() }) - view.photo_view.apply { - maximumScale = 8f - mediumScale = 3f - setOnOutsidePhotoTapListener { - photoClicked() - } - - setOnPhotoTapListener { view, x, y -> - photoClicked() - } - } + view.subsampling_view.setOnClickListener { photoClicked() } + view.gif_view.setOnClickListener { photoClicked() } loadImage() checkExtendedDetails() @@ -117,14 +107,30 @@ class PhotoFragment : ViewPagerFragment() { super.setMenuVisibility(menuVisible) isFragmentVisible = menuVisible if (wasInit) { - if (menuVisible) { - addZoomableView() + if (medium.isGif()) { + gifFragmentVisibilityChanged(menuVisible) } else { - view.subsampling_view.apply { - recycle() - beGone() - background = ColorDrawable(Color.TRANSPARENT) - } + photoFragmentVisibilityChanged(menuVisible) + } + } + } + + private fun gifFragmentVisibilityChanged(isVisible: Boolean) { + if (isVisible) { + gifDrawable?.start() + } else { + gifDrawable?.stop() + } + } + + private fun photoFragmentVisibilityChanged(isVisible: Boolean) { + if (isVisible) { + addZoomableView() + } else { + view.subsampling_view.apply { + recycle() + beGone() + background = ColorDrawable(Color.TRANSPARENT) } } } @@ -149,16 +155,11 @@ class PhotoFragment : ViewPagerFragment() { private fun loadImage() { if (medium.isGif()) { - val options = RequestOptions() - .priority(if (isFragmentVisible) Priority.IMMEDIATE else Priority.LOW) - .diskCacheStrategy(DiskCacheStrategy.DATA) + gifDrawable = GifDrawable(medium.path) + if (!isFragmentVisible) + gifDrawable!!.stop() - Glide.with(this) - .asGif() - .load(medium.path) - .transition(DrawableTransitionOptions.withCrossFade()) - .apply(options) - .into(view.photo_view) + view.gif_view.setImageDrawable(gifDrawable) } else { loadBitmap() } @@ -187,7 +188,7 @@ class PhotoFragment : ViewPagerFragment() { addZoomableView() return false } - }).into(view.photo_view) + }).into(view.gif_view) } else { val options = RequestOptions() .diskCacheStrategy(DiskCacheStrategy.NONE) @@ -198,7 +199,7 @@ class PhotoFragment : ViewPagerFragment() { .load(medium.path) .thumbnail(0.2f) .apply(options) - .into(view.photo_view) + .into(view.gif_view) } } @@ -286,7 +287,7 @@ class PhotoFragment : ViewPagerFragment() { super.onDestroyView() context.isKitkatPlus() if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 && !activity.isDestroyed) { - Glide.with(context).clear(view.photo_view) + Glide.with(context).clear(view.gif_view) } } diff --git a/app/src/main/res/layout/pager_photo_item.xml b/app/src/main/res/layout/pager_photo_item.xml index e48b6b90a..5f170ca80 100644 --- a/app/src/main/res/layout/pager_photo_item.xml +++ b/app/src/main/res/layout/pager_photo_item.xml @@ -6,8 +6,8 @@ android:layout_width="match_parent" android:layout_height="match_parent"> - From 1c3aab82ff456038be6959118580dcd383ce1a88 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 28 Oct 2017 12:56:57 +0200 Subject: [PATCH 095/188] use a simple ImageView at photo fragments --- .../com/simplemobiletools/gallery/fragments/PhotoFragment.kt | 3 ++- app/src/main/res/layout/pager_photo_item.xml | 2 +- 2 files changed, 3 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 20037228e..4bb52fdb1 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt @@ -156,8 +156,9 @@ class PhotoFragment : ViewPagerFragment() { private fun loadImage() { if (medium.isGif()) { gifDrawable = GifDrawable(medium.path) - if (!isFragmentVisible) + if (!isFragmentVisible) { gifDrawable!!.stop() + } view.gif_view.setImageDrawable(gifDrawable) } else { diff --git a/app/src/main/res/layout/pager_photo_item.xml b/app/src/main/res/layout/pager_photo_item.xml index 5f170ca80..152c24684 100644 --- a/app/src/main/res/layout/pager_photo_item.xml +++ b/app/src/main/res/layout/pager_photo_item.xml @@ -6,7 +6,7 @@ android:layout_width="match_parent" android:layout_height="match_parent"> - From 4fedc0557111786a19ce42e0284ea7d2624d00e7 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 28 Oct 2017 13:27:50 +0200 Subject: [PATCH 096/188] use GifDrawables at thumbnails too --- .../gallery/activities/MainActivity.kt | 10 +++- .../gallery/activities/MediaActivity.kt | 12 +++-- .../gallery/adapters/DirectoryAdapter.kt | 11 ++-- .../gallery/adapters/MediaAdapter.kt | 28 +++++----- .../gallery/extensions/activity.kt | 52 ++++++------------- app/src/main/res/layout/pager_photo_item.xml | 3 +- 6 files changed, 58 insertions(+), 58 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 6dfa6ef7a..108f34310 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -125,11 +125,17 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { super.onResume() config.isThirdPartyIntent = false if (mStoredAnimateGifs != config.animateGifs) { - directories_grid.adapter?.notifyDataSetChanged() + (directories_grid.adapter as? DirectoryAdapter)?.apply { + animateGifs = config.animateGifs + notifyDataSetChanged() + } } if (mStoredCropThumbnails != config.cropThumbnails) { - directories_grid.adapter?.notifyDataSetChanged() + (directories_grid.adapter as? DirectoryAdapter)?.apply { + cropThumbnails = config.cropThumbnails + notifyDataSetChanged() + } } if (mStoredShowMediaCount != config.showMediaCount) { 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 facb606a7..ca3df1126 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -89,12 +89,18 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { override fun onResume() { super.onResume() - if (mShowAll && mStoredAnimateGifs != config.animateGifs) { - media_grid.adapter?.notifyDataSetChanged() + if (mStoredAnimateGifs != config.animateGifs) { + (media_grid.adapter as? MediaAdapter)?.apply { + animateGifs = config.animateGifs + notifyDataSetChanged() + } } if (mStoredCropThumbnails != config.cropThumbnails) { - media_grid.adapter?.notifyDataSetChanged() + (media_grid.adapter as? MediaAdapter)?.apply { + cropThumbnails = config.cropThumbnails + notifyDataSetChanged() + } } if (mStoredScrollHorizontally != config.scrollHorizontally) { 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 7f36dfd26..ed836f91d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt @@ -30,11 +30,13 @@ import java.util.* class DirectoryAdapter(val activity: SimpleActivity, var dirs: MutableList, val listener: DirOperationsListener?, val isPickIntent: Boolean, val itemClick: (Directory) -> Unit) : RecyclerView.Adapter() { - val config = activity.config + private val config = activity.config var actMode: ActionMode? = null var primaryColor = config.primaryColor var scrollVertically = !config.scrollHorizontally var showMediaCount = config.showMediaCount + var animateGifs = config.animateGifs + var cropThumbnails = config.cropThumbnails private val multiSelector = MultiSelector() private val isListViewType = config.viewTypeFolders == VIEW_TYPE_LIST @@ -353,7 +355,7 @@ class DirectoryAdapter(val activity: SimpleActivity, var dirs: MutableList (Unit)) : SwappingHolder(view, MultiSelector()) { - fun bindView(directory: Directory, isPinned: Boolean, scrollVertically: Boolean, isListView: Boolean, textColor: Int, showMediaCount: Boolean): View { + fun bindView(directory: Directory, isPinned: Boolean, scrollVertically: Boolean, isListView: Boolean, textColor: Int, showMediaCount: Boolean, + animateGifs: Boolean, cropThumbnails: Boolean): View { itemView.apply { dir_name.text = directory.name dir_path?.text = "${directory.path.substringBeforeLast("/")}/" photo_cnt.text = directory.mediaCnt.toString() - activity.loadImage(directory.tmb, dir_thumbnail, scrollVertically) + activity.loadImage(directory.tmb, dir_thumbnail, scrollVertically, animateGifs, cropThumbnails) dir_pin.beVisibleIf(isPinned) dir_sd_card.beVisibleIf(activity.isPathOnSD(directory.path)) photo_cnt.beVisibleIf(showMediaCount) 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 6ede29e0d..82e9d9fae 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt @@ -28,18 +28,21 @@ import java.util.* class MediaAdapter(val activity: SimpleActivity, var media: MutableList, val listener: MediaOperationsListener?, val isPickIntent: Boolean, val allowMultiplePicks: Boolean, val itemClick: (Medium) -> Unit) : RecyclerView.Adapter() { - val multiSelector = MultiSelector() - val config = activity.config - val isListViewType = config.viewTypeFiles == VIEW_TYPE_LIST - var skipConfirmationDialog = false - + private val config = activity.config var actMode: ActionMode? = null - var itemViews = SparseArray() - val selectedPositions = HashSet() var primaryColor = config.primaryColor - var textColor = config.textColor - var displayFilenames = config.displayFileNames var scrollVertically = !config.scrollHorizontally + var animateGifs = config.animateGifs + var cropThumbnails = config.cropThumbnails + + private val multiSelector = MultiSelector() + private val isListViewType = config.viewTypeFiles == VIEW_TYPE_LIST + private var skipConfirmationDialog = false + + private var itemViews = SparseArray() + private val selectedPositions = HashSet() + private var textColor = config.textColor + private var displayFilenames = config.displayFileNames fun toggleItemSelection(select: Boolean, pos: Int) { if (select) { @@ -284,7 +287,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, isListViewType, textColor)) + itemViews.put(position, holder.bindView(media[position], displayFilenames, scrollVertically, isListViewType, textColor, animateGifs, cropThumbnails)) toggleItemSelection(selectedPositions.contains(position), position) holder.itemView.tag = holder } @@ -355,12 +358,13 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList, 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 { + fun bindView(medium: Medium, displayFilenames: Boolean, scrollVertically: Boolean, isListViewType: Boolean, textColor: Int, + animateGifs: Boolean, cropThumbnails: Boolean): View { itemView.apply { play_outline.visibility = if (medium.video) View.VISIBLE else View.GONE photo_name.beVisibleIf(displayFilenames || isListViewType) photo_name.text = medium.name - activity.loadImage(medium.path, medium_thumbnail, scrollVertically) + activity.loadImage(medium.path, medium_thumbnail, scrollVertically, animateGifs, cropThumbnails) if (isListViewType) { photo_name.setTextColor(textColor) 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 7d76be8a3..c7fd3b5e9 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt @@ -6,6 +6,7 @@ import android.net.Uri import android.provider.MediaStore import android.support.v7.app.AppCompatActivity import android.view.View +import android.widget.ImageView import com.bumptech.glide.Glide import com.bumptech.glide.load.DecodeFormat import com.bumptech.glide.load.engine.DiskCacheStrategy @@ -22,6 +23,7 @@ import com.simplemobiletools.gallery.helpers.* import com.simplemobiletools.gallery.models.Directory import com.simplemobiletools.gallery.models.Medium import com.simplemobiletools.gallery.views.MySquareImageView +import pl.droidsonroids.gif.GifDrawable import java.io.File import java.util.* @@ -199,24 +201,28 @@ fun SimpleActivity.toggleFileVisibility(oldFile: File, hide: Boolean, callback: } } -fun Activity.loadImage(path: String, target: MySquareImageView, verticalScroll: Boolean) { +fun Activity.loadImage(path: String, target: MySquareImageView, verticalScroll: Boolean, animateGifs: Boolean, cropThumbnails: Boolean) { target.isVerticalScrolling = verticalScroll if (path.isImageFast() || path.isVideoFast()) { if (path.isPng()) { - loadPng(path, target) + loadPng(path, target, cropThumbnails) } else { - loadJpg(path, target) + loadJpg(path, target, cropThumbnails) } } else if (path.isGif()) { - if (config.animateGifs) { - loadAnimatedGif(path, target) + val gifDrawable = GifDrawable(path) + target.setImageDrawable(gifDrawable) + if (animateGifs) { + gifDrawable.start() } else { - loadStaticGif(path, target) + gifDrawable.stop() } + + target.scaleType = if (cropThumbnails) ImageView.ScaleType.CENTER_CROP else ImageView.ScaleType.FIT_CENTER } } -fun Activity.loadPng(path: String, target: MySquareImageView) { +fun Activity.loadPng(path: String, target: MySquareImageView, cropThumbnails: Boolean) { val options = RequestOptions() .signature(path.getFileSignature()) .diskCacheStrategy(DiskCacheStrategy.RESOURCE) @@ -226,11 +232,11 @@ fun Activity.loadPng(path: String, target: MySquareImageView) { .asBitmap() .load(path) - if (config.cropThumbnails) options.centerCrop() else options.fitCenter() + if (cropThumbnails) options.centerCrop() else options.fitCenter() builder.apply(options).into(target) } -fun Activity.loadJpg(path: String, target: MySquareImageView) { +fun Activity.loadJpg(path: String, target: MySquareImageView, cropThumbnails: Boolean) { val options = RequestOptions() .signature(path.getFileSignature()) .diskCacheStrategy(DiskCacheStrategy.RESOURCE) @@ -238,36 +244,10 @@ fun Activity.loadJpg(path: String, target: MySquareImageView) { val builder = Glide.with(applicationContext) .load(path) - if (config.cropThumbnails) options.centerCrop() else options.fitCenter() + if (cropThumbnails) options.centerCrop() else options.fitCenter() builder.apply(options).transition(DrawableTransitionOptions.withCrossFade()).into(target) } -fun Activity.loadAnimatedGif(path: String, target: MySquareImageView) { - val options = RequestOptions() - .signature(path.getFileSignature()) - .diskCacheStrategy(DiskCacheStrategy.NONE) - - val builder = Glide.with(applicationContext) - .asGif() - .load(path) - - if (config.cropThumbnails) options.centerCrop() else options.fitCenter() - builder.apply(options).transition(DrawableTransitionOptions.withCrossFade()).into(target) -} - -fun Activity.loadStaticGif(path: String, target: MySquareImageView) { - val options = RequestOptions() - .signature(path.getFileSignature()) - .diskCacheStrategy(DiskCacheStrategy.DATA) - - val builder = Glide.with(applicationContext) - .asBitmap() - .load(path) - - if (config.cropThumbnails) options.centerCrop() else options.fitCenter() - builder.apply(options).into(target) -} - fun Activity.getCachedDirectories(): ArrayList { val token = object : TypeToken>() {}.type return Gson().fromJson>(config.directories, token) ?: ArrayList(1) diff --git a/app/src/main/res/layout/pager_photo_item.xml b/app/src/main/res/layout/pager_photo_item.xml index 152c24684..6e2f333c8 100644 --- a/app/src/main/res/layout/pager_photo_item.xml +++ b/app/src/main/res/layout/pager_photo_item.xml @@ -9,7 +9,8 @@ + android:layout_height="match_parent" + android:scaleType="fitCenter"/> Date: Sat, 28 Oct 2017 13:46:53 +0200 Subject: [PATCH 097/188] init the viewpager orientation listener earlier --- .../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 18eb2f5df..a6d91c38b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -85,6 +85,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View } private fun initViewPager() { + setupOrientationEventListener() measureScreen() val uri = intent.data if (uri != null) { @@ -140,7 +141,6 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View reloadViewPager() scanPath(mPath) {} - setupOrientationEventListener() if (config.darkBackground) view_pager.background = ColorDrawable(Color.BLACK) From 977edc1f34974643bc546128e86e2237a124de56 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 28 Oct 2017 14:11:01 +0200 Subject: [PATCH 098/188] some cleanup around thumbnail loading --- .../gallery/activities/MainActivity.kt | 24 ++++--------- .../gallery/activities/MediaActivity.kt | 19 ++++------- .../gallery/adapters/DirectoryAdapter.kt | 34 +++++++++++++++---- .../gallery/adapters/MediaAdapter.kt | 27 +++++++++++---- .../gallery/extensions/activity.kt | 4 +-- .../gallery/views/MySquareImageView.kt | 4 +-- 6 files changed, 65 insertions(+), 47 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 108f34310..172317755 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -125,36 +125,24 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { super.onResume() config.isThirdPartyIntent = false if (mStoredAnimateGifs != config.animateGifs) { - (directories_grid.adapter as? DirectoryAdapter)?.apply { - animateGifs = config.animateGifs - notifyDataSetChanged() - } + getDirectoryAdapter()?.updateAnimateGifs(config.animateGifs) } if (mStoredCropThumbnails != config.cropThumbnails) { - (directories_grid.adapter as? DirectoryAdapter)?.apply { - cropThumbnails = config.cropThumbnails - notifyDataSetChanged() - } + getDirectoryAdapter()?.updateCropThumbnails(config.cropThumbnails) } if (mStoredShowMediaCount != config.showMediaCount) { - (directories_grid.adapter as? DirectoryAdapter)?.apply { - showMediaCount = config.showMediaCount - notifyDataSetChanged() - } + getDirectoryAdapter()?.updateShowMediaCount(config.showMediaCount) } if (mStoredScrollHorizontally != config.scrollHorizontally) { - (directories_grid.adapter as? DirectoryAdapter)?.apply { - scrollVertically = config.viewTypeFolders == VIEW_TYPE_LIST || !config.scrollHorizontally - notifyDataSetChanged() - } + getDirectoryAdapter()?.updateScrollHorizontally(config.viewTypeFolders != VIEW_TYPE_LIST && config.scrollHorizontally) setupScrollDirection() } if (mStoredTextColor != config.textColor) { - (directories_grid.adapter as? DirectoryAdapter)?.updateTextColor(config.textColor) + getDirectoryAdapter()?.updateTextColor(config.textColor) } tryloadGallery() @@ -183,6 +171,8 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { removeTempFolder() } + private fun getDirectoryAdapter() = directories_grid.adapter as? DirectoryAdapter + private fun storeStateVariables() { config.apply { mStoredAnimateGifs = animateGifs 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 ca3df1126..1b1040443 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -90,29 +90,20 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { override fun onResume() { super.onResume() if (mStoredAnimateGifs != config.animateGifs) { - (media_grid.adapter as? MediaAdapter)?.apply { - animateGifs = config.animateGifs - notifyDataSetChanged() - } + getMediaAdapter()?.updateAnimateGifs(config.animateGifs) } if (mStoredCropThumbnails != config.cropThumbnails) { - (media_grid.adapter as? MediaAdapter)?.apply { - cropThumbnails = config.cropThumbnails - notifyDataSetChanged() - } + getMediaAdapter()?.updateCropThumbnails(config.cropThumbnails) } if (mStoredScrollHorizontally != config.scrollHorizontally) { - (media_grid.adapter as? MediaAdapter)?.apply { - scrollVertically = config.viewTypeFiles == VIEW_TYPE_LIST || !config.scrollHorizontally - notifyDataSetChanged() - } + getMediaAdapter()?.updateScrollHorizontally(config.viewTypeFiles != VIEW_TYPE_LIST || !config.scrollHorizontally) setupScrollDirection() } if (mStoredTextColor != config.textColor) { - (media_grid.adapter as? MediaAdapter)?.updateTextColor(config.textColor) + getMediaAdapter()?.updateTextColor(config.textColor) } tryloadGallery() @@ -159,6 +150,8 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { } } + private fun getMediaAdapter() = media_grid.adapter as? MediaAdapter + private fun checkIfColorChanged() { if (media_grid.adapter != null && getRecyclerAdapter().primaryColor != config.primaryColor) { getRecyclerAdapter().primaryColor = config.primaryColor 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 ed836f91d..b2f585e07 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt @@ -33,10 +33,6 @@ class DirectoryAdapter(val activity: SimpleActivity, var dirs: MutableList() private var textColor = config.textColor private var pinnedFolders = config.pinnedFolders + private var scrollHorizontally = config.scrollHorizontally + private var showMediaCount = config.showMediaCount + private var animateGifs = config.animateGifs + private var cropThumbnails = config.cropThumbnails fun toggleItemSelection(select: Boolean, pos: Int) { if (select) { @@ -355,7 +355,7 @@ class DirectoryAdapter(val activity: SimpleActivity, var dirs: MutableList (Unit)) : SwappingHolder(view, MultiSelector()) { - fun bindView(directory: Directory, isPinned: Boolean, scrollVertically: Boolean, isListView: Boolean, textColor: Int, showMediaCount: Boolean, + fun bindView(directory: Directory, isPinned: Boolean, scrollHorizontally: Boolean, isListView: Boolean, textColor: Int, showMediaCount: Boolean, animateGifs: Boolean, cropThumbnails: Boolean): View { itemView.apply { dir_name.text = directory.name dir_path?.text = "${directory.path.substringBeforeLast("/")}/" photo_cnt.text = directory.mediaCnt.toString() - activity.loadImage(directory.tmb, dir_thumbnail, scrollVertically, animateGifs, cropThumbnails) + activity.loadImage(directory.tmb, dir_thumbnail, scrollHorizontally, animateGifs, cropThumbnails) dir_pin.beVisibleIf(isPinned) dir_sd_card.beVisibleIf(activity.isPathOnSD(directory.path)) photo_cnt.beVisibleIf(showMediaCount) 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 82e9d9fae..c4f8b2e09 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt @@ -31,9 +31,6 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList, private val config = activity.config var actMode: ActionMode? = null var primaryColor = config.primaryColor - var scrollVertically = !config.scrollHorizontally - var animateGifs = config.animateGifs - var cropThumbnails = config.cropThumbnails private val multiSelector = MultiSelector() private val isListViewType = config.viewTypeFiles == VIEW_TYPE_LIST @@ -41,6 +38,9 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList, private var itemViews = SparseArray() private val selectedPositions = HashSet() + private var scrollHorizontally = config.scrollHorizontally + private var animateGifs = config.animateGifs + private var cropThumbnails = config.cropThumbnails private var textColor = config.textColor private var displayFilenames = config.displayFileNames @@ -287,7 +287,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, isListViewType, textColor, animateGifs, cropThumbnails)) + itemViews.put(position, holder.bindView(media[position], displayFilenames, scrollHorizontally, isListViewType, textColor, animateGifs, cropThumbnails)) toggleItemSelection(selectedPositions.contains(position), position) holder.itemView.tag = holder } @@ -310,6 +310,21 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList, notifyDataSetChanged() } + fun updateAnimateGifs(animateGifs: Boolean) { + this.animateGifs = animateGifs + notifyDataSetChanged() + } + + fun updateCropThumbnails(cropThumbnails: Boolean) { + this.cropThumbnails = cropThumbnails + notifyDataSetChanged() + } + + fun updateScrollHorizontally(scrollHorizontally: Boolean) { + this.scrollHorizontally = scrollHorizontally + notifyDataSetChanged() + } + fun updateTextColor(textColor: Int) { this.textColor = textColor notifyDataSetChanged() @@ -358,13 +373,13 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList, 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, + fun bindView(medium: Medium, displayFilenames: Boolean, scrollHorizontally: Boolean, isListViewType: Boolean, textColor: Int, animateGifs: Boolean, cropThumbnails: Boolean): View { itemView.apply { play_outline.visibility = if (medium.video) View.VISIBLE else View.GONE photo_name.beVisibleIf(displayFilenames || isListViewType) photo_name.text = medium.name - activity.loadImage(medium.path, medium_thumbnail, scrollVertically, animateGifs, cropThumbnails) + activity.loadImage(medium.path, medium_thumbnail, scrollHorizontally, animateGifs, cropThumbnails) if (isListViewType) { photo_name.setTextColor(textColor) 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 c7fd3b5e9..5423a0777 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt @@ -201,8 +201,8 @@ fun SimpleActivity.toggleFileVisibility(oldFile: File, hide: Boolean, callback: } } -fun Activity.loadImage(path: String, target: MySquareImageView, verticalScroll: Boolean, animateGifs: Boolean, cropThumbnails: Boolean) { - target.isVerticalScrolling = verticalScroll +fun Activity.loadImage(path: String, target: MySquareImageView, horizontalScroll: Boolean, animateGifs: Boolean, cropThumbnails: Boolean) { + target.isHorizontalScrolling = horizontalScroll if (path.isImageFast() || path.isVideoFast()) { if (path.isPng()) { loadPng(path, target, cropThumbnails) 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 f254d4183..39a2f74be 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/views/MySquareImageView.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/views/MySquareImageView.kt @@ -5,7 +5,7 @@ import android.util.AttributeSet import android.widget.ImageView class MySquareImageView : ImageView { - var isVerticalScrolling = true + var isHorizontalScrolling = false constructor(context: Context) : super(context) @@ -14,7 +14,7 @@ class MySquareImageView : ImageView { constructor(context: Context, attrs: AttributeSet, defStyle: Int) : super(context, attrs, defStyle) override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) { - val spec = if (isVerticalScrolling) widthMeasureSpec else heightMeasureSpec + val spec = if (isHorizontalScrolling) heightMeasureSpec else widthMeasureSpec super.onMeasure(spec, spec) } } From f3eec9135c41dc1357d76d70ee06368dc9ee1d81 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 28 Oct 2017 14:16:40 +0200 Subject: [PATCH 099/188] add a string for keeping old last-modified at copy/move/rename --- 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-nl/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 + 20 files changed, 20 insertions(+) diff --git a/app/src/main/res/values-ca/strings.xml b/app/src/main/res/values-ca/strings.xml index b2b1b6986..7d13156d9 100644 --- a/app/src/main/res/values-ca/strings.xml +++ b/app/src/main/res/values-ca/strings.xml @@ -129,6 +129,7 @@ Replace Share with Rotate at fullscreen menu Show extended details over fullscreen media Manage extended details + Keep old last-modified value at file copy/move/rename diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index 48f819337..0a789d2b9 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -129,6 +129,7 @@ Replace Share with Rotate at fullscreen menu Show extended details over fullscreen media Manage extended details + Keep old last-modified value at file copy/move/rename diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 4f3e23a51..cc3cf7217 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -129,6 +129,7 @@ Teilen/Drehen im Vollbild-Menü vertauschen Eigenschaften anzeigen im Vollbild Eigenschaften auswählen + Keep old last-modified value at file copy/move/rename diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 8f9bb7813..a734b1cd3 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -129,6 +129,7 @@ Reemplazar Compartir con Girar en el menú de pantalla completa Show extended details over fullscreen media Manage extended details + Keep old last-modified value at file copy/move/rename diff --git a/app/src/main/res/values-fi/strings.xml b/app/src/main/res/values-fi/strings.xml index 57e76daec..9e037de4c 100644 --- a/app/src/main/res/values-fi/strings.xml +++ b/app/src/main/res/values-fi/strings.xml @@ -129,6 +129,7 @@ Korvaa jakaminen kääntämisellä koko näytön tilassa Show extended details over fullscreen media Manage extended details + Keep old last-modified value at file copy/move/rename diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index efa023339..eb5ff60f6 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -129,6 +129,7 @@ Remplacer Partager par Pivoter si menu en plein écran Afficher les détails supplémentaires par dessus le média en plein écran Gérer les détails supplémentaires + Keep old last-modified value at file copy/move/rename diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index 2eb9d22d0..7db801366 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -129,6 +129,7 @@ Replace Share with Rotate at fullscreen menu Show extended details over fullscreen media Manage extended details + Keep old last-modified value at file copy/move/rename diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index f6c210722..cc6924dc3 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -129,6 +129,7 @@ Sostituisci Condividi con Ruota a schermo intero Mostra informazioni estese su media a schermo intero Gestisci le informazioni estese + Keep old last-modified value at file copy/move/rename diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index dc2413462..f91558821 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -129,6 +129,7 @@ フルスクリーンメニューの「共有」を「回転」に置き換える Show extended details over fullscreen media Manage extended details + Keep old last-modified value at file copy/move/rename diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index ec4df3365..3c7b31a69 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -129,6 +129,7 @@ Menu-item Draaien vastzetten in volledige weergave (in plaats van Delen) Uitgebreide informatie tonen in volledige weergave Uitgebreide informatie + Keep old last-modified value at file copy/move/rename diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index c77a32cad..c5ab80af2 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -129,6 +129,7 @@ Zamień funkcję udostępniania na obracanie w menu pełnoekranowym Dodatkowe szczegóły przy podglądzie pełnoekranowym Zarządzaj dodatkowymi szczegółami + Keep old last-modified value at file copy/move/rename diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 8c391f4b7..1e39213db 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -129,6 +129,7 @@ Substituir botão "Compartilhar" por "Rotação de tela" quando em tela cheia Exibir detalhes extendidos quando em tela cheia Gerenciar detalhes extendidos + Keep old last-modified value at file copy/move/rename diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index 09e7a83d3..bf1efa4af 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -129,6 +129,7 @@ Substituir a opção Partilhar pela opção Rodar se em ecrã completo Mostrar detalhes se em ecrã completo Gerir detalhes exibidos + Keep old last-modified value at file copy/move/rename diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index d62e8711d..b66903eef 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -129,6 +129,7 @@ Заменить \'Поделиться\' на \'Повернуть\' в меню полноэкранного режима Show extended details over fullscreen media Manage extended details + Keep old last-modified value at file copy/move/rename diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index f562dff8d..8f004a004 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -129,6 +129,7 @@ Nahradiť Zdieľanie s Otočením v celoobrazovkovom menu Zobraziť rozšírené vlastnosti ponad celoobrazovkové médiá Spravovať rozšírené vlastnosti + Ponechať starú hodnotu naposledy-upravené pri kopírovaní/presúvaní/premenúvaní súborov diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index 106063a54..b4c2aef0d 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -129,6 +129,7 @@ Ersätt Dela med Rotera i helskärmsmenyn Show extended details over fullscreen media Manage extended details + Keep old last-modified value at file copy/move/rename diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index a9ac2f748..811d06fb6 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -129,6 +129,7 @@ Replace Share with Rotate at fullscreen menu Show extended details over fullscreen media Manage extended details + Keep old last-modified value at file copy/move/rename diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 90412da97..a33042254 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -129,6 +129,7 @@ 替换全屏时菜单栏的“分享”为“旋转” 全屏浏览媒体时显示详细信息 要显示的详细信息项目 + Keep old last-modified value at file copy/move/rename diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index bc5042450..0bae980b9 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -129,6 +129,7 @@ 將全螢幕選單的分享取代為旋轉 Show extended details over fullscreen media Manage extended details + Keep old last-modified value at file copy/move/rename diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index b2b1b6986..7d13156d9 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -129,6 +129,7 @@ Replace Share with Rotate at fullscreen menu Show extended details over fullscreen media Manage extended details + Keep old last-modified value at file copy/move/rename From 729eb36ca5c94ea0d3106cd2d0898b0278222a1f Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 28 Oct 2017 16:22:44 +0200 Subject: [PATCH 100/188] do not set videoFragment visibility to false on pause --- .../com/simplemobiletools/gallery/fragments/VideoFragment.kt | 1 - 1 file changed, 1 deletion(-) 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 d130e81c1..470e2b986 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt @@ -96,7 +96,6 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee override fun onPause() { super.onPause() pauseVideo() - mIsFragmentVisible = false mStoredShowExtendedDetails = context.config.showExtendedDetails mStoredExtendedDetails = context.config.extendedDetails } From 05dfced1bc0e18bbc43c9f4ece701214fa5194c4 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 28 Oct 2017 17:50:50 +0200 Subject: [PATCH 101/188] add a toggle in Settings to set keeping last-modified value --- app/build.gradle | 2 +- .../gallery/activities/SettingsActivity.kt | 11 ++++++++++ app/src/main/res/layout/activity_settings.xml | 20 +++++++++++++++++++ 3 files changed, 32 insertions(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 0bd65828a..19c2a6d38 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,7 +37,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.32.6' + compile 'com.simplemobiletools:commons:2.32.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/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt index 7c0b7b60b..c01ad9ea5 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 android.support.v4.content.ContextCompat.startActivity import com.simplemobiletools.commons.dialogs.ConfirmationDialog import com.simplemobiletools.commons.dialogs.RadioGroupDialog import com.simplemobiletools.commons.dialogs.SecurityDialog @@ -13,6 +14,7 @@ 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.R.id.* import com.simplemobiletools.gallery.dialogs.ManageExtendedDetailsDialog import com.simplemobiletools.gallery.extensions.config import com.simplemobiletools.gallery.helpers.ROTATE_BY_ASPECT_RATIO @@ -50,6 +52,7 @@ class SettingsActivity : SimpleActivity() { setupDeleteEmptyFolders() setupAllowVideoGestures() setupShowMediaCount() + setupKeepLastModified() setupShowExtendedDetails() setupManageExtendedDetails() updateTextColors(settings_holder) @@ -207,6 +210,14 @@ class SettingsActivity : SimpleActivity() { } } + private fun setupKeepLastModified() { + settings_keep_last_modified.isChecked = config.keepLastModified + settings_keep_last_modified_holder.setOnClickListener { + settings_keep_last_modified.toggle() + config.keepLastModified = settings_keep_last_modified.isChecked + } + } + private fun setupScreenRotation() { settings_screen_rotation.text = getScreenRotationText() settings_screen_rotation_holder.setOnClickListener { diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index 192ef7050..0090560db 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -348,6 +348,26 @@ + + + + + + Date: Sat, 28 Oct 2017 17:55:36 +0200 Subject: [PATCH 102/188] remove some redundant imports --- .../simplemobiletools/gallery/activities/SettingsActivity.kt | 2 -- 1 file changed, 2 deletions(-) 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 c01ad9ea5..6e988b0e3 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt @@ -3,7 +3,6 @@ package com.simplemobiletools.gallery.activities import android.content.Intent import android.content.res.Resources import android.os.Bundle -import android.support.v4.content.ContextCompat.startActivity import com.simplemobiletools.commons.dialogs.ConfirmationDialog import com.simplemobiletools.commons.dialogs.RadioGroupDialog import com.simplemobiletools.commons.dialogs.SecurityDialog @@ -14,7 +13,6 @@ 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.R.id.* import com.simplemobiletools.gallery.dialogs.ManageExtendedDetailsDialog import com.simplemobiletools.gallery.extensions.config import com.simplemobiletools.gallery.helpers.ROTATE_BY_ASPECT_RATIO From 049d84e05407a3cc591a2bb9f2f1409be2f201d0 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 28 Oct 2017 18:39:04 +0200 Subject: [PATCH 103/188] update commons to 2.32.12 --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 19c2a6d38..2941b290c 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,7 +37,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.32.11' + compile 'com.simplemobiletools:commons:2.32.12' 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 b1019af51b34c8cae3eb50f58acc733d18798d61 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 28 Oct 2017 18:39:26 +0200 Subject: [PATCH 104/188] fix #320, make orientation by "Device rotation" less sensitive --- .../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 a6d91c38b..d8d814da1 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -176,8 +176,8 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View mOrientationEventListener = object : OrientationEventListener(this, SensorManager.SENSOR_DELAY_NORMAL) { override fun onOrientationChanged(orientation: Int) { val currOrient = when (orientation) { - in 45..134 -> ORIENT_LANDSCAPE_RIGHT - in 225..314 -> ORIENT_LANDSCAPE_LEFT + in 75..134 -> ORIENT_LANDSCAPE_RIGHT + in 225..289 -> ORIENT_LANDSCAPE_LEFT else -> ORIENT_PORTRAIT } From 883e3ad6c1819537ac7df5e018a92603de4a8ea0 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 28 Oct 2017 19:04:30 +0200 Subject: [PATCH 105/188] add a check if the owner file from extended details exists --- .../simplemobiletools/gallery/fragments/ViewPagerFragment.kt | 3 +++ 1 file changed, 3 insertions(+) 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 31a2888c4..e495e4168 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/ViewPagerFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/ViewPagerFragment.kt @@ -20,6 +20,9 @@ abstract class ViewPagerFragment : Fragment() { fun getMediumExtendedDetails(medium: Medium): String { val file = File(medium.path) + if (!file.exists()) + return "" + val path = "${file.parent.trimEnd('/')}/" val exif = android.media.ExifInterface(medium.path) val details = StringBuilder() From 75c9d28547b754cb9438b9132f253358487e9123 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 28 Oct 2017 19:05:51 +0200 Subject: [PATCH 106/188] make sure the video fragment still exists when the video completes --- .../com/simplemobiletools/gallery/fragments/VideoFragment.kt | 4 ++++ .../simplemobiletools/gallery/fragments/ViewPagerFragment.kt | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) 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 470e2b986..8985628c1 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt @@ -464,6 +464,10 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee } private fun videoCompleted() { + if (!isAdded) { + return + } + if (listener?.videoEnded() == false && context.config.loopVideos) { playVideo() } else { 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 e495e4168..20a73b886 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/ViewPagerFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/ViewPagerFragment.kt @@ -20,8 +20,9 @@ abstract class ViewPagerFragment : Fragment() { fun getMediumExtendedDetails(medium: Medium): String { val file = File(medium.path) - if (!file.exists()) + if (!file.exists()) { return "" + } val path = "${file.parent.trimEnd('/')}/" val exif = android.media.ExifInterface(medium.path) From 1dad41fdf71150d5f88754c98d3b3e6b7d7bb90d Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 28 Oct 2017 19:56:33 +0200 Subject: [PATCH 107/188] show an error if the user tries sharing too much data --- app/build.gradle | 2 +- .../com/simplemobiletools/gallery/extensions/activity.kt | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 2941b290c..53da5228b 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,7 +37,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.32.12' + compile 'com.simplemobiletools:commons:2.32.15' 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/extensions/activity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt index 5423a0777..3e4c91de9 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt @@ -3,6 +3,7 @@ package com.simplemobiletools.gallery.extensions import android.app.Activity import android.content.Intent import android.net.Uri +import android.os.TransactionTooLargeException import android.provider.MediaStore import android.support.v7.app.AppCompatActivity import android.view.View @@ -61,7 +62,11 @@ fun Activity.shareMedia(media: List) { type = uris.getMimeType() addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris) - startActivity(Intent.createChooser(this, shareTitle)) + try { + startActivity(Intent.createChooser(this, shareTitle)) + } catch (e: TransactionTooLargeException) { + toast(R.string.maximum_share_reached) + } } } From 4d913527f531d4b65e4b4a10f2297995b7f29fb9 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 28 Oct 2017 21:51:23 +0200 Subject: [PATCH 108/188] update commons to 2.33.0 --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 53da5228b..2e26e25e5 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,7 +37,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.32.15' + compile 'com.simplemobiletools:commons:2.33.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 788885227ae54bbb95370f1632aa152621324146 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 28 Oct 2017 22:02:17 +0200 Subject: [PATCH 109/188] added a fake drag check at slideshow --- .../gallery/activities/ViewPagerActivity.kt | 10 ++++++---- 1 file changed, 6 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 d8d814da1..a99a66b4d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -327,10 +327,12 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View 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)) + if (view_pager?.isFakeDragging == true) { + val dragPosition = animation.animatedValue as Int + val dragOffset = dragPosition - oldDragPosition + oldDragPosition = dragPosition + view_pager.fakeDragBy(dragOffset * (if (forward) 1f else -1f)) + } } }) From 4f2b05c2a0a2fecd11b96ebd8760693084e1aa09 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 28 Oct 2017 22:04:53 +0200 Subject: [PATCH 110/188] adding the new toggle to 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 172317755..259d564bf 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -635,6 +635,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { add(Release(133, R.string.release_133)) add(Release(136, R.string.release_136)) add(Release(137, R.string.release_137)) + add(Release(138, R.string.release_138)) checkWhatsNew(this, BuildConfig.VERSION_CODE) } } diff --git a/app/src/main/res/values/donottranslate.xml b/app/src/main/res/values/donottranslate.xml index de109b996..a8c998266 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 keep last-modified field at file copy/move/rename Added an option to hide folder media count on the main screen Added an option to show customizable extended details over fullscreen media From fc7626d2979094773ad97996dacaf614cc0162cc Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 28 Oct 2017 22:05:04 +0200 Subject: [PATCH 111/188] update version to 2.17.0 --- app/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 2e26e25e5..c5e620f2d 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,8 +10,8 @@ android { applicationId "com.simplemobiletools.gallery" minSdkVersion 16 targetSdkVersion 26 - versionCode 137 - versionName "2.16.1" + versionCode 138 + versionName "2.17.0" } signingConfigs { From 59b2d9136927fd5f759972e8c085da37309adc13 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 28 Oct 2017 22:08:11 +0200 Subject: [PATCH 112/188] updating changelog --- CHANGELOG.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 11500d8ac..ac69815dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,18 @@ Changelog ========== +Version 2.17.0 *(2017-10-28)* +---------------------------- + + * Added a toggle for keeping last-modified field at file copy/move/rename + * Improved GIF animation speed + * Implemented fileprovider support to third party intents + * Make rotation by "Device rotation" less sensitive + * Automatically append "_1" to filename after saving through the Editor + * Added support for Adaptive icons for Android 8 (by fiepi) + * Added Dutch translation (by ltGuillaume) + * Many other smaller improvements + Version 2.16.1 *(2017-10-24)* ---------------------------- From b966b79b7378b945bf917ab5af9d974e221bc77a Mon Sep 17 00:00:00 2001 From: Guillaume Date: Sun, 29 Oct 2017 05:55:11 +0100 Subject: [PATCH 113/188] New string --- app/src/main/res/values-nl/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index 3c7b31a69..82f9b4bff 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -129,7 +129,7 @@ Menu-item Draaien vastzetten in volledige weergave (in plaats van Delen) Uitgebreide informatie tonen in volledige weergave Uitgebreide informatie - Keep old last-modified value at file copy/move/rename + Datum laatst gewijzigd behouden bij bestandsoperaties From de1c418f7830c7048e94de23657fcb9c49d9e498 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 29 Oct 2017 10:29:57 +0100 Subject: [PATCH 114/188] catch exceptions thrown at getting mimetype from uri --- .../com/simplemobiletools/gallery/extensions/context.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 922ad88ff..9bbbf9acf 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt @@ -82,7 +82,10 @@ fun Context.getSortedDirectories(source: ArrayList): ArrayList Date: Sun, 29 Oct 2017 10:34:37 +0100 Subject: [PATCH 115/188] make mUri in PhotoVideoActivity nullable --- .../gallery/activities/PhotoVideoActivity.kt | 27 +++++++++---------- 1 file changed, 13 insertions(+), 14 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 ca6d1c0a0..29850ebfa 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt @@ -33,8 +33,7 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList private var mIsFullScreen = false private var mIsFromGallery = false private var mFragment: ViewPagerFragment? = null - - lateinit var mUri: Uri + private var mUri: Uri? = null var mIsVideo = false @@ -59,15 +58,15 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList mIsFromGallery = intent.getBooleanExtra(IS_FROM_GALLERY, false) - if (mUri.scheme == "file") { - scanPath(mUri.path) {} - sendViewPagerIntent(mUri.path) + if (mUri!!.scheme == "file") { + scanPath(mUri!!.path) {} + sendViewPagerIntent(mUri!!.path) finish() return } else { - val path = applicationContext.getRealPathFromURI(mUri) ?: "" + val path = applicationContext.getRealPathFromURI(mUri!!) ?: "" if (path != mUri.toString()) { - scanPath(mUri.path) {} + scanPath(mUri!!.path) {} if (path.isNotEmpty()) { sendViewPagerIntent(path) finish() @@ -79,7 +78,7 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList showSystemUI() val bundle = Bundle() val file = File(mUri.toString()) - mMedium = Medium(getFilenameFromUri(mUri), mUri.toString(), mIsVideo, 0, 0, file.length()) + mMedium = Medium(getFilenameFromUri(mUri!!), mUri.toString(), mIsVideo, 0, 0, file.length()) title = mMedium!!.name bundle.putSerializable(MEDIUM, mMedium) @@ -119,7 +118,7 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList menu.findItem(R.id.menu_set_as).isVisible = mMedium?.isImage() == true menu.findItem(R.id.menu_edit).isVisible = mMedium?.isImage() == true - menu.findItem(R.id.menu_edit).isVisible = mUri.scheme == "file" + menu.findItem(R.id.menu_edit).isVisible = mUri?.scheme == "file" return true } @@ -129,10 +128,10 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList return true when (item.itemId) { - R.id.menu_set_as -> setAs(mUri) - R.id.menu_open_with -> openFile(mUri, true) - R.id.menu_share -> shareUri(mUri) - R.id.menu_edit -> openEditor(mUri) + R.id.menu_set_as -> setAs(mUri!!) + R.id.menu_open_with -> openFile(mUri!!, true) + R.id.menu_share -> shareUri(mUri!!) + R.id.menu_edit -> openEditor(mUri!!) R.id.menu_properties -> showProperties() else -> return super.onOptionsItemSelected(item) } @@ -140,7 +139,7 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList } private fun showProperties() { - PropertiesDialog(this, mUri.path) + PropertiesDialog(this, mUri!!.path) } override fun fragmentClicked() { From b154ee77edd2911314697827ac40c8a703d24826 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 29 Oct 2017 10:34:44 +0100 Subject: [PATCH 116/188] update commons to 2.33.1 --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index c5e620f2d..86025a798 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,7 +37,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.33.0' + compile 'com.simplemobiletools:commons:2.33.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 d52eb60611f3824a90ce9c3040bca7f00ad68032 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 29 Oct 2017 11:26:14 +0100 Subject: [PATCH 117/188] use REAL_FILE_PATH from the commons library --- app/build.gradle | 2 +- .../simplemobiletools/gallery/activities/PhotoVideoActivity.kt | 2 +- .../kotlin/com/simplemobiletools/gallery/helpers/Constants.kt | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 86025a798..3705db051 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,7 +37,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.33.1' + compile 'com.simplemobiletools:commons:2.33.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' 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 29850ebfa..0d9e054dc 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt @@ -14,6 +14,7 @@ import com.simplemobiletools.commons.extensions.getRealPathFromURI import com.simplemobiletools.commons.extensions.scanPath import com.simplemobiletools.commons.extensions.toast import com.simplemobiletools.commons.helpers.PERMISSION_WRITE_STORAGE +import com.simplemobiletools.commons.helpers.REAL_FILE_PATH import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.extensions.* import com.simplemobiletools.gallery.fragments.PhotoFragment @@ -22,7 +23,6 @@ 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.helpers.REAL_FILE_PATH import com.simplemobiletools.gallery.models.Medium import kotlinx.android.synthetic.main.fragment_holder.* import java.io.File 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 710ac22b1..663cf7706 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt @@ -67,7 +67,6 @@ val DIRECTORIES = "directories2" val IS_VIEW_INTENT = "is_view_intent" val IS_FROM_GALLERY = "is_from_gallery" val PICKED_PATHS = "picked_paths" -val REAL_FILE_PATH = "real_file_path" val REQUEST_EDIT_IMAGE = 1 val REQUEST_SET_AS = 2 From b421dc273fe7f41e557245e942bbb332d4b04fc8 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 29 Oct 2017 11:41:31 +0100 Subject: [PATCH 118/188] replace MEDIUM constant with PATH in some intents --- .../simplemobiletools/gallery/activities/MediaActivity.kt | 2 +- .../gallery/activities/PhotoVideoActivity.kt | 3 ++- .../gallery/activities/ViewPagerActivity.kt | 2 +- .../simplemobiletools/gallery/adapters/MyPagerAdapter.kt | 6 +++--- .../com/simplemobiletools/gallery/helpers/Constants.kt | 1 + 5 files changed, 8 insertions(+), 6 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 1b1040443..990ae5c9c 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -506,7 +506,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { openFile(Uri.fromFile(file), false) } else { Intent(this, ViewPagerActivity::class.java).apply { - putExtra(MEDIUM, path) + putExtra(PATH, path) putExtra(SHOW_ALL, mShowAll) startActivity(this) } 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 0d9e054dc..9867df395 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt @@ -23,6 +23,7 @@ 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.helpers.PATH import com.simplemobiletools.gallery.models.Medium import kotlinx.android.synthetic.main.fragment_holder.* import java.io.File @@ -108,7 +109,7 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList Intent(this, ViewPagerActivity::class.java).apply { putExtra(IS_VIEW_INTENT, true) putExtra(IS_FROM_GALLERY, mIsFromGallery) - putExtra(MEDIUM, path) + putExtra(PATH, 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 a99a66b4d..57946761e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -101,7 +101,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View } } else { try { - mPath = intent.getStringExtra(MEDIUM) + mPath = intent.getStringExtra(PATH) mShowAll = config.showAll } catch (e: Exception) { showErrorToast(e) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MyPagerAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MyPagerAdapter.kt index b7e5640ad..b4be25e37 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MyPagerAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MyPagerAdapter.kt @@ -23,10 +23,10 @@ class MyPagerAdapter(val activity: ViewPagerActivity, fm: FragmentManager, val m bundle.putSerializable(MEDIUM, medium) val fragment: ViewPagerFragment - if (medium.video) { - fragment = VideoFragment() + fragment = if (medium.video) { + VideoFragment() } else { - fragment = PhotoFragment() + PhotoFragment() } fragment.arguments = bundle 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 663cf7706..6e24d3fc4 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt @@ -59,6 +59,7 @@ val NOMEDIA = ".nomedia" val DIRECTORY = "directory" val MEDIUM = "medium" +val PATH = "path" val GET_IMAGE_INTENT = "get_image_intent" val GET_VIDEO_INTENT = "get_video_intent" val GET_ANY_INTENT = "get_any_intent" From 809d9b81a2f13d3ee1ad48438c861eb5975b9fe0 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 29 Oct 2017 12:27:26 +0100 Subject: [PATCH 119/188] some corrections to loading gifs --- .../gallery/activities/PhotoVideoActivity.kt | 1 - .../gallery/fragments/PhotoFragment.kt | 14 ++++++++++++-- 2 files changed, 12 insertions(+), 3 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 9867df395..cbea2e3a8 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt @@ -28,7 +28,6 @@ import com.simplemobiletools.gallery.models.Medium import kotlinx.android.synthetic.main.fragment_holder.* import java.io.File - open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentListener { private var mMedium: Medium? = null private var mIsFullScreen = false 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 4bb52fdb1..5852698d2 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt @@ -24,6 +24,7 @@ import com.davemorrissey.labs.subscaleview.ImageSource import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.gallery.R +import com.simplemobiletools.gallery.activities.PhotoActivity import com.simplemobiletools.gallery.activities.ViewPagerActivity import com.simplemobiletools.gallery.extensions.* import com.simplemobiletools.gallery.helpers.GlideRotateTransformation @@ -48,10 +49,14 @@ class PhotoFragment : ViewPagerFragment() { override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View { view = inflater.inflate(R.layout.pager_photo_item, container, false) as ViewGroup + if (!isFragmentVisible && activity is PhotoActivity) { + isFragmentVisible = true + } + medium = arguments.getSerializable(MEDIUM) as Medium if (medium.path.startsWith("content://")) { val originalPath = medium.path - medium.path = context.getRealPathFromURI(Uri.parse(originalPath)) ?: "" + medium.path = context.getRealPathFromURI(Uri.parse(originalPath)) ?: medium.path if (medium.path.isEmpty()) { var out: FileOutputStream? = null @@ -155,7 +160,12 @@ class PhotoFragment : ViewPagerFragment() { private fun loadImage() { if (medium.isGif()) { - gifDrawable = GifDrawable(medium.path) + gifDrawable = if (medium.path.startsWith("content://") || medium.path.startsWith("file://")) { + GifDrawable(context.contentResolver, Uri.parse(medium.path)) + } else { + GifDrawable(medium.path) + } + if (!isFragmentVisible) { gifDrawable!!.stop() } From 972a1d4a39e0f1f528b8fcd7b649c7e16fd28a20 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 29 Oct 2017 12:51:04 +0100 Subject: [PATCH 120/188] show Properties button at PhotoVideoActivity only with file content uri --- .../gallery/activities/PhotoVideoActivity.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 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 cbea2e3a8..0b57d68fb 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt @@ -117,8 +117,8 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList menuInflater.inflate(R.menu.photo_video_menu, menu) menu.findItem(R.id.menu_set_as).isVisible = mMedium?.isImage() == true - menu.findItem(R.id.menu_edit).isVisible = mMedium?.isImage() == true - menu.findItem(R.id.menu_edit).isVisible = mUri?.scheme == "file" + menu.findItem(R.id.menu_edit).isVisible = mMedium?.isImage() == true && mUri?.scheme == "file" + menu.findItem(R.id.menu_properties).isVisible = mUri?.scheme == "file" return true } From 73856e676984fa063f3f3ac3f8a4d1d2e0f124a2 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 29 Oct 2017 18:28:28 +0100 Subject: [PATCH 121/188] reuse the OpenFile intent handling from Commons --- app/build.gradle | 2 +- .../gallery/activities/PhotoVideoActivity.kt | 2 +- .../gallery/activities/ViewPagerActivity.kt | 1 + .../gallery/extensions/activity.kt | 29 +++++-------------- .../gallery/extensions/context.kt | 20 ------------- .../gallery/helpers/Constants.kt | 1 - 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-fi/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-nl/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 -- 26 files changed, 10 insertions(+), 85 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 3705db051..df3495aa0 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,7 +37,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.33.2' + compile 'com.simplemobiletools:commons:2.33.3' 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/PhotoVideoActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt index 0b57d68fb..d0879b481 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt @@ -13,6 +13,7 @@ import com.simplemobiletools.commons.extensions.getFilenameFromUri import com.simplemobiletools.commons.extensions.getRealPathFromURI import com.simplemobiletools.commons.extensions.scanPath import com.simplemobiletools.commons.extensions.toast +import com.simplemobiletools.commons.helpers.IS_FROM_GALLERY import com.simplemobiletools.commons.helpers.PERMISSION_WRITE_STORAGE import com.simplemobiletools.commons.helpers.REAL_FILE_PATH import com.simplemobiletools.gallery.R @@ -20,7 +21,6 @@ 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.helpers.PATH 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 57946761e..967f1ce21 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.IS_FROM_GALLERY import com.simplemobiletools.commons.helpers.PERMISSION_WRITE_STORAGE import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.activities.MediaActivity.Companion.mMedia 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 3e4c91de9..675f67b2b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt @@ -20,7 +20,9 @@ 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.* +import com.simplemobiletools.gallery.helpers.NOMEDIA +import com.simplemobiletools.gallery.helpers.REQUEST_EDIT_IMAGE +import com.simplemobiletools.gallery.helpers.REQUEST_SET_AS import com.simplemobiletools.gallery.models.Directory import com.simplemobiletools.gallery.models.Medium import com.simplemobiletools.gallery.views.MySquareImageView @@ -32,7 +34,7 @@ fun Activity.shareUri(uri: Uri) { val shareTitle = resources.getString(R.string.share_via) Intent().apply { action = Intent.ACTION_SEND - putExtra(Intent.EXTRA_STREAM, ensurePublicUri(uri)) + putExtra(Intent.EXTRA_STREAM, ensurePublicUri(uri, BuildConfig.APPLICATION_ID)) type = getMimeTypeFromUri(uri) addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) startActivity(Intent.createChooser(this, shareTitle)) @@ -71,7 +73,7 @@ fun Activity.shareMedia(media: List) { } fun Activity.setAs(uri: Uri) { - val newUri = ensurePublicUri(uri) + val newUri = ensurePublicUri(uri, BuildConfig.APPLICATION_ID) Intent().apply { action = Intent.ACTION_ATTACH_DATA setDataAndType(newUri, getMimeTypeFromUri(newUri)) @@ -87,28 +89,11 @@ fun Activity.setAs(uri: Uri) { } fun Activity.openFile(uri: Uri, forceChooser: Boolean) { - val newUri = ensurePublicUri(uri) - Intent().apply { - action = Intent.ACTION_VIEW - setDataAndType(newUri, getMimeTypeFromUri(newUri)) - addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) - putExtra(IS_FROM_GALLERY, true) - - if (isNougatPlus()) { - putExtra(REAL_FILE_PATH, uri) - } - - if (resolveActivity(packageManager) != null) { - val chooser = Intent.createChooser(this, getString(R.string.open_with)) - startActivity(if (forceChooser) chooser else this) - } else { - toast(R.string.no_app_found) - } - } + openFile(uri, forceChooser, BuildConfig.APPLICATION_ID) } fun Activity.openEditor(uri: Uri) { - val newUri = ensurePublicUri(uri) + val newUri = ensurePublicUri(uri, BuildConfig.APPLICATION_ID) Intent().apply { action = Intent.ACTION_EDIT setDataAndType(newUri, getMimeTypeFromUri(newUri)) 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 9bbbf9acf..d4b01c633 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt @@ -78,23 +78,3 @@ fun Context.getSortedDirectories(source: ArrayList): ArrayListGallery Edit Open camera - Open with - No valid app found (hidden) Pin folder Unpin folder diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index 0a789d2b9..58607210b 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -4,8 +4,6 @@ Galerie Upravit Spustit fotoaparát - Otevřít pomocí - Nebyla nalezena žádná vhodná aplikace (skryté) Připnout složku Odepnout složku diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index cc3cf7217..c61f4ddcf 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -4,8 +4,6 @@ Galerie Bearbeiten Kamera öffnen - Öffnen mit - Keine passende App gefunden (versteckt) Ordner anheften Ordner loslösen diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index a734b1cd3..da0f6fcc5 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -4,8 +4,6 @@ Galería Editar Abrir cámara - Abrir con… - No se encontró una aplicación válida (oculto) Fijar carpeta No fijar carpeta diff --git a/app/src/main/res/values-fi/strings.xml b/app/src/main/res/values-fi/strings.xml index 9e037de4c..6b52c8944 100644 --- a/app/src/main/res/values-fi/strings.xml +++ b/app/src/main/res/values-fi/strings.xml @@ -4,8 +4,6 @@ Galleria Muokkaa Avaa kamera - Avaa - Sovelluksia ei löydetty (piilotettu) Kiinnitä kansio Poista kiinnitys diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index eb5ff60f6..04ef9738b 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -4,8 +4,6 @@ Galerie Édition Ouvrir appareil photo - Ouvrir avec - Aucune application valide trouvée (caché) Épingler le dossier Désépingler le dossier diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index 7db801366..64b823830 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -4,8 +4,6 @@ Gallery Edit Open camera - Open with - No valid app found (hidden) Pin folder Unpin folder diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index cc6924dc3..5e242277b 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -4,8 +4,6 @@ Galleria Modifica Apri fotocamera - Apri con - Nessun app valida trovata (nascosta) Blocca cartella Sblocca cartella diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index f91558821..b2ad7e4b3 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -4,8 +4,6 @@ ギャラリー 編集 カメラを開く - 別のアプリで開く - 有効なアプリが見つかりません (非表示) フォルダーをピン留めする フォルダーのピン留めを外す diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index 82f9b4bff..f8d0b97e1 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -4,8 +4,6 @@ Gallerij Bewerken Camera - Openen met - Geen app gevonden om dit bestand mee te openen (verborgen) Map vastzetten Map losmaken diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index c5ab80af2..5540e8018 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -4,8 +4,6 @@ Simple Gallery Edytuj Uruchom aplikację aparatu - Otwórz w - Nie znaleziono danych aplikacji (ukryty) Przypnij folder Wypakuj folder diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 1e39213db..f3c706810 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -4,8 +4,6 @@ Galeria Editar Abrir câmera - Abrir com - Nenhum aplicativo encontrado     (oculto) Fixar pasta Desfixar pasta diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index bf1efa4af..0cb7291f2 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -4,8 +4,6 @@ Galeria Editar Abrir câmara - Abrir com - Nenhuma aplicação encontrada (oculta) Fixar pasta Desafixar pasta diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index b66903eef..b2e684e73 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -4,8 +4,6 @@ Галерея Редактировать Открыть камеру - Открыть в - Приложение не найдено (Скрытый) Закрепить папку Открепить папку diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index 8f004a004..6239471e7 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -4,8 +4,6 @@ Galéria Upraviť Otvoriť fotoaparát - Otvoriť pomocou - Nenašla sa žiadna vhodná aplikácia (skryté) Pripnúť priečinok Odopnúť priečinok diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index b4c2aef0d..63e5194d9 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -4,8 +4,6 @@ Galleri Redigera Starta kameran - Öppna med - Hittade ingen giltig app (dold) Fäst mappen Släpp mappen diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index 811d06fb6..5179f74ef 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -4,8 +4,6 @@ Galeri Düzenle Kamerayı aç - Bununla aç - Geçerli bir uygulama bulunamadı (gizli) Pin klasör Klasörü çöz diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index a33042254..497b9247d 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -4,8 +4,6 @@ 简约图库 编辑 打开相机 - 打开方式 - 未找到可用应用 (隐藏) 锁定目录 解除锁定目录 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 0bae980b9..3be9815c9 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -4,8 +4,6 @@ 簡易相簿 編輯 開啟相機 - 以其他應用程式開啟 - 找不到應用程式 (隱藏) 釘選資料夾 取消釘選資料夾 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 7d13156d9..99c1c1e81 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -4,8 +4,6 @@ Gallery Edit Open camera - Open with - No valid app found (hidden) Pin folder Unpin folder From 02dfcd63c06fb8c7c4af1c04f037b1afad5ca844 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 29 Oct 2017 18:35:08 +0100 Subject: [PATCH 122/188] reuse shareUri at shareMedium --- .../simplemobiletools/gallery/extensions/activity.kt | 11 +---------- 1 file changed, 1 insertion(+), 10 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 675f67b2b..d38c06865 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt @@ -42,17 +42,8 @@ fun Activity.shareUri(uri: Uri) { } fun Activity.shareMedium(medium: Medium) { - val shareTitle = resources.getString(R.string.share_via) val file = File(medium.path) - val uri = getFilePublicUri(file, BuildConfig.APPLICATION_ID) - - Intent().apply { - action = Intent.ACTION_SEND - putExtra(Intent.EXTRA_STREAM, uri) - type = getMimeTypeFromUri(uri) - addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) - startActivity(Intent.createChooser(this, shareTitle)) - } + shareUri(Uri.fromFile(file)) } fun Activity.shareMedia(media: List) { From 437390cfa3c603d538c6384e865c8d15b4f0f606 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 29 Oct 2017 18:37:38 +0100 Subject: [PATCH 123/188] create a shareUris extension for sharing multiple media --- .../gallery/extensions/activity.kt | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 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 d38c06865..12f3ef851 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt @@ -41,15 +41,8 @@ fun Activity.shareUri(uri: Uri) { } } -fun Activity.shareMedium(medium: Medium) { - val file = File(medium.path) - shareUri(Uri.fromFile(file)) -} - -fun Activity.shareMedia(media: List) { +fun Activity.shareUris(uris: ArrayList) { val shareTitle = resources.getString(R.string.share_via) - val uris = media.map { getFilePublicUri(File(it.path), BuildConfig.APPLICATION_ID) } as ArrayList - Intent().apply { action = Intent.ACTION_SEND_MULTIPLE type = uris.getMimeType() @@ -63,6 +56,16 @@ fun Activity.shareMedia(media: List) { } } +fun Activity.shareMedium(medium: Medium) { + val file = File(medium.path) + shareUri(Uri.fromFile(file)) +} + +fun Activity.shareMedia(media: List) { + val uris = media.map { getFilePublicUri(File(it.path), BuildConfig.APPLICATION_ID) } as ArrayList + shareUris(uris) +} + fun Activity.setAs(uri: Uri) { val newUri = ensurePublicUri(uri, BuildConfig.APPLICATION_ID) Intent().apply { From 4c80ba98fbd6f53d1d4ef72304af04f80223e613 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 29 Oct 2017 19:08:45 +0100 Subject: [PATCH 124/188] move a couple more intent handling to the Commons library --- app/build.gradle | 2 +- .../gallery/activities/MediaActivity.kt | 1 + .../gallery/activities/ViewPagerActivity.kt | 2 + .../gallery/extensions/activity.kt | 56 ++----------------- .../gallery/helpers/Constants.kt | 3 - 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-nl/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 - 25 files changed, 8 insertions(+), 76 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index df3495aa0..97c2147ee 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,7 +37,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.33.3' + compile 'com.simplemobiletools:commons:2.33.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/MediaActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt index 990ae5c9c..cdb538151 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -22,6 +22,7 @@ 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.helpers.REQUEST_EDIT_IMAGE import com.simplemobiletools.commons.models.RadioItem import com.simplemobiletools.commons.views.MyScalableRecyclerView import com.simplemobiletools.gallery.R 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 967f1ce21..c405adf05 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -28,6 +28,8 @@ import com.simplemobiletools.commons.dialogs.RenameItemDialog import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.helpers.IS_FROM_GALLERY import com.simplemobiletools.commons.helpers.PERMISSION_WRITE_STORAGE +import com.simplemobiletools.commons.helpers.REQUEST_EDIT_IMAGE +import com.simplemobiletools.commons.helpers.REQUEST_SET_AS import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.activities.MediaActivity.Companion.mMedia import com.simplemobiletools.gallery.adapters.MyPagerAdapter 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 12f3ef851..5bf08e18d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt @@ -3,7 +3,6 @@ package com.simplemobiletools.gallery.extensions import android.app.Activity import android.content.Intent import android.net.Uri -import android.os.TransactionTooLargeException import android.provider.MediaStore import android.support.v7.app.AppCompatActivity import android.view.View @@ -21,8 +20,6 @@ import com.simplemobiletools.gallery.BuildConfig import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.activities.SimpleActivity import com.simplemobiletools.gallery.helpers.NOMEDIA -import com.simplemobiletools.gallery.helpers.REQUEST_EDIT_IMAGE -import com.simplemobiletools.gallery.helpers.REQUEST_SET_AS import com.simplemobiletools.gallery.models.Directory import com.simplemobiletools.gallery.models.Medium import com.simplemobiletools.gallery.views.MySquareImageView @@ -31,29 +28,11 @@ import java.io.File import java.util.* fun Activity.shareUri(uri: Uri) { - val shareTitle = resources.getString(R.string.share_via) - Intent().apply { - action = Intent.ACTION_SEND - putExtra(Intent.EXTRA_STREAM, ensurePublicUri(uri, BuildConfig.APPLICATION_ID)) - type = getMimeTypeFromUri(uri) - addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) - startActivity(Intent.createChooser(this, shareTitle)) - } + shareUri(uri, BuildConfig.APPLICATION_ID) } fun Activity.shareUris(uris: ArrayList) { - val shareTitle = resources.getString(R.string.share_via) - Intent().apply { - action = Intent.ACTION_SEND_MULTIPLE - type = uris.getMimeType() - addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) - putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris) - try { - startActivity(Intent.createChooser(this, shareTitle)) - } catch (e: TransactionTooLargeException) { - toast(R.string.maximum_share_reached) - } - } + shareUris(uris, BuildConfig.APPLICATION_ID) } fun Activity.shareMedium(medium: Medium) { @@ -67,19 +46,7 @@ fun Activity.shareMedia(media: List) { } fun Activity.setAs(uri: Uri) { - val newUri = ensurePublicUri(uri, BuildConfig.APPLICATION_ID) - Intent().apply { - action = Intent.ACTION_ATTACH_DATA - setDataAndType(newUri, getMimeTypeFromUri(newUri)) - addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) - val chooser = Intent.createChooser(this, getString(R.string.set_as)) - - if (resolveActivity(packageManager) != null) { - startActivityForResult(chooser, REQUEST_SET_AS) - } else { - toast(R.string.no_capable_app_found) - } - } + setAs(uri, BuildConfig.APPLICATION_ID) } fun Activity.openFile(uri: Uri, forceChooser: Boolean) { @@ -87,22 +54,7 @@ fun Activity.openFile(uri: Uri, forceChooser: Boolean) { } fun Activity.openEditor(uri: Uri) { - val newUri = ensurePublicUri(uri, BuildConfig.APPLICATION_ID) - Intent().apply { - action = Intent.ACTION_EDIT - setDataAndType(newUri, getMimeTypeFromUri(newUri)) - addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) - - if (isNougatPlus()) { - putExtra(MediaStore.EXTRA_OUTPUT, uri) - } - - if (resolveActivity(packageManager) != null) { - startActivityForResult(this, REQUEST_EDIT_IMAGE) - } else { - toast(R.string.no_editor_found) - } - } + openEditor(uri, BuildConfig.APPLICATION_ID) } fun Activity.launchCamera() { 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 4e3d212c5..23b5a2673 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt @@ -68,9 +68,6 @@ val DIRECTORIES = "directories2" val IS_VIEW_INTENT = "is_view_intent" val PICKED_PATHS = "picked_paths" -val REQUEST_EDIT_IMAGE = 1 -val REQUEST_SET_AS = 2 - // rotations val ROTATE_BY_SYSTEM_SETTING = 0 val ROTATE_BY_DEVICE_ROTATION = 1 diff --git a/app/src/main/res/values-ca/strings.xml b/app/src/main/res/values-ca/strings.xml index 99c1c1e81..d5cb6030c 100644 --- a/app/src/main/res/values-ca/strings.xml +++ b/app/src/main/res/values-ca/strings.xml @@ -20,7 +20,6 @@ Change cover image Select photo Use default - Set as Volume Brightness Do not ask again in this session diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index 58607210b..4d68d3bbd 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -20,7 +20,6 @@ Change cover image Select photo Use default - Nastavit jako Volume Brightness Do not ask again in this session diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index c61f4ddcf..319aafacb 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -20,7 +20,6 @@ Coverbild ändern Auswählen Standard - Festlegen als Lautstärke Helligkeit Nicht erneut fragen (in dieser Session) diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index da0f6fcc5..735ddbe69 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -20,7 +20,6 @@ Cambiar imagen de portada Seleccionar imagen Uso por defecto - Establecer como Volume Brightness Do not ask again in this session diff --git a/app/src/main/res/values-fi/strings.xml b/app/src/main/res/values-fi/strings.xml index 6b52c8944..22afe3cb2 100644 --- a/app/src/main/res/values-fi/strings.xml +++ b/app/src/main/res/values-fi/strings.xml @@ -20,7 +20,6 @@ Vaihda kansikuva Valitse kuva Käytä oletuksia - Aseta Äänenvoimakkuus Kirkkaus Do not ask again in this session diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 04ef9738b..2535b0601 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -20,7 +20,6 @@ Changer l\'image de couverture Sélectionner une photo Utiliser par défaut - Définir comme Volume Luminosité Ne pas redemander pour cette session diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index 64b823830..eab18e858 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -20,7 +20,6 @@ Change cover image Select photo Use default - Set as Volume Brightness Do not ask again in this session diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 5e242277b..440d4639c 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -20,7 +20,6 @@ Cambia immagine copertina Seleziona foto Usa predefinita - Imposta come Volume Luminosità Non chiedere nuovamente in questa sessione diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index b2ad7e4b3..3183601e4 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -20,7 +20,6 @@ カバー画像を変更 写真を選択 デフォルトに戻す - 他で使う 音量 明るさ Do not ask again in this session diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index f8d0b97e1..8397ea526 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -20,7 +20,6 @@ Afbeelding voor omslag veranderen Foto selecteren Standaard gebruiken - Instellen als Volume Helderheid Onthouden voor deze sessie diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index 5540e8018..1b1b88c63 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -20,7 +20,6 @@ Zmień okładkę Wybierz obraz Użyj domyślnej - Ustaw jako Głośność Jasność Nie pytaj więcej w tej sesji diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index f3c706810..d6592ce63 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -20,7 +20,6 @@ Trocar imagem de capa Selecionar foto Usar padrão - Definir como Volume Brilho Não perguntar novamente por enquanto diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index 0cb7291f2..9df65ece4 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -20,7 +20,6 @@ Alterar imagem de capa Selecionar foto Predefinição - Definir como Volume Brilho Não perguntar de novo para esta sessão diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index b2e684e73..5dd2a1e65 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -20,7 +20,6 @@ Изменить обложку Выбрать изображение Использовать по умолчанию - Установить как… Громкость Яркость Do not ask again in this session diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index 6239471e7..044be119d 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -20,7 +20,6 @@ Zmeniť obal albumu Zvoliť foto Použiť predvolený - Nastaviť ako Hlasitosť Jas Nepýtať sa už v tomto spustení diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index 63e5194d9..3fde655e0 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -20,7 +20,6 @@ Byt omslagsbild Välj foto Använd standard - Ange som Volym Ljusstyrka Do not ask again in this session diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index 5179f74ef..fada51349 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -20,7 +20,6 @@ Change cover image Select photo Use default - Set as Volume Brightness Do not ask again in this session diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 497b9247d..d69df212a 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -20,7 +20,6 @@ 更改封面图片 选择图片 使用默认 - 设置为 音量 亮度 不再提醒 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 3be9815c9..0a4bb90d3 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -20,7 +20,6 @@ 更換封面圖片 選擇相片 使用預設 - 設為 音量 亮度 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 99c1c1e81..d5cb6030c 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -20,7 +20,6 @@ Change cover image Select photo Use default - Set as Volume Brightness Do not ask again in this session From 1cf648069520ab847f1eae16841922d1375db047 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 29 Oct 2017 20:01:35 +0100 Subject: [PATCH 125/188] update commons to 2.33.8 --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 97c2147ee..6d9f6a588 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,7 +37,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.33.6' + compile 'com.simplemobiletools:commons:2.33.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' From 27476a0735be5fcc8232ad8a63c3334a4ffb029e Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 29 Oct 2017 20:19:12 +0100 Subject: [PATCH 126/188] lets show Set As and Edit button at videos too, why not --- .../simplemobiletools/gallery/activities/ViewPagerActivity.kt | 2 -- .../com/simplemobiletools/gallery/adapters/MediaAdapter.kt | 4 ---- 2 files changed, 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 c405adf05..ae02f2a66 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -233,8 +233,6 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View menu.apply { findItem(R.id.menu_share_1).isVisible = !config.replaceShare findItem(R.id.menu_share_2).isVisible = config.replaceShare - findItem(R.id.menu_set_as).isVisible = currentMedium.isImage() - findItem(R.id.menu_edit).isVisible = currentMedium.isImage() findItem(R.id.menu_rotate).isVisible = currentMedium.isImage() findItem(R.id.menu_save_as).isVisible = mRotationDegrees != 0f findItem(R.id.menu_hide).isVisible = !currentMedium.name.startsWith('.') 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 c4f8b2e09..46ff5a7cb 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt @@ -108,8 +108,6 @@ 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_open_with).isVisible = selectedPositions.size == 1 - menu.findItem(R.id.cab_edit).isVisible = isOneImageSelected() - menu.findItem(R.id.cab_set_as).isVisible = isOneImageSelected() menu.findItem(R.id.cab_confirm_selection).isVisible = isPickIntent && allowMultiplePicks && selectedPositions.size > 0 checkHideBtnVisibility(menu) @@ -140,8 +138,6 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList, menu.findItem(R.id.cab_hide).isVisible = unhiddenCnt > 0 menu.findItem(R.id.cab_unhide).isVisible = hiddenCnt > 0 } - - private fun isOneImageSelected() = selectedPositions.size == 1 && media.size > selectedPositions.first() && media[selectedPositions.first()].isImage() } private fun confirmSelection() { From bf0f4903972ae1cf130dc60836b6003dda711688 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 29 Oct 2017 20:22:26 +0100 Subject: [PATCH 127/188] update version to 2.17.1 --- app/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 6d9f6a588..236800871 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,8 +10,8 @@ android { applicationId "com.simplemobiletools.gallery" minSdkVersion 16 targetSdkVersion 26 - versionCode 138 - versionName "2.17.0" + versionCode 139 + versionName "2.17.1" } signingConfigs { From 37dd189300f87acaad35193574e7746cd21d9ed0 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 29 Oct 2017 20:22:31 +0100 Subject: [PATCH 128/188] updating changelog --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ac69815dc..0a02b84a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,12 @@ Changelog ========== +Version 2.17.1 *(2017-10-29)* +---------------------------- + + * Show "Set As" and "Edit" menu buttons at videos and gifs too + * Couple other smaller issues fixed + Version 2.17.0 *(2017-10-28)* ---------------------------- From 80c6dcdfc0368081c8aa5b390b4439f1c3fa1959 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 29 Oct 2017 21:01:17 +0100 Subject: [PATCH 129/188] update commons to 2.33.9 --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 236800871..1368f391e 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,7 +37,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.33.8' + compile 'com.simplemobiletools:commons:2.33.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 889ce80df8719c5d4901be98cd5aa4a707bd1b08 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 29 Oct 2017 21:14:09 +0100 Subject: [PATCH 130/188] update Commons to 2.34.1 --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 1368f391e..a06137f99 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,7 +37,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.33.9' + compile 'com.simplemobiletools:commons:2.34.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 26e91a5e0e3261ad0c61893d4f7f457bc2ca8986 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 29 Oct 2017 21:14:18 +0100 Subject: [PATCH 131/188] update version to 2.17.2 --- app/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index a06137f99..f448c2e4e 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,8 +10,8 @@ android { applicationId "com.simplemobiletools.gallery" minSdkVersion 16 targetSdkVersion 26 - versionCode 139 - versionName "2.17.1" + versionCode 140 + versionName "2.17.2" } signingConfigs { From ac5d0d604b17e8ce2636ee63d05e18ba6cc3ac57 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 29 Oct 2017 21:14:24 +0100 Subject: [PATCH 132/188] updating changelog --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a02b84a0..856703a75 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ Changelog ========== +Version 2.17.2 *(2017-10-29)* +---------------------------- + + * Couple more minor fixes + Version 2.17.1 *(2017-10-29)* ---------------------------- From c20a814100ffab0aaaccacd0ce151bdfe65af305 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 29 Oct 2017 22:20:13 +0100 Subject: [PATCH 133/188] use the Keep last-modified setting text from Commons --- app/build.gradle | 2 +- 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-nl/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 - 21 files changed, 1 insertion(+), 21 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index f448c2e4e..79f122486 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,7 +37,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.34.1' + compile 'com.simplemobiletools:commons:2.34.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' diff --git a/app/src/main/res/values-ca/strings.xml b/app/src/main/res/values-ca/strings.xml index d5cb6030c..209dc0b10 100644 --- a/app/src/main/res/values-ca/strings.xml +++ b/app/src/main/res/values-ca/strings.xml @@ -126,7 +126,6 @@ Replace Share with Rotate at fullscreen menu Show extended details over fullscreen media Manage extended details - Keep old last-modified value at file copy/move/rename diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index 4d68d3bbd..d835945cd 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -126,7 +126,6 @@ Replace Share with Rotate at fullscreen menu Show extended details over fullscreen media Manage extended details - Keep old last-modified value at file copy/move/rename diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 319aafacb..1e42aafee 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -126,7 +126,6 @@ Teilen/Drehen im Vollbild-Menü vertauschen Eigenschaften anzeigen im Vollbild Eigenschaften auswählen - Keep old last-modified value at file copy/move/rename diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 735ddbe69..037aa80de 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -126,7 +126,6 @@ Reemplazar Compartir con Girar en el menú de pantalla completa Show extended details over fullscreen media Manage extended details - Keep old last-modified value at file copy/move/rename diff --git a/app/src/main/res/values-fi/strings.xml b/app/src/main/res/values-fi/strings.xml index 22afe3cb2..f6ccd7a8d 100644 --- a/app/src/main/res/values-fi/strings.xml +++ b/app/src/main/res/values-fi/strings.xml @@ -126,7 +126,6 @@ Korvaa jakaminen kääntämisellä koko näytön tilassa Show extended details over fullscreen media Manage extended details - Keep old last-modified value at file copy/move/rename diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 2535b0601..edf3e5d03 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -126,7 +126,6 @@ Remplacer Partager par Pivoter si menu en plein écran Afficher les détails supplémentaires par dessus le média en plein écran Gérer les détails supplémentaires - Keep old last-modified value at file copy/move/rename diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index eab18e858..89abc717c 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -126,7 +126,6 @@ Replace Share with Rotate at fullscreen menu Show extended details over fullscreen media Manage extended details - Keep old last-modified value at file copy/move/rename diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 440d4639c..3e0b0643f 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -126,7 +126,6 @@ Sostituisci Condividi con Ruota a schermo intero Mostra informazioni estese su media a schermo intero Gestisci le informazioni estese - Keep old last-modified value at file copy/move/rename diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 3183601e4..2f9086eb3 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -126,7 +126,6 @@ フルスクリーンメニューの「共有」を「回転」に置き換える Show extended details over fullscreen media Manage extended details - Keep old last-modified value at file copy/move/rename diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index 8397ea526..b8062c76f 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -126,7 +126,6 @@ Menu-item Draaien vastzetten in volledige weergave (in plaats van Delen) Uitgebreide informatie tonen in volledige weergave Uitgebreide informatie - Datum laatst gewijzigd behouden bij bestandsoperaties diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index 1b1b88c63..d153c70ba 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -126,7 +126,6 @@ Zamień funkcję udostępniania na obracanie w menu pełnoekranowym Dodatkowe szczegóły przy podglądzie pełnoekranowym Zarządzaj dodatkowymi szczegółami - Keep old last-modified value at file copy/move/rename diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index d6592ce63..8a17fad18 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -126,7 +126,6 @@ Substituir botão "Compartilhar" por "Rotação de tela" quando em tela cheia Exibir detalhes extendidos quando em tela cheia Gerenciar detalhes extendidos - Keep old last-modified value at file copy/move/rename diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index 9df65ece4..6242d94c4 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -126,7 +126,6 @@ Substituir a opção Partilhar pela opção Rodar se em ecrã completo Mostrar detalhes se em ecrã completo Gerir detalhes exibidos - Keep old last-modified value at file copy/move/rename diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 5dd2a1e65..b3ac96a60 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -126,7 +126,6 @@ Заменить \'Поделиться\' на \'Повернуть\' в меню полноэкранного режима Show extended details over fullscreen media Manage extended details - Keep old last-modified value at file copy/move/rename diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index 044be119d..e4af5b81d 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -126,7 +126,6 @@ Nahradiť Zdieľanie s Otočením v celoobrazovkovom menu Zobraziť rozšírené vlastnosti ponad celoobrazovkové médiá Spravovať rozšírené vlastnosti - Ponechať starú hodnotu naposledy-upravené pri kopírovaní/presúvaní/premenúvaní súborov diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index 3fde655e0..703575d53 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -126,7 +126,6 @@ Ersätt Dela med Rotera i helskärmsmenyn Show extended details over fullscreen media Manage extended details - Keep old last-modified value at file copy/move/rename diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index fada51349..67ea088b9 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -126,7 +126,6 @@ Replace Share with Rotate at fullscreen menu Show extended details over fullscreen media Manage extended details - Keep old last-modified value at file copy/move/rename diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index d69df212a..5442e3f2e 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -126,7 +126,6 @@ 替换全屏时菜单栏的“分享”为“旋转” 全屏浏览媒体时显示详细信息 要显示的详细信息项目 - Keep old last-modified value at file copy/move/rename diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 0a4bb90d3..ff138ebbd 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -126,7 +126,6 @@ 將全螢幕選單的分享取代為旋轉 Show extended details over fullscreen media Manage extended details - Keep old last-modified value at file copy/move/rename diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index d5cb6030c..209dc0b10 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -126,7 +126,6 @@ Replace Share with Rotate at fullscreen menu Show extended details over fullscreen media Manage extended details - Keep old last-modified value at file copy/move/rename From 0fdd03cda20a01708d233a5a1a2b9683da940f0c Mon Sep 17 00:00:00 2001 From: Rodrigo Date: Mon, 30 Oct 2017 00:07:46 -0200 Subject: [PATCH 134/188] Update strings.xml --- app/src/main/res/values-pt-rBR/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 8a17fad18..c9e953185 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -122,7 +122,7 @@ Esconder interface do sistema automaticamente quando em tela cheia Apagar pastas vazias após deleter seu conteúdo Permitir controle do volume e brilho com gestos na vertical - Show folder media count on the main view + Mostrar quantidade de arquivos das pastas Substituir botão "Compartilhar" por "Rotação de tela" quando em tela cheia Exibir detalhes extendidos quando em tela cheia Gerenciar detalhes extendidos From 25e5279696671e98db63db4b7072da7d059971e0 Mon Sep 17 00:00:00 2001 From: Pzqqt <821026875@qq.com> Date: Mon, 30 Oct 2017 16:00:33 +0800 Subject: [PATCH 135/188] Update strings.xml --- app/src/main/res/values-zh-rCN/strings.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 5442e3f2e..74cfdfe11 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -27,7 +27,7 @@ 要显示的媒体文件 图片 - 适配 + 视频 GIFs 所选的过滤器没有找到媒体文件。 更改过滤器 @@ -41,7 +41,7 @@ 是否排除父目录? 此目录及其子目录中的媒体将不会在“简约图库”中显示,但是其它应用可以访问。如果您想对其它应用隐藏,请使用隐藏功能。 移除全部 - 是否删除排除列表中的所有文件夹?此操作不会删除文件夹。 + 是否删除排除列表中的所有项目?此操作不会删除文件夹本身。 包含目录 @@ -113,7 +113,7 @@ GIF 缩略图 浏览时最大亮度 裁剪缩略图 - 全屏时方向 + 全屏方向 系统设置 设备方向 根据长宽比 From 4701e58b0ed53e8d80ff360ad2a2b2ecc89ece8f Mon Sep 17 00:00:00 2001 From: Guillaume Date: Mon, 30 Oct 2017 19:41:47 +0100 Subject: [PATCH 136/188] Uniformity between apps --- app/src/main/res/values-nl/strings.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index ec4df3365..91e0ca7bf 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -1,6 +1,6 @@ - Simple Gallery + Eenvoudige Gallerij Gallerij Bewerken Camera @@ -134,7 +134,7 @@ Een gallerij voor afbeeldingen en video\'s, zonder advertenties. - Een simpele gallerij voor afbeeldingen en video\'s. Bestanden kunnen worden gesorteerd op datum, grootte en naam. Afbeeldingen kunnen in- en uitgezoomd worden. Bestanden worden afhankelijk van de schermgrootte weergegeven in kolommen, waarbij het aantal kolommen kan worden aangepast via knijpgebaren. Bestanden kunnen worden gedeeld, hernoemd, gekopieerd, verplaatst en verwijderd. Afbeeldingen kunnen ook worden bijgesneden, gedraaid, gekanteld of direct vanuit de app als achtergrond worden ingesteld. + Een eenvoudige gallerij voor afbeeldingen en video\'s. Bestanden kunnen worden gesorteerd op datum, grootte en naam. Afbeeldingen kunnen in- en uitgezoomd worden. Bestanden worden afhankelijk van de schermgrootte weergegeven in kolommen, waarbij het aantal kolommen kan worden aangepast via knijpgebaren. Bestanden kunnen worden gedeeld, hernoemd, gekopieerd, verplaatst en verwijderd. Afbeeldingen kunnen ook worden bijgesneden, gedraaid, gekanteld of direct vanuit de app als achtergrond worden ingesteld. De gallerij kan ook worden gebruikt voor het bekijken van afbeeldingen of video\'s vanuit andere apps, om bijlagen toe te voegen in e-mail, etc. Perfect voor dagelijks gebruik. From fc5e8cb9db8d2f0744f989f02e0d8073367756c4 Mon Sep 17 00:00:00 2001 From: Oleg A Date: Mon, 30 Oct 2017 23:06:32 +0300 Subject: [PATCH 137/188] Update strings.xml --- app/src/main/res/values-ru/strings.xml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index b3ac96a60..f480ce936 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -15,14 +15,14 @@ Место съёмки не указано Не найдено приложений с картами Не найдено приложения камеры - Добавить 1 столбец - Убрать 1 столбец + Добавить столбец + Убрать столбец Изменить обложку Выбрать изображение Использовать по умолчанию Громкость Яркость - Do not ask again in this session + Не спрашивать снова (до следующего запуска) Фильтр медиа @@ -84,8 +84,8 @@ Приложение не найдено Установка обоев… Обои успешно установлены - Формат изображения - Пейзажное соотношение сторон + Портрет + Ландшафт Слайдшоу @@ -122,10 +122,10 @@ Автоматически скрывать системный интерфейс в полноэкранном режиме Удалять пустые папки после удаления их содержимого Управлять громкостью и яркостью видео с помощью вертикальных жестов - Show folder media count on the main view + Показывать количество файлов в папках Заменить \'Поделиться\' на \'Повернуть\' в меню полноэкранного режима - Show extended details over fullscreen media - Manage extended details + Показывать детали файла + Выбрать детали файла From 4157f1fb113b1a65aed6aa0830460f707eb2a85d Mon Sep 17 00:00:00 2001 From: Phoenix1747 Date: Tue, 31 Oct 2017 14:38:05 +0100 Subject: [PATCH 138/188] Update strings.xml --- app/src/main/res/values-de/strings.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 1e42aafee..f216c800e 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -12,7 +12,7 @@ Ansicht: Als Ordner Ordner wählen Auf Karte zeigen - Unbekannter Ort + Unbekannter Pfad Keine Karten-App gefunden Keine Kamera-App gefunden Kacheln verkleinern @@ -22,7 +22,7 @@ Standard Lautstärke Helligkeit - Nicht erneut fragen (in dieser Session) + Nicht erneut fragen (in dieser Sitzung) Filter @@ -66,7 +66,7 @@ Bildbearbeitung fehlgeschlagen Bild bearbeiten mit Keine Bildeditor-App gefunden - Unbekannter Dateiort + Unbekannter Dateipfad Konnte Quelldatei nicht überschreiben Nach links drehen Nach rechts drehen @@ -131,11 +131,11 @@ Eine schlichte Galerie zum Betrachten von Bildern und Videos ohne Werbung. - Ein schlichtes Tool zum Betrachten von Bildern und Videos. Die Medien können nach Datum, Größe, Name sowie auf- oder absteigend sortiert angezeigt werden, in Bilder kann hineingezoomt werden. Die Vorschau-Kacheln werden in mehreren Spalten abhängig von der Displaygröße angezeigt, die Spaltenanzahl ist mit Zweifingergesten änderbar. Die Medien können umbenannt, geteilt, gelöscht, kopiert, verschoben werden. Bilder können zugeschnitten, gedreht oder als Hintergrund festgelegt werden, direkt aus der App heraus. + Eine schlichte App zum Betrachten von Bildern und Videos. Die Medien können nach Datum, Größe, Name sowie auf- oder absteigend sortiert werden, in Bilder kann auch hineingezoomt werden. Die Vorschau-Kacheln werden in mehreren Spalten abhängig von der Displaygröße angezeigt, die Spaltenanzahl ist mit Zweifingergesten änderbar. Die Medien können umbenannt, geteilt, gelöscht, kopiert und verschoben werden. Bilder können direkt aus der App heraus zugeschnitten, gedreht oder als Hintergrund festgelegt werden. - Die Galerie bietet auch für Drittparteien einige Funktionen an: zum Vorschauen von Bildern / Videos, zum Hinzufügen von Anhängen bei eMail-Clients, etc. Sie ist perfekt für den täglichen Gebrauch. + Diese Galerie bietet auch für Drittanbieter einige Funktionen an: zum Vorschauen von Bildern / Videos, zum Hinzufügen von Anhängen bei Email-Apps, etc. Sie ist perfekt für den täglichen Gebrauch. - Beinhaltet keine Werbung oder unnötige Berechtigungen. Sie ist komplett Open Source, verwendete Farben sind anpassbar. + Beinhaltet keine Werbung oder unnötigen Berechtigungen. Sie ist komplett Open Source, verwendete Farben sind anpassbar. Diese App ist nur eine aus einer größeren Serie von schlichten Apps. Der Rest davon findet sich auf http://www.simplemobiletools.com From 25bd77bd1224c064c0a83fc7fba6fe5594b4391f Mon Sep 17 00:00:00 2001 From: Guillaume Date: Wed, 1 Nov 2017 04:52:29 +0100 Subject: [PATCH 139/188] Lossless rotation Possible issue: even though most EXIF tags keep their original value, some of them are changed by android.media.ExifInterface. it.sephiroth.android.library.exif2.ExifInterface did the same, but to different values and/or with different results. --- .../gallery/activities/ViewPagerActivity.kt | 56 ++++++++++++++++--- 1 file changed, 48 insertions(+), 8 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 ae02f2a66..7ed831383 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -45,7 +45,9 @@ import com.simplemobiletools.gallery.helpers.* import com.simplemobiletools.gallery.models.Medium import kotlinx.android.synthetic.main.activity_medium.* import java.io.File -import java.io.OutputStream +import java.io.FileInputStream +import java.io.FileOutputStream +import java.io.FileNotFoundException import java.util.* class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, ViewPagerFragment.FragmentListener { @@ -463,7 +465,12 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View return@getFileOutputStream } - saveFile(tmpFile, bitmap, it) + if (currPath.isImageFast() && !currPath.isPng()) { // Is always JPEG? + saveRotation(currPath, tmpFile) + } else { + saveFile(tmpFile, bitmap, it as FileOutputStream) + } + if (needsStupidWritePermissions(selectedFile.absolutePath)) { deleteFile(selectedFile) {} } @@ -471,6 +478,12 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View renameFile(tmpFile, selectedFile) { deleteFile(tmpFile) {} } + + it.flush() + it.close() + toast(R.string.file_saved) + mRotationDegrees = 0f + invalidateOptionsMenu() } } catch (e: OutOfMemoryError) { toast(R.string.out_of_memory_error) @@ -483,18 +496,45 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View } } - private fun saveFile(file: File, bitmap: Bitmap, out: OutputStream) { + private fun saveFile(file: File, bitmap: Bitmap, out: FileOutputStream) { val matrix = Matrix() matrix.postRotate(mRotationDegrees) val bmp = Bitmap.createBitmap(bitmap, 0, 0, bitmap.width, bitmap.height, matrix, true) bmp.compress(file.getCompressionFormat(), 90, out) - out.flush() - out.close() - toast(R.string.file_saved) - mRotationDegrees = 0f - invalidateOptionsMenu() } + private fun saveRotation(input: String, out: File) { + var inputStream: FileInputStream? = null + var outputStream: FileOutputStream? = null + try { + inputStream = FileInputStream(input) + outputStream = FileOutputStream(out) + inputStream.copyTo(outputStream) + } catch (ignored: FileNotFoundException) { + } finally { + inputStream?.close() + outputStream?.close() + } + if (mRotationDegrees != 0f) { + val exif = ExifInterface(out.absolutePath) + var orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL) + var orientationDegrees = when (orientation) { + 8 -> 270f + 3 -> 180f + 6 -> 90f + else -> 0f + } + orientationDegrees = (orientationDegrees + mRotationDegrees) % 360 + orientation = when (orientationDegrees) { + 90f -> 6 + 180f -> 3 + 270f -> 8 + else -> 1 + } + exif.setAttribute(ExifInterface.TAG_ORIENTATION, ""+ orientation) + exif.saveAttributes() + } + } private fun isShowHiddenFlagNeeded(): Boolean { val file = File(mPath) if (file.isHidden) From a934510165bcc9400d220a1919c5f0b0713c6a81 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 1 Nov 2017 11:56:21 +0100 Subject: [PATCH 140/188] updage Commons to 2.34.9 --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 79f122486..d582daf64 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,7 +37,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.34.2' + compile 'com.simplemobiletools:commons:2.34.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 cb7d9ea10896b1441dfac16ec7c55279fe69719a Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 1 Nov 2017 12:05:04 +0100 Subject: [PATCH 141/188] adding a Malay strings file --- app/src/main/res/values-ms/strings.xml | 147 +++++++++++++++++++++++++ 1 file changed, 147 insertions(+) create mode 100644 app/src/main/res/values-ms/strings.xml diff --git a/app/src/main/res/values-ms/strings.xml b/app/src/main/res/values-ms/strings.xml new file mode 100644 index 000000000..209dc0b10 --- /dev/null +++ b/app/src/main/res/values-ms/strings.xml @@ -0,0 +1,147 @@ + + + Simple Gallery + Gallery + Edit + Open camera + (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 + Volume + Brightness + Do not ask again in this session + + + Filter media + 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? + 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.\n\nAdding some items here will not exclude any other folder. + + + 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 + Include videos + Include GIFs + Random order + Use fade animations + Move backwards + Loop slideshow + The slideshow ended + No media for the slideshow have been found + + + Change view type + Grid + List + + + Show hidden media + Play videos automatically + Toggle filename visibility + 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 + Show folder media count on the main view + Replace Share with Rotate at fullscreen menu + Show extended details over fullscreen media + Manage extended details + + + + 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 fdc10638389b77db88e29ec622eb283b246e3b4d Mon Sep 17 00:00:00 2001 From: Guillaume Date: Wed, 1 Nov 2017 14:51:11 +0100 Subject: [PATCH 142/188] Update ViewPagerActivity.kt - Removed `mRotationDegrees != 0f` check, because save buttton wouldn't have shown anyway - Check if output file is written - Added helpers functions (with `.toString()` instead of using `""+`) --- .../gallery/activities/ViewPagerActivity.kt | 33 ++++++++++--------- 1 file changed, 18 insertions(+), 15 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 7ed831383..59d01ae61 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -515,26 +515,29 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View inputStream?.close() outputStream?.close() } - if (mRotationDegrees != 0f) { + if (out.exists()) { val exif = ExifInterface(out.absolutePath) var orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL) - var orientationDegrees = when (orientation) { - 8 -> 270f - 3 -> 180f - 6 -> 90f - else -> 0f - } - orientationDegrees = (orientationDegrees + mRotationDegrees) % 360 - orientation = when (orientationDegrees) { - 90f -> 6 - 180f -> 3 - 270f -> 8 - else -> 1 - } - exif.setAttribute(ExifInterface.TAG_ORIENTATION, ""+ orientation) + var orientationDegrees = (degreesForRotation(orientation) + mRotationDegrees) % 360 + exif.setAttribute(ExifInterface.TAG_ORIENTATION, rotationFromDegrees(orientationDegrees)) exif.saveAttributes() } } + + private fun degreesForRotation(orientation: Int) = when (orientation) { + ExifInterface.ORIENTATION_ROTATE_270 -> 270f + ExifInterface.ORIENTATION_ROTATE_180 -> 180f + ExifInterface.ORIENTATION_ROTATE_90 -> 90f + else -> 0f + } + + private fun rotationFromDegrees(degrees: Float) = when (degrees) { + 90f -> ExifInterface.ORIENTATION_ROTATE_90 + 180f -> ExifInterface.ORIENTATION_ROTATE_180 + 270f -> ExifInterface.ORIENTATION_ROTATE_270 + else -> ExifInterface.ORIENTATION_NORMAL + }.toString() + private fun isShowHiddenFlagNeeded(): Boolean { val file = File(mPath) if (file.isHidden) From 76a9dfe6c72d379fea26a9d010c91f60ade9613d Mon Sep 17 00:00:00 2001 From: Guillaume Date: Wed, 1 Nov 2017 14:52:49 +0100 Subject: [PATCH 143/188] .isJpg() --- .../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 59d01ae61..0646498f3 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -465,7 +465,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View return@getFileOutputStream } - if (currPath.isImageFast() && !currPath.isPng()) { // Is always JPEG? + if (currPath.isJpg()) { saveRotation(currPath, tmpFile) } else { saveFile(tmpFile, bitmap, it as FileOutputStream) From 1cecff008c73a4b83d1565bc40ac52736ecbad8f Mon Sep 17 00:00:00 2001 From: Guillaume Date: Wed, 1 Nov 2017 16:12:27 +0100 Subject: [PATCH 144/188] OCD :-P --- .../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 0646498f3..bc325f210 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -532,9 +532,9 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View } private fun rotationFromDegrees(degrees: Float) = when (degrees) { - 90f -> ExifInterface.ORIENTATION_ROTATE_90 - 180f -> ExifInterface.ORIENTATION_ROTATE_180 270f -> ExifInterface.ORIENTATION_ROTATE_270 + 180f -> ExifInterface.ORIENTATION_ROTATE_180 + 90f -> ExifInterface.ORIENTATION_ROTATE_90 else -> ExifInterface.ORIENTATION_NORMAL }.toString() From b72686cefd3510261d79dafa0760610612bc78cd Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 1 Nov 2017 23:38:19 +0100 Subject: [PATCH 145/188] updating the way photos are rotated and saved --- .../gallery/activities/ViewPagerActivity.kt | 106 ++++++++++-------- .../gallery/fragments/PhotoFragment.kt | 5 + 2 files changed, 66 insertions(+), 45 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 bc325f210..177f0b38d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -46,8 +46,8 @@ import com.simplemobiletools.gallery.models.Medium import kotlinx.android.synthetic.main.activity_medium.* import java.io.File import java.io.FileInputStream -import java.io.FileOutputStream import java.io.FileNotFoundException +import java.io.FileOutputStream import java.util.* class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, ViewPagerFragment.FragmentListener { @@ -454,48 +454,55 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View SaveAsDialog(this, currPath, false) { Thread({ toast(R.string.saving) - val selectedFile = File(it) - val tmpFile = File(selectedFile.parent, ".tmp_${it.getFilenameFromPath()}") - try { - val bitmap = BitmapFactory.decodeFile(currPath) - getFileOutputStream(tmpFile) { - if (it == null) { - toast(R.string.unknown_error_occurred) - deleteFile(tmpFile) {} - return@getFileOutputStream + if (it.isJpg() && !isPathOnSD(it)) { + if (it == currPath) { + rotateFileByExif(it) + runOnUiThread { + (getCurrentFragment() as? PhotoFragment)?.refreshBitmap() } - - if (currPath.isJpg()) { - saveRotation(currPath, tmpFile) - } else { - saveFile(tmpFile, bitmap, it as FileOutputStream) - } - - if (needsStupidWritePermissions(selectedFile.absolutePath)) { - deleteFile(selectedFile) {} - } - - renameFile(tmpFile, selectedFile) { - deleteFile(tmpFile) {} - } - - it.flush() - it.close() - toast(R.string.file_saved) - mRotationDegrees = 0f - invalidateOptionsMenu() + } else { + copyFile(currPath, it) + rotateFileByExif(it) } - } catch (e: OutOfMemoryError) { - toast(R.string.out_of_memory_error) - deleteFile(tmpFile) {} - } catch (e: Exception) { - showErrorToast(e) - deleteFile(tmpFile) {} + } else { + rotateFileByDegrees(currPath, it) } }).start() } } + private fun rotateFileByDegrees(sourcePath: String, destinationPath: String) { + val tmpFile = File(File(destinationPath).parent, ".tmp_${destinationPath.getFilenameFromPath()}") + try { + getFileOutputStream(tmpFile) { + if (it == null) { + toast(R.string.unknown_error_occurred) + return@getFileOutputStream + } + + val bitmap = BitmapFactory.decodeFile(sourcePath) + saveFile(tmpFile, bitmap, it as FileOutputStream) + it.flush() + it.close() + + val destination = File(destinationPath) + deleteFile(destination) { + renameFile(tmpFile, destination) {} + } + + toast(R.string.file_saved) + mRotationDegrees = 0f + invalidateOptionsMenu() + } + } catch (e: OutOfMemoryError) { + toast(R.string.out_of_memory_error) + deleteFile(tmpFile) {} + } catch (e: Exception) { + showErrorToast(e) + deleteFile(tmpFile) {} + } + } + private fun saveFile(file: File, bitmap: Bitmap, out: FileOutputStream) { val matrix = Matrix() matrix.postRotate(mRotationDegrees) @@ -503,25 +510,34 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View bmp.compress(file.getCompressionFormat(), 90, out) } - private fun saveRotation(input: String, out: File) { + private fun copyFile(sourcePath: String, destinationPath: String) { var inputStream: FileInputStream? = null var outputStream: FileOutputStream? = null try { - inputStream = FileInputStream(input) - outputStream = FileOutputStream(out) + inputStream = FileInputStream(sourcePath) + outputStream = FileOutputStream(destinationPath) inputStream.copyTo(outputStream) + scanPath(destinationPath) {} } catch (ignored: FileNotFoundException) { } finally { inputStream?.close() outputStream?.close() } - if (out.exists()) { - val exif = ExifInterface(out.absolutePath) - var orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL) - var orientationDegrees = (degreesForRotation(orientation) + mRotationDegrees) % 360 - exif.setAttribute(ExifInterface.TAG_ORIENTATION, rotationFromDegrees(orientationDegrees)) - exif.saveAttributes() + } + + private fun rotateFileByExif(path: String) { + val exif = ExifInterface(path) + val orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL) + val orientationDegrees = (degreesForRotation(orientation) + mRotationDegrees) % 360 + exif.setAttribute(ExifInterface.TAG_ORIENTATION, rotationFromDegrees(orientationDegrees)) + exif.saveAttributes() + if (!config.keepLastModified) { + File(getCurrentPath()).setLastModified(System.currentTimeMillis()) } + + mRotationDegrees = 0f + invalidateOptionsMenu() + toast(R.string.file_saved) } private fun degreesForRotation(orientation: Int) = when (orientation) { 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 5852698d2..5decd01bd 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt @@ -322,4 +322,9 @@ class PhotoFragment : ViewPagerFragment() { } } } + + fun refreshBitmap() { + view.subsampling_view.beGone() + loadBitmap() + } } From 56c9d09975463a512c4fcc6035c9594e2398eef8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Marques?= Date: Wed, 1 Nov 2017 22:41:51 +0000 Subject: [PATCH 146/188] Update strings.xml --- 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 6242d94c4..33908e2b8 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -122,7 +122,7 @@ Ocultar interface do sistema se em ecrã completo 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 - Show folder media count on the main view + Mostrar número de ficheiros na vista principal Substituir a opção Partilhar pela opção Rodar se em ecrã completo Mostrar detalhes se em ecrã completo Gerir detalhes exibidos From 9d8dd61dfa8d643422269a8881f982365734e3f3 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 2 Nov 2017 09:43:49 +0100 Subject: [PATCH 147/188] style update + wrap gifDrawables in try/catch --- .../gallery/activities/MediaActivity.kt | 21 +++++++++++-------- .../gallery/adapters/MediaAdapter.kt | 4 ++-- .../gallery/extensions/activity.kt | 20 +++++++++++------- 3 files changed, 26 insertions(+), 19 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 cdb538151..7a8b1358e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -75,11 +75,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { media_refresh_layout.setOnRefreshListener({ getMedia() }) mPath = intent.getStringExtra(DIRECTORY) - mStoredAnimateGifs = config.animateGifs - mStoredCropThumbnails = config.cropThumbnails - mStoredScrollHorizontally = config.scrollHorizontally - mStoredTextColor = config.textColor - mShowAll = config.showAll + storeStateVariables() if (mShowAll) supportActionBar?.setDisplayHomeAsUpEnabled(false) @@ -117,10 +113,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { super.onPause() mIsGettingMedia = false media_refresh_layout.isRefreshing = false - mStoredAnimateGifs = config.animateGifs - mStoredCropThumbnails = config.cropThumbnails - mStoredScrollHorizontally = config.scrollHorizontally - mStoredTextColor = config.textColor + storeStateVariables() media_grid.listener = null mLastMediaHandler.removeCallbacksAndMessages(null) @@ -136,6 +129,16 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { mMedia.clear() } + private fun storeStateVariables() { + config.apply { + mStoredAnimateGifs = animateGifs + mStoredCropThumbnails = cropThumbnails + mStoredScrollHorizontally = scrollHorizontally + mStoredTextColor = textColor + mShowAll = showAll + } + } + private fun tryloadGallery() { handlePermission(PERMISSION_WRITE_STORAGE) { if (it) { 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 46ff5a7cb..eec2636f3 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt @@ -301,8 +301,8 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList, actMode?.finish() } - fun updateDisplayFilenames(display: Boolean) { - displayFilenames = display + fun updateDisplayFilenames(displayFilenames: Boolean) { + this.displayFilenames = displayFilenames notifyDataSetChanged() } 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 5bf08e18d..e80f14e8c 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt @@ -146,15 +146,19 @@ fun Activity.loadImage(path: String, target: MySquareImageView, horizontalScroll loadJpg(path, target, cropThumbnails) } } else if (path.isGif()) { - val gifDrawable = GifDrawable(path) - target.setImageDrawable(gifDrawable) - if (animateGifs) { - gifDrawable.start() - } else { - gifDrawable.stop() - } + try { + val gifDrawable = GifDrawable(path) + target.setImageDrawable(gifDrawable) + if (animateGifs) { + gifDrawable.start() + } else { + gifDrawable.stop() + } - target.scaleType = if (cropThumbnails) ImageView.ScaleType.CENTER_CROP else ImageView.ScaleType.FIT_CENTER + target.scaleType = if (cropThumbnails) ImageView.ScaleType.CENTER_CROP else ImageView.ScaleType.FIT_CENTER + } catch (e: Exception) { + showErrorToast(e) + } } } From ef284691dd8b87353f4a1e164322cc82809fd2c0 Mon Sep 17 00:00:00 2001 From: Primokorn Date: Thu, 2 Nov 2017 10:30:35 +0100 Subject: [PATCH 148/188] Update FR strings.xml --- app/src/main/res/values-fr/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index edf3e5d03..2c3c8a35b 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -122,7 +122,7 @@ 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 - Show folder media count on the main view + Afficher le nombre de fichiers dans les dossiers sur l\'écran principal Remplacer Partager par Pivoter si menu en plein écran Afficher les détails supplémentaires par dessus le média en plein écran Gérer les détails supplémentaires From 2ada4af2bfa31f1e4e68f6dde088655892249772 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 2 Nov 2017 16:23:20 +0100 Subject: [PATCH 149/188] catch exceptions thrown by GifDrawable, load them as simple jpgs --- .../simplemobiletools/gallery/extensions/activity.kt | 2 +- .../gallery/fragments/PhotoFragment.kt | 11 ++++++++++- 2 files changed, 11 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 e80f14e8c..200b2897b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt @@ -157,7 +157,7 @@ fun Activity.loadImage(path: String, target: MySquareImageView, horizontalScroll target.scaleType = if (cropThumbnails) ImageView.ScaleType.CENTER_CROP else ImageView.ScaleType.FIT_CENTER } catch (e: Exception) { - showErrorToast(e) + loadJpg(path, target, cropThumbnails) } } } 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 5decd01bd..11291468c 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt @@ -160,6 +160,14 @@ class PhotoFragment : ViewPagerFragment() { private fun loadImage() { if (medium.isGif()) { + loadGif() + } else { + loadBitmap() + } + } + + private fun loadGif() { + try { gifDrawable = if (medium.path.startsWith("content://") || medium.path.startsWith("file://")) { GifDrawable(context.contentResolver, Uri.parse(medium.path)) } else { @@ -171,7 +179,8 @@ class PhotoFragment : ViewPagerFragment() { } view.gif_view.setImageDrawable(gifDrawable) - } else { + } catch (e: Exception) { + gifDrawable = null loadBitmap() } } From 14abbe6b6914f66598a90cba04fd07d8cb9d0f40 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 2 Nov 2017 18:42:04 +0100 Subject: [PATCH 150/188] update version to 2.35.0 --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index d582daf64..a9d2460e4 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,7 +37,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.34.9' + compile 'com.simplemobiletools:commons:2.35.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 65ef896c30409402b2e22b5070625adb7e2e6674 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 2 Nov 2017 18:46:06 +0100 Subject: [PATCH 151/188] update version to 2.17.3 --- app/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index a9d2460e4..ea8686514 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,8 +10,8 @@ android { applicationId "com.simplemobiletools.gallery" minSdkVersion 16 targetSdkVersion 26 - versionCode 140 - versionName "2.17.2" + versionCode 141 + versionName "2.17.3" } signingConfigs { From d0e4fd1df7ac8ee606b7dabd138c3c989b19d6c7 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 2 Nov 2017 18:46:15 +0100 Subject: [PATCH 152/188] updating changelog --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 856703a75..1ddba8476 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,13 @@ Changelog ========== +Version 2.17.3 *(2017-11-02)* +---------------------------- + + * Fixed some corrupt gif file related crashes + * Rotate jpgs on the internal storage by exif + * Fixed some invisible SD card content + Version 2.17.2 *(2017-10-29)* ---------------------------- From 63d39b589a6479dbd81a1d6c040686503a29f2dc Mon Sep 17 00:00:00 2001 From: Guillaume Date: Fri, 3 Nov 2017 17:01:13 +0100 Subject: [PATCH 153/188] Working EXIF lossless on Internal & SD Tested and works on both Internal Storage and External SD cards --- .../gallery/activities/ViewPagerActivity.kt | 116 ++++++++---------- 1 file changed, 52 insertions(+), 64 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 177f0b38d..264fec318 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -46,8 +46,9 @@ import com.simplemobiletools.gallery.models.Medium import kotlinx.android.synthetic.main.activity_medium.* import java.io.File import java.io.FileInputStream -import java.io.FileNotFoundException import java.io.FileOutputStream +import java.io.InputStream +import java.io.OutputStream import java.util.* class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, ViewPagerFragment.FragmentListener { @@ -454,52 +455,60 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View SaveAsDialog(this, currPath, false) { Thread({ toast(R.string.saving) - if (it.isJpg() && !isPathOnSD(it)) { - if (it == currPath) { - rotateFileByExif(it) - runOnUiThread { - (getCurrentFragment() as? PhotoFragment)?.refreshBitmap() + val selectedFile = File(it) + val tmpFile = File(filesDir, ".tmp_${it.getFilenameFromPath()}") + try { + val bitmap = BitmapFactory.decodeFile(currPath) + getFileOutputStream(tmpFile) { + if (it == null) { + toast(R.string.unknown_error_occurred) + deleteFile(tmpFile) {} + return@getFileOutputStream } - } else { - copyFile(currPath, it) - rotateFileByExif(it) + + if (currPath.isJpg()) { + saveRotation(getCurrentFile(), tmpFile) + } else { + saveFile(tmpFile, bitmap, it as FileOutputStream) + } + + if (tmpFile.length() > 0 && selectedFile.exists()) { + deleteFile(selectedFile) {} + } + copyFile(tmpFile, selectedFile) + scanPath(selectedFile.absolutePath) {} + deleteFile(tmpFile) {} // Not necessary? + toast(R.string.file_saved) + + it.flush() + it.close() + mRotationDegrees = 0f + invalidateOptionsMenu() } - } else { - rotateFileByDegrees(currPath, it) + } catch (e: OutOfMemoryError) { + toast(R.string.out_of_memory_error) + deleteFile(tmpFile) {} + } catch (e: Exception) { + showErrorToast(e) + deleteFile(tmpFile) {} } }).start() } } - private fun rotateFileByDegrees(sourcePath: String, destinationPath: String) { - val tmpFile = File(File(destinationPath).parent, ".tmp_${destinationPath.getFilenameFromPath()}") + private fun copyFile(source: File, destination: File) { + var inputStream: InputStream? = null + var out: OutputStream? = null try { - getFileOutputStream(tmpFile) { - if (it == null) { - toast(R.string.unknown_error_occurred) - return@getFileOutputStream - } - - val bitmap = BitmapFactory.decodeFile(sourcePath) - saveFile(tmpFile, bitmap, it as FileOutputStream) - it.flush() - it.close() - - val destination = File(destinationPath) - deleteFile(destination) { - renameFile(tmpFile, destination) {} - } - - toast(R.string.file_saved) - mRotationDegrees = 0f - invalidateOptionsMenu() + if (needsStupidWritePermissions(destination.absolutePath)) { + getFileDocument(destination.parent) } - } catch (e: OutOfMemoryError) { - toast(R.string.out_of_memory_error) - deleteFile(tmpFile) {} - } catch (e: Exception) { - showErrorToast(e) - deleteFile(tmpFile) {} + out = getFileOutputStreamSync(destination.absolutePath, source.getMimeType(), getFileDocument(destination.parent)) + inputStream = FileInputStream(source) + inputStream.copyTo(out!!) + } finally { + inputStream?.close() + out?.close() } } @@ -510,34 +519,13 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View bmp.compress(file.getCompressionFormat(), 90, out) } - private fun copyFile(sourcePath: String, destinationPath: String) { - var inputStream: FileInputStream? = null - var outputStream: FileOutputStream? = null - try { - inputStream = FileInputStream(sourcePath) - outputStream = FileOutputStream(destinationPath) - inputStream.copyTo(outputStream) - scanPath(destinationPath) {} - } catch (ignored: FileNotFoundException) { - } finally { - inputStream?.close() - outputStream?.close() - } - } - - private fun rotateFileByExif(path: String) { - val exif = ExifInterface(path) - val orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL) - val orientationDegrees = (degreesForRotation(orientation) + mRotationDegrees) % 360 + private fun saveRotation(input: File, output: File) { + copyFile(input, output) + val exif = ExifInterface(output.absolutePath) + var orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL) + var orientationDegrees = (degreesForRotation(orientation) + mRotationDegrees) % 360 exif.setAttribute(ExifInterface.TAG_ORIENTATION, rotationFromDegrees(orientationDegrees)) exif.saveAttributes() - if (!config.keepLastModified) { - File(getCurrentPath()).setLastModified(System.currentTimeMillis()) - } - - mRotationDegrees = 0f - invalidateOptionsMenu() - toast(R.string.file_saved) } private fun degreesForRotation(orientation: Int) = when (orientation) { From 1aa9ebe2862bfd31bf2127a185567cf570339d70 Mon Sep 17 00:00:00 2001 From: Guillaume Date: Fri, 3 Nov 2017 21:36:17 +0100 Subject: [PATCH 154/188] Rotation button fix When rotating is initiated, show rotate button permanently to facilitate further rotation. Also, prevent accidental click on Delete when the option "replace share with rotate" is enabled. --- .../gallery/activities/ViewPagerActivity.kt | 5 +++++ 1 file changed, 5 insertions(+) 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 177f0b38d..85d7ca53a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -236,6 +236,11 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View findItem(R.id.menu_share_1).isVisible = !config.replaceShare findItem(R.id.menu_share_2).isVisible = config.replaceShare findItem(R.id.menu_rotate).isVisible = currentMedium.isImage() + findItem(R.id.menu_rotate).setShowAsAction( + if (mRotationDegrees !== 0f) + MenuItem.SHOW_AS_ACTION_ALWAYS + else + MenuItem.SHOW_AS_ACTION_IF_ROOM) findItem(R.id.menu_save_as).isVisible = mRotationDegrees != 0f findItem(R.id.menu_hide).isVisible = !currentMedium.name.startsWith('.') findItem(R.id.menu_unhide).isVisible = currentMedium.name.startsWith('.') From 598eeb154d11583d1f1be78afa6035994f8b1d9d Mon Sep 17 00:00:00 2001 From: Guillaume Date: Fri, 3 Nov 2017 21:57:56 +0100 Subject: [PATCH 155/188] Improvements as suggested --- .../gallery/activities/ViewPagerActivity.kt | 10 +++------- 1 file changed, 3 insertions(+), 7 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 264fec318..790a082bc 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -477,7 +477,6 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View } copyFile(tmpFile, selectedFile) scanPath(selectedFile.absolutePath) {} - deleteFile(tmpFile) {} // Not necessary? toast(R.string.file_saved) it.flush() @@ -487,9 +486,9 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View } } catch (e: OutOfMemoryError) { toast(R.string.out_of_memory_error) - deleteFile(tmpFile) {} } catch (e: Exception) { showErrorToast(e) + } finally { deleteFile(tmpFile) {} } }).start() @@ -500,9 +499,6 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View var inputStream: InputStream? = null var out: OutputStream? = null try { - if (needsStupidWritePermissions(destination.absolutePath)) { - getFileDocument(destination.parent) - } out = getFileOutputStreamSync(destination.absolutePath, source.getMimeType(), getFileDocument(destination.parent)) inputStream = FileInputStream(source) inputStream.copyTo(out!!) @@ -522,8 +518,8 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View private fun saveRotation(input: File, output: File) { copyFile(input, output) val exif = ExifInterface(output.absolutePath) - var orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL) - var orientationDegrees = (degreesForRotation(orientation) + mRotationDegrees) % 360 + val orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL) + val orientationDegrees = (degreesForRotation(orientation) + mRotationDegrees) % 360 exif.setAttribute(ExifInterface.TAG_ORIENTATION, rotationFromDegrees(orientationDegrees)) exif.saveAttributes() } From 4844e2c2d807423decf4eeaa9b9dcb329745b0b7 Mon Sep 17 00:00:00 2001 From: Guillaume Date: Fri, 3 Nov 2017 22:00:28 +0100 Subject: [PATCH 156/188] One more deleteFile to remove ...now I understand `return@getFileOutputStream`. --- .../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 790a082bc..c47e1f407 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -462,7 +462,6 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View getFileOutputStream(tmpFile) { if (it == null) { toast(R.string.unknown_error_occurred) - deleteFile(tmpFile) {} return@getFileOutputStream } From b4e43d1c21a52d995de82806030899f0c06d1ef6 Mon Sep 17 00:00:00 2001 From: Guillaume Date: Fri, 3 Nov 2017 22:05:56 +0100 Subject: [PATCH 157/188] Brackets and position fixed --- .../gallery/activities/ViewPagerActivity.kt | 11 ++++++----- 1 file changed, 6 insertions(+), 5 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 85d7ca53a..73fd3750e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -236,14 +236,15 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View findItem(R.id.menu_share_1).isVisible = !config.replaceShare findItem(R.id.menu_share_2).isVisible = config.replaceShare findItem(R.id.menu_rotate).isVisible = currentMedium.isImage() - findItem(R.id.menu_rotate).setShowAsAction( - if (mRotationDegrees !== 0f) - MenuItem.SHOW_AS_ACTION_ALWAYS - else - MenuItem.SHOW_AS_ACTION_IF_ROOM) findItem(R.id.menu_save_as).isVisible = mRotationDegrees != 0f findItem(R.id.menu_hide).isVisible = !currentMedium.name.startsWith('.') findItem(R.id.menu_unhide).isVisible = currentMedium.name.startsWith('.') + findItem(R.id.menu_rotate).setShowAsAction( + if (mRotationDegrees !== 0f) { + MenuItem.SHOW_AS_ACTION_ALWAYS + } else { + MenuItem.SHOW_AS_ACTION_IF_ROOM + }) } return true From 434b98b5e695addc0aa0471a708bafd6179aba7e Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 6 Nov 2017 15:14:05 +0100 Subject: [PATCH 158/188] update commons to 2.35.7 --- app/build.gradle | 2 +- app/src/main/res/values/styles.xml | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index ea8686514..ee67b19c2 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,7 +37,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:2.35.0' + compile 'com.simplemobiletools:commons:2.35.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/res/values/styles.xml b/app/src/main/res/values/styles.xml index f7114219d..54db9f7d0 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -1,8 +1,6 @@ - +