From 7eac78411ebcb644ff7c580f599b7f6d12733b9d Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 4 Apr 2022 15:58:05 +0200 Subject: [PATCH] adding some preparation for Material You theme --- .../gallery/pro/activities/EditActivity.kt | 2 +- .../pro/activities/ExcludedFoldersActivity.kt | 3 ++- .../pro/activities/HiddenFoldersActivity.kt | 3 ++- .../pro/activities/IncludedFoldersActivity.kt | 3 ++- .../gallery/pro/activities/MainActivity.kt | 14 ++++++-------- .../gallery/pro/activities/MediaActivity.kt | 14 ++++++-------- .../gallery/pro/activities/SearchActivity.kt | 8 +++++--- .../gallery/pro/activities/SettingsActivity.kt | 2 +- .../gallery/pro/activities/ViewPagerActivity.kt | 3 +-- .../pro/activities/WidgetConfigureActivity.kt | 2 +- .../gallery/pro/adapters/DirectoryAdapter.kt | 10 +++------- .../gallery/pro/adapters/ManageFoldersAdapter.kt | 4 ++-- .../pro/adapters/ManageHiddenFoldersAdapter.kt | 3 ++- .../dialogs/ChangeFolderThumbnailStyleDialog.kt | 5 +++-- .../gallery/pro/fragments/PhotoFragment.kt | 15 ++++++++++++--- .../gallery/pro/views/EditorDrawCanvas.kt | 5 ++--- 16 files changed, 51 insertions(+), 45 deletions(-) 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 c668fbc07..9b11e1738 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, getProperPrimaryColor(), config.backgroundColor) + bottom_draw_width.setColors(getProperTextColor(), getProperPrimaryColor(), getProperBackgroundColor()) } override fun onStop() { 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 0dc14ea88..9f0111e9c 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 @@ -5,6 +5,7 @@ import android.view.Menu import android.view.MenuItem import com.simplemobiletools.commons.dialogs.FilePickerDialog import com.simplemobiletools.commons.extensions.beVisibleIf +import com.simplemobiletools.commons.extensions.getProperTextColor import com.simplemobiletools.commons.extensions.internalStoragePath import com.simplemobiletools.commons.helpers.isRPlus import com.simplemobiletools.commons.interfaces.RefreshRecyclerViewListener @@ -26,7 +27,7 @@ class ExcludedFoldersActivity : SimpleActivity(), RefreshRecyclerViewListener { var placeholderText = getString(R.string.excluded_activity_placeholder) manage_folders_placeholder.apply { beVisibleIf(folders.isEmpty()) - setTextColor(config.textColor) + setTextColor(getProperTextColor()) if (isRPlus()) { placeholderText = placeholderText.substringBefore("\n") 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 4a5aaac85..4ad3c1c33 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 @@ -5,6 +5,7 @@ import android.view.Menu import android.view.MenuItem import com.simplemobiletools.commons.dialogs.FilePickerDialog import com.simplemobiletools.commons.extensions.beVisibleIf +import com.simplemobiletools.commons.extensions.getProperTextColor import com.simplemobiletools.commons.helpers.ensureBackgroundThread import com.simplemobiletools.commons.interfaces.RefreshRecyclerViewListener import com.simplemobiletools.gallery.pro.R @@ -27,7 +28,7 @@ class HiddenFoldersActivity : SimpleActivity(), RefreshRecyclerViewListener { manage_folders_placeholder.apply { text = getString(R.string.hidden_folders_placeholder) beVisibleIf(it.isEmpty()) - setTextColor(config.textColor) + setTextColor(getProperTextColor()) } val adapter = ManageHiddenFoldersAdapter(this, it, this, manage_folders_list) {} 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 e1f0d9a06..cc1975ef4 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 @@ -4,6 +4,7 @@ import android.os.Bundle import android.view.Menu import android.view.MenuItem import com.simplemobiletools.commons.extensions.beVisibleIf +import com.simplemobiletools.commons.extensions.getProperTextColor import com.simplemobiletools.commons.interfaces.RefreshRecyclerViewListener import com.simplemobiletools.gallery.pro.R import com.simplemobiletools.gallery.pro.adapters.ManageFoldersAdapter @@ -23,7 +24,7 @@ class IncludedFoldersActivity : SimpleActivity(), RefreshRecyclerViewListener { manage_folders_placeholder.apply { text = getString(R.string.included_activity_placeholder) beVisibleIf(folders.isEmpty()) - setTextColor(config.textColor) + setTextColor(getProperTextColor()) } val adapter = ManageFoldersAdapter(this, folders, false, this, manage_folders_list) {} 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 d10382991..c35f34716 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 @@ -43,8 +43,6 @@ import com.simplemobiletools.gallery.pro.models.Directory import com.simplemobiletools.gallery.pro.models.Medium import kotlinx.android.synthetic.main.activity_main.* import java.io.* -import java.util.* -import kotlin.collections.ArrayList class MainActivity : SimpleActivity(), DirectoryOperationsListener { private val PICK_MEDIA = 2 @@ -180,13 +178,13 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { getDirectories() } - if (mStoredTextColor != config.textColor) { - getRecyclerAdapter()?.updateTextColor(config.textColor) + if (mStoredTextColor != getProperTextColor()) { + getRecyclerAdapter()?.updateTextColor(getProperTextColor()) } val primaryColor = getProperPrimaryColor() if (mStoredPrimaryColor != primaryColor) { - getRecyclerAdapter()?.updatePrimaryColor(config.primaryColor) + getRecyclerAdapter()?.updatePrimaryColor(primaryColor) } val styleString = "${config.folderStyle}${config.showFolderMediaCount}${config.limitFolderTitle}" @@ -201,7 +199,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { timeFormat = getTimeFormat() } - directories_empty_placeholder.setTextColor(config.textColor) + directories_empty_placeholder.setTextColor(getProperTextColor()) directories_empty_placeholder_2.setTextColor(primaryColor) directories_switch_searching.setTextColor(primaryColor) directories_switch_searching.underlineText() @@ -334,14 +332,14 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { private fun getRecyclerAdapter() = directories_grid.adapter as? DirectoryAdapter private fun storeStateVariables() { + mStoredTextColor = getProperTextColor() + mStoredPrimaryColor = getProperPrimaryColor() config.apply { mStoredAnimateGifs = animateGifs mStoredCropThumbnails = cropThumbnails mStoredScrollHorizontally = scrollHorizontally - mStoredTextColor = textColor mStoredStyleString = "$folderStyle$showFolderMediaCount$limitFolderTitle" } - 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 e5f59e9f6..da19d1303 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 @@ -44,8 +44,6 @@ import com.simplemobiletools.gallery.pro.models.ThumbnailSection import kotlinx.android.synthetic.main.activity_media.* import java.io.File import java.io.IOException -import java.util.* -import kotlin.collections.ArrayList class MediaActivity : SimpleActivity(), MediaOperationsListener { private val LAST_MEDIA_CHECK_PERIOD = 3000L @@ -141,13 +139,13 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener { getMediaAdapter()?.updateShowFileTypes(config.showThumbnailFileTypes) } - if (mStoredTextColor != config.textColor) { - getMediaAdapter()?.updateTextColor(config.textColor) + if (mStoredTextColor != getProperTextColor()) { + getMediaAdapter()?.updateTextColor(getProperTextColor()) } val primaryColor = getProperPrimaryColor() if (mStoredPrimaryColor != primaryColor) { - getMediaAdapter()?.updatePrimaryColor(config.primaryColor) + getMediaAdapter()?.updatePrimaryColor(primaryColor) } if ( @@ -166,7 +164,7 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener { timeFormat = getTimeFormat() } - media_empty_text_placeholder.setTextColor(config.textColor) + media_empty_text_placeholder.setTextColor(getProperTextColor()) media_empty_text_placeholder_2.setTextColor(getProperPrimaryColor()) if (!mIsSearchOpen) { @@ -301,18 +299,18 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener { } private fun storeStateVariables() { + mStoredTextColor = getProperTextColor() + mStoredPrimaryColor = getProperPrimaryColor() config.apply { mStoredAnimateGifs = animateGifs mStoredCropThumbnails = cropThumbnails mStoredScrollHorizontally = scrollHorizontally mStoredShowFileTypes = showThumbnailFileTypes mStoredMarkFavoriteItems = markFavoriteItems - mStoredTextColor = textColor mStoredThumbnailSpacing = thumbnailSpacing mStoredRoundedCorners = fileRoundedCorners mShowAll = showAll } - 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 1452984ad..33ae8087e 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 @@ -21,11 +21,13 @@ import com.simplemobiletools.gallery.pro.R import com.simplemobiletools.gallery.pro.adapters.MediaAdapter import com.simplemobiletools.gallery.pro.asynctasks.GetMediaAsynctask import com.simplemobiletools.gallery.pro.extensions.* -import com.simplemobiletools.gallery.pro.helpers.* +import com.simplemobiletools.gallery.pro.helpers.GridSpacingItemDecoration +import com.simplemobiletools.gallery.pro.helpers.MediaFetcher +import com.simplemobiletools.gallery.pro.helpers.PATH +import com.simplemobiletools.gallery.pro.helpers.SHOW_ALL import com.simplemobiletools.gallery.pro.interfaces.MediaOperationsListener import com.simplemobiletools.gallery.pro.models.Medium import com.simplemobiletools.gallery.pro.models.ThumbnailItem -import kotlinx.android.synthetic.main.activity_main.* import kotlinx.android.synthetic.main.activity_search.* import java.io.File @@ -40,7 +42,7 @@ class SearchActivity : SimpleActivity(), MediaOperationsListener { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_search) - media_empty_text_placeholder.setTextColor(config.textColor) + media_empty_text_placeholder.setTextColor(getProperTextColor()) getAllMedia() media_fastscroller.updateColors(getProperPrimaryColor()) } 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 9c558d592..7bc411fc9 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 @@ -123,7 +123,7 @@ class SettingsActivity : SimpleActivity() { settings_recycle_bin_holder, settings_migrating_holder ).forEach { - it.background.applyColorFilter(baseConfig.backgroundColor.getContrastColor()) + it.background.applyColorFilter(getProperBackgroundColor().getContrastColor()) } } 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 581b5ae47..966c6768e 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 @@ -61,7 +61,6 @@ import kotlinx.android.synthetic.main.activity_medium.* import kotlinx.android.synthetic.main.bottom_actions.* import java.io.File import java.io.OutputStream -import java.util.* class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, ViewPagerFragment.FragmentListener { private val REQUEST_VIEW_VIDEO = 1 @@ -91,7 +90,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View super.onCreate(savedInstanceState) setContentView(R.layout.activity_medium) - window.decorView.setBackgroundColor(config.backgroundColor) + window.decorView.setBackgroundColor(getProperBackgroundColor()) top_shadow.layoutParams.height = statusBarHeight + actionBarHeight checkNotchSupport() (MediaActivity.mMedia.clone() as ArrayList).filter { it is Medium }.mapTo(mMediaFiles) { it as Medium } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/WidgetConfigureActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/WidgetConfigureActivity.kt index 43741c140..a93ccc346 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/WidgetConfigureActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/WidgetConfigureActivity.kt @@ -56,7 +56,7 @@ class WidgetConfigureActivity : SimpleActivity() { } updateTextColors(folder_picker_holder) - folder_picker_holder.background = ColorDrawable(config.backgroundColor) + folder_picker_holder.background = ColorDrawable(getProperBackgroundColor()) getCachedDirectories(false, false) { mDirectories = it 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 dbfa938fe..ed7b65430 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 @@ -5,14 +5,12 @@ import android.content.pm.ShortcutInfo import android.content.pm.ShortcutManager import android.graphics.drawable.ColorDrawable import android.graphics.drawable.Icon -import android.os.Build import android.text.TextUtils import android.view.Menu import android.view.MotionEvent import android.view.View import android.view.ViewGroup import android.widget.RelativeLayout -import androidx.annotation.RequiresApi import androidx.recyclerview.widget.ItemTouchHelper import androidx.recyclerview.widget.RecyclerView import androidx.swiperefreshlayout.widget.SwipeRefreshLayout @@ -52,8 +50,6 @@ import kotlinx.android.synthetic.main.directory_item_list.view.dir_holder import kotlinx.android.synthetic.main.directory_item_list.view.photo_cnt import java.io.File import java.util.* -import kotlin.collections.ArrayList -import kotlin.collections.HashMap class DirectoryAdapter( activity: BaseSimpleActivity, var dirs: ArrayList, val listener: DirectoryOperationsListener?, recyclerView: MyRecyclerView, @@ -626,7 +622,7 @@ class DirectoryAdapter( return@handleSAFDialog } - activity.handleSAFDialogSdk30(SAFPath){ + activity.handleSAFDialogSdk30(SAFPath) { if (!it) { return@handleSAFDialogSdk30 } @@ -789,8 +785,8 @@ class DirectoryAdapter( if (lockedFolderPaths.contains(directory.path)) { dir_lock.beVisible() - dir_lock.background = ColorDrawable(config.backgroundColor) - dir_lock.applyColorFilter(config.backgroundColor.getContrastColor()) + dir_lock.background = ColorDrawable(context.getProperBackgroundColor()) + dir_lock.applyColorFilter(context.getProperBackgroundColor().getContrastColor()) } else { dir_lock.beGone() val roundedCorners = when { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/ManageFoldersAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/ManageFoldersAdapter.kt index 4b9339554..9e3829068 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/ManageFoldersAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/ManageFoldersAdapter.kt @@ -5,12 +5,12 @@ import android.view.View import android.view.ViewGroup import com.simplemobiletools.commons.activities.BaseSimpleActivity import com.simplemobiletools.commons.adapters.MyRecyclerViewAdapter +import com.simplemobiletools.commons.extensions.getProperTextColor import com.simplemobiletools.commons.interfaces.RefreshRecyclerViewListener import com.simplemobiletools.commons.views.MyRecyclerView import com.simplemobiletools.gallery.pro.R import com.simplemobiletools.gallery.pro.extensions.config import kotlinx.android.synthetic.main.item_manage_folder.view.* -import java.util.* class ManageFoldersAdapter( activity: BaseSimpleActivity, var folders: ArrayList, val isShowingExcludedFolders: Boolean, val listener: RefreshRecyclerViewListener?, @@ -64,7 +64,7 @@ class ManageFoldersAdapter( manage_folder_holder?.isSelected = selectedKeys.contains(folder.hashCode()) manage_folder_title.apply { text = folder - setTextColor(config.textColor) + setTextColor(context.getProperTextColor()) } } } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/ManageHiddenFoldersAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/ManageHiddenFoldersAdapter.kt index 79e67867e..6fd74500d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/ManageHiddenFoldersAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/ManageHiddenFoldersAdapter.kt @@ -5,6 +5,7 @@ import android.view.View import android.view.ViewGroup import com.simplemobiletools.commons.activities.BaseSimpleActivity import com.simplemobiletools.commons.adapters.MyRecyclerViewAdapter +import com.simplemobiletools.commons.extensions.getProperTextColor import com.simplemobiletools.commons.extensions.isPathOnSD import com.simplemobiletools.commons.interfaces.RefreshRecyclerViewListener import com.simplemobiletools.commons.views.MyRecyclerView @@ -66,7 +67,7 @@ class ManageHiddenFoldersAdapter( manage_folder_holder?.isSelected = selectedKeys.contains(folder.hashCode()) manage_folder_title.apply { text = folder - setTextColor(config.textColor) + setTextColor(context.getProperTextColor()) } } } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/dialogs/ChangeFolderThumbnailStyleDialog.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/dialogs/ChangeFolderThumbnailStyleDialog.kt index b41b4b23e..864015872 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/dialogs/ChangeFolderThumbnailStyleDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/dialogs/ChangeFolderThumbnailStyleDialog.kt @@ -11,6 +11,7 @@ import com.bumptech.glide.request.RequestOptions import com.simplemobiletools.commons.activities.BaseSimpleActivity import com.simplemobiletools.commons.extensions.beGone import com.simplemobiletools.commons.extensions.beVisible +import com.simplemobiletools.commons.extensions.getProperTextColor import com.simplemobiletools.commons.extensions.setupDialogStuff import com.simplemobiletools.gallery.pro.R import com.simplemobiletools.gallery.pro.extensions.config @@ -106,8 +107,8 @@ class ChangeFolderThumbnailStyleDialog(val activity: BaseSimpleActivity, val cal if (useRoundedCornersLayout) { val cornerRadius = resources.getDimension(R.dimen.rounded_corner_radius_big).toInt() builder = builder.transform(CenterCrop(), RoundedCorners(cornerRadius)) - dir_name.setTextColor(activity.config.textColor) - photo_cnt.setTextColor(activity.config.textColor) + dir_name.setTextColor(activity.getProperTextColor()) + photo_cnt.setTextColor(activity.getProperTextColor()) } builder.into(dir_thumbnail) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/PhotoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/PhotoFragment.kt index 6b00ef5d6..1c747e243 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/PhotoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/fragments/PhotoFragment.kt @@ -19,7 +19,10 @@ import android.view.MotionEvent import android.view.View import android.view.ViewGroup import android.widget.RelativeLayout -import androidx.exifinterface.media.ExifInterface.* +import androidx.exifinterface.media.ExifInterface.ORIENTATION_ROTATE_180 +import androidx.exifinterface.media.ExifInterface.ORIENTATION_ROTATE_270 +import androidx.exifinterface.media.ExifInterface.ORIENTATION_ROTATE_90 +import androidx.exifinterface.media.ExifInterface.TAG_ORIENTATION import com.alexvasilkov.gestures.GestureController import com.alexvasilkov.gestures.State import com.bumptech.glide.Glide @@ -61,7 +64,6 @@ import org.apache.sanselan.formats.jpeg.JpegImageParser import pl.droidsonroids.gif.InputSource import java.io.File import java.io.FileOutputStream -import java.util.* import kotlin.math.ceil class PhotoFragment : ViewPagerFragment() { @@ -673,7 +675,14 @@ class PhotoFragment : ViewPagerFragment() { onImageEventListener = object : SubsamplingScaleImageView.OnImageEventListener { override fun onReady() { - background = ColorDrawable(if (config.blackBackground) Color.BLACK else config.backgroundColor) + background = ColorDrawable( + if (config.blackBackground) { + Color.BLACK + } else { + context.getProperBackgroundColor() + } + ) + val useWidth = if (mImageOrientation == ORIENTATION_ROTATE_90 || mImageOrientation == ORIENTATION_ROTATE_270) sHeight else sWidth val useHeight = if (mImageOrientation == ORIENTATION_ROTATE_90 || mImageOrientation == ORIENTATION_ROTATE_270) sWidth else sHeight doubleTapZoomScale = getDoubleTapZoomScale(useWidth, useHeight) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/EditorDrawCanvas.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/EditorDrawCanvas.kt index 592320b33..2220ef840 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/EditorDrawCanvas.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/views/EditorDrawCanvas.kt @@ -5,10 +5,9 @@ import android.graphics.* import android.util.AttributeSet import android.view.MotionEvent import android.view.View +import com.simplemobiletools.commons.extensions.getProperPrimaryColor import com.simplemobiletools.gallery.pro.R -import com.simplemobiletools.gallery.pro.extensions.config import com.simplemobiletools.gallery.pro.models.PaintOptions -import java.util.* class EditorDrawCanvas(context: Context, attrs: AttributeSet) : View(context, attrs) { private var mCurX = 0f @@ -26,7 +25,7 @@ class EditorDrawCanvas(context: Context, attrs: AttributeSet) : View(context, at private var backgroundBitmap: Bitmap? = null init { - mColor = context.config.primaryColor + mColor = context.getProperPrimaryColor() mPaint.apply { color = mColor style = Paint.Style.STROKE