commit 4265f7f2db0e16784f0dd18d2016183dfe46a3b1
parent f1903a6dad5501cff6509abc718ffa1444b0a2a5
Author: rhunk <101876869+rhunk@users.noreply.github.com>
Date: Wed, 7 Jun 2023 19:02:03 +0200
feat(hide_ui): remove camera borders
Diffstat:
3 files changed, 21 insertions(+), 5 deletions(-)
diff --git a/app/src/main/assets/lang/en_US.json b/app/src/main/assets/lang/en_US.json
@@ -114,7 +114,8 @@
"remove_call_buttons": "Remove Call Buttons",
"remove_cognac_button": "Remove Cognac Button",
"remove_stickers_button": "Remove Stickers Button",
- "remove_voice_record_button": "Remove Voice Record Button"
+ "remove_voice_record_button": "Remove Voice Record Button",
+ "remove_camera_borders": "Remove Camera Borders"
},
"auto_updater": {
"DISABLED": "Disabled",
diff --git a/app/src/main/kotlin/me/rhunk/snapenhance/config/ConfigProperty.kt b/app/src/main/kotlin/me/rhunk/snapenhance/config/ConfigProperty.kt
@@ -15,7 +15,7 @@ enum class ConfigProperty(
val valueContainer: ConfigValue<*>,
val shouldAppearInSettings: Boolean = true
) {
-
+
//SPYING AND PRIVACY
MESSAGE_LOGGER("property.message_logger",
"description.message_logger",
@@ -189,12 +189,13 @@ enum class ConfigProperty(
"description.hide_ui_elements",
ConfigCategory.UI_TWEAKS,
ConfigStateListValue(
- listOf("remove_voice_record_button", "remove_stickers_button", "remove_cognac_button", "remove_call_buttons"),
+ listOf("remove_voice_record_button", "remove_stickers_button", "remove_cognac_button", "remove_call_buttons", "remove_camera_borders"),
mutableMapOf(
"remove_voice_record_button" to false,
"remove_stickers_button" to false,
"remove_cognac_button" to false,
"remove_call_buttons" to false,
+ "remove_camera_borders" to false
)
)
),
@@ -268,7 +269,7 @@ enum class ConfigProperty(
"DAILY"
)
),
-
+
// EXPERIMENTAL DEBUGGING
USE_DOWNLOAD_MANAGER(
"property.use_download_manager",
diff --git a/app/src/main/kotlin/me/rhunk/snapenhance/features/impl/ui/UITweaks.kt b/app/src/main/kotlin/me/rhunk/snapenhance/features/impl/ui/UITweaks.kt
@@ -1,6 +1,7 @@
package me.rhunk.snapenhance.features.impl.ui
import android.annotation.SuppressLint
+import android.content.res.Resources
import android.view.View
import android.view.ViewGroup
import me.rhunk.snapenhance.Constants
@@ -9,12 +10,16 @@ import me.rhunk.snapenhance.features.Feature
import me.rhunk.snapenhance.features.FeatureLoadParams
import me.rhunk.snapenhance.hook.HookStage
import me.rhunk.snapenhance.hook.Hooker
+import me.rhunk.snapenhance.hook.hook
class UITweaks : Feature("UITweaks", loadParams = FeatureLoadParams.ACTIVITY_CREATE_SYNC) {
@SuppressLint("DiscouragedApi")
override fun onActivityCreate() {
val resources = context.resources
+ val capriViewfinderDefaultCornerRadius = context.resources.getIdentifier("capri_viewfinder_default_corner_radius", "dimen", Constants.SNAPCHAT_PACKAGE_NAME)
+ val ngsHovaNavLargerCameraButtonSize = context.resources.getIdentifier("ngs_hova_nav_larger_camera_button_size", "dimen", Constants.SNAPCHAT_PACKAGE_NAME)
+
val callButtonsStub = resources.getIdentifier("call_buttons_stub", "id", Constants.SNAPCHAT_PACKAGE_NAME)
val callButton1 = resources.getIdentifier("friend_action_button3", "id", Constants.SNAPCHAT_PACKAGE_NAME)
val callButton2 = resources.getIdentifier("friend_action_button4", "id", Constants.SNAPCHAT_PACKAGE_NAME)
@@ -23,7 +28,16 @@ class UITweaks : Feature("UITweaks", loadParams = FeatureLoadParams.ACTIVITY_CRE
val chatInputBarSticker = resources.getIdentifier("chat_input_bar_sticker", "id", Constants.SNAPCHAT_PACKAGE_NAME)
val chatInputBarCognac = resources.getIdentifier("chat_input_bar_cognac", "id", Constants.SNAPCHAT_PACKAGE_NAME)
val hiddenElements = context.config.options(ConfigProperty.HIDE_UI_ELEMENTS)
-
+
+ Resources::class.java.methods.first { it.name == "getDimensionPixelSize"}.hook(HookStage.AFTER, {
+ hiddenElements["remove_camera_borders"] == true
+ }) { param ->
+ val id = param.arg<Int>(0)
+ if (id == capriViewfinderDefaultCornerRadius || id == ngsHovaNavLargerCameraButtonSize) {
+ param.setResult(0)
+ }
+ }
+
Hooker.hook(View::class.java, "setVisibility", HookStage.BEFORE) { methodParam ->
val viewId = (methodParam.thisObject() as View).id
if (viewId == chatNoteRecordButton && hiddenElements["remove_voice_record_button"] == true) {