Compare commits
3 Commits
positions-
...
positions
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
580db768cb | ||
| 8a4aea7464 | |||
|
|
5fa241fa64 |
@@ -47,8 +47,6 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
api fileTree(dir: 'libs', include: ['*.jar'])
|
|
||||||
|
|
||||||
// https://mvnrepository.com/artifact/com.jzxiang.pickerview/TimePickerDialog
|
// https://mvnrepository.com/artifact/com.jzxiang.pickerview/TimePickerDialog
|
||||||
api 'com.jzxiang.pickerview:TimePickerDialog:1.0.1'
|
api 'com.jzxiang.pickerview:TimePickerDialog:1.0.1'
|
||||||
|
|
||||||
@@ -76,4 +74,5 @@ dependencies {
|
|||||||
|
|
||||||
api 'cc.winboll.studio:libaes:15.11.0'
|
api 'cc.winboll.studio:libaes:15.11.0'
|
||||||
api 'cc.winboll.studio:libappbase:15.11.0'
|
api 'cc.winboll.studio:libappbase:15.11.0'
|
||||||
|
api fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#Created by .winboll/winboll_app_build.gradle
|
#Created by .winboll/winboll_app_build.gradle
|
||||||
#Thu Nov 13 14:05:41 HKT 2025
|
#Sat Nov 15 08:45:48 GMT 2025
|
||||||
stageCount=1
|
stageCount=2
|
||||||
libraryProject=
|
libraryProject=
|
||||||
baseVersion=15.11
|
baseVersion=15.11
|
||||||
publishVersion=15.11.0
|
publishVersion=15.11.1
|
||||||
buildCount=0
|
buildCount=21
|
||||||
baseBetaVersion=15.11.1
|
baseBetaVersion=15.11.2
|
||||||
|
|||||||
@@ -9,9 +9,9 @@
|
|||||||
android:shortcutLongLabel="@string/open_appplus"
|
android:shortcutLongLabel="@string/open_appplus"
|
||||||
android:shortcutDisabledMessage="@string/appplus_open_disabled">
|
android:shortcutDisabledMessage="@string/appplus_open_disabled">
|
||||||
<intent
|
<intent
|
||||||
android:action="cc.winboll.studio.positions.MainActivity.ACTION_OPEN_APPPLUS"
|
android:action="cc.winboll.studio.positions.App.ACTION_OPEN_APPPLUS"
|
||||||
android:targetPackage="cc.winboll.studio.positions.beta"
|
android:targetPackage="cc.winboll.studio.positions.beta"
|
||||||
android:targetClass="cc.winboll.studio.positions.MainActivity"
|
android:targetClass="cc.winboll.studio.positions.activities.ShortcutActionActivity"
|
||||||
android:data="open_appplus" />
|
android:data="open_appplus" />
|
||||||
|
|
||||||
<categories android:name="android.shortcut.conversation" />
|
<categories android:name="android.shortcut.conversation" />
|
||||||
|
|||||||
@@ -9,9 +9,9 @@
|
|||||||
android:shortcutLongLabel="@string/close_appplus"
|
android:shortcutLongLabel="@string/close_appplus"
|
||||||
android:shortcutDisabledMessage="@string/appplus_close_disabled">
|
android:shortcutDisabledMessage="@string/appplus_close_disabled">
|
||||||
<intent
|
<intent
|
||||||
android:action="cc.winboll.studio.positions.MainActivity.ACTION_CLOSE_APPPLUS"
|
android:action="cc.winboll.studio.positions.App.ACTION_CLOSE_APPPLUS"
|
||||||
android:targetPackage="cc.winboll.studio.positions.beta"
|
android:targetPackage="cc.winboll.studio.positions.beta"
|
||||||
android:targetClass="cc.winboll.studio.positions.MainActivity"
|
android:targetClass="cc.winboll.studio.positions.activities.ShortcutActionActivity"
|
||||||
android:data="close_appplus" />
|
android:data="close_appplus" />
|
||||||
|
|
||||||
<categories android:name="android.shortcut.conversation" />
|
<categories android:name="android.shortcut.conversation" />
|
||||||
|
|||||||
@@ -3,15 +3,32 @@
|
|||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="cc.winboll.studio.positions">
|
package="cc.winboll.studio.positions">
|
||||||
|
|
||||||
<!-- 权限配置 -->
|
<!-- 只能在前台获取精确的位置信息 -->
|
||||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
|
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
|
||||||
|
|
||||||
|
<!-- 只有在前台运行时才能获取大致位置信息 -->
|
||||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
|
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
|
||||||
|
|
||||||
|
<!-- 在后台使用位置信息 -->
|
||||||
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"/>
|
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"/>
|
||||||
|
|
||||||
|
<!-- 运行前台服务 -->
|
||||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
|
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
|
||||||
|
|
||||||
|
<!-- 运行“location”类型的前台服务 -->
|
||||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_LOCATION"/>
|
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_LOCATION"/>
|
||||||
|
|
||||||
|
<!-- 拥有完全的网络访问权限 -->
|
||||||
<uses-permission android:name="android.permission.INTERNET"/>
|
<uses-permission android:name="android.permission.INTERNET"/>
|
||||||
<!-- 仅保留Android 8.0以下所需权限,若最低版本≥API26可移除 -->
|
|
||||||
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
|
<!-- 安装快捷方式 -->
|
||||||
|
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT"/>
|
||||||
|
|
||||||
|
<!-- 读取您共享存储空间中的内容 -->
|
||||||
|
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
|
||||||
|
|
||||||
|
<!-- 修改或删除您共享存储空间中的内容 -->
|
||||||
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||||
|
|
||||||
<uses-feature
|
<uses-feature
|
||||||
android:name="android.hardware.location.gps"
|
android:name="android.hardware.location.gps"
|
||||||
@@ -25,16 +42,31 @@
|
|||||||
android:resizeableActivity="true"
|
android:resizeableActivity="true"
|
||||||
android:name=".App">
|
android:name=".App">
|
||||||
|
|
||||||
<!-- 主Activity(核心页面,非启动入口) -->
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".MainActivity"
|
android:name=".MainActivity"
|
||||||
android:label="@string/app_name">
|
android:label="@string/app_name"
|
||||||
|
android:exported="true">
|
||||||
|
|
||||||
|
<intent-filter>
|
||||||
|
|
||||||
|
<category android:name="android.intent.category.DEFAULT"/>
|
||||||
|
|
||||||
|
<action android:name="android.intent.action.SEND"/>
|
||||||
|
|
||||||
|
<action android:name="android.intent.action.VIEW"/>
|
||||||
|
|
||||||
|
<action android:name="android.intent.action.EDIT"/>
|
||||||
|
|
||||||
|
<data android:mimeType="application/json"/>
|
||||||
|
|
||||||
|
<data android:mimeType="text/x-json"/>
|
||||||
|
|
||||||
|
</intent-filter>
|
||||||
|
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<!-- 独立CrashActivity(替换内部类声明,避免实例化失败) -->
|
|
||||||
<activity android:name=".activities.CrashActivity"/>
|
<activity android:name=".activities.CrashActivity"/>
|
||||||
|
|
||||||
<!-- Wukong 别名入口(默认禁用,通过代码启用) -->
|
|
||||||
<activity-alias
|
<activity-alias
|
||||||
android:name=".MainActivityWukong"
|
android:name=".MainActivityWukong"
|
||||||
android:targetActivity=".MainActivity"
|
android:targetActivity=".MainActivity"
|
||||||
@@ -44,17 +76,19 @@
|
|||||||
android:enabled="true">
|
android:enabled="true">
|
||||||
|
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<action android:name="android.intent.action.MAIN"/>
|
||||||
|
|
||||||
|
<category android:name="android.intent.category.LAUNCHER"/>
|
||||||
|
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
|
||||||
<!-- 长按图标快捷菜单 -->
|
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="android.app.shortcuts"
|
android:name="android.app.shortcuts"
|
||||||
android:resource="@xml/shortcutsmain" />
|
android:resource="@xml/shortcutsmain"/>
|
||||||
|
|
||||||
</activity-alias>
|
</activity-alias>
|
||||||
|
|
||||||
<!-- Laojun 别名入口(默认禁用,通过代码启用) -->
|
|
||||||
<activity-alias
|
<activity-alias
|
||||||
android:name=".MainActivityLaojun"
|
android:name=".MainActivityLaojun"
|
||||||
android:targetActivity=".MainActivity"
|
android:targetActivity=".MainActivity"
|
||||||
@@ -64,48 +98,65 @@
|
|||||||
android:enabled="false">
|
android:enabled="false">
|
||||||
|
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<action android:name="android.intent.action.MAIN"/>
|
||||||
|
|
||||||
|
<category android:name="android.intent.category.LAUNCHER"/>
|
||||||
|
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
|
||||||
<!-- 长按图标快捷菜单 -->
|
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="android.app.shortcuts"
|
android:name="android.app.shortcuts"
|
||||||
android:resource="@xml/shortcutsplus" />
|
android:resource="@xml/shortcutsplus"/>
|
||||||
|
|
||||||
</activity-alias>
|
</activity-alias>
|
||||||
|
|
||||||
<!-- 屏幕适配配置 -->
|
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="android.max_aspect"
|
android:name="android.max_aspect"
|
||||||
android:value="4.0"/>
|
android:value="4.0"/>
|
||||||
|
|
||||||
<!-- 其他Activity -->
|
|
||||||
<activity android:name="cc.winboll.studio.positions.activities.LocationActivity"/>
|
<activity android:name="cc.winboll.studio.positions.activities.LocationActivity"/>
|
||||||
|
|
||||||
<!-- Google服务版本配置 -->
|
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="com.google.android.gms.version"
|
android:name="com.google.android.gms.version"
|
||||||
android:value="@integer/google_play_services_version"/>
|
android:value="@integer/google_play_services_version"/>
|
||||||
|
|
||||||
<!-- 服务声明 -->
|
|
||||||
<service
|
<service
|
||||||
android:name=".services.MainService"
|
android:name=".services.MainService"
|
||||||
android:exported="false"/>
|
android:exported="false"/>
|
||||||
|
|
||||||
<service
|
<service
|
||||||
android:name=".services.AssistantService"
|
android:name=".services.AssistantService"
|
||||||
android:exported="false"/>
|
android:exported="false"/>
|
||||||
|
|
||||||
<service
|
<service
|
||||||
android:name=".services.DistanceRefreshService"
|
android:name=".services.DistanceRefreshService"
|
||||||
android:exported="false"/>
|
android:exported="false"/>
|
||||||
|
|
||||||
<!-- 广播接收器 -->
|
|
||||||
<receiver android:name="cc.winboll.studio.positions.receivers.MotionStatusReceiver">
|
<receiver android:name="cc.winboll.studio.positions.receivers.MotionStatusReceiver">
|
||||||
|
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
|
|
||||||
<action android:name="cc.winboll.studio.positions.receivers.MotionStatusReceiver"/>
|
<action android:name="cc.winboll.studio.positions.receivers.MotionStatusReceiver"/>
|
||||||
|
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
|
||||||
</receiver>
|
</receiver>
|
||||||
|
|
||||||
|
<provider
|
||||||
|
android:name="androidx.core.content.FileProvider"
|
||||||
|
android:authorities="${applicationId}.fileprovider"
|
||||||
|
android:exported="false"
|
||||||
|
android:grantUriPermissions="true">
|
||||||
|
|
||||||
|
<meta-data
|
||||||
|
android:name="android.support.FILE_PROVIDER_PATHS"
|
||||||
|
android:resource="@xml/file_paths"/>
|
||||||
|
|
||||||
|
</provider>
|
||||||
|
|
||||||
|
<activity android:name="cc.winboll.studio.positions.activities.ShortcutActionActivity"/>
|
||||||
|
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
||||||
|
|
||||||
@@ -23,9 +23,8 @@ import android.widget.TextView;
|
|||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
import cc.winboll.studio.libaes.utils.WinBoLLActivityManager;
|
import cc.winboll.studio.libaes.utils.WinBoLLActivityManager;
|
||||||
import cc.winboll.studio.libappbase.GlobalApplication;
|
import cc.winboll.studio.libappbase.GlobalApplication;
|
||||||
import cc.winboll.studio.libappbase.LogUtils;
|
|
||||||
import cc.winboll.studio.libappbase.ToastUtils;
|
import cc.winboll.studio.libappbase.ToastUtils;
|
||||||
import cc.winboll.studio.positions.activities.WinBoLLActivity;
|
import cc.winboll.studio.positions.utils.MyActivityLifecycleCallbacks;
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.Closeable;
|
import java.io.Closeable;
|
||||||
@@ -47,8 +46,15 @@ public class App extends GlobalApplication {
|
|||||||
|
|
||||||
public static volatile AppLevel _mAppLevel = AppLevel.WUKONG;
|
public static volatile AppLevel _mAppLevel = AppLevel.WUKONG;
|
||||||
|
|
||||||
private static Handler MAIN_HANDLER = new Handler(Looper.getMainLooper());
|
public static final String COMPONENT_WUKONG = "cc.winboll.studio.positions.MainActivityWukong";
|
||||||
|
public static final String COMPONENT_LAOJUN = "cc.winboll.studio.positions.MainActivityLaojun";
|
||||||
|
public static final String ACTION_OPEN_APPPLUS = "cc.winboll.studio.positions.App.ACTION_OPEN_APPPLUS";
|
||||||
|
public static final String ACTION_CLOSE_APPPLUS = "cc.winboll.studio.positions.App.ACTION_CLOSE_APPPLUS";
|
||||||
|
|
||||||
|
private static Handler MAIN_HANDLER = new Handler(Looper.getMainLooper());
|
||||||
|
|
||||||
|
MyActivityLifecycleCallbacks mMyActivityLifecycleCallbacks;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
@@ -66,28 +72,9 @@ public class App extends GlobalApplication {
|
|||||||
|
|
||||||
//CrashHandler.getInstance().registerGlobal(this);
|
//CrashHandler.getInstance().registerGlobal(this);
|
||||||
//CrashHandler.getInstance().registerPart(this);
|
//CrashHandler.getInstance().registerPart(this);
|
||||||
|
mMyActivityLifecycleCallbacks = new MyActivityLifecycleCallbacks();
|
||||||
|
registerActivityLifecycleCallbacks(mMyActivityLifecycleCallbacks);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void setAppLevel(WinBoLLActivity activity) {
|
|
||||||
// 根据应用当前启动入口设定整体应用级别
|
|
||||||
String launchComponent = activity.getComponentName().getClassName();
|
|
||||||
boolean isAliasLaunch = launchComponent.endsWith("MainActivityLaojun");
|
|
||||||
|
|
||||||
if (isAliasLaunch) {
|
|
||||||
// Alias入口启动逻辑(如切换应用级别、加载专属配置)
|
|
||||||
LogUtils.d(TAG, "通过Alias入口启动,切换为LAOJUN级别");
|
|
||||||
//ToastUtils.show("通过Alias入口启动,切换为LAOJUN级别");
|
|
||||||
App._mAppLevel = AppLevel.LAOJUN; // 结合之前定义的枚举
|
|
||||||
// 执行Alias专属初始化...
|
|
||||||
} else {
|
|
||||||
// 原入口启动逻辑
|
|
||||||
LogUtils.d(TAG, "通过原入口启动,默认WUKONG级别");
|
|
||||||
//ToastUtils.show("通过原入口启动,默认WUKONG级别");
|
|
||||||
App._mAppLevel = AppLevel.WUKONG;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void write(InputStream input, OutputStream output) throws IOException {
|
public static void write(InputStream input, OutputStream output) throws IOException {
|
||||||
byte[] buf = new byte[1024 * 8];
|
byte[] buf = new byte[1024 * 8];
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import android.content.Intent;
|
|||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.CompoundButton;
|
import android.widget.CompoundButton;
|
||||||
@@ -20,9 +21,10 @@ import cc.winboll.studio.libappbase.LogUtils;
|
|||||||
import cc.winboll.studio.libappbase.ToastUtils;
|
import cc.winboll.studio.libappbase.ToastUtils;
|
||||||
import cc.winboll.studio.positions.activities.LocationActivity;
|
import cc.winboll.studio.positions.activities.LocationActivity;
|
||||||
import cc.winboll.studio.positions.activities.WinBoLLActivity;
|
import cc.winboll.studio.positions.activities.WinBoLLActivity;
|
||||||
import cc.winboll.studio.positions.utils.AppConfigsUtil;
|
|
||||||
import cc.winboll.studio.positions.utils.ServiceUtil;
|
|
||||||
import cc.winboll.studio.positions.utils.APPPlusUtils;
|
import cc.winboll.studio.positions.utils.APPPlusUtils;
|
||||||
|
import cc.winboll.studio.positions.utils.AppConfigsUtil;
|
||||||
|
import cc.winboll.studio.positions.utils.JsonShareHandler;
|
||||||
|
import cc.winboll.studio.positions.utils.ServiceUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 主页面:仅负责
|
* 主页面:仅负责
|
||||||
@@ -32,11 +34,8 @@ import cc.winboll.studio.positions.utils.APPPlusUtils;
|
|||||||
*/
|
*/
|
||||||
public class MainActivity extends WinBoLLActivity implements IWinBoLLActivity {
|
public class MainActivity extends WinBoLLActivity implements IWinBoLLActivity {
|
||||||
public static final String TAG = "MainActivity";
|
public static final String TAG = "MainActivity";
|
||||||
public static final String COMPONENT_WUKONG = "cc.winboll.studio.positions.MainActivityWukong";
|
|
||||||
public static final String COMPONENT_LAOJUN = "cc.winboll.studio.positions.MainActivityLaojun";
|
// 权限请求码(建议定义为类常量,避免魔法值)
|
||||||
public static final String ACTION_OPEN_APPPLUS = "cc.winboll.studio.positions.MainActivity.ACTION_OPEN_APPPLUS";
|
|
||||||
public static final String ACTION_CLOSE_APPPLUS = "cc.winboll.studio.positions.MainActivity.ACTION_CLOSE_APPPLUS";
|
|
||||||
// 权限请求码(建议定义为类常量,避免魔法值)
|
|
||||||
private static final int REQUEST_LOCATION_PERMISSIONS = 1001;
|
private static final int REQUEST_LOCATION_PERMISSIONS = 1001;
|
||||||
private static final int REQUEST_BACKGROUND_LOCATION_PERMISSION = 1002;
|
private static final int REQUEST_BACKGROUND_LOCATION_PERMISSION = 1002;
|
||||||
|
|
||||||
@@ -46,7 +45,7 @@ public class MainActivity extends WinBoLLActivity implements IWinBoLLActivity {
|
|||||||
private Toolbar mToolbar;
|
private Toolbar mToolbar;
|
||||||
// 服务相关:服务实例、绑定状态标记
|
// 服务相关:服务实例、绑定状态标记
|
||||||
//private DistanceRefreshService mDistanceService;
|
//private DistanceRefreshService mDistanceService;
|
||||||
private boolean isServiceBound = false;
|
//private boolean isServiceBound = false;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -87,11 +86,10 @@ public class MainActivity extends WinBoLLActivity implements IWinBoLLActivity {
|
|||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_main); // 关联主页面布局
|
setContentView(R.layout.activity_main); // 关联主页面布局
|
||||||
// 处理应用级别的切换请求
|
|
||||||
handleSwitchRequest();
|
|
||||||
|
|
||||||
// 设置当前应用级别
|
// 处理启动时的分享 Intent
|
||||||
App.setAppLevel(this);
|
handleShareIntent(getIntent());
|
||||||
|
|
||||||
|
|
||||||
// 1. 初始化顶部 Toolbar(保留原逻辑,设置页面标题)
|
// 1. 初始化顶部 Toolbar(保留原逻辑,设置页面标题)
|
||||||
initToolbar();
|
initToolbar();
|
||||||
@@ -105,22 +103,30 @@ public class MainActivity extends WinBoLLActivity implements IWinBoLLActivity {
|
|||||||
//bindDistanceService();
|
//bindDistanceService();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 处理应用图标快捷菜单的请求
|
@Override
|
||||||
*/
|
protected void onNewIntent(Intent intent) {
|
||||||
private void handleSwitchRequest() {
|
super.onNewIntent(intent);
|
||||||
Intent intent = getIntent();
|
// 处理后续接收的分享 Intent(如应用已在后台)
|
||||||
if (intent != null && "open_appplus".equals(intent.getDataString())) {
|
handleShareIntent(intent);
|
||||||
ToastUtils.show("已添加" + getString(R.string.app_name) + "附加组件");
|
}
|
||||||
APPPlusUtils.openAPPPlus(this);
|
|
||||||
moveTaskToBack(true);
|
private void handleShareIntent(Intent intent) {
|
||||||
}
|
if (intent != null && Intent.ACTION_SEND.equals(intent.getAction())) {
|
||||||
if (intent != null && "close_appplus".equals(intent.getDataString())) {
|
// 调用工具类,弹出确认对话框
|
||||||
ToastUtils.show("已移除" + getString(R.string.app_name) + "附加组件");
|
JsonShareHandler.handleSharedJsonWithConfirm(this, intent, new JsonShareHandler.ConfirmCallback() {
|
||||||
APPPlusUtils.closeAPPPlus(this);
|
@Override
|
||||||
moveTaskToBack(true);
|
public void onConfirm(boolean isConfirm) {
|
||||||
}
|
// 回调处理:isConfirm 为 true 表示接收并保存,false 表示取消
|
||||||
}
|
if (!isConfirm) {
|
||||||
|
Log.d("MainActivity", "用户取消接收文件");
|
||||||
|
// 可添加取消后的逻辑(如关闭页面)
|
||||||
|
// finish();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDestroy() {
|
protected void onDestroy() {
|
||||||
@@ -141,9 +147,9 @@ public class MainActivity extends WinBoLLActivity implements IWinBoLLActivity {
|
|||||||
mToolbar = (Toolbar) findViewById(R.id.toolbar); // Java 7 显式 findViewById + 强转
|
mToolbar = (Toolbar) findViewById(R.id.toolbar); // Java 7 显式 findViewById + 强转
|
||||||
setSupportActionBar(mToolbar);
|
setSupportActionBar(mToolbar);
|
||||||
// 给ActionBar设置标题(先判断非空,避免空指针异常)
|
// 给ActionBar设置标题(先判断非空,避免空指针异常)
|
||||||
/*if (getSupportActionBar() != null) {
|
AppLevel appLevel = AppConfigsUtil.getInstance(getApplicationContext()).getAppLevel(true);
|
||||||
getSupportActionBar().setTitle(getString(R.string.app_name));
|
getSupportActionBar().setTitle(getString(R.string.app_name));
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package cc.winboll.studio.positions;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import cc.winboll.studio.libappbase.LogUtils;
|
||||||
|
import cc.winboll.studio.libappbase.ToastUtils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author ZhanGSKen&豆包大模型<zhangsken@qq.com>
|
||||||
|
* @Date 2025/11/13 15:21
|
||||||
|
* @Describe MainActivityLaojun
|
||||||
|
*/
|
||||||
|
public class MainActivityLaojun extends MainActivity {
|
||||||
|
|
||||||
|
public static final String TAG = "MainActivityLaojun";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
ToastUtils.show("道法自然");
|
||||||
|
LogUtils.d(TAG, "玩法归臻");
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package cc.winboll.studio.positions;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author ZhanGSKen&豆包大模型<zhangsken@qq.com>
|
||||||
|
* @Date 2025/11/15 15:14
|
||||||
|
* @Describe 应用入口级别类型枚举
|
||||||
|
*/
|
||||||
|
public enum PointLevel {
|
||||||
|
DORAEMON("doraemon", "叮铛级别"),
|
||||||
|
WUKONG("wukong", "悟空级别"),
|
||||||
|
LAOJUN("laojun", "老君级别");
|
||||||
|
|
||||||
|
public static final String TAG = "PointLevel";
|
||||||
|
|
||||||
|
// 枚举属性
|
||||||
|
private final String code; // 编码(如 "wukong")
|
||||||
|
private final String desc; // 描述
|
||||||
|
|
||||||
|
// 构造方法(Java 7 需显式定义)
|
||||||
|
PointLevel(String code, String desc) {
|
||||||
|
this.code = code;
|
||||||
|
this.desc = desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Getter 方法(获取枚举属性)
|
||||||
|
public String getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDesc() {
|
||||||
|
return desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 可选:根据 code 获取枚举项(便于业务使用)
|
||||||
|
public static PointLevel getByCode(String code) {
|
||||||
|
for (PointLevel level : values()) {
|
||||||
|
if (level.code.equals(code)) {
|
||||||
|
return level;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null; // 或抛出异常,根据业务需求调整
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
package cc.winboll.studio.positions.activities;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.os.PersistableBundle;
|
||||||
|
import cc.winboll.studio.libappbase.ToastUtils;
|
||||||
|
import cc.winboll.studio.positions.R;
|
||||||
|
import cc.winboll.studio.positions.utils.APPPlusUtils;
|
||||||
|
import cc.winboll.studio.positions.utils.AppConfigsUtil;
|
||||||
|
import cc.winboll.studio.positions.AppLevel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author ZhanGSKen&豆包大模型<zhangsken@qq.com>
|
||||||
|
* @Date 2025/11/15 13:45
|
||||||
|
* @Describe 应用快捷方式活动类
|
||||||
|
*/
|
||||||
|
public class ShortcutActionActivity extends Activity {
|
||||||
|
|
||||||
|
public static final String TAG = "ShortcutActionActivity";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
// 处理应用级别的切换请求
|
||||||
|
handleSwitchRequest();
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// @Override
|
||||||
|
// public void onPostCreate(Bundle savedInstanceState, PersistableBundle persistentState) {
|
||||||
|
// super.onPostCreate(savedInstanceState, persistentState);
|
||||||
|
// finish();
|
||||||
|
// }
|
||||||
|
|
||||||
|
// @Override
|
||||||
|
// protected void onStart() {
|
||||||
|
// super.onStart();
|
||||||
|
// }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理应用图标快捷菜单的请求
|
||||||
|
*/
|
||||||
|
private void handleSwitchRequest() {
|
||||||
|
Intent intent = getIntent();
|
||||||
|
if (intent != null && "open_appplus".equals(intent.getDataString())) {
|
||||||
|
ToastUtils.show("已添加" + getString(R.string.app_name) + "附加组件");
|
||||||
|
AppConfigsUtil.getInstance(getApplicationContext()).setAppLevel(AppLevel.LAOJUN);
|
||||||
|
APPPlusUtils.openAPPPlus(this);
|
||||||
|
//moveTaskToBack(true);
|
||||||
|
}
|
||||||
|
if (intent != null && "close_appplus".equals(intent.getDataString())) {
|
||||||
|
ToastUtils.show("已移除" + getString(R.string.app_name) + "附加组件");
|
||||||
|
AppConfigsUtil.getInstance(getApplicationContext()).setAppLevel(AppLevel.WUKONG);
|
||||||
|
APPPlusUtils.closeAPPPlus(this);
|
||||||
|
//moveTaskToBack(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -12,11 +12,19 @@ import androidx.appcompat.app.AppCompatActivity;
|
|||||||
import cc.winboll.studio.libaes.interfaces.IWinBoLLActivity;
|
import cc.winboll.studio.libaes.interfaces.IWinBoLLActivity;
|
||||||
import cc.winboll.studio.libaes.utils.WinBoLLActivityManager;
|
import cc.winboll.studio.libaes.utils.WinBoLLActivityManager;
|
||||||
import cc.winboll.studio.libappbase.LogUtils;
|
import cc.winboll.studio.libappbase.LogUtils;
|
||||||
|
import cc.winboll.studio.libappbase.ToastUtils;
|
||||||
|
import cc.winboll.studio.positions.App;
|
||||||
|
import cc.winboll.studio.positions.PointLevel;
|
||||||
|
import cc.winboll.studio.positions.R;
|
||||||
|
import cc.winboll.studio.positions.utils.ActivityAliasUtils;
|
||||||
|
import cc.winboll.studio.positions.utils.AppConfigsUtil;
|
||||||
|
|
||||||
public class WinBoLLActivity extends AppCompatActivity implements IWinBoLLActivity {
|
public class WinBoLLActivity extends AppCompatActivity implements IWinBoLLActivity {
|
||||||
|
|
||||||
public static final String TAG = "WinBoLLActivity";
|
public static final String TAG = "WinBoLLActivity";
|
||||||
|
|
||||||
|
public static volatile PointLevel _mPointLevel = PointLevel.WUKONG;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Activity getActivity() {
|
public Activity getActivity() {
|
||||||
return this;
|
return this;
|
||||||
@@ -30,18 +38,67 @@ public class WinBoLLActivity extends AppCompatActivity implements IWinBoLLActivi
|
|||||||
@Override
|
@Override
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
//ToastUtils.show("onResume");
|
||||||
|
|
||||||
|
// ActivityAliasUtils 工具使用示例
|
||||||
|
//
|
||||||
|
// // 获取真实的目标组件名(即使通过 alias 启动,也能拿到 OriginalActivity)
|
||||||
|
// String realTargetName = ActivityAliasUtils.getRealTargetNameFromIntent(this);
|
||||||
|
// LogUtils.d("AliasActivity", "真实组件名:" + realTargetName);
|
||||||
|
// 获取真实的目标组件名(即使通过 alias 启动,也能拿到 OriginalActivity)
|
||||||
|
// String realTargetName = ActivityAliasUtils.getRealTargetNameFromIntent(this);
|
||||||
|
// LogUtils.d(TAG, "真实组件名:" + realTargetName);
|
||||||
|
// ToastUtils.show(realTargetName);
|
||||||
|
// // 判断某个组件是否为 alias
|
||||||
|
// String componentName = "com.winboll.app.AliasActivity";
|
||||||
|
// boolean isAlias = ActivityAliasUtils.isActivityAlias(getApplicationContext(), componentName);
|
||||||
|
// LogUtils.d("判断结果", componentName + " 是否为 alias:" + isAlias); // true
|
||||||
|
// // 获取启动当前 Activity 的组件名(兼容 alias 场景)
|
||||||
|
// String launchComponent = ActivityAliasUtils.getLaunchComponentName(this);
|
||||||
|
// LogUtils.d("MainActivity", "启动组件名:" + launchComponent);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 应用入口逻辑模块
|
||||||
|
*/
|
||||||
|
//
|
||||||
|
// 检查当前活动的启动组件名,设置应用入口级别。
|
||||||
|
String launchComponent = ActivityAliasUtils.getLaunchComponentName(this);
|
||||||
|
LogUtils.d("MainActivity", "启动组件名:" + launchComponent);
|
||||||
|
ToastUtils.show(launchComponent);
|
||||||
|
// 当前应用处于活动暂停的状态时,就检查应用的入口组件名称,设置应用入口级别。
|
||||||
|
if (WinBoLLActivity._mPointLevel == PointLevel.DORAEMON) {
|
||||||
|
if (launchComponent.equals(App.COMPONENT_WUKONG)) {
|
||||||
|
getSupportActionBar().setTitle(getString(R.string.appplus_name));
|
||||||
|
ToastUtils.show("WUKONG");
|
||||||
|
_mPointLevel = PointLevel.WUKONG;
|
||||||
|
} else if (launchComponent.equals(App.COMPONENT_LAOJUN)) {
|
||||||
|
getSupportActionBar().setTitle(getString(R.string.app_name));
|
||||||
|
ToastUtils.show("LAOJUN");
|
||||||
|
_mPointLevel = PointLevel.LAOJUN;
|
||||||
|
} else {
|
||||||
|
// 如果是其他应用组件入口,就关闭活动
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 应用级别设置模块
|
||||||
|
*/
|
||||||
|
// 读取并配置应用级别
|
||||||
|
App._mAppLevel = AppConfigsUtil.getInstance(getApplicationContext()).getAppLevel(true);
|
||||||
|
|
||||||
LogUtils.d(TAG, String.format("onResume %s", getTag()));
|
LogUtils.d(TAG, String.format("onResume %s", getTag()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
/*if (item.getItemId() == R.id.item_log) {
|
/*if (item.getItemId() == R.id.item_log) {
|
||||||
WinBoLLActivityManager.getInstance().startLogActivity(this);
|
WinBoLLActivityManager.getInstance().startLogActivity(this);
|
||||||
return true;
|
return true;
|
||||||
} else if (item.getItemId() == R.id.item_home) {
|
} else if (item.getItemId() == R.id.item_home) {
|
||||||
startActivity(new Intent(this, MainActivity.class));
|
startActivity(new Intent(this, MainActivity.class));
|
||||||
return true;
|
return true;
|
||||||
}*/
|
}*/
|
||||||
// 在switch语句中处理每个ID,并在处理完后返回true,未处理的情况返回false。
|
// 在switch语句中处理每个ID,并在处理完后返回true,未处理的情况返回false。
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,12 +9,14 @@ package cc.winboll.studio.positions.models;
|
|||||||
import android.util.JsonWriter;
|
import android.util.JsonWriter;
|
||||||
import android.util.JsonReader;
|
import android.util.JsonReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import cc.winboll.studio.positions.AppLevel;
|
||||||
|
|
||||||
public class AppConfigsModel extends BaseBean {
|
public class AppConfigsModel extends BaseBean {
|
||||||
|
|
||||||
public static final String TAG = "AppConfigsModel";
|
public static final String TAG = "AppConfigsModel";
|
||||||
|
|
||||||
boolean isEnableMainService;
|
boolean isEnableMainService;
|
||||||
|
AppLevel appLevel;
|
||||||
|
|
||||||
public AppConfigsModel(boolean isEnableMainService) {
|
public AppConfigsModel(boolean isEnableMainService) {
|
||||||
this.isEnableMainService = isEnableMainService;
|
this.isEnableMainService = isEnableMainService;
|
||||||
@@ -24,6 +26,14 @@ public class AppConfigsModel extends BaseBean {
|
|||||||
this.isEnableMainService = false;
|
this.isEnableMainService = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setAppLevel(AppLevel appLevel) {
|
||||||
|
this.appLevel = appLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AppLevel getAppLevel() {
|
||||||
|
return appLevel;
|
||||||
|
}
|
||||||
|
|
||||||
public void setIsEnableMainService(boolean isEnableMainService) {
|
public void setIsEnableMainService(boolean isEnableMainService) {
|
||||||
this.isEnableMainService = isEnableMainService;
|
this.isEnableMainService = isEnableMainService;
|
||||||
}
|
}
|
||||||
@@ -42,6 +52,7 @@ public class AppConfigsModel extends BaseBean {
|
|||||||
public void writeThisToJsonWriter(JsonWriter jsonWriter) throws IOException {
|
public void writeThisToJsonWriter(JsonWriter jsonWriter) throws IOException {
|
||||||
super.writeThisToJsonWriter(jsonWriter);
|
super.writeThisToJsonWriter(jsonWriter);
|
||||||
jsonWriter.name("isEnableDistanceRefreshService").value(isEnableMainService());
|
jsonWriter.name("isEnableDistanceRefreshService").value(isEnableMainService());
|
||||||
|
jsonWriter.name("appLevel").value(getAppLevel().ordinal());
|
||||||
}
|
}
|
||||||
|
|
||||||
// JSON反序列化(加载位置数据,校验字段)
|
// JSON反序列化(加载位置数据,校验字段)
|
||||||
@@ -52,6 +63,8 @@ public class AppConfigsModel extends BaseBean {
|
|||||||
} else {
|
} else {
|
||||||
if (name.equals("isEnableDistanceRefreshService")) {
|
if (name.equals("isEnableDistanceRefreshService")) {
|
||||||
setIsEnableMainService(jsonReader.nextBoolean());
|
setIsEnableMainService(jsonReader.nextBoolean());
|
||||||
|
} else if (name.equals("appLevel")) {
|
||||||
|
setAppLevel((AppLevel.values()[jsonReader.nextInt()]));
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import android.content.pm.PackageManager;
|
|||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
import cc.winboll.studio.libappbase.LogUtils;
|
import cc.winboll.studio.libappbase.LogUtils;
|
||||||
|
import cc.winboll.studio.positions.App;
|
||||||
import cc.winboll.studio.positions.MainActivity;
|
import cc.winboll.studio.positions.MainActivity;
|
||||||
|
|
||||||
public class APPPlusUtils {
|
public class APPPlusUtils {
|
||||||
@@ -32,11 +33,11 @@ public class APPPlusUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
PackageManager pm = context.getPackageManager();
|
PackageManager pm = context.getPackageManager();
|
||||||
ComponentName plusComponentLaojun = new ComponentName(context, MainActivity.COMPONENT_LAOJUN);
|
ComponentName plusComponentLaojun = new ComponentName(context, App.COMPONENT_LAOJUN);
|
||||||
ComponentName plusComponentWuKong = new ComponentName(context, MainActivity.COMPONENT_WUKONG);
|
//ComponentName plusComponentWuKong = new ComponentName(context, MainActivity.COMPONENT_WUKONG);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
disableComponent(pm, plusComponentWuKong);
|
//disableComponent(pm, plusComponentWuKong);
|
||||||
enableComponent(pm, plusComponentLaojun);
|
enableComponent(pm, plusComponentLaojun);
|
||||||
|
|
||||||
// 2. 创建 Laojun 组件对应的快捷方式(自动去重)
|
// 2. 创建 Laojun 组件对应的快捷方式(自动去重)
|
||||||
@@ -75,11 +76,11 @@ public class APPPlusUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
PackageManager pm = context.getPackageManager();
|
PackageManager pm = context.getPackageManager();
|
||||||
ComponentName plusComponentLaojun = new ComponentName(context, MainActivity.COMPONENT_LAOJUN);
|
ComponentName plusComponentLaojun = new ComponentName(context, App.COMPONENT_LAOJUN);
|
||||||
ComponentName plusComponentWuKong = new ComponentName(context, MainActivity.COMPONENT_WUKONG);
|
//ComponentName plusComponentWuKong = new ComponentName(context, MainActivity.COMPONENT_WUKONG);
|
||||||
|
|
||||||
disableComponent(pm, plusComponentLaojun);
|
disableComponent(pm, plusComponentLaojun);
|
||||||
enableComponent(pm, plusComponentWuKong);
|
//enableComponent(pm, plusComponentWuKong);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,148 @@
|
|||||||
|
package cc.winboll.studio.positions.utils;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.pm.ActivityInfo;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
import cc.winboll.studio.libappbase.LogUtils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author ZhanGSKen&豆包大模型<zhangsken@qq.com>
|
||||||
|
* @Date 2025/11/15 15:23
|
||||||
|
* @Describe Activity Alias 工具类(兼容 Android 所有版本,Java 7 语法)
|
||||||
|
* 用于获取 activity-alias 对应的原始 Activity 组件名、判断 alias 类型、获取启动组件名等
|
||||||
|
*/
|
||||||
|
public class ActivityAliasUtils {
|
||||||
|
private static final String TAG = "ActivityAliasUtils";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取 activity-alias 指向的原始 Activity 组件名
|
||||||
|
*
|
||||||
|
* @param context 上下文(建议用 ApplicationContext)
|
||||||
|
* @param aliasName activity-alias 的组件名(完整路径,如 ".AliasActivity" 或 "com.winboll.app.AliasActivity")
|
||||||
|
* @return 原始 Activity 的完整组件名(如 "com.winboll.app.OriginalActivity"),失败返回 null
|
||||||
|
*/
|
||||||
|
public static String getTargetActivityName(Context context, String aliasName) {
|
||||||
|
// 校验参数
|
||||||
|
if (context == null || TextUtils.isEmpty(aliasName)) {
|
||||||
|
LogUtils.e(TAG, "getTargetActivityName: context is null or aliasName is empty");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 补全组件名(若传入的是短名,自动拼接包名)
|
||||||
|
String fullAliasName = aliasName.startsWith(".")
|
||||||
|
? context.getPackageName() + aliasName
|
||||||
|
: aliasName;
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 1. 获取 PackageManager
|
||||||
|
PackageManager packageManager = context.getPackageManager();
|
||||||
|
|
||||||
|
// 2. 解析 activity-alias 的 ActivityInfo(flag 必须设为 PackageManager.GET_META_DATA,否则可能获取不到 targetActivity)
|
||||||
|
ActivityInfo aliasActivityInfo = packageManager.getActivityInfo(
|
||||||
|
new android.content.ComponentName(context.getPackageName(), fullAliasName),
|
||||||
|
PackageManager.GET_META_DATA
|
||||||
|
);
|
||||||
|
|
||||||
|
// 3. 获取 targetActivity(原始 Activity 组件名)
|
||||||
|
String targetActivity = aliasActivityInfo.targetActivity;
|
||||||
|
if (TextUtils.isEmpty(targetActivity)) {
|
||||||
|
LogUtils.e(TAG, "getTargetActivityName: targetActivity is empty for alias " + fullAliasName);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 4. 补全原始 Activity 的完整包名(若 targetActivity 是短名)
|
||||||
|
String fullTargetName = targetActivity.startsWith(".")
|
||||||
|
? context.getPackageName() + targetActivity
|
||||||
|
: targetActivity;
|
||||||
|
|
||||||
|
LogUtils.d(TAG, "getTargetActivityName: alias=" + fullAliasName + ", target=" + fullTargetName);
|
||||||
|
return fullTargetName;
|
||||||
|
|
||||||
|
} catch (PackageManager.NameNotFoundException e) {
|
||||||
|
LogUtils.e(TAG, "getTargetActivityName: alias not found - " + fullAliasName, e);
|
||||||
|
} catch (Exception e) {
|
||||||
|
LogUtils.e(TAG, "getTargetActivityName: unknown error", e);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断某个组件名是否为 activity-alias(而非原始 Activity)
|
||||||
|
*
|
||||||
|
* @param context 上下文
|
||||||
|
* @param componentName 待判断的组件名(完整路径)
|
||||||
|
* @return true:是 activity-alias;false:不是或判断失败
|
||||||
|
*/
|
||||||
|
public static boolean isActivityAlias(Context context, String componentName) {
|
||||||
|
// 调用 getTargetActivityName,若返回非空,则说明是 alias
|
||||||
|
return !TextUtils.isEmpty(getTargetActivityName(context, componentName));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 从启动的 Intent 中获取实际的目标组件名(处理 alias 场景)
|
||||||
|
* 适用于 Activity 中获取自身真实组件名(原始 Activity 名)
|
||||||
|
*
|
||||||
|
* @param context 当前 Activity 上下文
|
||||||
|
* @return 真实的目标组件名(原始 Activity 名,若为 alias 启动则返回原始 Activity,否则返回自身)
|
||||||
|
*/
|
||||||
|
public static String getRealTargetNameFromIntent(Context context) {
|
||||||
|
if (context == null) {
|
||||||
|
LogUtils.e(TAG, "getRealTargetNameFromIntent: context is null");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取当前 Activity 的组件名(可能是 alias)
|
||||||
|
String currentComponentName = context.getClass().getName();
|
||||||
|
// 检查是否为 alias,若是则返回 target,否则返回自身
|
||||||
|
String targetName = getTargetActivityName(context, currentComponentName);
|
||||||
|
return TextUtils.isEmpty(targetName) ? currentComponentName : targetName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取当前活动上下文(Activity)的启动组件名(即启动时使用的组件名,可能是 alias 或原始 Activity)
|
||||||
|
* 场景:若通过 alias 启动 Activity,返回 alias 名;若直接启动原始 Activity,返回原始 Activity 名
|
||||||
|
*
|
||||||
|
* @param context 当前 Activity 上下文(必须是 Activity 实例,不能是 ApplicationContext)
|
||||||
|
* @return 启动组件的完整名,失败返回 null
|
||||||
|
*/
|
||||||
|
public static String getLaunchComponentName(Context context) {
|
||||||
|
// 1. 校验上下文类型(必须是 Activity,否则无法获取启动 Intent)
|
||||||
|
if (context == null) {
|
||||||
|
LogUtils.e(TAG, "getLaunchComponentName: context is null");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (!(context instanceof android.app.Activity)) {
|
||||||
|
LogUtils.e(TAG, "getLaunchComponentName: context must be Activity instance, current is " + context.getClass().getName());
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 2. 获取启动当前 Activity 的 Intent
|
||||||
|
android.app.Activity activity = (android.app.Activity) context;
|
||||||
|
Intent launchIntent = activity.getIntent();
|
||||||
|
if (launchIntent == null) {
|
||||||
|
LogUtils.e(TAG, "getLaunchComponentName: launch Intent is null");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. 从 Intent 中获取启动组件名(ComponentName)
|
||||||
|
android.content.ComponentName componentName = launchIntent.getComponent();
|
||||||
|
if (componentName == null) {
|
||||||
|
LogUtils.e(TAG, "getLaunchComponentName: ComponentName is null in launch Intent");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 4. 获取组件的完整类名(即启动时使用的组件名)
|
||||||
|
String launchComponentName = componentName.getClassName();
|
||||||
|
LogUtils.d(TAG, "getLaunchComponentName: current launch component is " + launchComponentName);
|
||||||
|
return launchComponentName;
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
LogUtils.e(TAG, "getLaunchComponentName: failed to get launch component name", e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
package cc.winboll.studio.positions.utils;
|
package cc.winboll.studio.positions.utils;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import cc.winboll.studio.positions.AppLevel;
|
||||||
import cc.winboll.studio.positions.models.AppConfigsModel;
|
import cc.winboll.studio.positions.models.AppConfigsModel;
|
||||||
|
import cc.winboll.studio.positions.App;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author ZhanGSKen&豆包大模型<zhangsken@qq.com>
|
* @Author ZhanGSKen&豆包大模型<zhangsken@qq.com>
|
||||||
@@ -58,11 +60,27 @@ public class AppConfigsUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setIsEnableMainService(boolean isEnableMainService) {
|
public void setIsEnableMainService(boolean isEnableMainService) {
|
||||||
if(mAppConfigsModel == null) {
|
if (mAppConfigsModel == null) {
|
||||||
mAppConfigsModel = new AppConfigsModel();
|
mAppConfigsModel = new AppConfigsModel();
|
||||||
}
|
}
|
||||||
mAppConfigsModel.setIsEnableMainService(isEnableMainService);
|
mAppConfigsModel.setIsEnableMainService(isEnableMainService);
|
||||||
saveConfigs();
|
saveConfigs();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public AppLevel getAppLevel(boolean isReloadConfigs) {
|
||||||
|
if (isReloadConfigs) {
|
||||||
|
loadConfigs();
|
||||||
|
}
|
||||||
|
return (mAppConfigsModel == null) ?AppLevel.WUKONG: mAppConfigsModel.getAppLevel();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAppLevel(AppLevel appLevel) {
|
||||||
|
if (mAppConfigsModel == null) {
|
||||||
|
mAppConfigsModel = new AppConfigsModel();
|
||||||
|
}
|
||||||
|
App._mAppLevel = appLevel;
|
||||||
|
mAppConfigsModel.setAppLevel(appLevel);
|
||||||
|
saveConfigs();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,241 @@
|
|||||||
|
package cc.winboll.studio.positions.utils;
|
||||||
|
|
||||||
|
import android.app.AlertDialog;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.DialogInterface;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.database.Cursor;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.os.Environment;
|
||||||
|
import android.provider.MediaStore;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.widget.Toast;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author ZhanGSKen&豆包大模型<zhangsken@qq.com>
|
||||||
|
* @Date 2025/11/13 15:42
|
||||||
|
* @Describe JsonShareHandler
|
||||||
|
* 外部 JSON 文件分享处理工具类
|
||||||
|
* 功能:接收外部分享的 .json 文件,弹出确认对话框,保存到外部存储 files/BaseBean 目录
|
||||||
|
*/
|
||||||
|
public class JsonShareHandler {
|
||||||
|
private static final String TAG = "JsonShareHandler";
|
||||||
|
private static final String TARGET_DIR = "BaseBean";
|
||||||
|
private static final String MIME_TYPE_JSON = "application/json";
|
||||||
|
private static final String FILE_SUFFIX_JSON = ".json";
|
||||||
|
// 对话框回调接口(Java7 无 Lambda,用接口实现)
|
||||||
|
public interface ConfirmCallback {
|
||||||
|
void onConfirm(boolean isConfirm);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理外部分享的 Intent,先弹出确认对话框,再决定是否接收文件
|
||||||
|
* @param context 上下文(需为 Activity,否则无法弹出对话框)
|
||||||
|
* @param intent 分享 Intent
|
||||||
|
* @param callback 确认结果回调(用于 Activity 处理后续逻辑)
|
||||||
|
*/
|
||||||
|
public static void handleSharedJsonWithConfirm(final Context context, final Intent intent, final ConfirmCallback callback) {
|
||||||
|
if (context == null || intent == null || callback == null) {
|
||||||
|
Log.e(TAG, "参数为空,处理失败");
|
||||||
|
if (callback != null) callback.onConfirm(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 1. 先验证 Intent 合法性(提前过滤无效分享)
|
||||||
|
String action = intent.getAction();
|
||||||
|
String type = intent.getType();
|
||||||
|
if (!Intent.ACTION_SEND.equals(action) || type == null) {
|
||||||
|
Log.e(TAG, "非文件分享 Intent");
|
||||||
|
Toast.makeText(context, "不支持的分享类型", Toast.LENGTH_SHORT).show();
|
||||||
|
callback.onConfirm(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. 弹出确认对话框
|
||||||
|
new AlertDialog.Builder(context)
|
||||||
|
.setTitle("接收 JSON 文件")
|
||||||
|
.setMessage("是否接收并保存该 JSON 文件?")
|
||||||
|
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
dialog.dismiss();
|
||||||
|
// 3. 点击 Yes,处理文件保存
|
||||||
|
String savedPath = handleSharedJsonFile(context, intent);
|
||||||
|
if (savedPath != null) {
|
||||||
|
Toast.makeText(context, "文件保存成功:" + savedPath, Toast.LENGTH_LONG).show();
|
||||||
|
callback.onConfirm(true);
|
||||||
|
} else {
|
||||||
|
Toast.makeText(context, "文件保存失败", Toast.LENGTH_SHORT).show();
|
||||||
|
callback.onConfirm(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.setNegativeButton("No", new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
dialog.dismiss();
|
||||||
|
// 4. 点击 No,直接退出处理
|
||||||
|
callback.onConfirm(false);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.setCancelable(false) // 不可点击外部取消
|
||||||
|
.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 核心文件处理逻辑(原有功能,无修改)
|
||||||
|
*/
|
||||||
|
private static String handleSharedJsonFile(Context context, Intent intent) {
|
||||||
|
String action = intent.getAction();
|
||||||
|
String type = intent.getType();
|
||||||
|
|
||||||
|
// 验证 JSON 格式
|
||||||
|
if (!MIME_TYPE_JSON.equals(type) && !type.contains("json")) {
|
||||||
|
Uri uri = intent.getParcelableExtra(Intent.EXTRA_STREAM);
|
||||||
|
if (uri == null || !getFileNameFromUri(context, uri).endsWith(FILE_SUFFIX_JSON)) {
|
||||||
|
Log.e(TAG, "接收的文件不是 JSON 格式");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Uri sharedUri = intent.getParcelableExtra(Intent.EXTRA_STREAM);
|
||||||
|
if (sharedUri == null) {
|
||||||
|
Log.e(TAG, "未获取到分享的文件 Uri");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 创建保存目录
|
||||||
|
File saveDir = getTargetSaveDir(context);
|
||||||
|
if (!saveDir.exists() && !saveDir.mkdirs()) {
|
||||||
|
Log.e(TAG, "创建保存目录失败:" + saveDir.getAbsolutePath());
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 解析文件名(兼容低版本)
|
||||||
|
String fileName = getFileNameFromUri(context, sharedUri);
|
||||||
|
if (fileName == null || !fileName.endsWith(FILE_SUFFIX_JSON)) {
|
||||||
|
fileName = "default_" + System.currentTimeMillis() + FILE_SUFFIX_JSON;
|
||||||
|
Log.w(TAG, "文件名解析失败,使用默认名称:" + fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 复制文件
|
||||||
|
File targetFile = new File(saveDir, fileName);
|
||||||
|
boolean copySuccess = copyFileFromUri(context, sharedUri, targetFile);
|
||||||
|
return copySuccess ? targetFile.getAbsolutePath() : null;
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.e(TAG, "处理分享文件异常:" + e.getMessage());
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取目标保存目录(兼容 Android 10+ 分区存储)
|
||||||
|
*/
|
||||||
|
private static File getTargetSaveDir(Context context) {
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||||
|
return new File(context.getExternalFilesDir(null), TARGET_DIR);
|
||||||
|
} else {
|
||||||
|
return new File(
|
||||||
|
Environment.getExternalStorageDirectory() + File.separator +
|
||||||
|
"Android" + File.separator +
|
||||||
|
"data" + File.separator +
|
||||||
|
context.getPackageName() + File.separator +
|
||||||
|
"files" + File.separator +
|
||||||
|
TARGET_DIR
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 从 Uri 解析文件名(兼容所有 Android 版本)
|
||||||
|
*/
|
||||||
|
private static String getFileNameFromUri(Context context, Uri uri) {
|
||||||
|
if (uri == null) return null;
|
||||||
|
|
||||||
|
// 1. 文件 Uri(file:// 开头)
|
||||||
|
if ("file".equals(uri.getScheme())) {
|
||||||
|
return new File(uri.getPath()).getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. 内容 Uri(content:// 开头)
|
||||||
|
if ("content".equals(uri.getScheme())) {
|
||||||
|
Cursor cursor = null;
|
||||||
|
try {
|
||||||
|
cursor = context.getContentResolver().query(
|
||||||
|
uri,
|
||||||
|
new String[]{MediaStore.MediaColumns.DISPLAY_NAME},
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null
|
||||||
|
);
|
||||||
|
if (cursor != null && cursor.moveToFirst()) {
|
||||||
|
int nameIndex = cursor.getColumnIndex(MediaStore.MediaColumns.DISPLAY_NAME);
|
||||||
|
if (nameIndex != -1) {
|
||||||
|
return cursor.getString(nameIndex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.e(TAG, "解析内容 Uri 文件名失败:" + e.getMessage());
|
||||||
|
} finally {
|
||||||
|
if (cursor != null) cursor.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. 解析失败,返回默认名称
|
||||||
|
String lastPathSegment = uri.getLastPathSegment();
|
||||||
|
return lastPathSegment != null ? lastPathSegment : "unknown.json";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 复制 Uri 指向的文件到目标路径
|
||||||
|
*/
|
||||||
|
private static boolean copyFileFromUri(Context context, Uri sourceUri, File targetFile) {
|
||||||
|
InputStream inputStream = null;
|
||||||
|
OutputStream outputStream = null;
|
||||||
|
try {
|
||||||
|
inputStream = context.getContentResolver().openInputStream(sourceUri);
|
||||||
|
if (inputStream == null) {
|
||||||
|
Log.e(TAG, "无法打开源文件输入流");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
outputStream = new FileOutputStream(targetFile);
|
||||||
|
byte[] buffer = new byte[1024 * 4];
|
||||||
|
int length;
|
||||||
|
while ((length = inputStream.read(buffer)) != -1) {
|
||||||
|
outputStream.write(buffer, 0, length);
|
||||||
|
}
|
||||||
|
outputStream.flush();
|
||||||
|
Log.d(TAG, "文件保存成功:" + targetFile.getAbsolutePath());
|
||||||
|
return true;
|
||||||
|
|
||||||
|
} catch (IOException e) {
|
||||||
|
Log.e(TAG, "文件复制异常:" + e.getMessage());
|
||||||
|
return false;
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
if (inputStream != null) inputStream.close();
|
||||||
|
if (outputStream != null) outputStream.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
Log.e(TAG, "关闭流异常:" + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查外部存储是否可用
|
||||||
|
*/
|
||||||
|
public static boolean isExternalStorageAvailable() {
|
||||||
|
String state = Environment.getExternalStorageState();
|
||||||
|
return Environment.MEDIA_MOUNTED.equals(state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,105 @@
|
|||||||
|
package cc.winboll.studio.positions.utils;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.app.Application;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import cc.winboll.studio.libappbase.LogUtils;
|
||||||
|
import cc.winboll.studio.libappbase.ToastUtils;
|
||||||
|
import cc.winboll.studio.positions.PointLevel;
|
||||||
|
import cc.winboll.studio.positions.activities.WinBoLLActivity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author ZhanGSKen&豆包大模型<zhangsken@qq.com>
|
||||||
|
* @Date 2025/11/15 15:59
|
||||||
|
* @Describe 应用活动窗口状态响应类
|
||||||
|
* 主要用于设置应用级别与组件状态
|
||||||
|
*/
|
||||||
|
public class MyActivityLifecycleCallbacks implements Application.ActivityLifecycleCallbacks {
|
||||||
|
|
||||||
|
public static final String TAG = "MyActivityLifecycleCallbacks";
|
||||||
|
|
||||||
|
public String mInfo = "";
|
||||||
|
|
||||||
|
public MyActivityLifecycleCallbacks() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void createActivityeInfo(Activity activity) {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
Intent receivedIntent = activity.getIntent();
|
||||||
|
sb.append("\nCallingActivity : \n");
|
||||||
|
if (activity.getCallingActivity() != null) {
|
||||||
|
sb.append(activity.getCallingActivity().getPackageName());
|
||||||
|
}
|
||||||
|
sb.append("\nReceived Intent Package : \n");
|
||||||
|
sb.append(receivedIntent.getPackage());
|
||||||
|
|
||||||
|
Bundle extras = receivedIntent.getExtras();
|
||||||
|
if (extras != null) {
|
||||||
|
for (String key : extras.keySet()) {
|
||||||
|
sb.append("\nIntentInfo");
|
||||||
|
sb.append("\n键: ");
|
||||||
|
sb.append(key);
|
||||||
|
sb.append(", 值: ");
|
||||||
|
sb.append(extras.get(key));
|
||||||
|
//Log.d("IntentInfo", "键: " + key + ", 值: " + extras.get(key));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mInfo = sb.toString();
|
||||||
|
//Log.d("IntentInfo", "发送Intent的应用包名: " + senderPackage);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void showActivityeInfo() {
|
||||||
|
//ToastUtils.show("ActivityeInfo : " + mInfo);
|
||||||
|
LogUtils.d(TAG, "ActivityeInfo : " + mInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onActivityCreated(Activity activity, Bundle savedInstanceState) {
|
||||||
|
// 在这里可以做一些初始化相关的操作,例如记录Activity的创建时间等
|
||||||
|
//System.out.println(activity.getLocalClassName() + " was created");
|
||||||
|
LogUtils.d(TAG, activity.getLocalClassName() + " was created");
|
||||||
|
createActivityeInfo(activity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onActivityStarted(Activity activity) {
|
||||||
|
//System.out.println(activity.getLocalClassName() + " was started");
|
||||||
|
LogUtils.d(TAG, activity.getLocalClassName() + " was started");
|
||||||
|
//createActivityeInfo(activity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onActivityResumed(Activity activity) {
|
||||||
|
//System.out.println(activity.getLocalClassName() + " was resumed");
|
||||||
|
LogUtils.d(TAG, activity.getLocalClassName() + " was resumed");
|
||||||
|
//createActivityeInfo(activity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onActivityPaused(Activity activity) {
|
||||||
|
ToastUtils.show("Activity Paused");
|
||||||
|
// 应用从正在活动状态抽离出来时,设置应用入口级别状态,设置为时空虚幻而不确定的哆啦A梦级别。
|
||||||
|
WinBoLLActivity._mPointLevel = PointLevel.DORAEMON;
|
||||||
|
//System.out.println(activity.getLocalClassName() + " was paused");
|
||||||
|
LogUtils.d(TAG, activity.getLocalClassName() + " was paused");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onActivityStopped(Activity activity) {
|
||||||
|
//System.out.println(activity.getLocalClassName() + " was stopped");
|
||||||
|
LogUtils.d(TAG, activity.getLocalClassName() + " was stopped");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onActivitySaveInstanceState(Activity activity, Bundle outState) {
|
||||||
|
// 可以在这里添加保存状态的自定义逻辑
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onActivityDestroyed(Activity activity) {
|
||||||
|
//System.out.println(activity.getLocalClassName() + " was destroyed");
|
||||||
|
LogUtils.d(TAG, activity.getLocalClassName() + " was destroyed");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -35,6 +35,8 @@ import java.util.List;
|
|||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import cc.winboll.studio.positions.App;
|
import cc.winboll.studio.positions.App;
|
||||||
import cc.winboll.studio.positions.AppLevel;
|
import cc.winboll.studio.positions.AppLevel;
|
||||||
|
import cc.winboll.studio.positions.activities.WinBoLLActivity;
|
||||||
|
import cc.winboll.studio.positions.PointLevel;
|
||||||
|
|
||||||
public class PositionTaskListView extends LinearLayout {
|
public class PositionTaskListView extends LinearLayout {
|
||||||
// 视图模式常量
|
// 视图模式常量
|
||||||
@@ -486,9 +488,9 @@ public class PositionTaskListView extends LinearLayout {
|
|||||||
Button btnCancel = dialogView.findViewById(R.id.btn_dialog_cancel);
|
Button btnCancel = dialogView.findViewById(R.id.btn_dialog_cancel);
|
||||||
Button btnSave = dialogView.findViewById(R.id.btn_dialog_save);
|
Button btnSave = dialogView.findViewById(R.id.btn_dialog_save);
|
||||||
HourglassView hourglassView = dialogView.findViewById(R.id.hourglassView);
|
HourglassView hourglassView = dialogView.findViewById(R.id.hourglassView);
|
||||||
if (App._mAppLevel == AppLevel.WUKONG) {
|
if (WinBoLLActivity._mPointLevel == PointLevel.WUKONG) {
|
||||||
hourglassView.setVisibility(View.GONE);
|
hourglassView.setVisibility(View.GONE);
|
||||||
} else if (App._mAppLevel == AppLevel.WUKONG) {
|
} else if (WinBoLLActivity._mPointLevel == PointLevel.LAOJUN) {
|
||||||
hourglassView.setHourglassId("hourglass_001");
|
hourglassView.setHourglassId("hourglass_001");
|
||||||
hourglassView.setHour(1);
|
hourglassView.setHour(1);
|
||||||
hourglassView.setMinute(30);
|
hourglassView.setMinute(30);
|
||||||
|
|||||||
6
positions/src/main/res/xml/file_paths.xml
Normal file
6
positions/src/main/res/xml/file_paths.xml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<paths xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<external-files-path
|
||||||
|
name="BaseBean"
|
||||||
|
path="BaseBean/" />
|
||||||
|
</paths>
|
||||||
@@ -9,9 +9,9 @@
|
|||||||
android:shortcutLongLabel="@string/open_appplus"
|
android:shortcutLongLabel="@string/open_appplus"
|
||||||
android:shortcutDisabledMessage="@string/appplus_open_disabled">
|
android:shortcutDisabledMessage="@string/appplus_open_disabled">
|
||||||
<intent
|
<intent
|
||||||
android:action="cc.winboll.studio.positions.MainActivity.ACTION_OPEN_APPPLUS"
|
android:action="cc.winboll.studio.positions.App.ACTION_OPEN_APPPLUS"
|
||||||
android:targetPackage="cc.winboll.studio.positions"
|
android:targetPackage="cc.winboll.studio.positions"
|
||||||
android:targetClass="cc.winboll.studio.positions.MainActivity"
|
android:targetClass="cc.winboll.studio.positions.activities.ShortcutActionActivity"
|
||||||
android:data="open_appplus" />
|
android:data="open_appplus" />
|
||||||
|
|
||||||
<categories android:name="android.shortcut.conversation" />
|
<categories android:name="android.shortcut.conversation" />
|
||||||
|
|||||||
@@ -9,9 +9,9 @@
|
|||||||
android:shortcutLongLabel="@string/close_appplus"
|
android:shortcutLongLabel="@string/close_appplus"
|
||||||
android:shortcutDisabledMessage="@string/appplus_close_disabled">
|
android:shortcutDisabledMessage="@string/appplus_close_disabled">
|
||||||
<intent
|
<intent
|
||||||
android:action="cc.winboll.studio.positions.MainActivity.ACTIO_CLOSE_APPPLUS"
|
android:action="cc.winboll.studio.positions.App.ACTION_CLOSE_APPPLUS"
|
||||||
android:targetPackage="cc.winboll.studio.positions"
|
android:targetPackage="cc.winboll.studio.positions"
|
||||||
android:targetClass="cc.winboll.studio.positions.MainActivity"
|
android:targetClass="cc.winboll.studio.positions.activities.ShortcutActionActivity"
|
||||||
android:data="close_appplus" />
|
android:data="close_appplus" />
|
||||||
|
|
||||||
<categories android:name="android.shortcut.conversation" />
|
<categories android:name="android.shortcut.conversation" />
|
||||||
|
|||||||
Reference in New Issue
Block a user