From 0f711b698ee14668bd29d337fe3e07962091a60c Mon Sep 17 00:00:00 2001 From: rhunk <101876869+rhunk@users.noreply.github.com> Date: Sun, 28 May 2023 17:27:49 +0200 Subject: [PATCH] refactor: optimize code & improve ui --- README.md | 7 +- app/src/main/assets/lang/en_US.json | 9 +- .../snapenhance/config/ConfigCategory.kt | 2 +- .../snapenhance/config/ConfigProperty.kt | 82 +++++++++---------- .../impl/downloader/MediaDownloader.kt | 4 +- .../features/impl/extras/AutoSave.kt | 4 +- .../features/impl/extras/Notifications.kt | 3 +- .../features/impl/privacy/DisableMetrics.kt | 4 +- .../{spy => spying}/AnonymousStoryViewing.kt | 2 +- .../impl/{spy => spying}/MessageLogger.kt | 2 +- .../{spy => spying}/PreventReadReceipts.kt | 2 +- .../impl/{spy => spying}/StealthMode.kt | 2 +- .../impl/ui/menus/ViewAppearanceHelper.kt | 19 ++--- .../impl/ui/menus/impl/ChatActionMenu.kt | 5 +- .../impl/ui/menus/impl/FriendFeedInfoMenu.kt | 2 +- .../impl/ui/menus/impl/SettingsMenu.kt | 14 +++- .../manager/impl/FeatureManager.kt | 9 +- 17 files changed, 88 insertions(+), 84 deletions(-) rename app/src/main/kotlin/me/rhunk/snapenhance/features/impl/{spy => spying}/AnonymousStoryViewing.kt (94%) rename app/src/main/kotlin/me/rhunk/snapenhance/features/impl/{spy => spying}/MessageLogger.kt (98%) rename app/src/main/kotlin/me/rhunk/snapenhance/features/impl/{spy => spying}/PreventReadReceipts.kt (96%) rename app/src/main/kotlin/me/rhunk/snapenhance/features/impl/{spy => spying}/StealthMode.kt (92%) diff --git a/README.md b/README.md index 23f9ebc8..f5fc255e 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ If the software is redistributed, it must remain under the same GPLv3 license an
- Spy + Spying - Anonymous story viewing (other users won't know you viewed their story) - Message logger (log all messages sent and received, you will be able to see deleted messages) @@ -59,3 +59,8 @@ You can also download the latest build from the [actions](https://github.com/rhu - BCH: qpu57a05kqljjadvpgjc6t894apprvth9slvlj4vpj - Bitcoin: bc1qaqnfn6mauzhmx0e6kkenh2wh4r6js0vh5vel92 - ETH: 0x0760987491e9de53A73fd87F092Bd432a227Ee92 + +## Contributors +- [rathmerdominik](https://github.com/rathmerdominik) +- [Flole998](https://github.com/Flole998) +- [authorisation](https://github.com/authorisation/) \ No newline at end of file diff --git a/app/src/main/assets/lang/en_US.json b/app/src/main/assets/lang/en_US.json index b69e0031..dff59bd0 100644 --- a/app/src/main/assets/lang/en_US.json +++ b/app/src/main/assets/lang/en_US.json @@ -1,13 +1,14 @@ { "category": { "general": "General", - "spy": "Spy", + "spying": "Spying", "media_download": "Media Downloader", "privacy": "Privacy", "ui": "UI", "extras": "Extras", "tweaks": "Tweaks", - "experimental": "Experimental" + "experimental": "Experimental", + "debugging": "Debugging" }, "action": { @@ -21,7 +22,7 @@ "prevent_read_receipts": "Prevent Read Receipts", "hide_bitmoji_presence": "Hide Bitmoji Presence", "show_message_content_in_notifications": "Show Message Content In Notifications", - "notification_filter": "Notification Filter", + "notification_blacklist": "Notification Blacklist", "message_logger": "Message Logger", "unlimited_snap_view_time": "Unlimited Snap View Time", "auto_download_snaps": "Auto Download Snaps", @@ -61,7 +62,7 @@ "option": { "property": { - "notification_filter": { + "notification_blacklist": { "chat": "Chat", "snap": "Snap", "typing": "Typing" diff --git a/app/src/main/kotlin/me/rhunk/snapenhance/config/ConfigCategory.kt b/app/src/main/kotlin/me/rhunk/snapenhance/config/ConfigCategory.kt index a13befb6..be067b15 100644 --- a/app/src/main/kotlin/me/rhunk/snapenhance/config/ConfigCategory.kt +++ b/app/src/main/kotlin/me/rhunk/snapenhance/config/ConfigCategory.kt @@ -4,7 +4,7 @@ enum class ConfigCategory( val key: String ) { GENERAL("category.general"), - SPY("category.spy"), + SPYING("category.spying"), MEDIA_DOWNLOADER("category.media_download"), PRIVACY("category.privacy"), UI("category.ui"), diff --git a/app/src/main/kotlin/me/rhunk/snapenhance/config/ConfigProperty.kt b/app/src/main/kotlin/me/rhunk/snapenhance/config/ConfigProperty.kt index 825ff3a7..671cf019 100644 --- a/app/src/main/kotlin/me/rhunk/snapenhance/config/ConfigProperty.kt +++ b/app/src/main/kotlin/me/rhunk/snapenhance/config/ConfigProperty.kt @@ -25,25 +25,25 @@ enum class ConfigProperty( PREVENT_READ_RECEIPTS( "property.prevent_read_receipts", "description.prevent_read_receipts", - ConfigCategory.SPY, + ConfigCategory.SPYING, ConfigStateValue(false) ), HIDE_BITMOJI_PRESENCE( "property.hide_bitmoji_presence", "description.hide_bitmoji_presence", - ConfigCategory.SPY, + ConfigCategory.SPYING, ConfigStateValue(false) ), SHOW_MESSAGE_CONTENT_IN_NOTIFICATIONS( "property.show_message_content_in_notifications", "description.show_message_content_in_notifications", - ConfigCategory.SPY, + ConfigCategory.SPYING, ConfigStateValue(false) ), - NOTIFICATION_FILTER( - "property.notification_filter", - "description.notification_filter", - ConfigCategory.SPY, + NOTIFICATION_BLACKLIST( + "property.notification_blacklist", + "description.notification_blacklist", + ConfigCategory.SPYING, ConfigStateListValue( listOf("snap", "chat", "typing"), mutableMapOf( @@ -54,8 +54,8 @@ enum class ConfigProperty( ) ), - MESSAGE_LOGGER("property.message_logger", "description.message_logger", ConfigCategory.SPY, ConfigStateValue(false)), - UNLIMITED_SNAP_VIEW_TIME("property.unlimited_snap_view_time", "description.unlimited_snap_view_time", ConfigCategory.SPY, ConfigStateValue(false)), + MESSAGE_LOGGER("property.message_logger", "description.message_logger", ConfigCategory.SPYING, ConfigStateValue(false)), + UNLIMITED_SNAP_VIEW_TIME("property.unlimited_snap_view_time", "description.unlimited_snap_view_time", ConfigCategory.SPYING, ConfigStateValue(false)), AUTO_DOWNLOAD_SNAPS( "property.auto_download_snaps", @@ -134,6 +134,36 @@ enum class ConfigProperty( ConfigIntegerValue(20) ), + AUTO_SAVE("property.auto_save", "description.auto_save", ConfigCategory.EXTRAS, ConfigStateValue(false)), + ANTI_AUTO_SAVE("property.anti_auto_save", "description.anti_auto_save", ConfigCategory.EXTRAS, ConfigStateValue(false)), + SNAPCHAT_PLUS("property.snapchat_plus", "description.snapchat_plus", ConfigCategory.EXTRAS, ConfigStateValue(false)), + DISABLE_SNAP_SPLITTING( + "property.disable_snap_splitting", + "description.disable_snap_splitting", + ConfigCategory.EXTRAS, + ConfigStateValue(false) + ), + DISABLE_VIDEO_LENGTH_RESTRICTION( + "property.disable_video_length_restriction", + "description.disable_video_length_restriction", + ConfigCategory.EXTRAS, + ConfigStateValue(false) + ), + OVERRIDE_MEDIA_QUALITY( + "property.override_media_quality", + "description.override_media_quality", + ConfigCategory.EXTRAS, + ConfigStateValue(false) + ), + MEDIA_QUALITY_LEVEL( + "property.media_quality_level", + "description.media_quality_level", + ConfigCategory.EXTRAS, + ConfigStateSelection( + listOf("LEVEL_NONE", "LEVEL_1", "LEVEL_2", "LEVEL_3", "LEVEL_4", "LEVEL_5", "LEVEL_6", "LEVEL_7", "LEVEL_MAX"), + "LEVEL_NONE" + ) + ), GALLERY_MEDIA_SEND_OVERRIDE( "property.gallery_media_send_override", "description.gallery_media_send_override", @@ -143,37 +173,7 @@ enum class ConfigProperty( "OFF" ) ), - AUTO_SAVE("property.auto_save", "description.auto_save", ConfigCategory.EXTRAS, ConfigStateValue(false)), - ANTI_AUTO_SAVE("property.anti_auto_save", "description.anti_auto_save", ConfigCategory.EXTRAS, ConfigStateValue(false)), - SNAPCHAT_PLUS("property.snapchat_plus", "description.snapchat_plus", ConfigCategory.EXTRAS, ConfigStateValue(false)), - DISABLE_SNAP_SPLITTING( - "property.disable_snap_splitting", - "description.disable_snap_splitting", - ConfigCategory.TWEAKS, - ConfigStateValue(false) - ), - DISABLE_VIDEO_LENGTH_RESTRICTION( - "property.disable_video_length_restriction", - "description.disable_video_length_restriction", - ConfigCategory.TWEAKS, - ConfigStateValue(false) - ), - OVERRIDE_MEDIA_QUALITY( - "property.override_media_quality", - "description.override_media_quality", - ConfigCategory.TWEAKS, - ConfigStateValue(false) - ), - MEDIA_QUALITY_LEVEL( - "property.media_quality_level", - "description.media_quality_level", - ConfigCategory.TWEAKS, - ConfigStateSelection( - listOf("LEVEL_NONE", "LEVEL_1", "LEVEL_2", "LEVEL_3", "LEVEL_4", "LEVEL_5", "LEVEL_6", "LEVEL_7", "LEVEL_MAX"), - "LEVEL_NONE" - ) - ), REMOVE_VOICE_RECORD_BUTTON( "property.remove_voice_record_button", "description.remove_voice_record_button", @@ -233,10 +233,6 @@ enum class ConfigProperty( ); companion object { - fun fromNameKey(nameKey: String): ConfigProperty? { - return values().find { it.nameKey == nameKey } - } - fun sortedByCategory(): List { return values().sortedBy { it.category.ordinal } } diff --git a/app/src/main/kotlin/me/rhunk/snapenhance/features/impl/downloader/MediaDownloader.kt b/app/src/main/kotlin/me/rhunk/snapenhance/features/impl/downloader/MediaDownloader.kt index b645ae8a..045dbbf1 100644 --- a/app/src/main/kotlin/me/rhunk/snapenhance/features/impl/downloader/MediaDownloader.kt +++ b/app/src/main/kotlin/me/rhunk/snapenhance/features/impl/downloader/MediaDownloader.kt @@ -21,7 +21,7 @@ import me.rhunk.snapenhance.data.wrapper.impl.media.opera.ParamMap import me.rhunk.snapenhance.features.Feature import me.rhunk.snapenhance.features.FeatureLoadParams import me.rhunk.snapenhance.features.impl.Messaging -import me.rhunk.snapenhance.features.impl.spy.MessageLogger +import me.rhunk.snapenhance.features.impl.spying.MessageLogger import me.rhunk.snapenhance.hook.HookAdapter import me.rhunk.snapenhance.hook.HookStage import me.rhunk.snapenhance.hook.Hooker @@ -62,7 +62,7 @@ class MediaDownloader : Feature("MediaDownloader", loadParams = FeatureLoadParam return isFFmpegPresent } - private fun createNewFilePath(hash: Int, author: String, fileType: FileType): String? { + private fun createNewFilePath(hash: Int, author: String, fileType: FileType): String { val hexHash = Integer.toHexString(hash) return author + "/" + hexHash + "." + fileType.fileExtension } diff --git a/app/src/main/kotlin/me/rhunk/snapenhance/features/impl/extras/AutoSave.kt b/app/src/main/kotlin/me/rhunk/snapenhance/features/impl/extras/AutoSave.kt index 86ef2591..971a2392 100644 --- a/app/src/main/kotlin/me/rhunk/snapenhance/features/impl/extras/AutoSave.kt +++ b/app/src/main/kotlin/me/rhunk/snapenhance/features/impl/extras/AutoSave.kt @@ -8,8 +8,8 @@ import me.rhunk.snapenhance.data.wrapper.impl.SnapUUID import me.rhunk.snapenhance.features.Feature import me.rhunk.snapenhance.features.FeatureLoadParams import me.rhunk.snapenhance.features.impl.Messaging -import me.rhunk.snapenhance.features.impl.spy.MessageLogger -import me.rhunk.snapenhance.features.impl.spy.StealthMode +import me.rhunk.snapenhance.features.impl.spying.MessageLogger +import me.rhunk.snapenhance.features.impl.spying.StealthMode import me.rhunk.snapenhance.hook.HookStage import me.rhunk.snapenhance.hook.Hooker import me.rhunk.snapenhance.util.CallbackBuilder diff --git a/app/src/main/kotlin/me/rhunk/snapenhance/features/impl/extras/Notifications.kt b/app/src/main/kotlin/me/rhunk/snapenhance/features/impl/extras/Notifications.kt index dd7995dd..d9bd9cc7 100644 --- a/app/src/main/kotlin/me/rhunk/snapenhance/features/impl/extras/Notifications.kt +++ b/app/src/main/kotlin/me/rhunk/snapenhance/features/impl/extras/Notifications.kt @@ -155,8 +155,7 @@ class Notifications : Feature("Notifications", loadParams = FeatureLoadParams.IN } private fun shouldIgnoreNotification(type: String): Boolean { - Logger.debug("notification type: $type") - val states = context.config.options(ConfigProperty.NOTIFICATION_FILTER) + val states = context.config.options(ConfigProperty.NOTIFICATION_BLACKLIST) states["snap"]?.let { if (type.endsWith("SNAP") && it) return true } states["chat"]?.let { if (type.endsWith("CHAT") && it) return true } diff --git a/app/src/main/kotlin/me/rhunk/snapenhance/features/impl/privacy/DisableMetrics.kt b/app/src/main/kotlin/me/rhunk/snapenhance/features/impl/privacy/DisableMetrics.kt index f47772bc..f80bb835 100644 --- a/app/src/main/kotlin/me/rhunk/snapenhance/features/impl/privacy/DisableMetrics.kt +++ b/app/src/main/kotlin/me/rhunk/snapenhance/features/impl/privacy/DisableMetrics.kt @@ -29,14 +29,14 @@ class DisableMetrics : Feature("DisableMetrics", loadParams = FeatureLoadParams. Hooker.hook(context.classCache.networkApi, "submit", HookStage.BEFORE, disableMetricsFilter) { param -> val httpRequest: Any = param.arg(0) val url = XposedHelpers.getObjectField(httpRequest, "mUrl").toString() - if (url.contains("resolve?co=")) { + /*if (url.contains("resolve?co=")) { val index = url.indexOf("co=") val end = url.lastIndexOf("&") val co = url.substring(index + 3, end) val decoded = Base64.getDecoder().decode(co.toByteArray(StandardCharsets.UTF_8)) debug("decoded : " + decoded.toString(Charsets.UTF_8)) debug("content: $co") - } + }*/ if (url.contains("app-analytics") || url.endsWith("v1/metrics")) { param.setResult(null) } diff --git a/app/src/main/kotlin/me/rhunk/snapenhance/features/impl/spy/AnonymousStoryViewing.kt b/app/src/main/kotlin/me/rhunk/snapenhance/features/impl/spying/AnonymousStoryViewing.kt similarity index 94% rename from app/src/main/kotlin/me/rhunk/snapenhance/features/impl/spy/AnonymousStoryViewing.kt rename to app/src/main/kotlin/me/rhunk/snapenhance/features/impl/spying/AnonymousStoryViewing.kt index 86028fe2..b50daeb5 100644 --- a/app/src/main/kotlin/me/rhunk/snapenhance/features/impl/spy/AnonymousStoryViewing.kt +++ b/app/src/main/kotlin/me/rhunk/snapenhance/features/impl/spying/AnonymousStoryViewing.kt @@ -1,4 +1,4 @@ -package me.rhunk.snapenhance.features.impl.spy +package me.rhunk.snapenhance.features.impl.spying import me.rhunk.snapenhance.config.ConfigProperty import me.rhunk.snapenhance.features.Feature diff --git a/app/src/main/kotlin/me/rhunk/snapenhance/features/impl/spy/MessageLogger.kt b/app/src/main/kotlin/me/rhunk/snapenhance/features/impl/spying/MessageLogger.kt similarity index 98% rename from app/src/main/kotlin/me/rhunk/snapenhance/features/impl/spy/MessageLogger.kt rename to app/src/main/kotlin/me/rhunk/snapenhance/features/impl/spying/MessageLogger.kt index 64a41d59..ed2f3602 100644 --- a/app/src/main/kotlin/me/rhunk/snapenhance/features/impl/spy/MessageLogger.kt +++ b/app/src/main/kotlin/me/rhunk/snapenhance/features/impl/spying/MessageLogger.kt @@ -1,4 +1,4 @@ -package me.rhunk.snapenhance.features.impl.spy +package me.rhunk.snapenhance.features.impl.spying import com.google.gson.JsonParser import me.rhunk.snapenhance.config.ConfigProperty diff --git a/app/src/main/kotlin/me/rhunk/snapenhance/features/impl/spy/PreventReadReceipts.kt b/app/src/main/kotlin/me/rhunk/snapenhance/features/impl/spying/PreventReadReceipts.kt similarity index 96% rename from app/src/main/kotlin/me/rhunk/snapenhance/features/impl/spy/PreventReadReceipts.kt rename to app/src/main/kotlin/me/rhunk/snapenhance/features/impl/spying/PreventReadReceipts.kt index 47285ebb..414d84c2 100644 --- a/app/src/main/kotlin/me/rhunk/snapenhance/features/impl/spy/PreventReadReceipts.kt +++ b/app/src/main/kotlin/me/rhunk/snapenhance/features/impl/spying/PreventReadReceipts.kt @@ -1,4 +1,4 @@ -package me.rhunk.snapenhance.features.impl.spy +package me.rhunk.snapenhance.features.impl.spying import me.rhunk.snapenhance.config.ConfigProperty import me.rhunk.snapenhance.data.wrapper.impl.SnapUUID diff --git a/app/src/main/kotlin/me/rhunk/snapenhance/features/impl/spy/StealthMode.kt b/app/src/main/kotlin/me/rhunk/snapenhance/features/impl/spying/StealthMode.kt similarity index 92% rename from app/src/main/kotlin/me/rhunk/snapenhance/features/impl/spy/StealthMode.kt rename to app/src/main/kotlin/me/rhunk/snapenhance/features/impl/spying/StealthMode.kt index 48428b85..14e02500 100644 --- a/app/src/main/kotlin/me/rhunk/snapenhance/features/impl/spy/StealthMode.kt +++ b/app/src/main/kotlin/me/rhunk/snapenhance/features/impl/spying/StealthMode.kt @@ -1,4 +1,4 @@ -package me.rhunk.snapenhance.features.impl.spy +package me.rhunk.snapenhance.features.impl.spying import me.rhunk.snapenhance.bridge.common.impl.file.BridgeFileType import me.rhunk.snapenhance.features.BridgeFileFeature diff --git a/app/src/main/kotlin/me/rhunk/snapenhance/features/impl/ui/menus/ViewAppearanceHelper.kt b/app/src/main/kotlin/me/rhunk/snapenhance/features/impl/ui/menus/ViewAppearanceHelper.kt index 919d9ab8..67f9cd3b 100644 --- a/app/src/main/kotlin/me/rhunk/snapenhance/features/impl/ui/menus/ViewAppearanceHelper.kt +++ b/app/src/main/kotlin/me/rhunk/snapenhance/features/impl/ui/menus/ViewAppearanceHelper.kt @@ -11,25 +11,24 @@ import android.widget.TextView import me.rhunk.snapenhance.Constants object ViewAppearanceHelper { - fun applyIndentation(view: TextView) { - view.setPadding(70, 0, 55, 0) - } - @SuppressLint("UseSwitchCompatOrMaterialCode", "RtlHardcoded", "DiscouragedApi") fun applyTheme(viewModel: View, view: TextView) { + val snapchatFontResId = view.context.resources.getIdentifier("avenir_next_medium", "font", "com.snapchat.android") //remove the shadow view.setBackgroundColor(0x00000000) view.setTextColor(viewModel.resources.getColor(viewModel.resources.getIdentifier("sig_color_text_primary_light", "color", Constants.SNAPCHAT_PACKAGE_NAME), null)) - view.setShadowLayer(0f, 0f, 0f, 0) + view.setShadowLayer(0F, 0F, 0F, 0) view.outlineProvider = null view.gravity = Gravity.LEFT or Gravity.CENTER_VERTICAL view.width = viewModel.width - //FIXME: hardcoded dimensions - view.height = 160 - view.setPadding(35, 0, 55, 0) + + //DPI Calculator + val scalingFactor = view.context.resources.displayMetrics.densityDpi.toDouble() / 400 + view.height = (150 * scalingFactor).toInt() + view.setPadding((40 * scalingFactor).toInt(), 0, (25 * scalingFactor).toInt(), 0) view.isAllCaps = false - view.textSize = 15f - view.typeface = Typeface.DEFAULT + view.textSize = 16f + view.typeface = view.context.resources.getFont(snapchatFontResId) //remove click effect if (view.javaClass == TextView::class.java) { diff --git a/app/src/main/kotlin/me/rhunk/snapenhance/features/impl/ui/menus/impl/ChatActionMenu.kt b/app/src/main/kotlin/me/rhunk/snapenhance/features/impl/ui/menus/impl/ChatActionMenu.kt index 539228fa..6d353725 100644 --- a/app/src/main/kotlin/me/rhunk/snapenhance/features/impl/ui/menus/impl/ChatActionMenu.kt +++ b/app/src/main/kotlin/me/rhunk/snapenhance/features/impl/ui/menus/impl/ChatActionMenu.kt @@ -2,9 +2,8 @@ package me.rhunk.snapenhance.features.impl.ui.menus.impl import android.annotation.SuppressLint import android.content.res.Resources -import android.graphics.BlendMode -import android.graphics.BlendModeColorFilter import android.graphics.Color +import android.graphics.drawable.ColorDrawable import android.os.SystemClock import android.util.TypedValue import android.view.MotionEvent @@ -27,7 +26,7 @@ class ChatActionMenu : AbstractMenu() { } private fun applyButtonTheme(parent: View, button: Button) { - button.background.colorFilter = BlendModeColorFilter(Color.WHITE, BlendMode.SRC_ATOP) + button.background = ColorDrawable(Color.WHITE) button.setTextColor(Color.BLACK) button.transformationMethod = null val margin = TypedValue.applyDimension( diff --git a/app/src/main/kotlin/me/rhunk/snapenhance/features/impl/ui/menus/impl/FriendFeedInfoMenu.kt b/app/src/main/kotlin/me/rhunk/snapenhance/features/impl/ui/menus/impl/FriendFeedInfoMenu.kt index d8d67543..741089fd 100644 --- a/app/src/main/kotlin/me/rhunk/snapenhance/features/impl/ui/menus/impl/FriendFeedInfoMenu.kt +++ b/app/src/main/kotlin/me/rhunk/snapenhance/features/impl/ui/menus/impl/FriendFeedInfoMenu.kt @@ -22,7 +22,7 @@ import me.rhunk.snapenhance.database.objects.UserConversationLink import me.rhunk.snapenhance.features.impl.Messaging import me.rhunk.snapenhance.features.impl.downloader.AntiAutoDownload import me.rhunk.snapenhance.features.impl.extras.AntiAutoSave -import me.rhunk.snapenhance.features.impl.spy.StealthMode +import me.rhunk.snapenhance.features.impl.spying.StealthMode import me.rhunk.snapenhance.features.impl.ui.menus.AbstractMenu import me.rhunk.snapenhance.features.impl.ui.menus.ViewAppearanceHelper.applyTheme import java.net.HttpURLConnection diff --git a/app/src/main/kotlin/me/rhunk/snapenhance/features/impl/ui/menus/impl/SettingsMenu.kt b/app/src/main/kotlin/me/rhunk/snapenhance/features/impl/ui/menus/impl/SettingsMenu.kt index 02fe23ca..de0d4667 100644 --- a/app/src/main/kotlin/me/rhunk/snapenhance/features/impl/ui/menus/impl/SettingsMenu.kt +++ b/app/src/main/kotlin/me/rhunk/snapenhance/features/impl/ui/menus/impl/SettingsMenu.kt @@ -2,6 +2,7 @@ package me.rhunk.snapenhance.features.impl.ui.menus.impl import android.annotation.SuppressLint import android.app.AlertDialog +import android.graphics.Typeface import android.text.InputType import android.view.View import android.widget.Button @@ -24,7 +25,8 @@ class SettingsMenu : AbstractMenu() { val categoryText = TextView(viewModel.context) categoryText.text = context.translation.get(key) ViewAppearanceHelper.applyTheme(viewModel, categoryText) - categoryText.textSize = 18f + categoryText.textSize = 20f + categoryText.typeface = categoryText.typeface?.let { Typeface.create(it, Typeface.BOLD) } return categoryText } @@ -33,6 +35,9 @@ class SettingsMenu : AbstractMenu() { val updateButtonText: (TextView, String) -> Unit = { textView, text -> textView.text = "${context.translation.get(property.nameKey)} $text" } + val updateStateSelectionText: (TextView, String) -> Unit = { textView, text -> + updateButtonText(textView, text.let { if (it.isEmpty()) "(empty)" else ": $it" }) + } val textEditor: ((String) -> Unit) -> Unit = { updateValue -> val builder = AlertDialog.Builder(viewModel.context) @@ -116,7 +121,7 @@ class SettingsMenu : AbstractMenu() { } is ConfigStateListValue -> { val button = Button(viewModel.context) - updateButtonText(button, property.valueContainer.toString()) + updateStateSelectionText(button, property.valueContainer.toString()) button.setOnClickListener {_ -> val builder = AlertDialog.Builder(viewModel.context) @@ -134,7 +139,7 @@ class SettingsMenu : AbstractMenu() { } builder.setPositiveButton("OK") { _, _ -> - updateButtonText(button, property.valueContainer.toString()) + updateStateSelectionText(button, property.valueContainer.toString()) } builder.show() @@ -177,7 +182,8 @@ class SettingsMenu : AbstractMenu() { } } - //actions + addView(createCategoryTitle(viewModel, "category.debugging")) + context.actionManager.getActions().forEach { val button = Button(viewModel.context) button.text = context.translation.get(it.nameKey) diff --git a/app/src/main/kotlin/me/rhunk/snapenhance/manager/impl/FeatureManager.kt b/app/src/main/kotlin/me/rhunk/snapenhance/manager/impl/FeatureManager.kt index 1981f615..d1a44ce2 100644 --- a/app/src/main/kotlin/me/rhunk/snapenhance/manager/impl/FeatureManager.kt +++ b/app/src/main/kotlin/me/rhunk/snapenhance/manager/impl/FeatureManager.kt @@ -20,10 +20,10 @@ import me.rhunk.snapenhance.features.impl.extras.SnapchatPlus import me.rhunk.snapenhance.features.impl.extras.UnlimitedSnapViewTime import me.rhunk.snapenhance.features.impl.privacy.DisableMetrics import me.rhunk.snapenhance.features.impl.privacy.PreventMessageSending -import me.rhunk.snapenhance.features.impl.spy.AnonymousStoryViewing -import me.rhunk.snapenhance.features.impl.spy.MessageLogger -import me.rhunk.snapenhance.features.impl.spy.PreventReadReceipts -import me.rhunk.snapenhance.features.impl.spy.StealthMode +import me.rhunk.snapenhance.features.impl.spying.AnonymousStoryViewing +import me.rhunk.snapenhance.features.impl.spying.MessageLogger +import me.rhunk.snapenhance.features.impl.spying.PreventReadReceipts +import me.rhunk.snapenhance.features.impl.spying.StealthMode import me.rhunk.snapenhance.features.impl.ui.UITweaks import me.rhunk.snapenhance.features.impl.ui.menus.MenuViewInjector import me.rhunk.snapenhance.manager.Manager @@ -37,7 +37,6 @@ class FeatureManager(private val context: ModContext) : Manager { private fun register(featureClass: KClass) { runCatching { with(featureClass.java.newInstance()) { - if (loadParams and FeatureLoadParams.NO_INIT != 0) return@with context = this@FeatureManager.context features.add(this) }