diff --git a/.Jules/palette.md b/.Jules/palette.md new file mode 100644 index 0000000..3cb2384 --- /dev/null +++ b/.Jules/palette.md @@ -0,0 +1,3 @@ +## 2024-05-13 - [Accessibility vs Metadata] +**Learning:** Adding `android:contentDescription` to a `TextView` that already contains meaningful, user-actionable text (like a shell command) can be counter-productive. It causes screen readers to read the description *instead* of the content, effectively hiding the actual data from the user. +**Action:** Only use `contentDescription` for non-textual elements (images, icons) or when the textual content is ambiguous. For actionable text, ensure the text itself is descriptive or use `android:hint` if appropriate. 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..c204f1d 100644 --- a/app/src/main/java/com/bytedance/shadowhook/sample/MainActivity.java +++ b/app/src/main/java/com/bytedance/shadowhook/sample/MainActivity.java @@ -25,10 +25,15 @@ import androidx.appcompat.app.AppCompatActivity; +import android.content.ClipData; +import android.content.ClipboardManager; +import android.content.Context; import android.os.Build; import android.os.Bundle; import android.util.Log; import android.view.View; +import android.widget.TextView; +import android.widget.Toast; import com.bytedance.shadowhook.ShadowHook; import com.bytedance.shadowhook.systest.SysTest; @@ -46,6 +51,21 @@ public class MainActivity extends AppCompatActivity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); + + TextView logcatCommand = findViewById(R.id.logcat_command); + logcatCommand.setOnLongClickListener(new View.OnLongClickListener() { + @Override + public boolean onLongClick(View v) { + ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE); + ClipData clip = ClipData.newPlainText("logcat_command", ((TextView) v).getText()); + if (clipboard != null) { + clipboard.setPrimaryClip(clip); + Toast.makeText(MainActivity.this, "Command copied to clipboard", Toast.LENGTH_SHORT).show(); + return true; + } + return false; + } + }); } public void onUnitTestHookSymAddrClick(View view) { diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index c74fc8e..c4bedd0 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -16,6 +16,7 @@ android:orientation="vertical">