From 044ccb3619dee8c7eca32e9bec9f19fbeef2ca33 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 26 Dec 2016 23:52:59 +0100 Subject: [PATCH] update commons and add Whats new dialog handling --- app/build.gradle | 2 +- .../gallery/activities/MainActivity.kt | 27 +++++++++++++++---- .../gallery/activities/SettingsActivity.kt | 8 +++--- .../gallery/extensions/activity.kt | 3 ++- 4 files changed, 29 insertions(+), 11 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 127ae1bc9..49477ab89 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -32,7 +32,7 @@ android { } dependencies { - compile 'com.simplemobiletools:commons:1.2.3' + compile 'com.simplemobiletools:commons:1.2.4' compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.6.0' compile 'com.theartofdev.edmodo:android-image-cropper:2.3.1' compile 'com.booking:rtlviewpager:1.0.1' 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 5157664be..48564c9e2 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -15,6 +15,7 @@ import android.view.Menu import android.view.MenuItem import android.view.View import com.simplemobiletools.commons.extensions.* +import com.simplemobiletools.commons.models.Release import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.adapters.DirectoryAdapter import com.simplemobiletools.gallery.asynctasks.GetDirectoriesAsynctask @@ -90,11 +91,6 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { override fun onResume() { super.onResume() tryloadGallery() - - if (DirectoryAdapter.foregroundColor != config.primaryColor) { - DirectoryAdapter.foregroundColor = config.primaryColor - setupAdapter() - } } override fun onPause() { @@ -114,6 +110,8 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { else getDirectories() handleZooming() + checkWhatsNewDialog() + checkIfColorChanged() } else { ActivityCompat.requestPermissions(this, arrayOf(Manifest.permission.WRITE_EXTERNAL_STORAGE), STORAGE_PERMISSION) } @@ -157,6 +155,13 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { finish() } + private fun checkIfColorChanged() { + if (DirectoryAdapter.foregroundColor != config.primaryColor) { + DirectoryAdapter.foregroundColor = config.primaryColor + setupAdapter() + } + } + override fun prepareForDeleting(paths: ArrayList) { toast(R.string.deleting) mToBeDeleted = paths @@ -343,4 +348,16 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { deleteDirs() } } + + private fun checkWhatsNewDialog() { + arrayListOf().apply { + add(Release(46, R.string.release_46)) + add(Release(47, R.string.release_47)) + add(Release(49, R.string.release_49)) + add(Release(50, R.string.release_50)) + add(Release(51, R.string.release_51)) + add(Release(52, R.string.release_52)) + checkWhatsNew(this) + } + } } 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 279f2d67b..457bc58b8 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt @@ -11,16 +11,16 @@ class SettingsActivity : SimpleActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_settings) + } + + override fun onResume() { + super.onResume() setupCustomizeColors() setupSameSorting() setupShowHiddenFolders() setupAutoplayVideos() setupShowMedia() - } - - override fun onResume() { - super.onResume() updateTextColors(settings_holder) } 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 8ec3768c7..1fa1c9da4 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/activity.kt @@ -13,6 +13,7 @@ import android.view.ViewConfiguration import com.simplemobiletools.commons.extensions.getMimeType import com.simplemobiletools.commons.extensions.toast 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.REQUEST_EDIT_IMAGE @@ -111,7 +112,7 @@ fun Activity.hasNavBar(): Boolean { fun SimpleActivity.launchAbout() { startAboutActivity(R.string.app_name, LICENSE_KOTLIN or LICENSE_SUBSAMPLING or LICENSE_GLIDE or LICENSE_CROPPER or - LICENSE_MULTISELECT or LICENSE_RTL or LICENSE_FILEPROPERTIES) + LICENSE_MULTISELECT or LICENSE_RTL, BuildConfig.VERSION_NAME) } fun AppCompatActivity.showSystemUI() {