From 52693adbe6d1fca0d218c65fb272a74361befb46 Mon Sep 17 00:00:00 2001 From: darthpaul Date: Thu, 31 Mar 2022 04:46:09 +0100 Subject: [PATCH] Update gallery with recent commons module --- app/build.gradle | 4 ++-- .../gallery/pro/activities/EditActivity.kt | 8 ++++---- .../gallery/pro/activities/MainActivity.kt | 14 +++++++------- .../gallery/pro/activities/MediaActivity.kt | 12 ++++++------ .../gallery/pro/activities/SearchActivity.kt | 2 +- .../gallery/pro/activities/SettingsActivity.kt | 2 +- .../gallery/pro/adapters/DirectoryAdapter.kt | 2 +- .../gallery/pro/adapters/MediaAdapter.kt | 2 +- .../gallery/pro/dialogs/PickDirectoryDialog.kt | 2 +- .../gallery/pro/dialogs/PickMediumDialog.kt | 4 ++-- .../gallery/pro/helpers/PicassoRegionDecoder.kt | 2 +- 11 files changed, 27 insertions(+), 27 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 6140f8c21..d294a7fae 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,7 +10,7 @@ if (keystorePropertiesFile.exists()) { } android { - compileSdk 30 + compileSdk 31 defaultConfig { applicationId "com.simplemobiletools.gallery.pro" @@ -77,7 +77,7 @@ android { } dependencies { - implementation 'com.github.SimpleMobileTools:Simple-Commons:4ef63f88a3' + implementation 'com.github.SimpleMobileTools:Simple-Commons:b16cc87e63' implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0' implementation 'it.sephiroth.android.exif:library:1.0.1' implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.24' 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 93f6d4051..c668fbc07 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 @@ -107,7 +107,7 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener override fun onResume() { super.onResume() isEditingWithThirdParty = false - bottom_draw_width.setColors(config.textColor, getAdjustedPrimaryColor(), config.backgroundColor) + bottom_draw_width.setColors(config.textColor, getProperPrimaryColor(), config.backgroundColor) } override fun onStop() { @@ -592,7 +592,7 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener else -> null } - currentPrimaryActionButton?.applyColorFilter(getAdjustedPrimaryColor()) + currentPrimaryActionButton?.applyColorFilter(getProperPrimaryColor()) bottom_editor_filter_actions.beVisibleIf(currPrimaryAction == PRIMARY_ACTION_FILTER) bottom_editor_crop_rotate_actions.beVisibleIf(currPrimaryAction == PRIMARY_ACTION_CROP_ROTATE) bottom_editor_draw_actions.beVisibleIf(currPrimaryAction == PRIMARY_ACTION_DRAW) @@ -708,7 +708,7 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener else -> bottom_aspect_ratio_other } - currentAspectRatioButton.setTextColor(getAdjustedPrimaryColor()) + currentAspectRatioButton.setTextColor(getProperPrimaryColor()) } private fun updateCropRotateActionButtons() { @@ -721,7 +721,7 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener else -> null } - primaryActionView?.applyColorFilter(getAdjustedPrimaryColor()) + primaryActionView?.applyColorFilter(getProperPrimaryColor()) } private fun updateDrawColor(color: Int) { 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 b804e27fe..d10382991 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 @@ -83,7 +83,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { private var mStoredCropThumbnails = true private var mStoredScrollHorizontally = true private var mStoredTextColor = 0 - private var mStoredAdjustedPrimaryColor = 0 + private var mStoredPrimaryColor = 0 private var mStoredStyleString = "" override fun onCreate(savedInstanceState: Bundle?) { @@ -184,8 +184,8 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { getRecyclerAdapter()?.updateTextColor(config.textColor) } - val adjustedPrimaryColor = getAdjustedPrimaryColor() - if (mStoredAdjustedPrimaryColor != adjustedPrimaryColor) { + val primaryColor = getProperPrimaryColor() + if (mStoredPrimaryColor != primaryColor) { getRecyclerAdapter()?.updatePrimaryColor(config.primaryColor) } @@ -194,7 +194,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { setupAdapter(mDirs, forceRecreate = true) } - directories_fastscroller.updateColors(adjustedPrimaryColor) + directories_fastscroller.updateColors(primaryColor) directories_refresh_layout.isEnabled = config.enablePullToRefresh getRecyclerAdapter()?.apply { dateFormat = config.dateFormat @@ -202,8 +202,8 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { } directories_empty_placeholder.setTextColor(config.textColor) - directories_empty_placeholder_2.setTextColor(adjustedPrimaryColor) - directories_switch_searching.setTextColor(adjustedPrimaryColor) + directories_empty_placeholder_2.setTextColor(primaryColor) + directories_switch_searching.setTextColor(primaryColor) directories_switch_searching.underlineText() if (!mIsSearchOpen) { @@ -341,7 +341,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { mStoredTextColor = textColor mStoredStyleString = "$folderStyle$showFolderMediaCount$limitFolderTitle" } - mStoredAdjustedPrimaryColor = getAdjustedPrimaryColor() + mStoredPrimaryColor = getProperPrimaryColor() } private fun setupSearch(menu: Menu) { 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 d50c91cff..e5f59e9f6 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 @@ -75,7 +75,7 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener { private var mStoredRoundedCorners = false private var mStoredMarkFavoriteItems = true private var mStoredTextColor = 0 - private var mStoredAdjustedPrimaryColor = 0 + private var mStoredPrimaryColor = 0 private var mStoredThumbnailSpacing = 0 companion object { @@ -145,8 +145,8 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener { getMediaAdapter()?.updateTextColor(config.textColor) } - val adjustedPrimaryColor = getAdjustedPrimaryColor() - if (mStoredAdjustedPrimaryColor != adjustedPrimaryColor) { + val primaryColor = getProperPrimaryColor() + if (mStoredPrimaryColor != primaryColor) { getMediaAdapter()?.updatePrimaryColor(config.primaryColor) } @@ -159,7 +159,7 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener { setupAdapter() } - media_fastscroller.updateColors(adjustedPrimaryColor) + media_fastscroller.updateColors(primaryColor) media_refresh_layout.isEnabled = config.enablePullToRefresh getMediaAdapter()?.apply { dateFormat = config.dateFormat @@ -167,7 +167,7 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener { } media_empty_text_placeholder.setTextColor(config.textColor) - media_empty_text_placeholder_2.setTextColor(getAdjustedPrimaryColor()) + media_empty_text_placeholder_2.setTextColor(getProperPrimaryColor()) if (!mIsSearchOpen) { invalidateOptionsMenu() @@ -312,7 +312,7 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener { mStoredRoundedCorners = fileRoundedCorners mShowAll = showAll } - mStoredAdjustedPrimaryColor = getAdjustedPrimaryColor() + mStoredPrimaryColor = getProperPrimaryColor() } private fun setupSearch(menu: Menu) { 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 73af513a2..1452984ad 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 @@ -42,7 +42,7 @@ class SearchActivity : SimpleActivity(), MediaOperationsListener { setContentView(R.layout.activity_search) media_empty_text_placeholder.setTextColor(config.textColor) getAllMedia() - media_fastscroller.updateColors(getAdjustedPrimaryColor()) + media_fastscroller.updateColors(getProperPrimaryColor()) } override fun onDestroy() { 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 15c15c221..9c558d592 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 @@ -105,7 +105,7 @@ class SettingsActivity : SimpleActivity() { settings_recycle_bin_label, settings_migrating_label ).forEach { - it.setTextColor(getAdjustedPrimaryColor()) + it.setTextColor(getProperPrimaryColor()) } arrayOf( diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/DirectoryAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/DirectoryAdapter.kt index b3ed7542d..dbfa938fe 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/DirectoryAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/DirectoryAdapter.kt @@ -761,7 +761,7 @@ class DirectoryAdapter( dir_check?.beVisibleIf(isSelected) if (isSelected) { - dir_check.background?.applyColorFilter(adjustedPrimaryColor) + dir_check.background?.applyColorFilter(properPrimaryColor) dir_check.applyColorFilter(contrastColor) } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/MediaAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/MediaAdapter.kt index 3ca5cd943..9b07dca42 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/MediaAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/MediaAdapter.kt @@ -585,7 +585,7 @@ class MediaAdapter( medium_check?.beVisibleIf(isSelected) if (isSelected) { - medium_check?.background?.applyColorFilter(adjustedPrimaryColor) + medium_check?.background?.applyColorFilter(properPrimaryColor) medium_check.applyColorFilter(contrastColor) } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/dialogs/PickDirectoryDialog.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/dialogs/PickDirectoryDialog.kt index 7d81001fc..06a80e232 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/dialogs/PickDirectoryDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/dialogs/PickDirectoryDialog.kt @@ -34,7 +34,7 @@ class PickDirectoryDialog( spanCount = if (isGridViewType) activity.config.dirColumnCnt else 1 } - view.directories_fastscroller.updateColors(activity.getAdjustedPrimaryColor()) + view.directories_fastscroller.updateColors(activity.getProperPrimaryColor()) val builder = AlertDialog.Builder(activity) .setPositiveButton(R.string.ok, null) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/dialogs/PickMediumDialog.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/dialogs/PickMediumDialog.kt index 7c3da17a0..a2837ebc5 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/dialogs/PickMediumDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/dialogs/PickMediumDialog.kt @@ -3,7 +3,7 @@ package com.simplemobiletools.gallery.pro.dialogs import androidx.appcompat.app.AlertDialog import androidx.recyclerview.widget.RecyclerView import com.simplemobiletools.commons.activities.BaseSimpleActivity -import com.simplemobiletools.commons.extensions.getAdjustedPrimaryColor +import com.simplemobiletools.commons.extensions.getProperPrimaryColor import com.simplemobiletools.commons.extensions.setupDialogStuff import com.simplemobiletools.commons.helpers.VIEW_TYPE_GRID import com.simplemobiletools.commons.views.MyGridLayoutManager @@ -33,7 +33,7 @@ class PickMediumDialog(val activity: BaseSimpleActivity, val path: String, val c spanCount = if (isGridViewType) config.mediaColumnCnt else 1 } - view.media_fastscroller.updateColors(activity.getAdjustedPrimaryColor()) + view.media_fastscroller.updateColors(activity.getProperPrimaryColor()) dialog = AlertDialog.Builder(activity) .setPositiveButton(R.string.ok, null) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/PicassoRegionDecoder.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/PicassoRegionDecoder.kt index b6135f9ab..b3133327d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/PicassoRegionDecoder.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/PicassoRegionDecoder.kt @@ -18,7 +18,7 @@ class PicassoRegionDecoder( override fun init(context: Context, uri: Uri): Point { val newUri = Uri.parse(uri.toString().replace("%", "%25").replace("#", "%23")) val inputStream = context.contentResolver.openInputStream(newUri) - decoder = BitmapRegionDecoder.newInstance(inputStream, false) + decoder = BitmapRegionDecoder.newInstance(inputStream!!, false) return Point(decoder!!.width, decoder!!.height) }