-
Notifications
You must be signed in to change notification settings - Fork 502
adapt for play store #105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
adapt for play store #105
Changes from all commits
611aa66
56ee969
97cdfea
b2e3a79
8c2a42d
a716625
4d0beff
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -79,6 +79,7 @@ public class TouchHelperServiceImpl { | |||||||||||||||||||||
| private static final int PACKAGE_POSITION_CLICK_RETRY_INTERVAL = 500; | ||||||||||||||||||||||
| private static final int PACKAGE_POSITION_CLICK_RETRY = 6; | ||||||||||||||||||||||
| private boolean isShow = false; | ||||||||||||||||||||||
| private long lastContentChangedTime = 0; | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| public TouchHelperServiceImpl(AccessibilityService service) { | ||||||||||||||||||||||
| this.service = service; | ||||||||||||||||||||||
|
|
@@ -361,6 +362,12 @@ public void run() { | |||||||||||||||||||||
| break; | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| long currentTime = System.currentTimeMillis(); | ||||||||||||||||||||||
| if (currentTime - lastContentChangedTime < 150) { | ||||||||||||||||||||||
| break; | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
| lastContentChangedTime = currentTime; | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
Comment on lines
+365
to
+370
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Verify timer APIs used for debounce/interval checks in the repo.
# Expectation: elapsedRealtime()/uptimeMillis() for elapsed checks, avoid currentTimeMillis() for throttling.
rg -n -C2 'currentTimeMillis\(|elapsedRealtime\(|uptimeMillis\('Repository: zfdang/Android-Touch-Helper Length of output: 626 🏁 Script executed: # Read the full context around line 365 and nearby code
sed -n '350,380p' app/src/main/java/com/zfdang/touchhelper/TouchHelperServiceImpl.javaRepository: zfdang/Android-Touch-Helper Length of output: 1549 🏁 Script executed: # Find where lastContentChangedTime is declared and initialized
rg -n 'lastContentChangedTime' app/src/main/java/com/zfdang/touchhelper/TouchHelperServiceImpl.javaRepository: zfdang/Android-Touch-Helper Length of output: 254 🏁 Script executed: # Check current imports in the file
head -30 app/src/main/java/com/zfdang/touchhelper/TouchHelperServiceImpl.javaRepository: zfdang/Android-Touch-Helper Length of output: 1155 Use a monotonic clock for debounce timing. Line 365 uses Proposed fix import android.os.Handler;
import android.os.Looper;
+import android.os.SystemClock;
@@
- long currentTime = System.currentTimeMillis();
+ long currentTime = SystemClock.elapsedRealtime();
if (currentTime - lastContentChangedTime < 150) {
break;
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||
| if (setTargetedWidgets != null) { | ||||||||||||||||||||||
| if (BuildConfig.DEBUG) { | ||||||||||||||||||||||
| Log.d(TAG, "method by widget in CONTENT_CHANGED"); | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,7 +31,7 @@ | |
| import androidx.lifecycle.MediatorLiveData; | ||
| import androidx.lifecycle.MutableLiveData; | ||
| import androidx.lifecycle.Observer; | ||
| import androidx.lifecycle.ViewModelProviders; | ||
| import androidx.lifecycle.ViewModelProvider; | ||
|
|
||
| import com.zfdang.touchhelper.R; | ||
| import com.zfdang.touchhelper.TouchHelperService; | ||
|
|
@@ -45,7 +45,7 @@ public class HomeFragment extends Fragment { | |
| public View onCreateView(@NonNull LayoutInflater inflater, | ||
| ViewGroup container, Bundle savedInstanceState) { | ||
| homeViewModel = | ||
| ViewModelProviders.of(this).get(HomeViewModel.class); | ||
| new ViewModelProvider(this).get(HomeViewModel.class); | ||
| View root = inflater.inflate(R.layout.fragment_home, container, false); | ||
|
|
||
| final Drawable drawableYes = ContextCompat.getDrawable(getContext(), R.drawable.ic_right); | ||
|
|
@@ -82,9 +82,16 @@ public void onChanged(Boolean aBoolean) { | |
| btAccessibilityPermission.setOnClickListener(new View.OnClickListener() { | ||
| @Override | ||
| public void onClick(View v) { | ||
| Intent intent_abs = new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS); | ||
| intent_abs.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | ||
| startActivity(intent_abs); | ||
| new androidx.appcompat.app.AlertDialog.Builder(getContext()) | ||
| .setTitle("重要说明 (Prominent Disclosure)") | ||
| .setMessage("本应用需要使用无障碍服务(AccessibilityService API)来帮您在其他应用中自动查找并点击屏幕上的指定控件(例如各类重复性的按钮)。\n\n本应用属于自动化工具,所有的点击操作均基于您的配置和触发策略。\n本应用完全离线运行,不会收集、存储、传输或分享您的任何个人数据及敏感信息。\n\n请点击“同意”以继续前往系统设置中授权此服务。") | ||
| .setPositiveButton("同意", (dialog, which) -> { | ||
| Intent intent_abs = new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS); | ||
| intent_abs.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | ||
| startActivity(intent_abs); | ||
| }) | ||
| .setNegativeButton("拒绝", null) | ||
| .show(); | ||
|
Comment on lines
+85
to
+94
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| } | ||
| }); | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -65,6 +65,21 @@ | |||||||||
| app:layout_constraintStart_toStartOf="parent" | ||||||||||
| app:layout_constraintTop_toBottomOf="@+id/textView_app_introduction" /> | ||||||||||
|
|
||||||||||
| <TextView | ||||||||||
| android:id="@+id/textView_privacy" | ||||||||||
| android:layout_width="match_parent" | ||||||||||
| android:layout_height="wrap_content" | ||||||||||
| android:layout_marginTop="16dp" | ||||||||||
| android:autoLink="web" | ||||||||||
| android:linksClickable="true" | ||||||||||
| android:paddingLeft="12dp" | ||||||||||
| android:paddingRight="12dp" | ||||||||||
|
Comment on lines
+75
to
+76
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Verify all directional-padding opportunities in XML layouts.
rg -n --type=xml -C2 'paddingLeft|paddingRight'Repository: zfdang/Android-Touch-Helper Length of output: 2830 🏁 Script executed: # Check the project's minSdkVersion
find . -name "AndroidManifest.xml" -o -name "build.gradle" -o -name "build.gradle.kts" | head -5Repository: zfdang/Android-Touch-Helper Length of output: 139 🏁 Script executed: # Also check for minSdkVersion in gradle files
rg -n "minSdkVersion" --type=gradleRepository: zfdang/Android-Touch-Helper Length of output: 115 Use directional padding attributes for RTL-safe layouts. Lines 75-76 should use ♻️ Proposed update- android:paddingLeft="12dp"
- android:paddingRight="12dp"
+ android:paddingStart="12dp"
+ android:paddingEnd="12dp"📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||
| android:text="@string/about_privacy" | ||||||||||
| android:textSize="14sp" | ||||||||||
| app:layout_constraintEnd_toEndOf="parent" | ||||||||||
| app:layout_constraintStart_toStartOf="parent" | ||||||||||
| app:layout_constraintTop_toBottomOf="@+id/textView_weblink" /> | ||||||||||
|
Comment on lines
+68
to
+81
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# 1) Confirm this layout is not already wrapped by a scroll container via include/inflate usage context.
rg -n -C3 'fragment_about|R\.layout\.fragment_about|inflate\([^)]*fragment_about'
# 2) List long text blocks in this layout that increase vertical pressure.
rg -n --type=xml -C1 'textView_app_introduction|textView_weblink|textView_privacy|layout_constraintBottom_toBottomOf'Repository: zfdang/Android-Touch-Helper Length of output: 5080 🏁 Script executed: cat -n app/src/main/res/layout/fragment_about.xmlRepository: zfdang/Android-Touch-Helper Length of output: 4438 🏁 Script executed: rg -n -B5 -A5 'FragmentContainerView|fragment_container|R\.id\..*container' app/src/main/res/layout/activity_main.xmlRepository: zfdang/Android-Touch-Helper Length of output: 53 🏁 Script executed: cat -n app/src/main/res/layout/activity_main.xmlRepository: zfdang/Android-Touch-Helper Length of output: 1788 Wrap content in ScrollView or NestedScrollView to prevent overflow. The fragment's root 🤖 Prompt for AI Agents |
||||||||||
|
|
||||||||||
| <TextView | ||||||||||
| android:id="@+id/textView_copyright" | ||||||||||
| android:layout_width="wrap_content" | ||||||||||
|
|
||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The value
150is a magic number. It's better to define it as a named constant to improve readability and maintainability, for example:private static final int CONTENT_CHANGED_THROTTLE_INTERVAL_MS = 150;at the class level.