diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index faf2ee4..dc1cb5a 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -3,18 +3,21 @@ import java.util.Date
plugins {
alias(libs.plugins.android.application)
+ alias(libs.plugins.kotlin.android)
+// id("com.android.application")
+// id("org.jetbrains.kotlin.android")
}
val timestamp: String = SimpleDateFormat("MM_dd_HH_mm").format(Date())
android {
namespace = "com.auto.clicker.autoclicker"
- compileSdk = 35
+ compileSdk = 36
defaultConfig {
applicationId = "com.auto.clicker.autoclicker"
minSdk = 24
- targetSdk = 35
+ targetSdk = 36
versionCode = 1
- versionName = "1.0.0"
+ versionName = "1.0"
setProperty(
"archivesBaseName",
"Auto Clicker_V" + versionName + "(${versionCode})_$timestamp"
@@ -23,9 +26,11 @@ android {
}
buildFeatures{
- viewBinding = true;
+ viewBinding = true
+ }
+ kotlinOptions {
+ jvmTarget = "17"
}
-
buildTypes {
release {
isMinifyEnabled = true
@@ -36,8 +41,8 @@ android {
}
}
compileOptions {
- sourceCompatibility = JavaVersion.VERSION_11
- targetCompatibility = JavaVersion.VERSION_11
+ sourceCompatibility = JavaVersion.VERSION_17
+ targetCompatibility = JavaVersion.VERSION_17
}
}
@@ -50,12 +55,21 @@ dependencies {
testImplementation(libs.junit)
androidTestImplementation(libs.ext.junit)
androidTestImplementation(libs.espresso.core)
+ implementation(libs.kotlin.stdlib)
+// implementation("androidx.appcompat:appcompat:1.7.1")
+// implementation("com.google.android.material:material:1.12.0")
+// implementation("androidx.constraintlayout:constraintlayout:2.2.1")
+// testImplementation("junit:junit:4.13.2")
+// androidTestImplementation("androidx.test.ext:junit:1.2.1")
+// androidTestImplementation("androidx.test.espresso:espresso-core:3.6.1")
+// implementation("androidx.core:core-ktx:2.1.0")
+
implementation("com.github.bumptech.glide:glide:4.16.0")
annotationProcessor("com.github.bumptech.glide:compiler:4.16.0")
-
- implementation ("androidx.room:room-runtime:2.7.1")
- annotationProcessor ("androidx.room:room-compiler:2.7.1")
-
+//
+ implementation ("androidx.room:room-runtime:2.5.2")
+ annotationProcessor ("androidx.room:room-compiler:2.5.2")
+//
implementation("com.google.code.gson:gson:2.12.1")
}
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 78207e4..2e1e4a0 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -12,9 +12,9 @@
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
- android:icon="@mipmap/ic_launcher"
+ android:icon="@mipmap/logo"
android:label="@string/app_name"
- android:roundIcon="@mipmap/ic_launcher"
+ android:roundIcon="@mipmap/logo"
android:supportsRtl="true"
android:theme="@style/Theme.AutoClicker"
tools:targetApi="31">
@@ -53,10 +53,7 @@
android:exported="false" />
-
+ android:exported="true" >
@@ -64,6 +61,7 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/assets/myfont.ttf b/app/src/main/assets/myfont.ttf
new file mode 100644
index 0000000..70281c0
Binary files /dev/null and b/app/src/main/assets/myfont.ttf differ
diff --git a/app/src/main/java/com/auto/clicker/autoclicker/MyApplication.java b/app/src/main/java/com/auto/clicker/autoclicker/MyApplication.java
index 944d1d2..e81a83f 100644
--- a/app/src/main/java/com/auto/clicker/autoclicker/MyApplication.java
+++ b/app/src/main/java/com/auto/clicker/autoclicker/MyApplication.java
@@ -2,17 +2,20 @@ package com.auto.clicker.autoclicker;
import android.app.Application;
import android.content.Context;
+import android.graphics.Typeface;
public class MyApplication extends Application {
public static MyApplication application;
public static final int DB_VERSION = 1;
public static final String DB_NAME = "auto_clicker_database";
+ public static Typeface fromAsset;
@Override
public void onCreate() {
super.onCreate();
-
application = this;
+ fromAsset = Typeface.createFromAsset(getAssets(), "myfont.ttf");
+
}
diff --git a/app/src/main/java/com/auto/clicker/autoclicker/room/entity/EventEntity.java b/app/src/main/java/com/auto/clicker/autoclicker/room/entity/EventEntity.java
index 5ef3401..8e9d703 100644
--- a/app/src/main/java/com/auto/clicker/autoclicker/room/entity/EventEntity.java
+++ b/app/src/main/java/com/auto/clicker/autoclicker/room/entity/EventEntity.java
@@ -5,6 +5,7 @@ import static androidx.room.ForeignKey.CASCADE;
import androidx.room.ColumnInfo;
import androidx.room.Entity;
import androidx.room.ForeignKey;
+import androidx.room.Index;
import androidx.room.PrimaryKey;
import com.google.gson.annotations.Expose;
@@ -27,7 +28,12 @@ import com.google.gson.annotations.Expose;
parentColumns = "pointId",
childColumns = "slide_end_point_id",
onDelete = CASCADE)
- })
+ }, indices = {
+ @Index("solution_id"),
+ @Index("click_point_id"),
+ @Index("slide_start_point_id"),
+ @Index("slide_end_point_id")
+})
public class EventEntity {
@Expose
@PrimaryKey(autoGenerate = true)
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 faff802..e116173 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
@@ -2,13 +2,17 @@ package com.auto.clicker.autoclicker.service;
import android.accessibilityservice.AccessibilityService;
import android.accessibilityservice.GestureDescription;
+import android.content.BroadcastReceiver;
+import android.content.Context;
import android.content.Intent;
+import android.content.IntentFilter;
import android.graphics.Path;
import android.graphics.Point;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;
import android.view.accessibility.AccessibilityEvent;
+import android.widget.TextView;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
@@ -16,6 +20,7 @@ import com.auto.clicker.autoclicker.data.Event;
import com.auto.clicker.autoclicker.data.EventWrapper;
import com.auto.clicker.autoclicker.data.PointEvent;
import com.auto.clicker.autoclicker.data.SlideEvent;
+import com.auto.clicker.autoclicker.util.ConstValue;
import com.auto.clicker.autoclicker.util.EventViewBinder;
import com.auto.clicker.autoclicker.util.ScreenUtils;
import com.auto.clicker.autoclicker.view.FloatingViewManager;
@@ -25,7 +30,7 @@ import java.util.Comparator;
import java.util.List;
public class AutoClickService extends AccessibilityService {
- private static final String TAG = "AutoClickService";
+ private static final String TAG = "TAG----------AutoClickService";
private static AutoClickService instance;
private static final long MIN_CLICK_INTERVAL = 40;
@@ -35,7 +40,12 @@ public class AutoClickService extends AccessibilityService {
private List runtimeEvents = new ArrayList<>();
- private FloatingViewManager floatingViewManager;
+ private static FloatingViewManager floatingViewManager;
+
+ public static FloatingViewManager getFloatingViewManager() {
+ return floatingViewManager;
+ }
+
private int touchPointSize;
private final Handler handler = new Handler(Looper.getMainLooper());
@@ -50,7 +60,12 @@ public class AutoClickService extends AccessibilityService {
private long loopTimeMillis = 0;
private long startTimeMillis;
private int currentLoop = 0;
-
+ private boolean isFloatingViewShown = false;
+ private final String Action0=String.valueOf(ConstValue.FLOATING_NONE);
+ private final String Action1=String.valueOf(ConstValue.FLOATING_SINGLE);
+ private final String Action2=String.valueOf(ConstValue.FLOATING_MULTI);
+ private final String Action3=String.valueOf(ConstValue.FLOATING_UPDATE_SIZE);
+ private final String Action4=String.valueOf(ConstValue.FLOATING_UPDATE_BAR_SIZE);
@Override
public void onCreate() {
super.onCreate();
@@ -60,14 +75,14 @@ public class AutoClickService extends AccessibilityService {
int screenHeight = screenSize.y;
logDebug("屏幕尺寸: " + screenWidth + "x" + screenHeight);
- ForegroundService service = ForegroundService.getInstance();
- if (service != null) {
- floatingViewManager = service.getFloatingViewManager();
- }
-
- if (floatingViewManager != null) {
- touchPointSize = floatingViewManager.getTouchPointSize();
- }
+// ForegroundService service = ForegroundService.getInstance();
+// if (service != null) {
+// floatingViewManager = service.getFloatingViewManager();
+// }
+// floatingViewManager = new FloatingViewManager(this);
+// if (floatingViewManager != null) {
+// touchPointSize = floatingViewManager.getTouchPointSize();
+// }
}
public static AutoClickService getInstance() {
@@ -78,6 +93,67 @@ public class AutoClickService extends AccessibilityService {
public void onServiceConnected() {
super.onServiceConnected();
logDebug("无障碍服务已连接");
+
+// ForegroundService service = ForegroundService.getInstance();
+// if (service != null) {
+// floatingViewManager = service.getFloatingViewManager();
+// }
+
+ floatingViewManager = new FloatingViewManager(this);
+ if (floatingViewManager != null) {
+ touchPointSize = floatingViewManager.getTouchPointSize();
+ }
+ setBroadcast();
+
+ }
+
+
+ private void setBroadcast() {
+ LocalBroadcastManager localBroadcastManager = LocalBroadcastManager.getInstance(this);
+
+ IntentFilter intentFilter = new IntentFilter();
+ intentFilter.addAction(Action0);
+ intentFilter.addAction(Action1);
+ intentFilter.addAction(Action2);
+ intentFilter.addAction(Action3);
+ intentFilter.addAction(Action4);
+ BroadcastReceiver broadcastReceiver = new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ String action = intent.getAction();
+ if (action == null) return;
+
+ switch (action) {
+ case "0":
+ floatingViewManager.removeAllFloatingViews();
+ break;
+ case "1":
+ floatingViewManager.showFloatingViews(1);
+ break;
+ case "2":
+ floatingViewManager.showFloatingViews(2);
+ break;
+ case "3":
+ int intExtra = intent.getIntExtra(ConstValue.KEY_UPDATE_SIZE,-1);
+ if(intExtra!= -1){
+ floatingViewManager.setTouchPointSize(intExtra);
+ }
+
+ break;
+ case "4":
+ int intBAr = intent.getIntExtra(ConstValue.KEY_UPDATE_BAR_SIZE,-1);
+ if(intBAr!= -1){
+ floatingViewManager.setControlBarSize(intBAr);
+ }
+
+ break;
+
+
+ }
+ }
+ };
+
+ localBroadcastManager.registerReceiver(broadcastReceiver, intentFilter);
}
@Override
@@ -206,7 +282,6 @@ public class AutoClickService extends AccessibilityService {
stopClicking();
return;
}
-
runtimeEvents.sort(Comparator.comparingInt(EventWrapper::getOrder));
if (currentEventIndex >= runtimeEvents.size()) {
@@ -255,9 +330,25 @@ public class AutoClickService extends AccessibilityService {
}
}
+
+ /**
+ * 执行单点
+ * @param pointEvent
+ */
private void performSingleClick(PointEvent pointEvent) {
int viewLeftX = pointEvent.getX();
int viewTopY = pointEvent.getY();
+ Log.d(TAG,"performSingleClick----------pointEvent.getLayoutParams().flags="+pointEvent.getLayoutParams().flags);
+
+ TextView view = pointEvent.getView();
+
+ int[] singlePoint = new int[2];
+ view.getLocationOnScreen(singlePoint);
+ int finalClickX = singlePoint[0] + touchPointSize / 2;
+ int finalClickY = singlePoint[1] + touchPointSize / 2;
+
+ logDebug("---------singlePoint[0]= "+singlePoint[0]+"-------singlePoint[1]="+singlePoint[1]);
+
final int CORRECTION_X = 54;
final int CORRECTION_Y = 165;
@@ -265,11 +356,12 @@ public class AutoClickService extends AccessibilityService {
int correctedViewLeftX = viewLeftX + CORRECTION_X;
int correctedViewTopY = viewTopY + CORRECTION_Y;
- int finalClickX = correctedViewLeftX + touchPointSize / 2;
- int finalClickY = correctedViewTopY + touchPointSize / 2;
+// int finalClickX = correctedViewLeftX + touchPointSize / 2;
+// int finalClickY = correctedViewTopY + touchPointSize / 2;
Path path = new Path();
path.moveTo(finalClickX, finalClickY);
+ Log.d(TAG,"---------------finalClickX="+finalClickX+"------finalClickY="+finalClickY);
GestureDescription.StrokeDescription stroke =
new GestureDescription.StrokeDescription(path, 0, clickDuration);
GestureDescription gesture =
diff --git a/app/src/main/java/com/auto/clicker/autoclicker/service/ForegroundService.java b/app/src/main/java/com/auto/clicker/autoclicker/service/ForegroundService.java
index fe659a0..1d9aa5f 100644
--- a/app/src/main/java/com/auto/clicker/autoclicker/service/ForegroundService.java
+++ b/app/src/main/java/com/auto/clicker/autoclicker/service/ForegroundService.java
@@ -1,6 +1,6 @@
package com.auto.clicker.autoclicker.service;
-import static com.auto.clicker.autoclicker.ui.activity.main.MainActivity.FLOATING_SINGLE;
+
import android.app.Notification;
import android.app.NotificationChannel;
@@ -35,7 +35,7 @@ public class ForegroundService extends Service {
createNotificationChannel();
try {
- floatingViewManager = new FloatingViewManager(this);
+// floatingViewManager = new FloatingViewManager(this);
} catch (Exception e) {
Log.e(TAG, "初始化 FloatingViewManager 失败", e);
stopSelf();
@@ -44,7 +44,7 @@ public class ForegroundService extends Service {
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
- int type = intent != null ? intent.getIntExtra("FLOATING_TYPE", FLOATING_SINGLE) : FLOATING_SINGLE;
+// int type = intent != null ? intent.getIntExtra("FLOATING_TYPE", FLOATING_SINGLE) : FLOATING_SINGLE;
Intent notificationIntent = new Intent(this, MainActivity.class);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, notificationIntent, PendingIntent.FLAG_IMMUTABLE);
@@ -58,17 +58,17 @@ public class ForegroundService extends Service {
startForeground(NOTIFICATION_ID, notification);
- if (floatingViewManager != null && !isFloatingViewShown) {
- try {
- floatingViewManager.showFloatingViews(type);
- isFloatingViewShown = true;
- } catch (SecurityException e) {
- Log.e(TAG, "未授予悬浮窗权限", e);
- stopSelf();
- }
- } else if (floatingViewManager == null) {
- stopSelf();
- }
+// if (floatingViewManager != null && !isFloatingViewShown) {
+// try {
+// floatingViewManager.showFloatingViews(type);
+// isFloatingViewShown = true;
+// } catch (SecurityException e) {
+// Log.e(TAG, "未授予悬浮窗权限", e);
+// stopSelf();
+// }
+// } else if (floatingViewManager == null) {
+// stopSelf();
+// }
return START_STICKY;
}
@@ -103,7 +103,7 @@ public class ForegroundService extends Service {
instance = null;
if (floatingViewManager != null) {
- floatingViewManager.removeAllFloatingViews();
+// floatingViewManager.removeAllFloatingViews();
isFloatingViewShown = false;
Log.d(TAG, "悬浮窗已移除");
}
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 5c088be..a724107 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
@@ -1,14 +1,12 @@
package com.auto.clicker.autoclicker.ui.activity.main;
import android.accessibilityservice.AccessibilityServiceInfo;
-import android.app.ActivityManager;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.Uri;
-import android.os.Build;
import android.os.Bundle;
import android.os.PowerManager;
import android.provider.Settings;
@@ -33,21 +31,24 @@ import com.auto.clicker.autoclicker.service.AutoClickService;
import com.auto.clicker.autoclicker.service.ForegroundService;
import com.auto.clicker.autoclicker.ui.activity.menu.MenuActivity;
import com.auto.clicker.autoclicker.ui.activity.setting.SettingActivity;
+import com.auto.clicker.autoclicker.ui.dialog.DialogFloatingWindows;
+import com.auto.clicker.autoclicker.ui.dialog.DialogPermission;
+import com.auto.clicker.autoclicker.util.ConstValue;
import com.auto.clicker.autoclicker.util.PrefUtils;
import java.util.List;
+import kotlin.Unit;
+import kotlin.jvm.functions.Function1;
+
public class MainActivity extends AppCompatActivity {
private static final String TAG = "MainActivity";
private static final String ACTION_FLOATING_STATE_CHANGED = "com.auto.clicker.autoclicker.FLOATING_WINDOW_STATE_CHANGED";
private ActivityMainBinding binding;
-
+ private LocalBroadcastManager localBroadcastManager;
private boolean isPermissionFlowActive = false;
- public static final int FLOATING_NONE = 0;
- public static final int FLOATING_SINGLE = 1;
- public static final int FLOATING_MULTI = 2;
private Toast debounceToast;
@@ -57,14 +58,16 @@ public class MainActivity extends AppCompatActivity {
private static final long DEBOUNCE_INTERVAL = 500;
private int isFloatingShown;
- private int selectedFloatingMode = FLOATING_SINGLE;
+ private int selectedFloatingMode = ConstValue.FLOATING_SINGLE;
public static final String EXTRA_FLOATING_MODE = "extra_floating_mode";
+ private DialogPermission accesDialog;
+ private DialogFloatingWindows floatingDialog;
private final BroadcastReceiver floatingReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
- isFloatingShown = intent.getIntExtra("isShown", FLOATING_NONE);
+ isFloatingShown = intent.getIntExtra("isShown", ConstValue.FLOATING_NONE);
logDebug("接收到浮窗状态广播: isShown = " + isFloatingShown);
updateSelectionButtons();
@@ -77,7 +80,7 @@ public class MainActivity extends AppCompatActivity {
binding = ActivityMainBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot());
-
+ localBroadcastManager = LocalBroadcastManager.getInstance(this);
EdgeToEdge.enable(this);
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
@@ -109,10 +112,10 @@ public class MainActivity extends AppCompatActivity {
private void initData() {
isFloatingShown = PrefUtils.getFloatingShown(this);
- if (isFloatingShown != FLOATING_NONE) {
+ if (isFloatingShown != ConstValue.FLOATING_NONE) {
selectedFloatingMode = isFloatingShown;
} else {
- selectedFloatingMode = FLOATING_SINGLE;
+ selectedFloatingMode = ConstValue.FLOATING_SINGLE;
}
logDebug("initData: 初始化 isFloatingShown=" + isFloatingShown + ", selectedFloatingMode=" + selectedFloatingMode);
@@ -153,21 +156,21 @@ public class MainActivity extends AppCompatActivity {
});
binding.single.setOnClickListener(v -> {
- if (isFloatingShown != FLOATING_NONE) {
+ if (isFloatingShown != ConstValue.FLOATING_NONE) {
Toast.makeText(this, "请先关闭悬浮窗再切换模式", Toast.LENGTH_SHORT).show();
return;
}
- selectedFloatingMode = FLOATING_SINGLE;
+ selectedFloatingMode = ConstValue.FLOATING_SINGLE;
updateSelectionButtons();
logDebug("选择单点模式. selectedFloatingMode=" + selectedFloatingMode);
});
binding.multi.setOnClickListener(v -> {
- if (isFloatingShown != FLOATING_NONE) {
+ if (isFloatingShown != ConstValue.FLOATING_NONE) {
Toast.makeText(this, "Please close the floating window first and then switch the mode", Toast.LENGTH_SHORT).show();
return;
}
- selectedFloatingMode = FLOATING_MULTI;
+ selectedFloatingMode = ConstValue.FLOATING_MULTI;
updateSelectionButtons();
logDebug("选择多点模式. selectedFloatingMode=" + selectedFloatingMode);
});
@@ -184,27 +187,28 @@ public class MainActivity extends AppCompatActivity {
if (!accessibilityGranted) {
logDebug("无障碍服务未启用,请求权限");
- showPermissionRequest();
+ showAccessServiceDialog();
setStartButtonEnabled(false);
return false;
}
if (!overlayGranted) {
logDebug("悬浮窗权限未授予,请求权限");
- Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION, Uri.parse("package:" + getPackageName()));
- showPermissionRequest(intent, "Please grant the floating window permission; otherwise, the floating window cannot be displayed", "The floating window setting cannot be opened");
+ showFloatingDialog();
+
+
setStartButtonEnabled(false);
return false;
}
- if (!batteryOptimizationIgnored) {
- logDebug("电池优化未忽略,请求权限");
- Intent intent = new Intent(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS);
- intent.setData(Uri.parse("package:" + getPackageName()));
- showPermissionRequest(intent, "Please disable battery optimization to ensure the stable operation of the application in the background", "The battery optimization Settings cannot be opened");
- setStartButtonEnabled(false);
- return false;
- }
+// if (!batteryOptimizationIgnored) {
+// logDebug("电池优化未忽略,请求权限");
+// Intent intent = new Intent(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS);
+// intent.setData(Uri.parse("package:" + getPackageName()));
+// showPermissionRequest(intent, "Please disable battery optimization to ensure the stable operation of the application in the background", "The battery optimization Settings cannot be opened");
+// setStartButtonEnabled(false);
+// return false;
+// }
logDebug("所有权限均已授予");
setStartButtonEnabled(true);
@@ -220,13 +224,13 @@ public class MainActivity extends AppCompatActivity {
}
private void handleIncomingIntent(Intent intent) {
- int mode = intent.getIntExtra(EXTRA_FLOATING_MODE, FLOATING_NONE);
+ int mode = intent.getIntExtra(EXTRA_FLOATING_MODE, ConstValue.FLOATING_NONE);
Log.d(TAG, "mode: " + mode);
- if (mode != FLOATING_NONE) {
- if (mode == FLOATING_SINGLE) {
+ if (mode != ConstValue.FLOATING_NONE) {
+ if (mode == ConstValue.FLOATING_SINGLE) {
binding.single.performClick();
binding.animatedView.performClick();
- } else if (mode == FLOATING_MULTI) {
+ } else if (mode == ConstValue.FLOATING_MULTI) {
binding.multi.performClick();
binding.animatedView.performClick();
}
@@ -242,7 +246,7 @@ public class MainActivity extends AppCompatActivity {
if (!accessibilityGranted) {
logDebug("无障碍服务未启用,请求权限");
- showPermissionRequest();
+ showAccessServiceDialog();
setStartButtonEnabled(false);
return;
@@ -250,33 +254,66 @@ public class MainActivity extends AppCompatActivity {
if (!overlayGranted) {
logDebug("悬浮窗权限未授予,请求权限");
- Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION, Uri.parse("package:" + getPackageName()));
- showPermissionRequest(intent, "Please grant the floating window permission; otherwise, the floating window cannot be displayed", "The floating window setting cannot be opened");
+ showFloatingDialog();
+
setStartButtonEnabled(false);
return;
}
- if (!batteryOptimizationIgnored) {
- logDebug("电池优化未忽略,请求权限");
- Intent intent = new Intent(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS);
- intent.setData(Uri.parse("package:" + getPackageName()));
- showPermissionRequest(intent, "Please disable battery optimization to ensure the stable operation of the application in the background", "The battery optimization Settings cannot be opened");
- setStartButtonEnabled(false);
-
- return;
- }
+// if (!batteryOptimizationIgnored) {
+// logDebug("电池优化未忽略,请求权限");
+// Intent intent = new Intent(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS);
+// intent.setData(Uri.parse("package:" + getPackageName()));
+// showPermissionRequest(intent, "Please disable battery optimization to ensure the stable operation of the application in the background", "The battery optimization Settings cannot be opened");
+// setStartButtonEnabled(false);
+//
+// return;
+// }
logDebug("所有权限均已授予");
setStartButtonEnabled(true);
}
- private void showPermissionRequest() {
+ private void showAccessServiceDialog() {
+ if (accesDialog == null) {
+ accesDialog = new DialogPermission();
+ accesDialog.setListener(new Function1() {
+ @Override
+ public Unit invoke(Boolean aBoolean) {
+ if (aBoolean) {
+ openAccessService();
+ }
+ return null;
+ }
+ });
+ }
+ accesDialog.show(getSupportFragmentManager(), "");
+
+ }
+
+ private void showFloatingDialog() {
+ if (floatingDialog == null) {
+ floatingDialog = new DialogFloatingWindows();
+ floatingDialog.setListener(new Function1() {
+ @Override
+ public Unit invoke(Boolean aBoolean) {
+ launchFloatingPermission("Please grant the floating window permission; otherwise, the floating window cannot be displayed", "The floating window setting cannot be opened");
+ return null;
+ }
+ });
+ }
+ floatingDialog.show(getSupportFragmentManager(), "MyBottomSheet");
+
+ }
+
+ //开启无障碍服务
+ private void openAccessService() {
try {
Intent intent = new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS);
permissionLauncher.launch(intent);
- Toast.makeText(this, "Please enable accessibility services to ensure the application works properly", Toast.LENGTH_LONG).show();
+// 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, "Accessibility Settings cannot be enabled", Toast.LENGTH_LONG).show();
@@ -284,10 +321,11 @@ public class MainActivity extends AppCompatActivity {
}
}
- private void showPermissionRequest(Intent intent, String toastMessage, String errorMessage) {
+ private void launchFloatingPermission(String toastMessage, String errorMessage) {
try {
+ Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION, Uri.parse("package:" + getPackageName()));
permissionLauncher.launch(intent);
- Toast.makeText(this, toastMessage, Toast.LENGTH_LONG).show();
+// Toast.makeText(this, toastMessage, Toast.LENGTH_LONG).show();
logDebug("尝试启动权限设置页面 (带URI): " + intent.getAction());
} catch (Exception e) {
Toast.makeText(this, errorMessage, Toast.LENGTH_LONG).show();
@@ -329,23 +367,25 @@ public class MainActivity extends AppCompatActivity {
}
private int getFloatingMode() {
- ActivityManager manager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
- if (manager == null) {
- logDebug("ActivityManager 为空");
- return FLOATING_NONE;
- }
-
- List runningServices = manager.getRunningServices(Integer.MAX_VALUE);
- for (ActivityManager.RunningServiceInfo service : runningServices) {
- if (ForegroundService.class.getName().equals(service.service.getClassName())) {
-
- int mode = PrefUtils.getFloatingShown(this);
- logDebug("前台服务正在运行,PrefUtils 获取浮窗模式: " + mode);
- return mode;
- }
- }
- logDebug("前台服务未运行");
- return FLOATING_NONE;
+// ActivityManager manager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
+// if (manager == null) {
+// logDebug("ActivityManager 为空");
+// return ConstValue.FLOATING_NONE;
+// }
+//
+// List runningServices = manager.getRunningServices(Integer.MAX_VALUE);
+// for (ActivityManager.RunningServiceInfo service : runningServices) {
+// if (ForegroundService.class.getName().equals(service.service.getClassName())) {
+//
+// int mode = PrefUtils.getFloatingShown(this);
+// logDebug("前台服务正在运行,PrefUtils 获取浮窗模式: " + mode);
+// return mode;
+// }
+// }
+// logDebug("前台服务未运行");
+ int mode = PrefUtils.getFloatingShown(this);
+ return mode;
+// return ConstValue.FLOATING_NONE;
}
public void onToggleFloatingWindowClicked() {
@@ -358,14 +398,14 @@ public class MainActivity extends AppCompatActivity {
lastClickTime = currentTime;
logDebug("点击启动/隐藏浮窗按钮. 当前 isFloatingShown=" + isFloatingShown + ", selectedFloatingMode=" + selectedFloatingMode);
- if (!isAccessibilityServiceEnabled() || !Settings.canDrawOverlays(this) || !isIgnoringBatteryOptimizations()) {
- Toast.makeText(this, "请授予所有必要权限", Toast.LENGTH_LONG).show();
- checkPermissions();
- logDebug("权限不足,无法启动浮窗,重新检查权限");
- return;
- }
+// if (!isAccessibilityServiceEnabled() || !Settings.canDrawOverlays(this) || !isIgnoringBatteryOptimizations()) {
+// Toast.makeText(this, "请授予所有必要权限", Toast.LENGTH_LONG).show();
+// checkPermissions();
+// logDebug("权限不足,无法启动浮窗,重新检查权限");
+// return;
+// }
- if (isFloatingShown != FLOATING_NONE && isFloatingShown != selectedFloatingMode) {
+ if (isFloatingShown != ConstValue.FLOATING_NONE && isFloatingShown != selectedFloatingMode) {
Toast.makeText(this, "已显示其他悬浮窗,请先关闭", Toast.LENGTH_SHORT).show();
logDebug("已显示其他模式的浮窗,请先关闭");
return;
@@ -380,7 +420,11 @@ public class MainActivity extends AppCompatActivity {
AutoClickService.getInstance().stopClicking();
logDebug("已停止 AutoClickService 点击");
}
- isFloatingShown = FLOATING_NONE;
+ Intent intent = new Intent();
+ intent.setAction(String.valueOf(ConstValue.FLOATING_NONE));
+ localBroadcastManager.sendBroadcast(intent);
+
+ isFloatingShown = ConstValue.FLOATING_NONE;
logDebug("悬浮窗已经隐藏");
} else {
@@ -388,11 +432,16 @@ public class MainActivity extends AppCompatActivity {
Intent serviceIntent = new Intent(this, ForegroundService.class);
serviceIntent.putExtra("FLOATING_TYPE", selectedFloatingMode);
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
- startForegroundService(serviceIntent);
- } else {
- startService(serviceIntent);
- }
+ Intent intent = new Intent();
+ intent.setAction(String.valueOf(selectedFloatingMode));
+ localBroadcastManager.sendBroadcast(intent);
+ // TODO: 2025/7/2
+
+// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+// startForegroundService(serviceIntent);
+// } else {
+// startService(serviceIntent);
+// }
isFloatingShown = selectedFloatingMode;
logDebug("悬浮窗已显示: " + selectedFloatingMode);
@@ -402,7 +451,7 @@ public class MainActivity extends AppCompatActivity {
broadcastFloatingState(isFloatingShown);
updateSelectionButtons();
- if (isFloatingShown == FLOATING_NONE) {
+ if (isFloatingShown == ConstValue.FLOATING_NONE) {
setVideo(Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.bolangblue));
} else {
setVideo(Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.bolangred));
@@ -419,13 +468,13 @@ public class MainActivity extends AppCompatActivity {
private void updateSelectionButtons() {
logDebug("更新选择按钮UI: selectedFloatingMode=" + selectedFloatingMode);
- if (selectedFloatingMode == FLOATING_SINGLE) {
+ if (selectedFloatingMode == ConstValue.FLOATING_SINGLE) {
binding.single.setSelected(true);
binding.multi.setSelected(false);
binding.single.setBackgroundTintList(ContextCompat.getColorStateList(this, R.color.button_selected));
binding.multi.setBackgroundTintList(ContextCompat.getColorStateList(this, R.color.button_unselected));
- } else if (selectedFloatingMode == FLOATING_MULTI) {
+ } else if (selectedFloatingMode == ConstValue.FLOATING_MULTI) {
binding.single.setSelected(false);
binding.multi.setSelected(true);
@@ -433,10 +482,10 @@ public class MainActivity extends AppCompatActivity {
binding.multi.setBackgroundTintList(ContextCompat.getColorStateList(this, R.color.button_selected));
}
- binding.single.setEnabled(isFloatingShown == FLOATING_NONE);
- binding.multi.setEnabled(isFloatingShown == FLOATING_NONE);
+ binding.single.setEnabled(isFloatingShown == ConstValue.FLOATING_NONE);
+ binding.multi.setEnabled(isFloatingShown == ConstValue.FLOATING_NONE);
- if (isFloatingShown == FLOATING_NONE) {
+ if (isFloatingShown == ConstValue.FLOATING_NONE) {
setVideo(Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.bolangblue));
} else {
setVideo(Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.bolangred));
diff --git a/app/src/main/java/com/auto/clicker/autoclicker/ui/activity/main/QuestionActivity.java b/app/src/main/java/com/auto/clicker/autoclicker/ui/activity/main/QuestionActivity.java
index 92a63fc..4086ce5 100644
--- a/app/src/main/java/com/auto/clicker/autoclicker/ui/activity/main/QuestionActivity.java
+++ b/app/src/main/java/com/auto/clicker/autoclicker/ui/activity/main/QuestionActivity.java
@@ -1,6 +1,7 @@
package com.auto.clicker.autoclicker.ui.activity.main;
import android.os.Bundle;
+import android.view.View;
import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
@@ -17,6 +18,12 @@ public class QuestionActivity extends AppCompatActivity {
super.onCreate(savedInstanceState);
EdgeToEdge.enable(this);
setContentView(R.layout.activity_question);
+ findViewById(R.id.btn_back).setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ finish();
+ }
+ });
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
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 aa0878b..e853703 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
@@ -37,7 +37,7 @@ public class MenuActivity extends AppCompatActivity {
}
private void initData() {
- setupItem(R.id.scripts, R.drawable.scripts, "Scripts", "Your Saved Scripts");
+// setupItem(R.id.scripts, R.drawable.scripts, "Scripts", "Your Saved Scripts");
setupItem(R.id.trouble, R.drawable.trouble, "Troubleshooting", "Repair your app");
setupItem(R.id.battery, R.drawable.battery, "Battery Limit Free", "Background battery usage");
setupItem(R.id.question, R.drawable.menu_question, "How To Use?", "How to use can use app controller");
@@ -50,10 +50,10 @@ public class MenuActivity extends AppCompatActivity {
private void initEvent() {
binding.btnBack.setOnClickListener(v -> finish());
- binding.scripts.arrow.setOnClickListener(v -> {
- Intent intent = new Intent(this, ScriptsActivity.class);
- startActivity(intent);
- });
+// binding.scripts.arrow.setOnClickListener(v -> {
+// Intent intent = new Intent(this, ScriptsActivity.class);
+// startActivity(intent);
+// });
binding.trouble.arrow.setOnClickListener(v -> {
Intent intent = new Intent(this, TroubleshootingActivity.class);
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 bfd8de9..e25efb0 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
@@ -10,15 +10,17 @@ import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;
+import com.auto.clicker.autoclicker.MyApplication;
import com.auto.clicker.autoclicker.R;
import com.auto.clicker.autoclicker.databinding.ActivitySplashBinding;
import com.auto.clicker.autoclicker.ui.activity.main.MainActivity;
+import com.auto.clicker.autoclicker.util.ScreenUtils;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
public class SplashActivity extends AppCompatActivity {
private ActivitySplashBinding binding;
- private static final long TOTAL_TIME = 1000;
+ private static final long TOTAL_TIME = 2000;
private CountDownTimer countDownTimer;
@Override
@@ -27,23 +29,21 @@ public class SplashActivity extends AppCompatActivity {
binding = ActivitySplashBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot());
- EdgeToEdge.enable(this);
- ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
- Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
- v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
- return insets;
- });
+ ScreenUtils.setStatusBarTextColor(this,false);
+// EdgeToEdge.enable(this);
+// ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
+// Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
+// v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
+// return insets;
+// });
- Glide.with(this)
- .load(R.mipmap.ic_launcher)
- .transform(new RoundedCorners(32))
- .into(binding.image);
+ binding.mainTitle.setTypeface(MyApplication.fromAsset);
countDownTimer = new CountDownTimer(TOTAL_TIME,100) {
@Override
public void onTick(long millisUntilFinished) {
- int percentage = (int) (100 - (float) millisUntilFinished / TOTAL_TIME * 100);
- binding.progress.setProgress(percentage);
+// int percentage = (int) (100 - (float) millisUntilFinished / TOTAL_TIME * 100);
+// binding.progress.setProgress(percentage);
}
@Override
@@ -56,7 +56,7 @@ public class SplashActivity extends AppCompatActivity {
}
private void startMain() {
- binding.progress.setProgress(100);
+// binding.progress.setProgress(100);
Intent intent = new Intent(SplashActivity.this, MainActivity.class);
startActivity(intent);
diff --git a/app/src/main/java/com/auto/clicker/autoclicker/ui/adapter/setting/SettingAdapter.java b/app/src/main/java/com/auto/clicker/autoclicker/ui/adapter/setting/SettingAdapter.java
index 78a589a..062c8f8 100644
--- a/app/src/main/java/com/auto/clicker/autoclicker/ui/adapter/setting/SettingAdapter.java
+++ b/app/src/main/java/com/auto/clicker/autoclicker/ui/adapter/setting/SettingAdapter.java
@@ -17,7 +17,7 @@ public class SettingAdapter extends FragmentStateAdapter {
public SettingAdapter(@NonNull FragmentActivity fragmentActivity) {
super(fragmentActivity);
fragmentList = new ArrayList<>();
- fragmentList.add(new ActionFragment());
+// fragmentList.add(new ActionFragment());
fragmentList.add(new UISizeFragment());
}
diff --git a/app/src/main/java/com/auto/clicker/autoclicker/ui/dialog/DialogFloatingWindows.kt b/app/src/main/java/com/auto/clicker/autoclicker/ui/dialog/DialogFloatingWindows.kt
new file mode 100644
index 0000000..56ec973
--- /dev/null
+++ b/app/src/main/java/com/auto/clicker/autoclicker/ui/dialog/DialogFloatingWindows.kt
@@ -0,0 +1,53 @@
+package com.auto.clicker.autoclicker.ui.dialog
+
+import android.os.Bundle
+import android.view.Gravity
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.view.WindowManager
+import androidx.fragment.app.DialogFragment
+import com.auto.clicker.autoclicker.R
+import com.auto.clicker.autoclicker.databinding.AccessibilityDialogViewBinding
+import com.auto.clicker.autoclicker.databinding.SystemDialogViewBinding
+import com.google.android.material.bottomsheet.BottomSheetDialogFragment
+
+class DialogFloatingWindows : BottomSheetDialogFragment() {
+ private lateinit var viewBind: SystemDialogViewBinding
+ private var mListener: ((agree:Boolean) -> Unit)? = null
+
+
+
+ fun setListener(listener:(agree:Boolean) -> Unit){
+ mListener = listener
+ }
+
+ override fun onCreateView(
+ inflater: LayoutInflater,
+ container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View? {
+
+ viewBind = SystemDialogViewBinding.inflate(inflater, container, false)
+ isCancelable = false
+ dialog?.window?.apply {
+ dialog?.setCanceledOnTouchOutside(true)
+ setBackgroundDrawableResource(R.color.transparent)
+ decorView.setPadding(0, 0, 0, 0)
+ val layoutParams = attributes
+ layoutParams.width = WindowManager.LayoutParams.MATCH_PARENT
+ layoutParams.height = WindowManager.LayoutParams.WRAP_CONTENT
+ layoutParams.gravity = Gravity.CENTER
+ attributes = layoutParams
+ }
+ viewBind.enableSys.setOnClickListener {
+ mListener?.invoke(true)
+ dismiss()
+ }
+
+
+
+
+ return viewBind.root
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/auto/clicker/autoclicker/ui/dialog/DialogPermission.kt b/app/src/main/java/com/auto/clicker/autoclicker/ui/dialog/DialogPermission.kt
new file mode 100644
index 0000000..d40bbd8
--- /dev/null
+++ b/app/src/main/java/com/auto/clicker/autoclicker/ui/dialog/DialogPermission.kt
@@ -0,0 +1,54 @@
+package com.auto.clicker.autoclicker.ui.dialog
+
+import android.os.Bundle
+import android.view.Gravity
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.view.WindowManager
+import androidx.fragment.app.DialogFragment
+import com.auto.clicker.autoclicker.R
+import com.auto.clicker.autoclicker.databinding.AccessibilityDialogViewBinding
+
+class DialogPermission : DialogFragment() {
+ private lateinit var viewBind: AccessibilityDialogViewBinding
+ private var mListener: ((agree:Boolean) -> Unit)? = null
+
+
+
+ fun setListener(listener:(agree:Boolean) -> Unit){
+ mListener = listener
+ }
+
+ override fun onCreateView(
+ inflater: LayoutInflater,
+ container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View? {
+
+ viewBind = AccessibilityDialogViewBinding.inflate(inflater, container, false)
+ isCancelable = false
+ dialog?.window?.apply {
+ dialog?.setCanceledOnTouchOutside(true)
+ setBackgroundDrawableResource(R.color.transparent)
+ decorView.setPadding(0, 0, 0, 0)
+ val layoutParams = attributes
+ layoutParams.width = WindowManager.LayoutParams.MATCH_PARENT
+ layoutParams.height = WindowManager.LayoutParams.WRAP_CONTENT
+ layoutParams.gravity = Gravity.CENTER
+ attributes = layoutParams
+ }
+ viewBind.btnOk.setOnClickListener {
+ mListener?.invoke(true)
+ dismiss()
+ }
+
+ viewBind.btnCancel.setOnClickListener {
+ mListener?.invoke(false)
+ dismiss()
+ }
+
+
+ return viewBind.root
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/auto/clicker/autoclicker/ui/fragment/setting/UISizeFragment.java b/app/src/main/java/com/auto/clicker/autoclicker/ui/fragment/setting/UISizeFragment.java
index 9796c59..51b327a 100644
--- a/app/src/main/java/com/auto/clicker/autoclicker/ui/fragment/setting/UISizeFragment.java
+++ b/app/src/main/java/com/auto/clicker/autoclicker/ui/fragment/setting/UISizeFragment.java
@@ -1,5 +1,6 @@
package com.auto.clicker.autoclicker.ui.fragment.setting;
+import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.util.TypedValue;
@@ -10,9 +11,12 @@ import android.widget.SeekBar;
import android.widget.Toast;
import androidx.fragment.app.Fragment;
+import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import com.auto.clicker.autoclicker.databinding.FragmentUISizeBinding;
+import com.auto.clicker.autoclicker.service.AutoClickService;
import com.auto.clicker.autoclicker.service.ForegroundService;
+import com.auto.clicker.autoclicker.util.ConstValue;
import com.auto.clicker.autoclicker.view.FloatingViewManager;
public class UISizeFragment extends Fragment {
@@ -26,7 +30,7 @@ public class UISizeFragment extends Fragment {
private static final int MIN_CONTROL_BAR_WIDTH_DP = 20;
private static final int MAX_CONTROL_BAR_WIDTH_DP = 80;
-
+ private LocalBroadcastManager localBroadcastManager;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
@@ -34,16 +38,20 @@ public class UISizeFragment extends Fragment {
ForegroundService service = ForegroundService.getInstance();
if (service != null) {
- floatingViewManager = service.getFloatingViewManager();
+// floatingViewManager = service.getFloatingViewManager();
}
- if (floatingViewManager != null) {
- setupPointSizeControl();
- setupControlBarSizeControl();
- } else {
- Toast.makeText(getContext(), "The automated service is not running and the UI size setting function is unavailable.", Toast.LENGTH_LONG).show();
- disableAllControlUI();
- }
+// if (floatingViewManager != null) {
+// setupPointSizeControl();
+// setupControlBarSizeControl();
+// } else {
+// Toast.makeText(getContext(), "The automated service is not running and the UI size setting function is unavailable.", Toast.LENGTH_LONG).show();
+// disableAllControlUI();
+// }
+ localBroadcastManager = LocalBroadcastManager.getInstance(requireContext());
+ floatingViewManager = AutoClickService.getFloatingViewManager();
+ setupPointSizeControl();
+ setupControlBarSizeControl();
return binding.getRoot();
}
@@ -72,13 +80,32 @@ public class UISizeFragment extends Fragment {
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
int finalSize = seekBar.getProgress() + MIN_POINT_SIZE;
- floatingViewManager.setTouchPointSize(finalSize);
+// floatingViewManager.setTouchPointSize(finalSize);
+ sendUpdatePointSize(finalSize);
Log.d(TAG, "触摸点大小设置为: " + finalSize + "px");
Toast.makeText(getContext(), "The size of the touch points has been updated", Toast.LENGTH_SHORT).show();
}
});
}
+
+ //发送广播通知更新Ui size
+ private void sendUpdatePointSize(int size){
+ Intent intent = new Intent();
+ intent.setAction(String.valueOf(ConstValue.FLOATING_UPDATE_SIZE));
+ intent.putExtra(ConstValue.KEY_UPDATE_SIZE,size);
+ localBroadcastManager.sendBroadcast(intent);
+ }
+
+
+ //发送广播通知更新Ui size
+ private void sendUpdateBarSize(int size){
+ Intent intent = new Intent();
+ intent.setAction(String.valueOf(ConstValue.FLOATING_UPDATE_BAR_SIZE));
+ intent.putExtra(ConstValue.KEY_UPDATE_BAR_SIZE,size);
+ localBroadcastManager.sendBroadcast(intent);
+ }
+
private void setupControlBarSizeControl() {
int minControlBarWidthPx = dpToPx(MIN_CONTROL_BAR_WIDTH_DP);
int maxControlBarWidthPx = dpToPx(MAX_CONTROL_BAR_WIDTH_DP);
@@ -107,7 +134,8 @@ public class UISizeFragment extends Fragment {
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
int finalWidthPx = seekBar.getProgress() + minControlBarWidthPx;
- floatingViewManager.setControlBarSize(finalWidthPx);
+ sendUpdateBarSize(finalWidthPx);
+// floatingViewManager.setControlBarSize(finalWidthPx);
Log.d(TAG, "控制栏大小设置为: " + pxToDp(finalWidthPx) + "dp (" + finalWidthPx + "px)");
Toast.makeText(getContext(), "The size of the control bar has been updated", Toast.LENGTH_SHORT).show();
}
diff --git a/app/src/main/java/com/auto/clicker/autoclicker/util/ConstValue.kt b/app/src/main/java/com/auto/clicker/autoclicker/util/ConstValue.kt
new file mode 100644
index 0000000..f60fcac
--- /dev/null
+++ b/app/src/main/java/com/auto/clicker/autoclicker/util/ConstValue.kt
@@ -0,0 +1,14 @@
+package com.auto.clicker.autoclicker.util
+
+object ConstValue {
+
+ const val FLOATING_NONE = 0
+ const val FLOATING_SINGLE = 1
+ const val FLOATING_MULTI = 2
+
+ const val FLOATING_UPDATE_SIZE = 3
+ const val KEY_UPDATE_SIZE = "update_size"
+
+ const val FLOATING_UPDATE_BAR_SIZE =4
+ const val KEY_UPDATE_BAR_SIZE = "update_bar_size"
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/auto/clicker/autoclicker/util/EventViewBinder.java b/app/src/main/java/com/auto/clicker/autoclicker/util/EventViewBinder.java
index 80202bf..b4f133e 100644
--- a/app/src/main/java/com/auto/clicker/autoclicker/util/EventViewBinder.java
+++ b/app/src/main/java/com/auto/clicker/autoclicker/util/EventViewBinder.java
@@ -34,7 +34,7 @@ public class EventViewBinder {
OnPositionChangedCallback callback, int order, float initialTextSize) {
TextView pointView = createTouchPointView(context, String.valueOf(order));
- Log.d("bind", "id: " + order);
+
WindowManager.LayoutParams params = createTouchPointParams(context, touchPointSize);
params.x = pointEvent.getX();
@@ -56,6 +56,7 @@ public class EventViewBinder {
pointView.setOnTouchListener(touchListener);
activeDragListeners.put(pointView, touchListener);
+ Log.d("bind", "addView"+"------------bindPoint id: " + order);
windowManager.addView(pointView, params);
}
@@ -195,21 +196,32 @@ public class EventViewBinder {
}
private static WindowManager.LayoutParams createTouchPointParams(Context context, int size) {
- int overlayType = Build.VERSION.SDK_INT >= Build.VERSION_CODES.O ?
- WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY :
- WindowManager.LayoutParams.TYPE_PHONE;
+ // TODO: 2025/7/2 点击事件穿透
+// int overlayType = Build.VERSION.SDK_INT >= Build.VERSION_CODES.O ?
+// WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY :
+// WindowManager.LayoutParams.TYPE_PHONE;
+
+// WindowManager.LayoutParams params = new WindowManager.LayoutParams(
+// size, size,
+// overlayType,
+// WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE |
+// WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL,
+// PixelFormat.TRANSLUCENT
+
+ int overlayType = WindowManager.LayoutParams.TYPE_ACCESSIBILITY_OVERLAY;
WindowManager.LayoutParams params = new WindowManager.LayoutParams(
size, size,
overlayType,
- WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE |
- WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL,
- PixelFormat.TRANSLUCENT
+ WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE, PixelFormat.TRANSLUCENT
);
params.gravity = Gravity.TOP | Gravity.START;
return params;
}
+
+
+
private static WindowManager.LayoutParams createLineViewParams(Context context) {
int overlayType = Build.VERSION.SDK_INT >= Build.VERSION_CODES.O ?
WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY :
diff --git a/app/src/main/java/com/auto/clicker/autoclicker/util/ScreenUtils.java b/app/src/main/java/com/auto/clicker/autoclicker/util/ScreenUtils.java
index 13ec4e8..24578c8 100644
--- a/app/src/main/java/com/auto/clicker/autoclicker/util/ScreenUtils.java
+++ b/app/src/main/java/com/auto/clicker/autoclicker/util/ScreenUtils.java
@@ -1,8 +1,12 @@
package com.auto.clicker.autoclicker.util;
+import android.app.Activity;
import android.content.Context;
import android.graphics.Point;
import android.util.DisplayMetrics;
+import android.view.View;
+import android.view.Window;
+import android.view.WindowManager;
public class ScreenUtils {
@@ -11,4 +15,18 @@ public class ScreenUtils {
DisplayMetrics metrics = context.getResources().getDisplayMetrics();
return new Point(metrics.widthPixels, metrics.heightPixels);
}
+
+
+ public static void setStatusBarTextColor(Activity activity, boolean dark) {
+ Window window = activity.getWindow();
+ View decor = window.getDecorView();
+ if (dark) {
+ decor.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
+ | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
+ } else {
+ decor.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
+ | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
+ }
+ window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
+ }
}
\ No newline at end of file
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 53aca59..db931be 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
@@ -48,7 +48,7 @@ import java.util.ArrayList;
import java.util.List;
public class FloatingViewManager {
- private static final String TAG = "FloatingViewManager";
+ private static final String TAG = "TAG----------FloatingViewManager";
public static final long DEBOUNCE_INTERVAL = 500;
private int mode;
@@ -112,9 +112,9 @@ public class FloatingViewManager {
}
public void showFloatingViews(int mode) throws SecurityException {
- if (!Settings.canDrawOverlays(context)) {
- throw new SecurityException("A floating window permit is required");
- }
+// if (!Settings.canDrawOverlays(context)) {
+// throw new SecurityException("A floating window permit is required");
+// }
this.mode = mode;
@@ -255,9 +255,9 @@ public class FloatingViewManager {
removeButton.setOnClickListener(v -> removeLastEvent());
slideButton.setOnClickListener(v -> addSlideEvent());
- saveButton.setOnClickListener(v -> {
- floatingTabDialogManager.showFloatingTabDialog();
- });
+// saveButton.setOnClickListener(v -> {
+// floatingTabDialogManager.showFloatingTabDialog();
+// });
eyeButton.setOnClickListener(v -> {
areEventsVisible = !areEventsVisible;
@@ -292,6 +292,7 @@ public class FloatingViewManager {
if (isMultipleRunning) {
stopMultiClicking(service);
} else {
+ updateTouchPointsBackground(false,R.drawable.touch_point);
startMultiClicking(service);
}
@@ -340,27 +341,30 @@ public class FloatingViewManager {
eventOrderCounter++;
}
- public void toggleEventsVisibility(boolean show) {
+ private void toggleEventsVisibility(boolean show) {
for (EventWrapper wrapper : new ArrayList<>(runtimeEvents)) {
WindowManager.LayoutParams params = null;
if (wrapper.getType() == EventWrapper.EventType.POINT) {
PointEvent pointEvent = (PointEvent) wrapper.getEvent();
View pointView = pointEvent.getView();
-
+ // TODO: 2025/11/18
if (pointView != null) {
params = (WindowManager.LayoutParams) pointView.getLayoutParams();
if (params != null) {
if (show) {
+ Log.d("-----------","show");
pointView.setAlpha(1.0f);
params.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE |
WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL;
} else {
+ Log.d("-----------","hide");
pointView.setAlpha(0.0f);
params.flags = WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE |
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE |
WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL;
}
+ Log.d(TAG,"updateViewLayout-----------11111111111");
windowManager.updateViewLayout(pointView, params);
}
}
@@ -382,6 +386,7 @@ public class FloatingViewManager {
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE |
WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL;
}
+ Log.d(TAG,"updateViewLayout-----------222222222222");
windowManager.updateViewLayout(startPointView, params);
}
}
@@ -400,6 +405,7 @@ public class FloatingViewManager {
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE |
WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL;
}
+ Log.d(TAG,"updateViewLayout-----------333333333333333");
windowManager.updateViewLayout(endPointView, params);
}
}
@@ -419,6 +425,7 @@ public class FloatingViewManager {
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE |
WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL;
}
+ Log.d(TAG,"updateViewLayout-----------444444444444");
windowManager.updateViewLayout(lineView, params);
}
}
@@ -464,21 +471,22 @@ public class FloatingViewManager {
private void startMultiClicking(AutoClickService service) {
service.addMultipleClickEvents(runtimeEvents);
+ setControlButtonsEnabled(false);
service.startClicking();
Log.d(TAG, "开始多点点击事件 " + runtimeEvents.size());
- Toast.makeText(context, "Click more to start", Toast.LENGTH_SHORT).show();
+// Toast.makeText(context, "Click more to start", Toast.LENGTH_SHORT).show();
+
+
- updateTouchPointsBackground(R.drawable.touch_point);
- setControlButtonsEnabled(false);
}
private void stopMultiClicking(AutoClickService service) {
service.stopClicking();
Toast.makeText(context, "Click more to stop", Toast.LENGTH_SHORT).show();
- updateTouchPointsBackground(R.drawable.ring_has_bg);
+ updateTouchPointsBackground(true,R.drawable.ring_has_bg);
setControlButtonsEnabled(true);
}
@@ -532,7 +540,7 @@ public class FloatingViewManager {
Log.d(TAG, "所有浮动视图(包括控制栏和事件)已移除");
}
- public void removeAllEventViews() {
+ private void removeAllEventViews() {
try {
for (EventWrapper wrapper : new ArrayList<>(runtimeEvents)) {
if (wrapper.getType() == EventWrapper.EventType.POINT) {
@@ -552,7 +560,7 @@ public class FloatingViewManager {
}
}
- public void removeMultipleControlBarView() {
+ private void removeMultipleControlBarView() {
try {
if (multipleControlBarView != null) {
safeRemoveView(multipleControlBarView);
@@ -573,21 +581,64 @@ public class FloatingViewManager {
}
}
- private void updateTouchPointsBackground(int resourceId) {
+ private void updateTouchPointsBackground(boolean canDrag,int resourceId) {
for (EventWrapper wrapper : new ArrayList<>(runtimeEvents)) {
if (wrapper.getType() == EventWrapper.EventType.POINT) {
PointEvent pe = (PointEvent) wrapper.getEvent();
- pe.getView().setBackgroundResource(resourceId);
+ TextView view = pe.getView();
+ WindowManager.LayoutParams layoutParams = pe.getLayoutParams();
+ view.setBackgroundResource(resourceId);
+ setFlag(canDrag,view,layoutParams);
+ Log.d(TAG, " canDrag= " + canDrag);
+ }else if (wrapper.getType() == EventWrapper.EventType.SLIDE) {
+ SlideEvent se = (SlideEvent) wrapper.getEvent();
+ PointEvent startPoint = se.getStartPoint();
+ TextView viewStart = startPoint.getView();
+ WindowManager.LayoutParams layoutParamsStartPoint = startPoint.getLayoutParams();
+
+ PointEvent endPoint = se.getEndPoint();
+ TextView viewEnd = endPoint.getView();
+ WindowManager.LayoutParams layoutParamsEndPoint = endPoint.getLayoutParams();
+
+ viewStart.setBackgroundResource(resourceId);
+ viewEnd.setBackgroundResource(resourceId);
+ Log.d(TAG, " viewStart viewEnd canDrag= " + canDrag);
+ setFlag(canDrag,viewStart,layoutParamsStartPoint);
+ setFlag(canDrag,viewEnd,layoutParamsEndPoint);
}
}
- for (EventWrapper wrapper : new ArrayList<>(runtimeEvents)) {
- if (wrapper.getType() == EventWrapper.EventType.SLIDE) {
- SlideEvent se = (SlideEvent) wrapper.getEvent();
- se.getStartPoint().getView().setBackgroundResource(resourceId);
- se.getEndPoint().getView().setBackgroundResource(resourceId);
- }
+ }
+ private void setFlag(boolean canDrag, TextView view,WindowManager.LayoutParams layoutParams) {
+ int tempFlag;
+// WindowManager.LayoutParams layoutParams = (WindowManager.LayoutParams) view.getLayoutParams();
+
+ if (canDrag) {
+ tempFlag = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
+ } else {
+ tempFlag = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE;
}
+ layoutParams.flags = tempFlag;
+
+ if(view.getWindowToken()!= null){
+ Log.d(TAG,"updateViewLayout-----------5555555555");
+ windowManager.updateViewLayout(view,layoutParams);
+ }
+// if(isStart){
+// Log.d(TAG, "----------------removeView");
+// windowManager.removeView(view);
+// }else {
+// if (view.getParent() == null) {
+// Log.d(TAG, "---------------addView");
+// windowManager.addView(view, layoutParams);
+// } else {
+// Log.d(TAG, "View already added, skip addView.");
+// }
+//
+// }
+
+
+
}
private void handleMissingService() {
@@ -605,7 +656,7 @@ public class FloatingViewManager {
}
}
- public void flashTouchPoint(int index) {
+ private void flashTouchPoint(int index) {
if (index >= 0 && index < runtimeEvents.size()) {
Event event = runtimeEvents.get(index).getEvent();
Log.d(TAG, "index : " + index);
@@ -643,7 +694,7 @@ public class FloatingViewManager {
if (isStopEvent) {
Log.d(TAG, "接收到停止点击完成广播,更新触点背景");
- updateTouchPointsBackground(R.drawable.ring_has_bg);
+ updateTouchPointsBackground(true,R.drawable.ring_has_bg);
setControlButtonsEnabled(true);
isMultipleRunning = false;
updatePlayButtonImage(false);
@@ -826,6 +877,7 @@ public class FloatingViewManager {
pointView.setTextSize(TypedValue.COMPLEX_UNIT_SP, newTextSize);
try {
+ Log.d(TAG,"updateViewLayout-----------666666666666");
windowManager.updateViewLayout(pointView, params);
} catch (IllegalArgumentException e) {
Log.w(TAG, "尝试更新不存在的点击点视图", e);
@@ -843,6 +895,7 @@ public class FloatingViewManager {
startParams.height = touchPointSize;
startView.setTextSize(TypedValue.COMPLEX_UNIT_SP, newTextSize);
try {
+ Log.d(TAG,"updateViewLayout-----------77777777777777");
windowManager.updateViewLayout(startView, startParams);
} catch (IllegalArgumentException e) {
Log.w(TAG, "尝试更新不存在的滑动起点视图", e);
@@ -856,6 +909,7 @@ public class FloatingViewManager {
endParams.height = touchPointSize;
endView.setTextSize(TypedValue.COMPLEX_UNIT_SP, newTextSize);
try {
+ Log.d(TAG,"updateViewLayout-----------888888888888888");
windowManager.updateViewLayout(endView, endParams);
} catch (IllegalArgumentException e) {
Log.w(TAG, "尝试更新不存在的滑动终点视图", e);
@@ -911,29 +965,29 @@ public class FloatingViewManager {
continue;
}
- int originalImgWidthDp = 0;
- int originalImgHeightDp = 0;
+ int originalImgWidthDp = 20;
+ int originalImgHeightDp = 20;
- if (imageView.getId() == R.id.play_button || imageView.getId() == R.id.add_button || imageView.getId() == R.id.remove_button || imageView.getId() == R.id.close_button) {
- originalImgWidthDp = 13;
- if (imageView.getId() == R.id.remove_button) {
- originalImgHeightDp = 2;
- } else {
- originalImgHeightDp = 13;
- }
- } else if (imageView.getId() == R.id.slide_button) {
- originalImgWidthDp = 17;
- originalImgHeightDp = 17;
- } else if (imageView.getId() == R.id.save_button) {
- originalImgWidthDp = 15;
- originalImgHeightDp = 15;
- } else if (imageView.getId() == R.id.eye_button) {
- originalImgWidthDp = 16;
- originalImgHeightDp = 9;
- } else if (imageView.getId() == R.id.settings_button) {
- originalImgWidthDp = 14;
- originalImgHeightDp = 14;
- }
+// if (imageView.getId() == R.id.play_button || imageView.getId() == R.id.add_button || imageView.getId() == R.id.remove_button || imageView.getId() == R.id.close_button) {
+// originalImgWidthDp = 13;
+// if (imageView.getId() == R.id.remove_button) {
+// originalImgHeightDp = 2;
+// } else {
+// originalImgHeightDp = 13;
+// }
+// } else if (imageView.getId() == R.id.slide_button) {
+// originalImgWidthDp = 17;
+// originalImgHeightDp = 17;
+// } else if (imageView.getId() == R.id.save_button) {
+// originalImgWidthDp = 15;
+// originalImgHeightDp = 15;
+// } else if (imageView.getId() == R.id.eye_button) {
+// originalImgWidthDp = 16;
+// originalImgHeightDp = 9;
+// } else if (imageView.getId() == R.id.settings_button) {
+// originalImgWidthDp = 14;
+// originalImgHeightDp = 14;
+// }
if (originalImgWidthDp > 0) {
// 根据原始 dp 值和缩放因子计算新的像素尺寸
@@ -997,4 +1051,24 @@ public class FloatingViewManager {
public EventRepository getEventRepository() {
return eventRepository;
}
+
+
+ public void setCanDrag(WindowManager.LayoutParams layoutParams,WindowManager windowManager,boolean isEnable) {
+
+ int tempFlag;
+
+ if (isEnable) {
+ tempFlag = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
+ } else {
+ tempFlag = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
+ | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE;
+ }
+
+ layoutParams.flags = tempFlag;
+
+// if (targetStartVB.getRoot().getWindowToken() != null) {
+// windowManager.updateViewLayout(targetStartVB.getRoot(), layoutParams);
+// }
+
+ }
}
\ No newline at end of file
diff --git a/app/src/main/res/drawable/dialog_bg.xml b/app/src/main/res/drawable/dialog_bg.xml
new file mode 100644
index 0000000..0e3b77b
--- /dev/null
+++ b/app/src/main/res/drawable/dialog_bg.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/dialog_bottom_bg.xml b/app/src/main/res/drawable/dialog_bottom_bg.xml
new file mode 100644
index 0000000..64029f7
--- /dev/null
+++ b/app/src/main/res/drawable/dialog_bottom_bg.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/dialog_button_bg.xml b/app/src/main/res/drawable/dialog_button_bg.xml
new file mode 100644
index 0000000..f3d2d2b
--- /dev/null
+++ b/app/src/main/res/drawable/dialog_button_bg.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/dialog_button_not_now.xml b/app/src/main/res/drawable/dialog_button_not_now.xml
new file mode 100644
index 0000000..8b42066
--- /dev/null
+++ b/app/src/main/res/drawable/dialog_button_not_now.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/dialog_ic1.png b/app/src/main/res/drawable/dialog_ic1.png
new file mode 100644
index 0000000..47dd8df
Binary files /dev/null and b/app/src/main/res/drawable/dialog_ic1.png differ
diff --git a/app/src/main/res/drawable/dialog_ic_click.png b/app/src/main/res/drawable/dialog_ic_click.png
new file mode 100644
index 0000000..54d6faa
Binary files /dev/null and b/app/src/main/res/drawable/dialog_ic_click.png differ
diff --git a/app/src/main/res/drawable/dialog_ic_slide.png b/app/src/main/res/drawable/dialog_ic_slide.png
new file mode 100644
index 0000000..a26d513
Binary files /dev/null and b/app/src/main/res/drawable/dialog_ic_slide.png differ
diff --git a/app/src/main/res/drawable/welcome.png b/app/src/main/res/drawable/welcome.png
new file mode 100644
index 0000000..9f2c6bd
Binary files /dev/null and b/app/src/main/res/drawable/welcome.png differ
diff --git a/app/src/main/res/layout/accessibility_dialog_view.xml b/app/src/main/res/layout/accessibility_dialog_view.xml
new file mode 100644
index 0000000..6883742
--- /dev/null
+++ b/app/src/main/res/layout/accessibility_dialog_view.xml
@@ -0,0 +1,143 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index 4f66822..c02eccb 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -23,6 +23,7 @@
android:layout_height="24dp"
android:layout_marginEnd="24dp"
android:src="@drawable/setting"
+ android:visibility="gone"
app:layout_constraintBottom_toBottomOf="@+id/title"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/title" />
@@ -44,10 +45,12 @@
android:id="@+id/question"
android:layout_width="24dp"
android:layout_height="24dp"
- android:layout_marginTop="48dp"
android:src="@drawable/question"
- app:layout_constraintEnd_toEndOf="@id/setting"
- app:layout_constraintTop_toBottomOf="@id/setting" />
+ app:layout_constraintTop_toTopOf="@id/title"
+ app:layout_constraintBottom_toBottomOf="@id/title"
+ app:layout_constraintEnd_toEndOf="parent"
+ android:layout_marginEnd="25dp"
+ android:layout_marginStart="15dp" />
-
+
+
+
+
+
+
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:src="@drawable/welcome"
+ app:layout_constraintBottom_toTopOf="@id/main_title"
+ app:layout_constraintTop_toTopOf="parent" />
+ app:layout_constraintStart_toStartOf="parent" />
+ app:layout_constraintBottom_toTopOf="@id/loading" />
+ android:layout_marginBottom="84dp"/>
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/multiple_control_bar.xml b/app/src/main/res/layout/multiple_control_bar.xml
index a1cbe98..bb1d6f1 100644
--- a/app/src/main/res/layout/multiple_control_bar.xml
+++ b/app/src/main/res/layout/multiple_control_bar.xml
@@ -13,51 +13,58 @@
@@ -79,8 +86,9 @@
diff --git a/app/src/main/res/layout/system_dialog_view.xml b/app/src/main/res/layout/system_dialog_view.xml
new file mode 100644
index 0000000..8e0b6c3
--- /dev/null
+++ b/app/src/main/res/layout/system_dialog_view.xml
@@ -0,0 +1,97 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png
deleted file mode 100644
index fdb275d..0000000
Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher.png and /dev/null differ
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp
deleted file mode 100644
index b2dfe3d..0000000
Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp and /dev/null differ
diff --git a/app/src/main/res/mipmap-hdpi/logo.png b/app/src/main/res/mipmap-hdpi/logo.png
deleted file mode 100644
index fdb275d..0000000
Binary files a/app/src/main/res/mipmap-hdpi/logo.png and /dev/null differ
diff --git a/app/src/main/res/mipmap-mdpi/logo.png b/app/src/main/res/mipmap-mdpi/logo.png
deleted file mode 100644
index cac04eb..0000000
Binary files a/app/src/main/res/mipmap-mdpi/logo.png and /dev/null differ
diff --git a/app/src/main/res/mipmap-xhdpi/logo.png b/app/src/main/res/mipmap-xhdpi/logo.png
deleted file mode 100644
index e0e3b9d..0000000
Binary files a/app/src/main/res/mipmap-xhdpi/logo.png and /dev/null differ
diff --git a/app/src/main/res/mipmap-xxhdpi/logo.png b/app/src/main/res/mipmap-xxhdpi/logo.png
deleted file mode 100644
index fceb970..0000000
Binary files a/app/src/main/res/mipmap-xxhdpi/logo.png and /dev/null differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/logo.png b/app/src/main/res/mipmap-xxxhdpi/logo.png
index 8afff10..9a64bad 100644
Binary files a/app/src/main/res/mipmap-xxxhdpi/logo.png and b/app/src/main/res/mipmap-xxxhdpi/logo.png differ
diff --git a/app/src/main/res/raw/bolangblue.mp4 b/app/src/main/res/raw/bolangblue.mp4
index c1872d1..76f00c6 100644
Binary files a/app/src/main/res/raw/bolangblue.mp4 and b/app/src/main/res/raw/bolangblue.mp4 differ
diff --git a/app/src/main/res/raw/bolangred.mp4 b/app/src/main/res/raw/bolangred.mp4
index e19bc0b..ad0f924 100644
Binary files a/app/src/main/res/raw/bolangred.mp4 and b/app/src/main/res/raw/bolangred.mp4 differ
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
index 9fe88d3..41a6acd 100644
--- a/app/src/main/res/values/colors.xml
+++ b/app/src/main/res/values/colors.xml
@@ -11,4 +11,8 @@
#1A546B
#171717
#368298
+ #98A2A6
+ #6CDAFB
+ #FFFFFFFF
+ #00000000
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index d9996db..b88846a 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -5,7 +5,7 @@
I have read and Accept the Privacy Policy and
Terms & Conditions
- AUTO CLICKER
+ AUTO CLICKER
Automatic Tap & Gesture
Loading . . .
Start
@@ -51,4 +51,18 @@ functionalities.
infinitely
Duration
Cycle
+ We use AccessibilityService API services to help implement our app\'s main features, such as simulating auto clicks and swipes on the screen. Please click I Agree, then select Click Helper in the list and activate the service
+ I Agree
+ Cancel
+ Enable
+ Floating window permissions,used to display the operation bar
+ Accessibility
+ Please allow Auto Clicker to use the
+Accessibility Service for app features.
+ Why we use this\npermission?
+ Auto Clicker uses the Accessibility Service API
+permission to enable the following core
+functionalities.
+ -Simulating clicks on device screen
+ Floating window
\ No newline at end of file
diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml
index 5039878..16aaa66 100644
--- a/app/src/main/res/values/themes.xml
+++ b/app/src/main/res/values/themes.xml
@@ -3,7 +3,7 @@
diff --git a/build.gradle.kts b/build.gradle.kts
index 3756278..4b3a2a4 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -1,4 +1,7 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
alias(libs.plugins.android.application) apply false
+ alias(libs.plugins.kotlin.android) apply false
+// id("com.android.application") version "8.1.3" apply false
+// id("org.jetbrains.kotlin.android") version "1.9.0" apply false
}
\ No newline at end of file
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index acf0863..96a0006 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -1,5 +1,6 @@
[versions]
-agp = "8.10.1"
+agp = "8.1.3"
+kotlin = "1.9.0"
junit = "4.13.2"
junitVersion = "1.2.1"
espressoCore = "3.6.1"
@@ -16,7 +17,11 @@ appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "a
material = { group = "com.google.android.material", name = "material", version.ref = "material" }
activity = { group = "androidx.activity", name = "activity", version.ref = "activity" }
constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "constraintlayout" }
+kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlin"}
+
[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }
+kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
+
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index d44aa2d..d540e63 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,4 +1,4 @@
-#Tue May 06 14:18:38 CST 2025
+#Tue Jul 01 14:26:38 CST 2025
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip