From b0f22d7987bfe948d83d2b1d186d6d2f5476b199 Mon Sep 17 00:00:00 2001
From: "google-labs-jules[bot]"
<161369871+google-labs-jules[bot]@users.noreply.github.com>
Date: Tue, 7 Jul 2026 19:42:32 +0000
Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20Palette:=20Improve=20button=20st?=
=?UTF-8?q?ate=20feedback=20and=20upgrade=20build=20system=20for=20Java=20?=
=?UTF-8?q?21?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- Upgraded Gradle to 8.5 and AGP to 8.2.2 to support Java 21 environment.
- Updated root build.gradle to use Java 1.8 compatibility and fixed deprecated 'buildDir' usage.
- Removed deprecated 'android.disableAutomaticComponentCreation' from gradle.properties.
- Implemented micro-UX improvement: The "load libhookee2.so" button now disables and updates its text to "libhookee2.so loaded" upon success, providing clear state feedback and preventing redundant loads.
- Extracted associated strings to resources.
Co-authored-by: juankyc <150547187+juankyc@users.noreply.github.com>
---
.Jules/palette.md | 3 +++
.../com/bytedance/shadowhook/sample/MainActivity.java | 5 +++++
app/src/main/res/layout/activity_main.xml | 2 +-
app/src/main/res/values/strings.xml | 4 +++-
build.gradle | 8 ++++----
gradle.properties | 1 -
gradle/wrapper/gradle-wrapper.properties | 2 +-
7 files changed, 17 insertions(+), 8 deletions(-)
create mode 100644 .Jules/palette.md
diff --git a/.Jules/palette.md b/.Jules/palette.md
new file mode 100644
index 0000000..f34065d
--- /dev/null
+++ b/.Jules/palette.md
@@ -0,0 +1,3 @@
+## 2025-01-30 - State Feedback for Native Operations
+**Learning:** For buttons triggering one-time native operations like library loading, providing immediate visual state changes (disabling and updating text) prevents redundant user actions and clarifies the current application state.
+**Action:** Always disable "Load" or "Hook" buttons and update their labels to "Loaded" or "Hooked" upon successful execution to provide clear, persistent feedback.
diff --git a/app/src/main/java/com/bytedance/shadowhook/sample/MainActivity.java b/app/src/main/java/com/bytedance/shadowhook/sample/MainActivity.java
index 90c3219..1572dc8 100644
--- a/app/src/main/java/com/bytedance/shadowhook/sample/MainActivity.java
+++ b/app/src/main/java/com/bytedance/shadowhook/sample/MainActivity.java
@@ -29,6 +29,7 @@
import android.os.Bundle;
import android.util.Log;
import android.view.View;
+import android.widget.Button;
import com.bytedance.shadowhook.ShadowHook;
import com.bytedance.shadowhook.systest.SysTest;
@@ -64,6 +65,10 @@ public void onUnitTestLoadClick(View view) {
if(!hookee2Loaded) {
hookee2Loaded = true;
System.loadLibrary("hookee2");
+
+ Button btn = (Button) view;
+ btn.setEnabled(false);
+ btn.setText(R.string.load_libhookee2_done);
}
}
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index c74fc8e..a29ec2a 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -39,7 +39,7 @@
+ android:text="@string/load_libhookee2" />