Skip to content

Commit 611aa66

Browse files
committed
adapt for play store
1 parent f91d396 commit 611aa66

5 files changed

Lines changed: 34 additions & 4 deletions

File tree

app/src/main/java/com/zfdang/touchhelper/TouchHelperServiceImpl.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ public class TouchHelperServiceImpl {
7979
private static final int PACKAGE_POSITION_CLICK_RETRY_INTERVAL = 500;
8080
private static final int PACKAGE_POSITION_CLICK_RETRY = 6;
8181
private boolean isShow = false;
82+
private long lastContentChangedTime = 0;
8283

8384
public TouchHelperServiceImpl(AccessibilityService service) {
8485
this.service = service;
@@ -361,6 +362,12 @@ public void run() {
361362
break;
362363
}
363364

365+
long currentTime = System.currentTimeMillis();
366+
if (currentTime - lastContentChangedTime < 150) {
367+
break;
368+
}
369+
lastContentChangedTime = currentTime;
370+
364371
if (setTargetedWidgets != null) {
365372
if (BuildConfig.DEBUG) {
366373
Log.d(TAG, "method by widget in CONTENT_CHANGED");

app/src/main/java/com/zfdang/touchhelper/ui/home/HomeFragment.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,16 @@ public void onChanged(Boolean aBoolean) {
8282
btAccessibilityPermission.setOnClickListener(new View.OnClickListener() {
8383
@Override
8484
public void onClick(View v) {
85-
Intent intent_abs = new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS);
86-
intent_abs.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
87-
startActivity(intent_abs);
85+
new androidx.appcompat.app.AlertDialog.Builder(getContext())
86+
.setTitle("重要说明 (Prominent Disclosure)")
87+
.setMessage("本应用需要使用无障碍服务(AccessibilityService API)来帮您在其他应用中自动查找并点击屏幕上的指定控件(例如各类重复性的按钮)。\n\n本应用属于自动化工具,所有的点击操作均基于您的配置和触发策略。\n本应用完全离线运行,不会收集、存储、传输或分享您的任何个人数据及敏感信息。\n\n请点击“同意”以继续前往系统设置中授权此服务。")
88+
.setPositiveButton("同意", (dialog, which) -> {
89+
Intent intent_abs = new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS);
90+
intent_abs.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
91+
startActivity(intent_abs);
92+
})
93+
.setNegativeButton("拒绝", null)
94+
.show();
8895
}
8996
});
9097

app/src/main/res/layout/fragment_about.xml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,21 @@
6565
app:layout_constraintStart_toStartOf="parent"
6666
app:layout_constraintTop_toBottomOf="@+id/textView_app_introduction" />
6767

68+
<TextView
69+
android:id="@+id/textView_privacy"
70+
android:layout_width="match_parent"
71+
android:layout_height="wrap_content"
72+
android:layout_marginTop="16dp"
73+
android:autoLink="web"
74+
android:linksClickable="true"
75+
android:paddingLeft="12dp"
76+
android:paddingRight="12dp"
77+
android:text="@string/about_privacy"
78+
android:textSize="14sp"
79+
app:layout_constraintEnd_toEndOf="parent"
80+
app:layout_constraintStart_toStartOf="parent"
81+
app:layout_constraintTop_toBottomOf="@+id/textView_weblink" />
82+
6883
<TextView
6984
android:id="@+id/textView_copyright"
7085
android:layout_width="wrap_content"

app/src/main/res/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
</string>
2727

2828
<string name="about_weblink">https://touchhelper.zfdang.com/</string>
29+
<string name="about_privacy">隐私政策 (Privacy Policy):\nhttps://github.com/zfdang/Android-Touch-Helper/blob/master/PrivacyPolicy.md</string>
2930
<string name="about_copyright">Copyright © 2022 Zhengfa Dang</string>
3031

3132
<string name="app_version">版本: %s (%d)</string>

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ android.enableJetifier=true
2222
# Set these in local.properties or as environment variables
2323
KEYSTORE_PASSWORD=touchhelper
2424
KEY_ALIAS=touchhelper
25-
KEY_PASSWORD=touchhelper
25+
KEY_PASSWORD=touchhelperandroid.suppressUnsupportedCompileSdk=35

0 commit comments

Comments
 (0)