feat(hide_ui): remove camera borders
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user