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)* ---------------------------- diff --git a/app/build.gradle b/app/build.gradle index 38604d2c2..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") } @@ -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.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' + 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/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 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) } 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..232e2835a 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 = "" @@ -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() 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() } } 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..bffd0b422 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 @@ -179,6 +178,9 @@ class PhotoFragment : ViewPagerFragment() { } catch (e: Exception) { gifDrawable = null loadBitmap() + } catch (e: OutOfMemoryError) { + gifDrawable = null + loadBitmap() } } @@ -224,7 +226,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)) @@ -235,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?) { @@ -258,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) { @@ -286,8 +282,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) } 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 { 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 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" } } }