处理bug
@ -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")
|
||||
}
|
||||
@ -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" />
|
||||
<activity
|
||||
android:name=".ui.activity.welcome.SplashActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".ui.activity.welcome.LauncherActivity"
|
||||
android:exported="true">
|
||||
android:exported="true" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
@ -64,6 +61,7 @@
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
|
||||
<service
|
||||
android:name=".service.AutoClickService"
|
||||
android:enabled="true"
|
||||
@ -82,6 +80,7 @@
|
||||
android:enabled="true"
|
||||
android:exported="false"
|
||||
android:foregroundServiceType="specialUse" />
|
||||
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
BIN
app/src/main/assets/myfont.ttf
Normal file
@ -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");
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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<EventWrapper> 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 =
|
||||
|
||||
@ -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, "悬浮窗已移除");
|
||||
}
|
||||
|
||||
@ -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<Boolean, Unit>() {
|
||||
@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<Boolean, Unit>() {
|
||||
@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<ActivityManager.RunningServiceInfo> runningServices = manager.getRunningServices(Integer.MAX_VALUE);
|
||||
for (ActivityManager.RunningServiceInfo service : runningServices) {
|
||||
if (ForegroundService.class.getName().equals(service.service.getClassName())) {
|
||||
|
||||
// ActivityManager manager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
|
||||
// if (manager == null) {
|
||||
// logDebug("ActivityManager 为空");
|
||||
// return ConstValue.FLOATING_NONE;
|
||||
// }
|
||||
//
|
||||
// List<ActivityManager.RunningServiceInfo> 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);
|
||||
logDebug("前台服务正在运行,PrefUtils 获取浮窗模式: " + mode);
|
||||
return mode;
|
||||
}
|
||||
}
|
||||
logDebug("前台服务未运行");
|
||||
return FLOATING_NONE;
|
||||
// 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));
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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());
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
}
|
||||
}
|
||||
@ -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
|
||||
}
|
||||
}
|
||||
@ -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) {
|
||||
// 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();
|
||||
} else {
|
||||
Toast.makeText(getContext(), "The automated service is not running and the UI size setting function is unavailable.", Toast.LENGTH_LONG).show();
|
||||
disableAllControlUI();
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
@ -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"
|
||||
}
|
||||
@ -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 :
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
@ -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);
|
||||
// }
|
||||
|
||||
}
|
||||
}
|
||||
7
app/src/main/res/drawable/dialog_bg.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners android:radius="15dp" />
|
||||
<solid android:color="@color/button_unselected"/>
|
||||
|
||||
</shape>
|
||||
7
app/src/main/res/drawable/dialog_bottom_bg.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners android:topRightRadius="15dp" android:topLeftRadius="15dp" />
|
||||
<solid android:color="@color/button_unselected"/>
|
||||
|
||||
</shape>
|
||||
7
app/src/main/res/drawable/dialog_button_bg.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners android:radius="13dp"/>
|
||||
<solid android:color="@color/blue"/>
|
||||
|
||||
</shape>
|
||||
7
app/src/main/res/drawable/dialog_button_not_now.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners android:radius="13dp"/>
|
||||
<stroke android:color="@color/blue" android:width="1dp"/>
|
||||
|
||||
</shape>
|
||||
BIN
app/src/main/res/drawable/dialog_ic1.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
app/src/main/res/drawable/dialog_ic_click.png
Normal file
|
After Width: | Height: | Size: 732 B |
BIN
app/src/main/res/drawable/dialog_ic_slide.png
Normal file
|
After Width: | Height: | Size: 652 B |
BIN
app/src/main/res/drawable/welcome.png
Normal file
|
After Width: | Height: | Size: 50 KiB |
143
app/src/main/res/layout/accessibility_dialog_view.xml
Normal file
@ -0,0 +1,143 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/dialog_bg"
|
||||
android:padding="20dp"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/logo"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:text="@string/Accessibility"
|
||||
android:textColor="@color/dialog_tv_color"
|
||||
android:textSize="28sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/sub1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/logo"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginStart="50dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginEnd="50dp"
|
||||
android:text="@string/sub1"
|
||||
android:textColor="@color/dialog_tv_color"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_alignTop="@id/text_why"
|
||||
android:layout_alignBottom="@id/text_why"
|
||||
android:src="@drawable/dialog_ic1" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_why"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/sub1"
|
||||
android:layout_alignStart="@id/sub1"
|
||||
android:layout_marginTop="15dp"
|
||||
android:lineSpacingExtra="4dp"
|
||||
android:text="@string/why"
|
||||
android:textColor="@color/color_6CDAFB"
|
||||
android:textSize="21sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_desc"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/text_why"
|
||||
android:layout_marginTop="10dp"
|
||||
android:lineSpacingExtra="3dp"
|
||||
android:text="@string/sub2"
|
||||
android:textColor="@color/dialog_tv_color"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/im_click"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_below="@id/tv_desc"
|
||||
android:layout_marginTop="20dp"
|
||||
android:src="@drawable/dialog_ic_click" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@id/im_click"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_toEndOf="@id/im_click"
|
||||
android:lineSpacingExtra="3dp"
|
||||
android:text="@string/tv_click"
|
||||
android:textColor="@color/dialog_tv_color"
|
||||
android:textSize="14sp" />
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/im_swipe"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_below="@id/im_click"
|
||||
android:layout_marginTop="12dp"
|
||||
android:src="@drawable/dialog_ic_slide" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@id/im_swipe"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_toEndOf="@id/im_swipe"
|
||||
android:lineSpacingExtra="3dp"
|
||||
android:text="@string/tv_click"
|
||||
android:textColor="@color/dialog_tv_color"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/im_swipe"
|
||||
android:layout_marginTop="25dp"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/btn_cancel"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="50dp"
|
||||
android:background="@drawable/dialog_button_not_now"
|
||||
android:gravity="center"
|
||||
android:text="@string/cancel"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="17sp" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/btn_ok"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="43dp"
|
||||
android:layout_below="@id/text"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_toEndOf="@id/btn_cancel"
|
||||
android:background="@drawable/dialog_button_bg"
|
||||
android:gravity="center"
|
||||
android:text="@string/ok"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="17sp" />
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@ -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" />
|
||||
|
||||
<VideoView
|
||||
android:id="@+id/animated_video"
|
||||
|
||||
@ -22,8 +22,9 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/btn_back"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_width="44dp"
|
||||
android:layout_height="44dp"
|
||||
android:padding="10dp"
|
||||
android:src="@drawable/back" />
|
||||
|
||||
<TextView
|
||||
@ -45,9 +46,9 @@
|
||||
android:textColor="@color/gray"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<include
|
||||
android:id="@+id/scripts"
|
||||
layout="@layout/item_menu" />
|
||||
<!-- <include-->
|
||||
<!-- android:id="@+id/scripts"-->
|
||||
<!-- layout="@layout/item_menu" />-->
|
||||
|
||||
<include
|
||||
android:id="@+id/trouble"
|
||||
|
||||
@ -7,6 +7,18 @@
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".ui.activity.main.QuestionActivity">
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/btn_back"
|
||||
android:layout_width="44dp"
|
||||
android:layout_height="44dp"
|
||||
android:src="@drawable/back"
|
||||
android:padding="10dp"
|
||||
android:layout_marginStart="20dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="@id/single_poin"
|
||||
app:layout_constraintTop_toTopOf="@id/single_poin" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/single_poin"
|
||||
android:layout_width="160dp"
|
||||
@ -17,8 +29,8 @@
|
||||
android:textColor="@color/white"
|
||||
android:textSize="28sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintLeft_toRightOf="@id/btn_back"
|
||||
android:layout_marginStart="20dp"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
|
||||
@ -9,10 +9,11 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/back"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="44dp"
|
||||
android:layout_height="44dp"
|
||||
android:layout_marginStart="23dp"
|
||||
android:src="@drawable/back"
|
||||
android:padding="10dp"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/setting_title"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/setting_title"
|
||||
@ -22,13 +23,13 @@
|
||||
android:id="@+id/setting_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="60dp"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginTop="28dp"
|
||||
android:text="Settings"
|
||||
app:layout_constraintLeft_toRightOf="@id/back"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="28sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<com.google.android.material.tabs.TabLayout
|
||||
|
||||
@ -5,18 +5,16 @@
|
||||
android:id="@+id/main"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/button_unselected"
|
||||
tools:context=".ui.activity.welcome.SplashActivity">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/image"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="150dp"
|
||||
android:src="@mipmap/ic_launcher"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.388" />
|
||||
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" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/main_title"
|
||||
@ -26,10 +24,9 @@
|
||||
android:text="@string/splash_main_title"
|
||||
android:textSize="32sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@id/subtitle"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/image" />
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/subtitle"
|
||||
@ -38,11 +35,12 @@
|
||||
android:layout_marginTop="8dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/splash_subtitle"
|
||||
android:textColor="@color/gray"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/color_98A2A6"
|
||||
android:textSize="19sp"
|
||||
android:layout_marginBottom="24dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/main_title" />
|
||||
app:layout_constraintBottom_toTopOf="@id/loading" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/loading"
|
||||
@ -51,26 +49,12 @@
|
||||
android:layout_marginTop="8dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/splash_loading"
|
||||
android:textColor="@color/gray"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/color_98A2A6"
|
||||
android:textSize="19sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/subtitle" />
|
||||
android:layout_marginBottom="84dp"/>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progress"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginStart="53dp"
|
||||
android:layout_marginEnd="53dp"
|
||||
android:layout_marginBottom="80dp"
|
||||
android:max="100"
|
||||
android:progress="0"
|
||||
android:progressDrawable="@drawable/progress_gradient"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@ -13,51 +13,58 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/play_button"
|
||||
android:layout_width="13dp"
|
||||
android:layout_height="13dp"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:padding="5dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:src="@drawable/play" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/add_button"
|
||||
android:layout_width="13dp"
|
||||
android:layout_height="13dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:padding="5dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:src="@drawable/add" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/remove_button"
|
||||
android:layout_width="13dp"
|
||||
android:layout_height="2dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:padding="5dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:src="@drawable/remove" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/slide_button"
|
||||
android:layout_width="17dp"
|
||||
android:layout_height="17dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:padding="2dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:src="@drawable/slide" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/save_button"
|
||||
android:layout_width="15dp"
|
||||
android:layout_height="15dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:visibility="gone"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:src="@drawable/save" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/eye_button"
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="9dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:padding="2dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:src="@drawable/eye" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/settings_button"
|
||||
android:layout_width="14dp"
|
||||
android:layout_height="14dp"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:padding="2dp"
|
||||
android:layout_marginBottom="9dp"
|
||||
android:src="@drawable/control_setting" />
|
||||
</LinearLayout>
|
||||
@ -79,8 +86,9 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/close_button"
|
||||
android:layout_width="10dp"
|
||||
android:layout_height="10dp"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:padding="5dp"
|
||||
android:layout_marginBottom="11dp"
|
||||
android:src="@drawable/cancel" />
|
||||
</LinearLayout>
|
||||
|
||||
97
app/src/main/res/layout/system_dialog_view.xml
Normal file
@ -0,0 +1,97 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/dialog_bottom_bg"
|
||||
android:paddingStart="10dp"
|
||||
android:paddingTop="10dp"
|
||||
android:paddingEnd="10dp"
|
||||
android:paddingBottom="25dp"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="@string/Floating_window"
|
||||
android:textColor="@color/dialog_tv_color"
|
||||
android:textSize="22sp" />
|
||||
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/layout_sys"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/title"
|
||||
android:layout_marginTop="25dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_toStartOf="@id/enable_sys"
|
||||
android:lineSpacingExtra="1dp"
|
||||
android:text="@string/Floating"
|
||||
android:textColor="@color/dialog_tv_color"
|
||||
android:textSize="15sp" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/enable_sys"
|
||||
android:layout_width="90dp"
|
||||
android:layout_height="33dp"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginStart="20dp"
|
||||
android:background="@drawable/dialog_button_bg"
|
||||
android:gravity="center"
|
||||
android:text="@string/Enable"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="17sp" />
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/layout_sys"
|
||||
android:layout_marginTop="25dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:visibility="gone">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:lineSpacingExtra="4dp"
|
||||
android:text="@string/Floating"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="16sp" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/enable_barrary"
|
||||
android:layout_width="90dp"
|
||||
android:layout_height="33dp"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginStart="20dp"
|
||||
android:background="@drawable/dialog_button_bg"
|
||||
android:gravity="center"
|
||||
android:text="@string/Enable"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="17sp" />
|
||||
</RelativeLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
Before Width: | Height: | Size: 6.7 KiB |
|
Before Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 6.7 KiB |
|
Before Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 219 KiB |
@ -11,4 +11,8 @@
|
||||
<color name="button_selected">#1A546B</color>
|
||||
<color name="button_unselected">#171717</color>
|
||||
<color name="close_blue">#368298</color>
|
||||
<color name="color_98A2A6">#98A2A6</color>
|
||||
<color name="color_6CDAFB">#6CDAFB</color>
|
||||
<color name="dialog_tv_color">#FFFFFFFF</color>
|
||||
<color name="transparent">#00000000</color>
|
||||
</resources>
|
||||
@ -5,7 +5,7 @@
|
||||
I have read and Accept the <font color="#0BC4FC"><a href="https://yourdomain.com/privacy">Privacy Policy</a></font> and
|
||||
<font color="#0BC4FC"><a href="https://yourdomain.com/terms">Terms & Conditions</a></font>
|
||||
</string>
|
||||
<string name="splash_main_title"><font color="#0BC4FC">AUTO</font> <font color="#FFFFFF">CLICKER</font></string>
|
||||
<string name="splash_main_title"><font color="#0BC4FC">AUTO</font>  <font color="#FFFFFF">CLICKER</font></string>
|
||||
<string name="splash_subtitle">Automatic Tap & Gesture</string>
|
||||
<string name="splash_loading">Loading . . .</string>
|
||||
<string name="start">Start</string>
|
||||
@ -51,4 +51,18 @@ functionalities.</string>
|
||||
<string name="infinitely_unit">infinitely</string>
|
||||
<string name="duration_unit">Duration</string>
|
||||
<string name="cycle_unit">Cycle</string>
|
||||
<string name="dialog_text">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</string>
|
||||
<string name="ok">I Agree</string>
|
||||
<string name="cancel">Cancel</string>
|
||||
<string name="Enable">Enable</string>
|
||||
<string name="Floating">Floating window permissions,used to display the operation bar</string>
|
||||
<string name="Accessibility">Accessibility</string>
|
||||
<string name="sub1">Please allow Auto Clicker to use the
|
||||
Accessibility Service for app features.</string>
|
||||
<string name="why">Why we use this\npermission?</string>
|
||||
<string name="sub2">Auto Clicker uses the Accessibility Service API
|
||||
permission to enable the following core
|
||||
functionalities.</string>
|
||||
<string name="tv_click">-Simulating clicks on device screen</string>
|
||||
<string name="Floating_window">Floating window</string>
|
||||
</resources>
|
||||
@ -3,7 +3,7 @@
|
||||
<style name="Base.Theme.AutoClicker" parent="Theme.Material3.DayNight.NoActionBar">
|
||||
<!-- Customize your light theme here. -->
|
||||
<!-- <item name="colorPrimary">@color/my_light_primary</item> -->
|
||||
<item name="android:windowBackground">@drawable/activity_background</item>
|
||||
<item name="android:windowBackground">@color/button_unselected</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.AutoClicker" parent="Base.Theme.AutoClicker" />
|
||||
|
||||
@ -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
|
||||
}
|
||||
@ -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" }
|
||||
|
||||
|
||||
|
||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -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
|
||||
|
||||