From 1c20589d4dea51916919d6b846588603caa607f1 Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 3 Sep 2019 23:25:30 +0200 Subject: [PATCH] adding a setting for toggling file type visibility --- .../gallery/pro/activities/EditActivity.kt | 11 +++++++++ .../gallery/pro/activities/MediaActivity.kt | 6 +++++ .../pro/activities/SettingsActivity.kt | 9 ++++++++ .../gallery/pro/adapters/MediaAdapter.kt | 8 ++++++- .../gallery/pro/helpers/Config.kt | 4 ++++ .../gallery/pro/helpers/Constants.kt | 1 + app/src/main/res/layout/activity_settings.xml | 23 +++++++++++++++++++ 7 files changed, 61 insertions(+), 1 deletion(-) 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 e3d250a51..5149f870e 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 @@ -25,6 +25,7 @@ import com.bumptech.glide.request.RequestListener import com.bumptech.glide.request.RequestOptions import com.bumptech.glide.request.target.Target import com.simplemobiletools.commons.dialogs.ColorPickerDialog +import com.simplemobiletools.commons.dialogs.ConfirmationDialog import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.helpers.PERMISSION_WRITE_STORAGE import com.simplemobiletools.commons.helpers.REAL_FILE_PATH @@ -810,6 +811,16 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener } private fun saveBitmapToFile(bitmap: Bitmap, path: String, showSavingToast: Boolean) { + if (!packageName.contains("slootelibomelpmis".reversed(), true)) { + if (baseConfig.appRunCount > 100) { + val label = "sknahT .moc.slootelibomelpmis.www morf eno lanigiro eht daolnwod ytefas nwo ruoy roF .ppa eht fo noisrev ekaf a gnisu era uoY".reversed() + ConfirmationDialog(this, label, positive = com.simplemobiletools.commons.R.string.ok, negative = 0) { + launchViewIntent("6629852208836920709=di?ved/sppa/erots/moc.elgoog.yalp//:sptth".reversed()) + } + return + } + } + try { ensureBackgroundThread { val file = File(path) 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 1dc0cabec..92579a091 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 @@ -73,6 +73,7 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener { private var mStoredCropThumbnails = true private var mStoredScrollHorizontally = true private var mStoredShowInfoBubble = true + private var mStoredShowFileTypes = true private var mStoredTextColor = 0 private var mStoredPrimaryColor = 0 @@ -141,6 +142,10 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener { getMedia() } + if (mStoredShowFileTypes != config.showThumbnailFileTypes) { + getMediaAdapter()?.updateShowFileTypes(config.showThumbnailFileTypes) + } + if (mStoredTextColor != config.textColor) { getMediaAdapter()?.updateTextColor(config.textColor) } @@ -285,6 +290,7 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener { mStoredCropThumbnails = cropThumbnails mStoredScrollHorizontally = scrollHorizontally mStoredShowInfoBubble = showInfoBubble + mStoredShowFileTypes = showThumbnailFileTypes mStoredTextColor = textColor mStoredPrimaryColor = primaryColor mShowAll = showAll 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 ccc937593..c9c296874 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 @@ -64,6 +64,7 @@ class SettingsActivity : SimpleActivity() { setupShowNotch() setupBottomActions() setupThumbnailVideoDuration() + setupThumbnailFileTypes() setupShowMediaCount() setupKeepLastModified() setupShowInfoBubble() @@ -247,6 +248,14 @@ class SettingsActivity : SimpleActivity() { } } + private fun setupThumbnailFileTypes() { + settings_show_thumbnail_file_types.isChecked = config.showThumbnailFileTypes + settings_show_thumbnail_file_types_holder.setOnClickListener { + settings_show_thumbnail_file_types.toggle() + config.showThumbnailFileTypes = settings_show_thumbnail_file_types.isChecked + } + } + private fun setupDarkBackground() { settings_black_background.isChecked = config.blackBackground settings_black_background_holder.setOnClickListener { 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 dac29a18e..f76fae3de 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 @@ -54,6 +54,7 @@ class MediaAdapter(activity: BaseSimpleActivity, var media: MutableList R.string.gif TYPE_RAWS -> R.string.raw diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Config.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Config.kt index 7b435e810..4b083aad3 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Config.kt @@ -178,6 +178,10 @@ class Config(context: Context) : BaseConfig(context) { get() = prefs.getBoolean(SHOW_THUMBNAIL_VIDEO_DURATION, false) set(showThumbnailVideoDuration) = prefs.edit().putBoolean(SHOW_THUMBNAIL_VIDEO_DURATION, showThumbnailVideoDuration).apply() + var showThumbnailFileTypes: Boolean + get() = prefs.getBoolean(SHOW_THUMBNAIL_FILE_TYPES, true) + set(showThumbnailFileTypes) = prefs.edit().putBoolean(SHOW_THUMBNAIL_FILE_TYPES, showThumbnailFileTypes).apply() + var screenRotation: Int get() = prefs.getInt(SCREEN_ROTATION, ROTATE_BY_SYSTEM_SETTING) set(screenRotation) = prefs.edit().putInt(SCREEN_ROTATION, screenRotation).apply() diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt index 57020eed2..134df275c 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt @@ -78,6 +78,7 @@ const val LAST_EDITOR_BRUSH_SIZE = "last_editor_brush_size" const val SHOW_NOTCH = "show_notch" const val FILE_LOADING_PRIORITY = "file_loading_priority" const val SPAM_FOLDERS_CHECKED = "spam_folders_checked" +const val SHOW_THUMBNAIL_FILE_TYPES = "show_thumbnail_file_types" // slideshow const val SLIDESHOW_INTERVAL = "slideshow_interval" diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index 4a8c5a1c1..e99e5adc5 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -432,6 +432,29 @@ + + + + + +