From f2014212d7f9c386675f1fe20503cc7e445e9808 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Marques?= Date: Mon, 20 Nov 2017 00:52:49 +0000 Subject: [PATCH 01/13] Update strings.xml --- app/src/main/res/values-pt/strings.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index e5a41ece4..40ec56b98 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -23,8 +23,8 @@ Volume Brilho Não perguntar de novo para esta sessão - Lock orientation - Unlock orientation + Bloquear orientação + Desbloquear orientação Filtrar multimédia From 2b3223be0845734e6ba8cf30c7107fe5548a34c6 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 20 Nov 2017 21:53:55 +0100 Subject: [PATCH 02/13] use encoded video path only at passing it to the mediaplayer --- .../simplemobiletools/gallery/fragments/VideoFragment.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt index 423ecd1ea..f4b7f4b67 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt @@ -47,6 +47,7 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee private var mStoredExtendedDetails = 0 private var mCurrTime = 0 private var mDuration = 0 + private var mEncodedPath = "" private var mTouchDownX = 0f private var mTouchDownY = 0f @@ -416,9 +417,10 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee return } + val mediumPath = if (wasEncoded) mEncodedPath else medium.path try { mMediaPlayer = MediaPlayer().apply { - setDataSource(context, Uri.parse(medium.path)) + setDataSource(context, Uri.parse(mediumPath)) setDisplay(mSurfaceHolder) setOnCompletionListener { videoCompleted() } setOnVideoSizeChangedListener({ mediaPlayer, width, height -> setVideoSize() }) @@ -427,7 +429,7 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee prepare() } } catch (e: IOException) { - medium.path = Uri.encode(medium.path) + mEncodedPath = Uri.encode(medium.path) if (wasEncoded) { releaseMediaPlayer() } else { From b1a53c0e9c566d29e66b722ed60005679d803aad Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 21 Nov 2017 16:22:08 +0100 Subject: [PATCH 03/13] updating Commons --- app/build.gradle | 33 ++++++++++----------------------- build.gradle | 9 +++++++-- 2 files changed, 17 insertions(+), 25 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 38604d2c2..c856902ca 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -47,32 +47,19 @@ ext { } dependencies { - compile 'com.simplemobiletools:commons:2.39.10' - compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.8.0' - compile 'com.theartofdev.edmodo:android-image-cropper:2.4.0' - compile 'com.android.support:multidex:1.0.2' - compile 'com.google.code.gson:gson:2.8.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" + implementation 'com.simplemobiletools:commons:2.41.5' + implementation 'com.davemorrissey.labs:subsampling-scale-image-view:3.8.0' + implementation 'com.theartofdev.edmodo:android-image-cropper:2.4.0' + implementation 'com.android.support:multidex:1.0.2' + implementation 'com.google.code.gson:gson:2.8.2' + implementation 'it.sephiroth.android.exif:library:1.0.1' + implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.8' - debugCompile "com.squareup.leakcanary:leakcanary-android:$leakCanaryVersion" - releaseCompile "com.squareup.leakcanary:leakcanary-android-no-op:$leakCanaryVersion" + debugImplementation "com.squareup.leakcanary:leakcanary-android:$leakCanaryVersion" + releaseImplementation "com.squareup.leakcanary:leakcanary-android-no-op:$leakCanaryVersion" } -buildscript { - ext.kotlin_version = '1.1.60' - repositories { - mavenCentral() - } - - dependencies { - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version" - } -} - -def Properties props = new Properties() +Properties props = new Properties() def propFile = new File('signing.properties') if (propFile.canRead()) { props.load(new FileInputStream(propFile)) diff --git a/build.gradle b/build.gradle index 8c22f1119..60b648170 100644 --- a/build.gradle +++ b/build.gradle @@ -1,11 +1,16 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { + ext.kotlin_version = '1.1.60' + repositories { jcenter() + google() } + dependencies { - classpath 'com.android.tools.build:gradle:3.0.0' + classpath 'com.android.tools.build:gradle:3.0.1' + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files @@ -15,8 +20,8 @@ buildscript { allprojects { repositories { jcenter() + google() maven { url "https://jitpack.io" } - maven { url "https://maven.google.com" } } } From 07d921330ef7eb6653ffdb68864050083cb9269e Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 21 Nov 2017 23:50:46 +0100 Subject: [PATCH 04/13] save images in the editor on the background thread --- .../com/simplemobiletools/gallery/activities/EditActivity.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 53c278d5e..5b62357ab 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/EditActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/EditActivity.kt @@ -172,7 +172,9 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener try { getFileOutputStream(file) { if (it != null) { - saveBitmap(file, bitmap, it) + Thread { + saveBitmap(file, bitmap, it) + }.start() } else { toast(R.string.image_editing_failed) } From aa2f8722ea718408effb23eb142cdab52d09d90b Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 22 Nov 2017 00:01:07 +0100 Subject: [PATCH 05/13] delete items from the main activity and viewpager activity on background threads --- .../com/simplemobiletools/gallery/activities/MainActivity.kt | 2 +- .../simplemobiletools/gallery/activities/ViewPagerActivity.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt index 25806c41e..2059b0cae 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -208,7 +208,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { val newFolder = File(config.tempFolderPath) if (newFolder.exists() && newFolder.isDirectory) { if (newFolder.list()?.isEmpty() == true) { - deleteFileBg(newFolder, true) + deleteFile(newFolder, true) } } config.tempFolderPath = "" 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 1c00f66a8..d0c9b7a61 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -716,7 +716,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View } private fun deleteConfirmed() { - deleteFileBg(File(getCurrentMedia()[mPos].path)) { + deleteFile(File(getCurrentMedia()[mPos].path)) { reloadViewPager() } } From 015fde6a97fe428ac7a4c9d15732c1106033be73 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 23 Nov 2017 08:45:20 +0100 Subject: [PATCH 06/13] lets remove GlideDecoder for now, roll back to rgb_565 format --- .../com/simplemobiletools/gallery/fragments/PhotoFragment.kt | 5 +---- 1 file changed, 1 insertion(+), 4 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 323731665..17e6cb52f 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt @@ -26,7 +26,6 @@ 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.GlideDecoder import com.simplemobiletools.gallery.helpers.GlideRotateTransformation import com.simplemobiletools.gallery.helpers.MEDIUM import com.simplemobiletools.gallery.models.Medium @@ -224,7 +223,6 @@ class PhotoFragment : ViewPagerFragment() { if ((medium.isImage()) && isFragmentVisible && view.subsampling_view.isGone()) { ViewPagerActivity.wasDecodedByGlide = false view.subsampling_view.apply { - setBitmapDecoderClass(GlideDecoder::class.java) maxScale = 10f beVisible() setImage(ImageSource.uri(medium.path)) @@ -286,8 +284,7 @@ class PhotoFragment : ViewPagerFragment() { } fun rotateImageViewBy(degrees: Float) { - // do not make Subsampling view Gone, because it gets recycled and can crash with "Error, cannot access an invalid/free'd bitmap here!" - view.subsampling_view.beInvisible() + view.subsampling_view.beGone() loadBitmap(degrees) } From 2c2f0ea5f672e32156104d1a7f737b37ce2e7d4c Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 23 Nov 2017 09:07:10 +0100 Subject: [PATCH 07/13] fix #470, avoid running 2 directory fetching async tasks at once --- .../com/simplemobiletools/gallery/activities/MainActivity.kt | 2 ++ 1 file 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 2059b0cae..232e2835a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -247,7 +247,9 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { } mLoadedInitialPhotos = true + mCurrAsyncTask?.stopFetching() mCurrAsyncTask = GetDirectoriesAsynctask(applicationContext, mIsPickVideoIntent || mIsGetVideoContentIntent, mIsPickImageIntent || mIsGetImageContentIntent) { + mCurrAsyncTask = null gotDirectories(addTempFolderIfNeeded(it), false) } mCurrAsyncTask!!.execute() From 62e3f0428aabb1d790a02f6cc573066957c9ab22 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 23 Nov 2017 09:37:08 +0100 Subject: [PATCH 08/13] update commons to 2.41.8 --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index c856902ca..232451813 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -47,7 +47,7 @@ ext { } dependencies { - implementation 'com.simplemobiletools:commons:2.41.5' + implementation 'com.simplemobiletools:commons:2.41.8' implementation 'com.davemorrissey.labs:subsampling-scale-image-view:3.8.0' implementation 'com.theartofdev.edmodo:android-image-cropper:2.4.0' implementation 'com.android.support:multidex:1.0.2' From 1c7c95d5792e2cc72371875de9e18dd6ae878f26 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 23 Nov 2017 09:43:14 +0100 Subject: [PATCH 09/13] comment out leak canary initialization --- app/src/main/kotlin/com/simplemobiletools/gallery/App.kt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/App.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/App.kt index 361504972..350f990c2 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/App.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/App.kt @@ -2,20 +2,18 @@ package com.simplemobiletools.gallery import android.support.multidex.MultiDexApplication import com.github.ajalt.reprint.core.Reprint -import com.simplemobiletools.gallery.BuildConfig.USE_LEAK_CANARY import com.simplemobiletools.gallery.extensions.config -import com.squareup.leakcanary.LeakCanary import java.util.* class App : MultiDexApplication() { override fun onCreate() { super.onCreate() - if (USE_LEAK_CANARY) { + /*if (USE_LEAK_CANARY) { if (LeakCanary.isInAnalyzerProcess(this)) { return } LeakCanary.install(this) - } + }*/ if (config.useEnglish) { val conf = resources.configuration From 1b88318f467ce8c1b564bcfb61cd742e343fbc75 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 23 Nov 2017 09:44:26 +0100 Subject: [PATCH 10/13] catch OutOfMemory errors at GifDrawables --- .../com/simplemobiletools/gallery/fragments/PhotoFragment.kt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt index 17e6cb52f..63cd99e2a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt @@ -178,6 +178,9 @@ class PhotoFragment : ViewPagerFragment() { } catch (e: Exception) { gifDrawable = null loadBitmap() + } catch (e: OutOfMemoryError) { + gifDrawable = null + loadBitmap() } } From 6ebfb82e39c4c03938594031006e7c85cfbee81e Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 23 Nov 2017 09:58:12 +0100 Subject: [PATCH 11/13] avoid decoding fullscreen images twice --- .../simplemobiletools/gallery/fragments/PhotoFragment.kt | 9 ++------- 1 file changed, 2 insertions(+), 7 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 63cd99e2a..bffd0b422 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt @@ -236,7 +236,7 @@ class PhotoFragment : ViewPagerFragment() { override fun onReady() { background = ColorDrawable(if (context.config.darkBackground) Color.BLACK else context.config.backgroundColor) - setDoubleTapZoomScale(getDoubleTapZoomScale()) + setDoubleTapZoomScale(getDoubleTapZoomScale(sWidth, sHeight)) } override fun onTileLoadError(e: Exception?) { @@ -259,12 +259,7 @@ class PhotoFragment : ViewPagerFragment() { } } - private fun getDoubleTapZoomScale(): Float { - val bitmapOptions = BitmapFactory.Options() - bitmapOptions.inJustDecodeBounds = true - BitmapFactory.decodeFile(medium.path, bitmapOptions) - val width = bitmapOptions.outWidth - val height = bitmapOptions.outHeight + private fun getDoubleTapZoomScale(width: Int, height: Int): Float { val bitmapAspectRatio = height / (width).toFloat() return if (context == null) { From 7ed35a83b35a67d838e01e808b8fe17451561487 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 23 Nov 2017 09:59:45 +0100 Subject: [PATCH 12/13] update version to 2.19.0 --- app/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 232451813..6634facfb 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,8 +10,8 @@ android { applicationId "com.simplemobiletools.gallery" minSdkVersion 16 targetSdkVersion 27 - versionCode 144 - versionName "2.18.1" + versionCode 145 + versionName "2.19.0" multiDexEnabled true setProperty("archivesBaseName", "gallery") } From 92a8d30c1eed50fb6c26a8189de14e3b1f906dc4 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 23 Nov 2017 09:59:50 +0100 Subject: [PATCH 13/13] updating changelog --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e90ef9f4..a15ade565 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,13 @@ Changelog ========== +Version 2.19.0 *(2017-11-23)* +---------------------------- + + * Rolled back to displaying images in RGB_565 quality for proper zoom and performance + * Load directory thumbnails faster if a new medium has been discovered + * Couple performance and stability improvements + Version 2.18.1 *(2017-11-16)* ----------------------------