From bb109fce95072f50f600ba5131aa8403f87665c7 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 11 Aug 2019 17:32:49 +0200 Subject: [PATCH] update the top menu colors depending on the primary color B/W --- app/build.gradle | 2 +- .../gallery/pro/activities/EditActivity.kt | 1 + .../pro/activities/ExcludedFoldersActivity.kt | 3 ++- .../pro/activities/HiddenFoldersActivity.kt | 3 ++- .../pro/activities/IncludedFoldersActivity.kt | 3 ++- .../gallery/pro/activities/MainActivity.kt | 1 + .../gallery/pro/activities/MediaActivity.kt | 1 + .../pro/activities/PhotoVideoActivity.kt | 1 + .../gallery/pro/activities/SearchActivity.kt | 1 + .../pro/activities/SetWallpaperActivity.kt | 27 ++++++++++--------- .../pro/activities/SettingsActivity.kt | 6 +++++ .../pro/activities/ViewPagerActivity.kt | 4 +++ 12 files changed, 36 insertions(+), 17 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index e2717d25e..28137f5a8 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -62,7 +62,7 @@ android { } dependencies { - implementation 'com.simplemobiletools:commons:5.15.33' + implementation 'com.simplemobiletools:commons:5.16.5' implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0' implementation 'androidx.multidex:multidex:2.0.1' implementation 'it.sephiroth.android.exif:library:1.0.1' diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt index ae8b82750..e3d250a51 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt @@ -122,6 +122,7 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener override fun onCreateOptionsMenu(menu: Menu): Boolean { menuInflater.inflate(R.menu.menu_editor, menu) + updateMenuItemColors(menu) return true } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ExcludedFoldersActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ExcludedFoldersActivity.kt index 0d3f96fdc..530452b0b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ExcludedFoldersActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ExcludedFoldersActivity.kt @@ -31,8 +31,9 @@ class ExcludedFoldersActivity : SimpleActivity(), RefreshRecyclerViewListener { manage_folders_list.adapter = adapter } - override fun onCreateOptionsMenu(menu: Menu?): Boolean { + override fun onCreateOptionsMenu(menu: Menu): Boolean { menuInflater.inflate(R.menu.menu_add_folder, menu) + updateMenuItemColors(menu) return true } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/HiddenFoldersActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/HiddenFoldersActivity.kt index a7a5002ba..4a5aaac85 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/HiddenFoldersActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/HiddenFoldersActivity.kt @@ -36,8 +36,9 @@ class HiddenFoldersActivity : SimpleActivity(), RefreshRecyclerViewListener { } } - override fun onCreateOptionsMenu(menu: Menu?): Boolean { + override fun onCreateOptionsMenu(menu: Menu): Boolean { menuInflater.inflate(R.menu.menu_add_folder, menu) + updateMenuItemColors(menu) return true } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/IncludedFoldersActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/IncludedFoldersActivity.kt index f4e0258c3..e1f0d9a06 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/IncludedFoldersActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/IncludedFoldersActivity.kt @@ -30,8 +30,9 @@ class IncludedFoldersActivity : SimpleActivity(), RefreshRecyclerViewListener { manage_folders_list.adapter = adapter } - override fun onCreateOptionsMenu(menu: Menu?): Boolean { + override fun onCreateOptionsMenu(menu: Menu): Boolean { menuInflater.inflate(R.menu.menu_add_folder, menu) + updateMenuItemColors(menu) return true } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt index 943634d3d..3f6993df1 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt @@ -289,6 +289,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { menu.findItem(R.id.temporarily_show_hidden).isVisible = !config.shouldShowHidden menu.findItem(R.id.stop_showing_hidden).isVisible = config.temporarilyShowHidden + updateMenuItemColors(menu) return true } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MediaActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MediaActivity.kt index f053fc89a..1dc0cabec 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MediaActivity.kt @@ -234,6 +234,7 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener { } setupSearch(menu) + updateMenuItemColors(menu) return true } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/PhotoVideoActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/PhotoVideoActivity.kt index f893e8eba..b29dff33b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/PhotoVideoActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/PhotoVideoActivity.kt @@ -249,6 +249,7 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList findItem(R.id.menu_show_on_map).isVisible = visibleBottomActions and BOTTOM_ACTION_SHOW_ON_MAP == 0 } + updateMenuItemColors(menu) return true } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SearchActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SearchActivity.kt index e87755245..0febbfd0b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SearchActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SearchActivity.kt @@ -51,6 +51,7 @@ class SearchActivity : SimpleActivity(), MediaOperationsListener { override fun onCreateOptionsMenu(menu: Menu): Boolean { menuInflater.inflate(R.menu.menu_search, menu) setupSearch(menu) + updateMenuItemColors(menu) return true } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SetWallpaperActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SetWallpaperActivity.kt index a1f83c574..56d5d01cd 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SetWallpaperActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SetWallpaperActivity.kt @@ -48,6 +48,20 @@ class SetWallpaperActivity : SimpleActivity(), CropImageView.OnCropImageComplete setupBottomActions() } + override fun onCreateOptionsMenu(menu: Menu): Boolean { + menuInflater.inflate(R.menu.menu_set_wallpaper, menu) + updateMenuItemColors(menu) + return true + } + + override fun onOptionsItemSelected(item: MenuItem): Boolean { + when (item.itemId) { + R.id.save -> confirmWallpaper() + else -> return super.onOptionsItemSelected(item) + } + return true + } + private fun handleImage(intent: Intent) { uri = intent.data if (uri.scheme != "file" && uri.scheme != "content") { @@ -81,19 +95,6 @@ class SetWallpaperActivity : SimpleActivity(), CropImageView.OnCropImageComplete bottom_set_wallpaper_aspect_ratio.setImageResource(if (isLandscapeRatio) R.drawable.ic_minimize else R.drawable.ic_maximize) } - override fun onCreateOptionsMenu(menu: Menu): Boolean { - menuInflater.inflate(R.menu.menu_set_wallpaper, menu) - return true - } - - override fun onOptionsItemSelected(item: MenuItem): Boolean { - when (item.itemId) { - R.id.save -> confirmWallpaper() - else -> return super.onOptionsItemSelected(item) - } - return true - } - private fun changeAspectRatio(isLandscape: Boolean) { isLandscapeRatio = isLandscape setupAspectRatio() diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SettingsActivity.kt index 320cfbf1a..4b58e4000 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SettingsActivity.kt @@ -3,6 +3,7 @@ package com.simplemobiletools.gallery.pro.activities import android.content.Intent import android.os.Bundle import android.text.TextUtils +import android.view.Menu import com.simplemobiletools.commons.dialogs.* import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.helpers.* @@ -86,6 +87,11 @@ class SettingsActivity : SimpleActivity() { setupImportSettings() } + override fun onCreateOptionsMenu(menu: Menu): Boolean { + updateMenuItemColors(menu) + return super.onCreateOptionsMenu(menu) + } + private fun setupSectionColors() { val adjustedPrimaryColor = getAdjustedPrimaryColor() arrayListOf(visibility_label, videos_label, thumbnails_label, scrolling_label, fullscreen_media_label, security_label, diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt index 452e348c3..7cf212687 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt @@ -19,6 +19,7 @@ import android.net.Uri import android.os.Bundle import android.os.Handler import android.provider.MediaStore +import android.text.Html import android.view.Menu import android.view.MenuItem import android.view.View @@ -126,6 +127,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View invalidateOptionsMenu() supportActionBar?.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT)) + supportActionBar?.title = Html.fromHtml("${mPath.getFilenameFromPath()}") window.statusBarColor = Color.TRANSPARENT } @@ -189,6 +191,8 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View if (visibleBottomActions != 0) { updateBottomActionIcons(currentMedium) } + + updateMenuItemColors(menu, baseColor = Color.BLACK) return true }