Merge pull request #5 from SimpleMobileTools/master

update
This commit is contained in:
solokot 2017-11-26 19:43:10 +03:00 committed by GitHub
commit d356f18dde
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 47 additions and 49 deletions

View file

@ -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)*
----------------------------

View file

@ -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))

View file

@ -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

View file

@ -172,7 +172,9 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener
try {
getFileOutputStream(file) {
if (it != null) {
Thread {
saveBitmap(file, bitmap, it)
}.start()
} else {
toast(R.string.image_editing_failed)
}

View file

@ -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()

View file

@ -716,7 +716,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
}
private fun deleteConfirmed() {
deleteFileBg(File(getCurrentMedia()[mPos].path)) {
deleteFile(File(getCurrentMedia()[mPos].path)) {
reloadViewPager()
}
}

View file

@ -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)
}

View file

@ -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 {

View file

@ -23,8 +23,8 @@
<string name="volume">Volume</string>
<string name="brightness">Brilho</string>
<string name="do_not_ask_again">Não perguntar de novo para esta sessão</string>
<string name="lock_orientation">Lock orientation</string>
<string name="unlock_orientation">Unlock orientation</string>
<string name="lock_orientation">Bloquear orientação</string>
<string name="unlock_orientation">Desbloquear orientação</string>
<!-- Filter -->
<string name="filter_media">Filtrar multimédia</string>

View file

@ -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" }
}
}