V1.0.0(1)完成版
This commit is contained in:
parent
4d7f9b8f39
commit
474f01b83c
BIN
app/AutoClicker.jks
Normal file
BIN
app/AutoClicker.jks
Normal file
Binary file not shown.
@ -1,7 +1,10 @@
|
|||||||
|
import java.text.SimpleDateFormat
|
||||||
|
import java.util.Date
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
alias(libs.plugins.android.application)
|
alias(libs.plugins.android.application)
|
||||||
}
|
}
|
||||||
|
val timestamp: String = SimpleDateFormat("MM_dd_HH_mm").format(Date())
|
||||||
android {
|
android {
|
||||||
namespace = "com.auto.clicker.autoclicker"
|
namespace = "com.auto.clicker.autoclicker"
|
||||||
compileSdk = 35
|
compileSdk = 35
|
||||||
@ -12,7 +15,10 @@ android {
|
|||||||
targetSdk = 35
|
targetSdk = 35
|
||||||
versionCode = 1
|
versionCode = 1
|
||||||
versionName = "1.0.0"
|
versionName = "1.0.0"
|
||||||
|
setProperty(
|
||||||
|
"archivesBaseName",
|
||||||
|
"Auto Clicker_V" + versionName + "(${versionCode})_$timestamp"
|
||||||
|
)
|
||||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
17
app/proguard-rules.pro
vendored
17
app/proguard-rules.pro
vendored
@ -18,4 +18,19 @@
|
|||||||
|
|
||||||
# If you keep the line number information, uncomment this to
|
# If you keep the line number information, uncomment this to
|
||||||
# hide the original source file name.
|
# hide the original source file name.
|
||||||
#-renamesourcefileattribute SourceFile
|
#-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 <methods>;
|
||||||
|
}
|
||||||
|
|
||||||
|
-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 { *; }
|
||||||
@ -184,6 +184,10 @@ public class AutoClickService extends AccessibilityService {
|
|||||||
startTimeMillis = 0;
|
startTimeMillis = 0;
|
||||||
|
|
||||||
logDebug("停止执行事件");
|
logDebug("停止执行事件");
|
||||||
|
|
||||||
|
Intent stopIntent = new Intent("com.auto.clicker.autoclicker.FLASH_TOUCH_POINT");
|
||||||
|
stopIntent.putExtra("isStopEvent", true);
|
||||||
|
LocalBroadcastManager.getInstance(this).sendBroadcast(stopIntent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -15,7 +15,6 @@ import android.provider.Settings;
|
|||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.accessibility.AccessibilityManager;
|
import android.view.accessibility.AccessibilityManager;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
import android.widget.VideoView;
|
|
||||||
|
|
||||||
import androidx.activity.EdgeToEdge;
|
import androidx.activity.EdgeToEdge;
|
||||||
import androidx.activity.result.ActivityResultLauncher;
|
import androidx.activity.result.ActivityResultLauncher;
|
||||||
@ -185,7 +184,7 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
if (!accessibilityGranted) {
|
if (!accessibilityGranted) {
|
||||||
logDebug("无障碍服务未启用,请求权限");
|
logDebug("无障碍服务未启用,请求权限");
|
||||||
showPermissionRequest(Settings.ACTION_ACCESSIBILITY_SETTINGS, "Please enable accessibility services to ensure the application works properly", "Accessibility Settings cannot be enabled");
|
showPermissionRequest();
|
||||||
setStartButtonEnabled(false);
|
setStartButtonEnabled(false);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -243,7 +242,7 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
if (!accessibilityGranted) {
|
if (!accessibilityGranted) {
|
||||||
logDebug("无障碍服务未启用,请求权限");
|
logDebug("无障碍服务未启用,请求权限");
|
||||||
showPermissionRequest(Settings.ACTION_ACCESSIBILITY_SETTINGS, "Please enable accessibility services to ensure the application works properly", "Accessibility Settings cannot be enabled");
|
showPermissionRequest();
|
||||||
setStartButtonEnabled(false);
|
setStartButtonEnabled(false);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -273,15 +272,15 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showPermissionRequest(String action, String toastMessage, String errorMessage) {
|
private void showPermissionRequest() {
|
||||||
try {
|
try {
|
||||||
Intent intent = new Intent(action);
|
Intent intent = new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS);
|
||||||
permissionLauncher.launch(intent);
|
permissionLauncher.launch(intent);
|
||||||
Toast.makeText(this, toastMessage, Toast.LENGTH_LONG).show();
|
Toast.makeText(this, "Please enable accessibility services to ensure the application works properly", Toast.LENGTH_LONG).show();
|
||||||
logDebug("尝试启动权限设置页面: " + action);
|
logDebug("尝试启动权限设置页面: " + Settings.ACTION_ACCESSIBILITY_SETTINGS);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Toast.makeText(this, errorMessage, Toast.LENGTH_LONG).show();
|
Toast.makeText(this, "Accessibility Settings cannot be enabled", Toast.LENGTH_LONG).show();
|
||||||
logDebug("打开设置页面失败: " + errorMessage + ", 异常: " + e.getMessage());
|
logDebug("打开设置页面失败: " + "Accessibility Settings cannot be enabled" + ", 异常: " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,11 @@
|
|||||||
package com.auto.clicker.autoclicker.ui.activity.menu;
|
package com.auto.clicker.autoclicker.ui.activity.menu;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.provider.Settings;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.Button;
|
||||||
|
|
||||||
import androidx.activity.EdgeToEdge;
|
import androidx.activity.EdgeToEdge;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
@ -27,5 +32,16 @@ public class BatteryLimitFreeActivity extends AppCompatActivity {
|
|||||||
});
|
});
|
||||||
|
|
||||||
binding.back.setOnClickListener(v -> finish());
|
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);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -69,6 +69,20 @@ public class MenuActivity extends AppCompatActivity {
|
|||||||
Intent intent = new Intent(this, HowToUseActivity.class);
|
Intent intent = new Intent(this, HowToUseActivity.class);
|
||||||
startActivity(intent);
|
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) {
|
private void setupItem(int viewId, int iconRes, String title, String subtitle) {
|
||||||
|
|||||||
@ -1,6 +1,10 @@
|
|||||||
package com.auto.clicker.autoclicker.ui.activity.menu;
|
package com.auto.clicker.autoclicker.ui.activity.menu;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.provider.Settings;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.Button;
|
||||||
|
|
||||||
import androidx.activity.EdgeToEdge;
|
import androidx.activity.EdgeToEdge;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
@ -27,5 +31,15 @@ public class TroubleshootingActivity extends AppCompatActivity {
|
|||||||
});
|
});
|
||||||
|
|
||||||
binding.back.setOnClickListener(v -> finish());
|
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);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -14,8 +14,9 @@ public class LauncherActivity extends AppCompatActivity {
|
|||||||
boolean agreed = getSharedPreferences("app_prefs", MODE_PRIVATE)
|
boolean agreed = getSharedPreferences("app_prefs", MODE_PRIVATE)
|
||||||
.getBoolean("agreed_privacy", false);
|
.getBoolean("agreed_privacy", false);
|
||||||
|
|
||||||
Intent intent = new Intent(this,
|
// Intent intent = new Intent(this,
|
||||||
agreed ? SplashActivity.class : AgreementActivity.class);
|
// agreed ? SplashActivity.class : AgreementActivity.class);
|
||||||
|
Intent intent = new Intent(this, SplashActivity.class);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,7 +18,7 @@ import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
|
|||||||
|
|
||||||
public class SplashActivity extends AppCompatActivity {
|
public class SplashActivity extends AppCompatActivity {
|
||||||
private ActivitySplashBinding binding;
|
private ActivitySplashBinding binding;
|
||||||
private static final long TOTAL_TIME = 100;
|
private static final long TOTAL_TIME = 1000;
|
||||||
private CountDownTimer countDownTimer;
|
private CountDownTimer countDownTimer;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -36,6 +36,14 @@ public class FloatingSettingDialogManager {
|
|||||||
private ConstraintLayout floatingDialogView;
|
private ConstraintLayout floatingDialogView;
|
||||||
private WindowManager.LayoutParams floatingDialogParams;
|
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_INTERVAL = 0;
|
||||||
private static final int TYPE_SWIPE_DURATION = 1;
|
private static final int TYPE_SWIPE_DURATION = 1;
|
||||||
private static final int TYPE_REPEAT = 2;
|
private static final int TYPE_REPEAT = 2;
|
||||||
@ -54,9 +62,6 @@ public class FloatingSettingDialogManager {
|
|||||||
private AppCompatButton saveButton;
|
private AppCompatButton saveButton;
|
||||||
private AppCompatButton closeButton;
|
private AppCompatButton closeButton;
|
||||||
|
|
||||||
private String currentIntervalUnit = "";
|
|
||||||
private String currentSwipeDurationUnit = "";
|
|
||||||
private String currentRepeatUnit = "";
|
|
||||||
private String currentIntervalValue = "";
|
private String currentIntervalValue = "";
|
||||||
private String currentDurationValue = "";
|
private String currentDurationValue = "";
|
||||||
private String currentRepeatValue = "";
|
private String currentRepeatValue = "";
|
||||||
@ -65,6 +70,9 @@ public class FloatingSettingDialogManager {
|
|||||||
public FloatingSettingDialogManager(Context context) {
|
public FloatingSettingDialogManager(Context context) {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
this.windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
|
this.windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
|
||||||
|
currentIntervalUnit = UnitType.MS;
|
||||||
|
currentSwipeDurationUnit = UnitType.MS;
|
||||||
|
currentRepeatUnit = UnitType.INFINITELY;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showFloatingTabDialog() {
|
public void showFloatingTabDialog() {
|
||||||
@ -201,28 +209,6 @@ public class FloatingSettingDialogManager {
|
|||||||
repeatSelectorContainer.setOnClickListener(v -> showUnitSelection(v, TYPE_REPEAT));
|
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) {
|
private void showUnitSelection(View anchorView, int type) {
|
||||||
View popupView = LayoutInflater.from(context).inflate(R.layout.dialog_unit_selection, null);
|
View popupView = LayoutInflater.from(context).inflate(R.layout.dialog_unit_selection, null);
|
||||||
PopupWindow popupWindow = new PopupWindow(
|
PopupWindow popupWindow = new PopupWindow(
|
||||||
@ -272,34 +258,24 @@ public class FloatingSettingDialogManager {
|
|||||||
|
|
||||||
if (type == TYPE_INTERVAL || type == TYPE_SWIPE_DURATION) {
|
if (type == TYPE_INTERVAL || type == TYPE_SWIPE_DURATION) {
|
||||||
tvMs.setOnClickListener(v -> {
|
tvMs.setOnClickListener(v -> {
|
||||||
|
UnitType selectedUnitType = UnitType.MS;
|
||||||
String unitText = context.getString(R.string.milliseconds_unit);
|
String unitText = context.getString(R.string.milliseconds_unit);
|
||||||
if (type == TYPE_INTERVAL) {
|
updateUIAndSaveSettings(type, selectedUnitType, unitText);
|
||||||
intervalSelectedUnit.setText(unitText);
|
|
||||||
currentIntervalUnit = unitText;
|
|
||||||
} else {
|
|
||||||
tvSelectedUnit.setText(unitText);
|
|
||||||
currentSwipeDurationUnit = unitText;
|
|
||||||
}
|
|
||||||
popupWindow.dismiss();
|
popupWindow.dismiss();
|
||||||
});
|
});
|
||||||
|
|
||||||
tvSec.setOnClickListener(v -> {
|
tvSec.setOnClickListener(v -> {
|
||||||
|
UnitType selectedUnitType = UnitType.SEC;
|
||||||
String unitText = context.getString(R.string.seconds_unit);
|
String unitText = context.getString(R.string.seconds_unit);
|
||||||
if (type == TYPE_INTERVAL) {
|
updateUIAndSaveSettings(type, selectedUnitType, unitText);
|
||||||
intervalSelectedUnit.setText(unitText);
|
|
||||||
currentIntervalUnit = unitText;
|
|
||||||
} else {
|
|
||||||
tvSelectedUnit.setText(unitText);
|
|
||||||
currentSwipeDurationUnit = unitText;
|
|
||||||
}
|
|
||||||
popupWindow.dismiss();
|
popupWindow.dismiss();
|
||||||
});
|
});
|
||||||
|
|
||||||
if (type == TYPE_INTERVAL) {
|
if (type == TYPE_INTERVAL) {
|
||||||
tvMin.setOnClickListener(v -> {
|
tvMin.setOnClickListener(v -> {
|
||||||
|
UnitType selectedUnitType = UnitType.MIN;
|
||||||
String unitText = context.getString(R.string.minutes_unit);
|
String unitText = context.getString(R.string.minutes_unit);
|
||||||
intervalSelectedUnit.setText(unitText);
|
updateUIAndSaveSettings(type, selectedUnitType, unitText);
|
||||||
currentIntervalUnit = unitText;
|
|
||||||
popupWindow.dismiss();
|
popupWindow.dismiss();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -307,32 +283,26 @@ public class FloatingSettingDialogManager {
|
|||||||
|
|
||||||
if (type == TYPE_REPEAT) {
|
if (type == TYPE_REPEAT) {
|
||||||
tvInfinitely.setOnClickListener(v -> {
|
tvInfinitely.setOnClickListener(v -> {
|
||||||
|
UnitType selectedUnitType = UnitType.INFINITELY;
|
||||||
String unitText = context.getString(R.string.infinitely_unit);
|
String unitText = context.getString(R.string.infinitely_unit);
|
||||||
repeatSelectedUnit.setText(unitText);
|
updateUIAndSaveSettings(type, selectedUnitType, unitText);
|
||||||
currentRepeatUnit = unitText;
|
updateRepeatUI(true); // 悬浮窗中,需要在选择后立即更新UI
|
||||||
etRepeatValue.setText("");
|
|
||||||
etRepeatValue.setEnabled(false);
|
|
||||||
etRepeatValue.setInputType(InputType.TYPE_NULL);
|
|
||||||
popupWindow.dismiss();
|
popupWindow.dismiss();
|
||||||
});
|
});
|
||||||
|
|
||||||
tvDuration.setOnClickListener(v -> {
|
tvDuration.setOnClickListener(v -> {
|
||||||
|
UnitType selectedUnitType = UnitType.DURATION;
|
||||||
String unitText = context.getString(R.string.duration_unit);
|
String unitText = context.getString(R.string.duration_unit);
|
||||||
repeatSelectedUnit.setText(unitText);
|
updateUIAndSaveSettings(type, selectedUnitType, unitText);
|
||||||
currentRepeatUnit = unitText;
|
updateRepeatUI(true);
|
||||||
etRepeatValue.setText("");
|
|
||||||
etRepeatValue.setEnabled(true);
|
|
||||||
etRepeatValue.setInputType(InputType.TYPE_CLASS_NUMBER);
|
|
||||||
popupWindow.dismiss();
|
popupWindow.dismiss();
|
||||||
});
|
});
|
||||||
|
|
||||||
tvCycle.setOnClickListener(v -> {
|
tvCycle.setOnClickListener(v -> {
|
||||||
|
UnitType selectedUnitType = UnitType.CYCLE;
|
||||||
String unitText = context.getString(R.string.cycle_unit);
|
String unitText = context.getString(R.string.cycle_unit);
|
||||||
repeatSelectedUnit.setText(unitText);
|
updateUIAndSaveSettings(type, selectedUnitType, unitText);
|
||||||
currentRepeatUnit = unitText;
|
updateRepeatUI(true);
|
||||||
etRepeatValue.setText("");
|
|
||||||
etRepeatValue.setEnabled(true);
|
|
||||||
etRepeatValue.setInputType(InputType.TYPE_CLASS_NUMBER);
|
|
||||||
popupWindow.dismiss();
|
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() {
|
private void saveCurrentSettings() {
|
||||||
currentIntervalValue = etIntervalValue.getText().toString();
|
currentIntervalValue = etIntervalValue.getText().toString();
|
||||||
currentDurationValue = etDurationValue.getText().toString();
|
currentDurationValue = etDurationValue.getText().toString();
|
||||||
@ -363,14 +376,13 @@ public class FloatingSettingDialogManager {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 应用点击间隔
|
|
||||||
long intervalValue = 0;
|
long intervalValue = 0;
|
||||||
if (!currentIntervalValue.isEmpty()) {
|
if (!currentIntervalValue.isEmpty()) {
|
||||||
try {
|
try {
|
||||||
intervalValue = Long.parseLong(currentIntervalValue);
|
intervalValue = Long.parseLong(currentIntervalValue);
|
||||||
if (currentIntervalUnit.equals(context.getString(R.string.seconds_unit))) {
|
if (currentIntervalUnit == UnitType.SEC) {
|
||||||
intervalValue *= 1000;
|
intervalValue *= 1000;
|
||||||
} else if (currentIntervalUnit.equals(context.getString(R.string.minutes_unit))) {
|
} else if (currentIntervalUnit == UnitType.MIN) {
|
||||||
intervalValue *= 60 * 1000;
|
intervalValue *= 60 * 1000;
|
||||||
}
|
}
|
||||||
service.setClickInterval(intervalValue);
|
service.setClickInterval(intervalValue);
|
||||||
@ -387,7 +399,7 @@ public class FloatingSettingDialogManager {
|
|||||||
if (!currentDurationValue.isEmpty()) {
|
if (!currentDurationValue.isEmpty()) {
|
||||||
try {
|
try {
|
||||||
slideDurationValue = Integer.parseInt(currentDurationValue);
|
slideDurationValue = Integer.parseInt(currentDurationValue);
|
||||||
if (currentSwipeDurationUnit.equals(context.getString(R.string.seconds_unit))) {
|
if (currentSwipeDurationUnit == UnitType.SEC) {
|
||||||
slideDurationValue *= 1000;
|
slideDurationValue *= 1000;
|
||||||
}
|
}
|
||||||
service.setSlideDuration(slideDurationValue);
|
service.setSlideDuration(slideDurationValue);
|
||||||
@ -401,10 +413,10 @@ public class FloatingSettingDialogManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isRepeatSwitchChecked) {
|
if (isRepeatSwitchChecked) {
|
||||||
if (currentRepeatUnit.equals(context.getString(R.string.infinitely_unit))) {
|
if (currentRepeatUnit == UnitType.INFINITELY) {
|
||||||
service.setLoopCount(0); // 无限循环
|
service.setLoopCount(0);
|
||||||
Log.d(TAG, "应用重复模式: 无限次。");
|
Log.d(TAG, "应用重复模式: 无限次。");
|
||||||
} else if (currentRepeatUnit.equals(context.getString(R.string.duration_unit))) {
|
} else if (currentRepeatUnit == UnitType.DURATION) {
|
||||||
long repeatDurationMillis = 0;
|
long repeatDurationMillis = 0;
|
||||||
if (!currentRepeatValue.isEmpty()) {
|
if (!currentRepeatValue.isEmpty()) {
|
||||||
try {
|
try {
|
||||||
@ -421,7 +433,7 @@ public class FloatingSettingDialogManager {
|
|||||||
Log.d(TAG, "重复时长值为空,取消时间循环。");
|
Log.d(TAG, "重复时长值为空,取消时间循环。");
|
||||||
}
|
}
|
||||||
service.setLoopCount(0); // 确保与时间循环互斥
|
service.setLoopCount(0); // 确保与时间循环互斥
|
||||||
} else if (currentRepeatUnit.equals(context.getString(R.string.cycle_unit))) {
|
} else if (currentRepeatUnit == UnitType.CYCLE) {
|
||||||
int repeatCount = 0;
|
int repeatCount = 0;
|
||||||
if (!currentRepeatValue.isEmpty()) {
|
if (!currentRepeatValue.isEmpty()) {
|
||||||
try {
|
try {
|
||||||
@ -447,51 +459,40 @@ public class FloatingSettingDialogManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void restoreUIState() {
|
private void restoreUIState() {
|
||||||
// 恢复点击间隔
|
|
||||||
if (!currentIntervalValue.isEmpty()) {
|
if (!currentIntervalValue.isEmpty()) {
|
||||||
etIntervalValue.setText(currentIntervalValue);
|
etIntervalValue.setText(currentIntervalValue);
|
||||||
}
|
}
|
||||||
if (!currentIntervalUnit.isEmpty()) {
|
intervalSelectedUnit.setText(getUnitString(currentIntervalUnit));
|
||||||
intervalSelectedUnit.setText(currentIntervalUnit);
|
|
||||||
} else {
|
|
||||||
intervalSelectedUnit.setText(context.getString(R.string.milliseconds_unit)); // 默认单位
|
|
||||||
currentIntervalUnit = context.getString(R.string.milliseconds_unit);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 恢复滑动时长
|
|
||||||
if (!currentDurationValue.isEmpty()) {
|
if (!currentDurationValue.isEmpty()) {
|
||||||
etDurationValue.setText(currentDurationValue);
|
etDurationValue.setText(currentDurationValue);
|
||||||
}
|
}
|
||||||
if (!currentSwipeDurationUnit.isEmpty()) {
|
tvSelectedUnit.setText(getUnitString(currentSwipeDurationUnit));
|
||||||
tvSelectedUnit.setText(currentSwipeDurationUnit);
|
|
||||||
} else {
|
|
||||||
tvSelectedUnit.setText(context.getString(R.string.milliseconds_unit));
|
|
||||||
currentSwipeDurationUnit = context.getString(R.string.milliseconds_unit);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 恢复重复设置
|
|
||||||
repeatSwitch.setChecked(isRepeatSwitchChecked);
|
repeatSwitch.setChecked(isRepeatSwitchChecked);
|
||||||
updateRepeatUI(isRepeatSwitchChecked);
|
updateRepeatUI(isRepeatSwitchChecked);
|
||||||
|
|
||||||
if (isRepeatSwitchChecked) {
|
if (isRepeatSwitchChecked) {
|
||||||
if (currentRepeatUnit.isEmpty()) {
|
repeatSelectedUnit.setText(getUnitString(currentRepeatUnit));
|
||||||
repeatSelectedUnit.setText(context.getString(R.string.infinitely_unit));
|
}
|
||||||
currentRepeatUnit = context.getString(R.string.infinitely_unit);
|
}
|
||||||
etRepeatValue.setText("");
|
|
||||||
etRepeatValue.setEnabled(false);
|
private String getUnitString(UnitType unitType) {
|
||||||
etRepeatValue.setInputType(InputType.TYPE_NULL);
|
switch (unitType) {
|
||||||
} else {
|
case MS:
|
||||||
repeatSelectedUnit.setText(currentRepeatUnit);
|
return context.getString(R.string.milliseconds_unit);
|
||||||
if (currentRepeatUnit.equals(context.getString(R.string.infinitely_unit))) {
|
case SEC:
|
||||||
etRepeatValue.setText("");
|
return context.getString(R.string.seconds_unit);
|
||||||
etRepeatValue.setEnabled(false);
|
case MIN:
|
||||||
etRepeatValue.setInputType(InputType.TYPE_NULL);
|
return context.getString(R.string.minutes_unit);
|
||||||
} else {
|
case INFINITELY:
|
||||||
etRepeatValue.setText(currentRepeatValue);
|
return context.getString(R.string.infinitely_unit);
|
||||||
etRepeatValue.setEnabled(true);
|
case DURATION:
|
||||||
etRepeatValue.setInputType(InputType.TYPE_CLASS_NUMBER);
|
return context.getString(R.string.duration_unit);
|
||||||
}
|
case CYCLE:
|
||||||
}
|
return context.getString(R.string.cycle_unit);
|
||||||
|
default:
|
||||||
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -639,8 +639,18 @@ public class FloatingViewManager {
|
|||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
if ("com.auto.clicker.autoclicker.FLASH_TOUCH_POINT".equals(intent.getAction())) {
|
if ("com.auto.clicker.autoclicker.FLASH_TOUCH_POINT".equals(intent.getAction())) {
|
||||||
int index = intent.getIntExtra("index", -1);
|
boolean isStopEvent = intent.getBooleanExtra("isStopEvent", false);
|
||||||
flashTouchPoint(index);
|
|
||||||
|
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();
|
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 {
|
} 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) {
|
public void onError(Exception e) {
|
||||||
Log.e(TAG, "加载方案失败: " + e.getMessage(), e);
|
Log.e(TAG, "加载方案失败: " + e.getMessage(), e);
|
||||||
new Handler(Looper.getMainLooper()).post(() ->
|
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()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@ -87,6 +87,7 @@ Feedback"
|
|||||||
android:textSize="16sp" />
|
android:textSize="16sp" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
|
android:id="@+id/grant"
|
||||||
android:layout_width="127dp"
|
android:layout_width="127dp"
|
||||||
android:layout_height="42dp"
|
android:layout_height="42dp"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
|
|||||||
@ -38,6 +38,7 @@
|
|||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
android:background="@android:color/transparent"
|
android:background="@android:color/transparent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/how_title"
|
app:layout_constraintTop_toBottomOf="@+id/how_title"
|
||||||
|
app:tabIndicatorHeight="0dp"
|
||||||
app:tabRippleColor="@android:color/transparent" />
|
app:tabRippleColor="@android:color/transparent" />
|
||||||
|
|
||||||
<androidx.viewpager2.widget.ViewPager2
|
<androidx.viewpager2.widget.ViewPager2
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:id="@+id/main"
|
android:id="@+id/main"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
tools:context=".ui.activity.menu.MenuActivity">
|
tools:context=".ui.activity.menu.MenuActivity">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@ -81,15 +81,18 @@
|
|||||||
|
|
||||||
<include
|
<include
|
||||||
android:id="@+id/feedback"
|
android:id="@+id/feedback"
|
||||||
layout="@layout/item_menu" />
|
layout="@layout/item_menu"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
<include
|
<include
|
||||||
android:id="@+id/privacy"
|
android:id="@+id/privacy"
|
||||||
layout="@layout/item_menu" />
|
layout="@layout/item_menu"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
<include
|
<include
|
||||||
android:id="@+id/term"
|
android:id="@+id/term"
|
||||||
layout="@layout/item_menu" />
|
layout="@layout/item_menu"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
|||||||
@ -38,6 +38,7 @@
|
|||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
android:background="@android:color/transparent"
|
android:background="@android:color/transparent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/setting_title"
|
app:layout_constraintTop_toBottomOf="@+id/setting_title"
|
||||||
|
app:tabIndicatorHeight="0dp"
|
||||||
app:tabRippleColor="@android:color/transparent" />
|
app:tabRippleColor="@android:color/transparent" />
|
||||||
|
|
||||||
<androidx.viewpager2.widget.ViewPager2
|
<androidx.viewpager2.widget.ViewPager2
|
||||||
|
|||||||
@ -64,6 +64,7 @@
|
|||||||
android:textSize="16sp" />
|
android:textSize="16sp" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
|
android:id="@+id/Regrant"
|
||||||
android:layout_width="127dp"
|
android:layout_width="127dp"
|
||||||
android:layout_height="42dp"
|
android:layout_height="42dp"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="321dp"
|
android:layout_width="321dp"
|
||||||
android:layout_height="420dp"
|
android:layout_height="wrap_content"
|
||||||
android:background="@drawable/bg_rounded_rect"
|
android:background="@drawable/bg_rounded_rect"
|
||||||
android:paddingBottom="25dp">
|
android:paddingBottom="25dp">
|
||||||
|
|
||||||
@ -96,6 +96,18 @@
|
|||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_interval_range_hint"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="36dp"
|
||||||
|
android:layout_marginTop="4dp"
|
||||||
|
android:text="范围: 40ms - 10000ms"
|
||||||
|
android:textColor="@color/gray"
|
||||||
|
android:textSize="12sp"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/input_interval" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/duration_icon"
|
android:id="@+id/duration_icon"
|
||||||
android:layout_width="20dp"
|
android:layout_width="20dp"
|
||||||
@ -114,7 +126,7 @@
|
|||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
app:layout_constraintStart_toStartOf="@+id/tv_interval_label"
|
app:layout_constraintStart_toStartOf="@+id/tv_interval_label"
|
||||||
app:layout_constraintTop_toBottomOf="@id/input_interval" />
|
app:layout_constraintTop_toBottomOf="@id/tv_interval_range_hint" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_preview_label"
|
android:id="@+id/tv_preview_label"
|
||||||
@ -184,6 +196,18 @@
|
|||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_duration_range_hint"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="36dp"
|
||||||
|
android:layout_marginTop="4dp"
|
||||||
|
android:text="范围: 100ms - 2000ms"
|
||||||
|
android:textColor="@color/gray"
|
||||||
|
android:textSize="12sp"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/input_with_unit_container" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/default_cycle_title"
|
android:id="@+id/default_cycle_title"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
@ -195,7 +219,7 @@
|
|||||||
android:textSize="15sp"
|
android:textSize="15sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/input_with_unit_container" />
|
app:layout_constraintTop_toBottomOf="@+id/tv_duration_range_hint" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/repeat_icon"
|
android:id="@+id/repeat_icon"
|
||||||
|
|||||||
6
keystore.properties
Normal file
6
keystore.properties
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
app_name=Auto Clicker
|
||||||
|
package_name=com.auto.clicker.autoclicker
|
||||||
|
keystoreFile=app/AutoClicker.jks
|
||||||
|
key_alias=AutoClickerkey0
|
||||||
|
key_store_password=AutoClicker
|
||||||
|
key_password=AutoClicker
|
||||||
Loading…
Reference in New Issue
Block a user