diff --git a/app/AutoClicker.jks b/app/AutoClicker.jks new file mode 100644 index 0000000..7b19266 Binary files /dev/null and b/app/AutoClicker.jks differ diff --git a/app/build.gradle.kts b/app/build.gradle.kts index bc74911..faf2ee4 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -1,7 +1,10 @@ +import java.text.SimpleDateFormat +import java.util.Date + plugins { alias(libs.plugins.android.application) } - +val timestamp: String = SimpleDateFormat("MM_dd_HH_mm").format(Date()) android { namespace = "com.auto.clicker.autoclicker" compileSdk = 35 @@ -12,7 +15,10 @@ android { targetSdk = 35 versionCode = 1 versionName = "1.0.0" - + setProperty( + "archivesBaseName", + "Auto Clicker_V" + versionName + "(${versionCode})_$timestamp" + ) testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" } diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index 481bb43..64a1c8f 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -18,4 +18,19 @@ # If you keep the line number information, uncomment this to # hide the original source file name. -#-renamesourcefileattribute SourceFile \ No newline at end of file +#-renamesourcefileattribute SourceFile + +-keepclassmembers class com.auto.clicker.autoclicker.MyApplication { + public static final java.lang.String DB_NAME; + public static final int DB_VERSION; +} + +-keepclassmembers class * { + @androidx.room.Query ; +} + +-keep class com.auto.clicker.autoclicker.room.AppDatabase { *; } +-keep class com.auto.clicker.autoclicker.room.entity.TouchPoint { *; } +-keep class com.auto.clicker.autoclicker.room.entity.EventEntity { *; } +-keep class com.auto.clicker.autoclicker.room.entity.Solution { *; } +-keep class com.auto.clicker.autoclicker.room.SolutionWithEventsAndPoints { *; } \ No newline at end of file diff --git a/app/src/main/java/com/auto/clicker/autoclicker/service/AutoClickService.java b/app/src/main/java/com/auto/clicker/autoclicker/service/AutoClickService.java index 35dfcaf..faff802 100644 --- a/app/src/main/java/com/auto/clicker/autoclicker/service/AutoClickService.java +++ b/app/src/main/java/com/auto/clicker/autoclicker/service/AutoClickService.java @@ -184,6 +184,10 @@ public class AutoClickService extends AccessibilityService { startTimeMillis = 0; logDebug("停止执行事件"); + + Intent stopIntent = new Intent("com.auto.clicker.autoclicker.FLASH_TOUCH_POINT"); + stopIntent.putExtra("isStopEvent", true); + LocalBroadcastManager.getInstance(this).sendBroadcast(stopIntent); } } diff --git a/app/src/main/java/com/auto/clicker/autoclicker/ui/activity/main/MainActivity.java b/app/src/main/java/com/auto/clicker/autoclicker/ui/activity/main/MainActivity.java index ac72f1a..5c088be 100644 --- a/app/src/main/java/com/auto/clicker/autoclicker/ui/activity/main/MainActivity.java +++ b/app/src/main/java/com/auto/clicker/autoclicker/ui/activity/main/MainActivity.java @@ -15,7 +15,6 @@ import android.provider.Settings; import android.util.Log; import android.view.accessibility.AccessibilityManager; import android.widget.Toast; -import android.widget.VideoView; import androidx.activity.EdgeToEdge; import androidx.activity.result.ActivityResultLauncher; @@ -185,7 +184,7 @@ public class MainActivity extends AppCompatActivity { if (!accessibilityGranted) { logDebug("无障碍服务未启用,请求权限"); - showPermissionRequest(Settings.ACTION_ACCESSIBILITY_SETTINGS, "Please enable accessibility services to ensure the application works properly", "Accessibility Settings cannot be enabled"); + showPermissionRequest(); setStartButtonEnabled(false); return false; } @@ -243,7 +242,7 @@ public class MainActivity extends AppCompatActivity { if (!accessibilityGranted) { logDebug("无障碍服务未启用,请求权限"); - showPermissionRequest(Settings.ACTION_ACCESSIBILITY_SETTINGS, "Please enable accessibility services to ensure the application works properly", "Accessibility Settings cannot be enabled"); + showPermissionRequest(); setStartButtonEnabled(false); return; @@ -273,15 +272,15 @@ public class MainActivity extends AppCompatActivity { } - private void showPermissionRequest(String action, String toastMessage, String errorMessage) { + private void showPermissionRequest() { try { - Intent intent = new Intent(action); + Intent intent = new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS); permissionLauncher.launch(intent); - Toast.makeText(this, toastMessage, Toast.LENGTH_LONG).show(); - logDebug("尝试启动权限设置页面: " + action); + Toast.makeText(this, "Please enable accessibility services to ensure the application works properly", Toast.LENGTH_LONG).show(); + logDebug("尝试启动权限设置页面: " + Settings.ACTION_ACCESSIBILITY_SETTINGS); } catch (Exception e) { - Toast.makeText(this, errorMessage, Toast.LENGTH_LONG).show(); - logDebug("打开设置页面失败: " + errorMessage + ", 异常: " + e.getMessage()); + Toast.makeText(this, "Accessibility Settings cannot be enabled", Toast.LENGTH_LONG).show(); + logDebug("打开设置页面失败: " + "Accessibility Settings cannot be enabled" + ", 异常: " + e.getMessage()); } } diff --git a/app/src/main/java/com/auto/clicker/autoclicker/ui/activity/menu/BatteryLimitFreeActivity.java b/app/src/main/java/com/auto/clicker/autoclicker/ui/activity/menu/BatteryLimitFreeActivity.java index 7b49b6a..2e5fdee 100644 --- a/app/src/main/java/com/auto/clicker/autoclicker/ui/activity/menu/BatteryLimitFreeActivity.java +++ b/app/src/main/java/com/auto/clicker/autoclicker/ui/activity/menu/BatteryLimitFreeActivity.java @@ -1,6 +1,11 @@ package com.auto.clicker.autoclicker.ui.activity.menu; +import android.content.Intent; +import android.net.Uri; import android.os.Bundle; +import android.provider.Settings; +import android.view.View; +import android.widget.Button; import androidx.activity.EdgeToEdge; import androidx.appcompat.app.AppCompatActivity; @@ -27,5 +32,16 @@ public class BatteryLimitFreeActivity extends AppCompatActivity { }); binding.back.setOnClickListener(v -> finish()); + + Button grantButton = binding.grant; + + grantButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent = new Intent(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS); + intent.setData(Uri.parse("package:" + getApplicationContext().getPackageName())); + startActivity(intent); + } + }); } } \ No newline at end of file diff --git a/app/src/main/java/com/auto/clicker/autoclicker/ui/activity/menu/MenuActivity.java b/app/src/main/java/com/auto/clicker/autoclicker/ui/activity/menu/MenuActivity.java index b92294f..aa0878b 100644 --- a/app/src/main/java/com/auto/clicker/autoclicker/ui/activity/menu/MenuActivity.java +++ b/app/src/main/java/com/auto/clicker/autoclicker/ui/activity/menu/MenuActivity.java @@ -69,6 +69,20 @@ public class MenuActivity extends AppCompatActivity { Intent intent = new Intent(this, HowToUseActivity.class); startActivity(intent); }); + + binding.share.arrow.setOnClickListener(v -> { + String packageName = getPackageName(); + String appShareLink = "https://play.google.com/store/apps/details?id=" + packageName; + + Intent shareIntent = new Intent(Intent.ACTION_SEND); + shareIntent.setType("text/plain"); + + shareIntent.putExtra(Intent.EXTRA_SUBJECT, "Check out this awesome app!"); + + shareIntent.putExtra(Intent.EXTRA_TEXT, "Hey, you should check out this app! " + appShareLink); + + startActivity(Intent.createChooser(shareIntent, "Share app via...")); + }); } private void setupItem(int viewId, int iconRes, String title, String subtitle) { diff --git a/app/src/main/java/com/auto/clicker/autoclicker/ui/activity/menu/TroubleshootingActivity.java b/app/src/main/java/com/auto/clicker/autoclicker/ui/activity/menu/TroubleshootingActivity.java index e7f5262..62fa2b6 100644 --- a/app/src/main/java/com/auto/clicker/autoclicker/ui/activity/menu/TroubleshootingActivity.java +++ b/app/src/main/java/com/auto/clicker/autoclicker/ui/activity/menu/TroubleshootingActivity.java @@ -1,6 +1,10 @@ package com.auto.clicker.autoclicker.ui.activity.menu; +import android.content.Intent; import android.os.Bundle; +import android.provider.Settings; +import android.view.View; +import android.widget.Button; import androidx.activity.EdgeToEdge; import androidx.appcompat.app.AppCompatActivity; @@ -27,5 +31,15 @@ public class TroubleshootingActivity extends AppCompatActivity { }); binding.back.setOnClickListener(v -> finish()); + + Button regrantButton = binding.Regrant; + + regrantButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent = new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS); + startActivity(intent); + } + }); } } \ No newline at end of file diff --git a/app/src/main/java/com/auto/clicker/autoclicker/ui/activity/welcome/LauncherActivity.java b/app/src/main/java/com/auto/clicker/autoclicker/ui/activity/welcome/LauncherActivity.java index 9580dea..fbc6171 100644 --- a/app/src/main/java/com/auto/clicker/autoclicker/ui/activity/welcome/LauncherActivity.java +++ b/app/src/main/java/com/auto/clicker/autoclicker/ui/activity/welcome/LauncherActivity.java @@ -14,8 +14,9 @@ public class LauncherActivity extends AppCompatActivity { boolean agreed = getSharedPreferences("app_prefs", MODE_PRIVATE) .getBoolean("agreed_privacy", false); - Intent intent = new Intent(this, - agreed ? SplashActivity.class : AgreementActivity.class); +// Intent intent = new Intent(this, +// agreed ? SplashActivity.class : AgreementActivity.class); + Intent intent = new Intent(this, SplashActivity.class); startActivity(intent); finish(); } diff --git a/app/src/main/java/com/auto/clicker/autoclicker/ui/activity/welcome/SplashActivity.java b/app/src/main/java/com/auto/clicker/autoclicker/ui/activity/welcome/SplashActivity.java index c674287..bfd8de9 100644 --- a/app/src/main/java/com/auto/clicker/autoclicker/ui/activity/welcome/SplashActivity.java +++ b/app/src/main/java/com/auto/clicker/autoclicker/ui/activity/welcome/SplashActivity.java @@ -18,7 +18,7 @@ import com.bumptech.glide.load.resource.bitmap.RoundedCorners; public class SplashActivity extends AppCompatActivity { private ActivitySplashBinding binding; - private static final long TOTAL_TIME = 100; + private static final long TOTAL_TIME = 1000; private CountDownTimer countDownTimer; @Override diff --git a/app/src/main/java/com/auto/clicker/autoclicker/view/FloatingSettingDialogManager.java b/app/src/main/java/com/auto/clicker/autoclicker/view/FloatingSettingDialogManager.java index 7b95e33..72cdca1 100644 --- a/app/src/main/java/com/auto/clicker/autoclicker/view/FloatingSettingDialogManager.java +++ b/app/src/main/java/com/auto/clicker/autoclicker/view/FloatingSettingDialogManager.java @@ -36,6 +36,14 @@ public class FloatingSettingDialogManager { private ConstraintLayout floatingDialogView; private WindowManager.LayoutParams floatingDialogParams; + private enum UnitType { + MS, SEC, MIN, INFINITELY, DURATION, CYCLE, UNKNOWN + } + + private UnitType currentIntervalUnit = UnitType.MS; + private UnitType currentSwipeDurationUnit = UnitType.MS; + private UnitType currentRepeatUnit = UnitType.INFINITELY; + private static final int TYPE_INTERVAL = 0; private static final int TYPE_SWIPE_DURATION = 1; private static final int TYPE_REPEAT = 2; @@ -54,9 +62,6 @@ public class FloatingSettingDialogManager { private AppCompatButton saveButton; private AppCompatButton closeButton; - private String currentIntervalUnit = ""; - private String currentSwipeDurationUnit = ""; - private String currentRepeatUnit = ""; private String currentIntervalValue = ""; private String currentDurationValue = ""; private String currentRepeatValue = ""; @@ -65,6 +70,9 @@ public class FloatingSettingDialogManager { public FloatingSettingDialogManager(Context context) { this.context = context; this.windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); + currentIntervalUnit = UnitType.MS; + currentSwipeDurationUnit = UnitType.MS; + currentRepeatUnit = UnitType.INFINITELY; } public void showFloatingTabDialog() { @@ -201,28 +209,6 @@ public class FloatingSettingDialogManager { repeatSelectorContainer.setOnClickListener(v -> showUnitSelection(v, TYPE_REPEAT)); } - private void updateRepeatUI(boolean isChecked) { - if (isChecked) { - repeatInput.setVisibility(View.VISIBLE); - repeatSelectorContainer.setVisibility(View.VISIBLE); - if (currentRepeatUnit.equals(context.getString(R.string.infinitely_unit)) || repeatSelectedUnit.getText().toString().equals(context.getString(R.string.infinitely_unit))) { - etRepeatValue.setText(""); - etRepeatValue.setEnabled(false); - etRepeatValue.setInputType(InputType.TYPE_NULL); - repeatSelectedUnit.setText(context.getString(R.string.infinitely_unit)); - } else { - etRepeatValue.setEnabled(true); - etRepeatValue.setInputType(InputType.TYPE_CLASS_NUMBER); - etRepeatValue.setText(currentRepeatValue); - repeatSelectedUnit.setText(currentRepeatUnit.isEmpty() ? context.getString(R.string.cycle_unit) : currentRepeatUnit); - } - - } else { - repeatInput.setVisibility(View.GONE); - repeatSelectorContainer.setVisibility(View.GONE); - } - } - private void showUnitSelection(View anchorView, int type) { View popupView = LayoutInflater.from(context).inflate(R.layout.dialog_unit_selection, null); PopupWindow popupWindow = new PopupWindow( @@ -272,34 +258,24 @@ public class FloatingSettingDialogManager { if (type == TYPE_INTERVAL || type == TYPE_SWIPE_DURATION) { tvMs.setOnClickListener(v -> { + UnitType selectedUnitType = UnitType.MS; String unitText = context.getString(R.string.milliseconds_unit); - if (type == TYPE_INTERVAL) { - intervalSelectedUnit.setText(unitText); - currentIntervalUnit = unitText; - } else { - tvSelectedUnit.setText(unitText); - currentSwipeDurationUnit = unitText; - } + updateUIAndSaveSettings(type, selectedUnitType, unitText); popupWindow.dismiss(); }); tvSec.setOnClickListener(v -> { + UnitType selectedUnitType = UnitType.SEC; String unitText = context.getString(R.string.seconds_unit); - if (type == TYPE_INTERVAL) { - intervalSelectedUnit.setText(unitText); - currentIntervalUnit = unitText; - } else { - tvSelectedUnit.setText(unitText); - currentSwipeDurationUnit = unitText; - } + updateUIAndSaveSettings(type, selectedUnitType, unitText); popupWindow.dismiss(); }); if (type == TYPE_INTERVAL) { tvMin.setOnClickListener(v -> { + UnitType selectedUnitType = UnitType.MIN; String unitText = context.getString(R.string.minutes_unit); - intervalSelectedUnit.setText(unitText); - currentIntervalUnit = unitText; + updateUIAndSaveSettings(type, selectedUnitType, unitText); popupWindow.dismiss(); }); } @@ -307,32 +283,26 @@ public class FloatingSettingDialogManager { if (type == TYPE_REPEAT) { tvInfinitely.setOnClickListener(v -> { + UnitType selectedUnitType = UnitType.INFINITELY; String unitText = context.getString(R.string.infinitely_unit); - repeatSelectedUnit.setText(unitText); - currentRepeatUnit = unitText; - etRepeatValue.setText(""); - etRepeatValue.setEnabled(false); - etRepeatValue.setInputType(InputType.TYPE_NULL); + updateUIAndSaveSettings(type, selectedUnitType, unitText); + updateRepeatUI(true); // 悬浮窗中,需要在选择后立即更新UI popupWindow.dismiss(); }); tvDuration.setOnClickListener(v -> { + UnitType selectedUnitType = UnitType.DURATION; String unitText = context.getString(R.string.duration_unit); - repeatSelectedUnit.setText(unitText); - currentRepeatUnit = unitText; - etRepeatValue.setText(""); - etRepeatValue.setEnabled(true); - etRepeatValue.setInputType(InputType.TYPE_CLASS_NUMBER); + updateUIAndSaveSettings(type, selectedUnitType, unitText); + updateRepeatUI(true); popupWindow.dismiss(); }); tvCycle.setOnClickListener(v -> { + UnitType selectedUnitType = UnitType.CYCLE; String unitText = context.getString(R.string.cycle_unit); - repeatSelectedUnit.setText(unitText); - currentRepeatUnit = unitText; - etRepeatValue.setText(""); - etRepeatValue.setEnabled(true); - etRepeatValue.setInputType(InputType.TYPE_CLASS_NUMBER); + updateUIAndSaveSettings(type, selectedUnitType, unitText); + updateRepeatUI(true); popupWindow.dismiss(); }); } @@ -344,6 +314,49 @@ public class FloatingSettingDialogManager { } } + private void updateUIAndSaveSettings(int type, UnitType selectedUnitType, String unitText) { + switch (type) { + case TYPE_INTERVAL: + intervalSelectedUnit.setText(unitText); + currentIntervalUnit = selectedUnitType; + break; + case TYPE_SWIPE_DURATION: + tvSelectedUnit.setText(unitText); + currentSwipeDurationUnit = selectedUnitType; + break; + case TYPE_REPEAT: + repeatSelectedUnit.setText(unitText); + currentRepeatUnit = selectedUnitType; + break; + } + } + + private void updateRepeatUI(boolean isChecked) { + if (isChecked) { + repeatInput.setVisibility(View.VISIBLE); + repeatSelectorContainer.setVisibility(View.VISIBLE); + if (currentRepeatUnit == UnitType.INFINITELY) { + etRepeatValue.setText(""); + etRepeatValue.setEnabled(false); + etRepeatValue.setInputType(InputType.TYPE_NULL); + repeatSelectedUnit.setText(context.getString(R.string.infinitely_unit)); + } else if (currentRepeatUnit == UnitType.DURATION) { + etRepeatValue.setText(currentRepeatValue); + etRepeatValue.setEnabled(true); + etRepeatValue.setInputType(InputType.TYPE_CLASS_NUMBER); + repeatSelectedUnit.setText(context.getString(R.string.duration_unit)); + } else if (currentRepeatUnit == UnitType.CYCLE) { + etRepeatValue.setText(currentRepeatValue); + etRepeatValue.setEnabled(true); + etRepeatValue.setInputType(InputType.TYPE_CLASS_NUMBER); + repeatSelectedUnit.setText(context.getString(R.string.cycle_unit)); + } + } else { + repeatInput.setVisibility(View.GONE); + repeatSelectorContainer.setVisibility(View.GONE); + } + } + private void saveCurrentSettings() { currentIntervalValue = etIntervalValue.getText().toString(); currentDurationValue = etDurationValue.getText().toString(); @@ -363,14 +376,13 @@ public class FloatingSettingDialogManager { return; } - // 应用点击间隔 long intervalValue = 0; if (!currentIntervalValue.isEmpty()) { try { intervalValue = Long.parseLong(currentIntervalValue); - if (currentIntervalUnit.equals(context.getString(R.string.seconds_unit))) { + if (currentIntervalUnit == UnitType.SEC) { intervalValue *= 1000; - } else if (currentIntervalUnit.equals(context.getString(R.string.minutes_unit))) { + } else if (currentIntervalUnit == UnitType.MIN) { intervalValue *= 60 * 1000; } service.setClickInterval(intervalValue); @@ -387,7 +399,7 @@ public class FloatingSettingDialogManager { if (!currentDurationValue.isEmpty()) { try { slideDurationValue = Integer.parseInt(currentDurationValue); - if (currentSwipeDurationUnit.equals(context.getString(R.string.seconds_unit))) { + if (currentSwipeDurationUnit == UnitType.SEC) { slideDurationValue *= 1000; } service.setSlideDuration(slideDurationValue); @@ -401,10 +413,10 @@ public class FloatingSettingDialogManager { } if (isRepeatSwitchChecked) { - if (currentRepeatUnit.equals(context.getString(R.string.infinitely_unit))) { - service.setLoopCount(0); // 无限循环 + if (currentRepeatUnit == UnitType.INFINITELY) { + service.setLoopCount(0); Log.d(TAG, "应用重复模式: 无限次。"); - } else if (currentRepeatUnit.equals(context.getString(R.string.duration_unit))) { + } else if (currentRepeatUnit == UnitType.DURATION) { long repeatDurationMillis = 0; if (!currentRepeatValue.isEmpty()) { try { @@ -421,7 +433,7 @@ public class FloatingSettingDialogManager { Log.d(TAG, "重复时长值为空,取消时间循环。"); } service.setLoopCount(0); // 确保与时间循环互斥 - } else if (currentRepeatUnit.equals(context.getString(R.string.cycle_unit))) { + } else if (currentRepeatUnit == UnitType.CYCLE) { int repeatCount = 0; if (!currentRepeatValue.isEmpty()) { try { @@ -447,51 +459,40 @@ public class FloatingSettingDialogManager { } private void restoreUIState() { - // 恢复点击间隔 if (!currentIntervalValue.isEmpty()) { etIntervalValue.setText(currentIntervalValue); } - if (!currentIntervalUnit.isEmpty()) { - intervalSelectedUnit.setText(currentIntervalUnit); - } else { - intervalSelectedUnit.setText(context.getString(R.string.milliseconds_unit)); // 默认单位 - currentIntervalUnit = context.getString(R.string.milliseconds_unit); - } + intervalSelectedUnit.setText(getUnitString(currentIntervalUnit)); - // 恢复滑动时长 if (!currentDurationValue.isEmpty()) { etDurationValue.setText(currentDurationValue); } - if (!currentSwipeDurationUnit.isEmpty()) { - tvSelectedUnit.setText(currentSwipeDurationUnit); - } else { - tvSelectedUnit.setText(context.getString(R.string.milliseconds_unit)); - currentSwipeDurationUnit = context.getString(R.string.milliseconds_unit); - } + tvSelectedUnit.setText(getUnitString(currentSwipeDurationUnit)); - // 恢复重复设置 repeatSwitch.setChecked(isRepeatSwitchChecked); updateRepeatUI(isRepeatSwitchChecked); if (isRepeatSwitchChecked) { - if (currentRepeatUnit.isEmpty()) { - repeatSelectedUnit.setText(context.getString(R.string.infinitely_unit)); - currentRepeatUnit = context.getString(R.string.infinitely_unit); - etRepeatValue.setText(""); - etRepeatValue.setEnabled(false); - etRepeatValue.setInputType(InputType.TYPE_NULL); - } else { - repeatSelectedUnit.setText(currentRepeatUnit); - if (currentRepeatUnit.equals(context.getString(R.string.infinitely_unit))) { - etRepeatValue.setText(""); - etRepeatValue.setEnabled(false); - etRepeatValue.setInputType(InputType.TYPE_NULL); - } else { - etRepeatValue.setText(currentRepeatValue); - etRepeatValue.setEnabled(true); - etRepeatValue.setInputType(InputType.TYPE_CLASS_NUMBER); - } - } + repeatSelectedUnit.setText(getUnitString(currentRepeatUnit)); + } + } + + private String getUnitString(UnitType unitType) { + switch (unitType) { + case MS: + return context.getString(R.string.milliseconds_unit); + case SEC: + return context.getString(R.string.seconds_unit); + case MIN: + return context.getString(R.string.minutes_unit); + case INFINITELY: + return context.getString(R.string.infinitely_unit); + case DURATION: + return context.getString(R.string.duration_unit); + case CYCLE: + return context.getString(R.string.cycle_unit); + default: + return ""; } } diff --git a/app/src/main/java/com/auto/clicker/autoclicker/view/FloatingViewManager.java b/app/src/main/java/com/auto/clicker/autoclicker/view/FloatingViewManager.java index 514afb9..53aca59 100644 --- a/app/src/main/java/com/auto/clicker/autoclicker/view/FloatingViewManager.java +++ b/app/src/main/java/com/auto/clicker/autoclicker/view/FloatingViewManager.java @@ -639,8 +639,18 @@ public class FloatingViewManager { @Override public void onReceive(Context context, Intent intent) { if ("com.auto.clicker.autoclicker.FLASH_TOUCH_POINT".equals(intent.getAction())) { - int index = intent.getIntExtra("index", -1); - flashTouchPoint(index); + boolean isStopEvent = intent.getBooleanExtra("isStopEvent", false); + + if (isStopEvent) { + Log.d(TAG, "接收到停止点击完成广播,更新触点背景"); + updateTouchPointsBackground(R.drawable.ring_has_bg); + setControlButtonsEnabled(true); + isMultipleRunning = false; + updatePlayButtonImage(false); + } else { + int index = intent.getIntExtra("index", -1); + flashTouchPoint(index); + } } } }, @@ -740,9 +750,9 @@ public class FloatingViewManager { } } updateServicePositions(); - Toast.makeText(context, "方案 '" + solutionData.solution.solutionName + "' 加载成功!", Toast.LENGTH_SHORT).show(); + Toast.makeText(context, "Script '" + solutionData.solution.solutionName + "' Loading successful!", Toast.LENGTH_SHORT).show(); } else { - Toast.makeText(context, "加载方案失败或方案不存在。", Toast.LENGTH_SHORT).show(); + Toast.makeText(context, "The loading scheme fails or the scheme does not exist。", Toast.LENGTH_SHORT).show(); } }); } @@ -751,7 +761,7 @@ public class FloatingViewManager { public void onError(Exception e) { Log.e(TAG, "加载方案失败: " + e.getMessage(), e); new Handler(Looper.getMainLooper()).post(() -> - Toast.makeText(context, "加载方案失败: " + e.getMessage(), Toast.LENGTH_SHORT).show() + Toast.makeText(context, "The loading scheme failed.: " + e.getMessage(), Toast.LENGTH_SHORT).show() ); } }); diff --git a/app/src/main/res/layout/activity_battery_limit_free.xml b/app/src/main/res/layout/activity_battery_limit_free.xml index 1a40ddb..f6936a1 100644 --- a/app/src/main/res/layout/activity_battery_limit_free.xml +++ b/app/src/main/res/layout/activity_battery_limit_free.xml @@ -87,6 +87,7 @@ Feedback" android:textSize="16sp" />