mirror of
https://gitea.winboll.cc/ZhanGSKen/MyWinBoLL.git
synced 2026-08-15 05:52:09 +08:00
Compare commits
19 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 91d97efe4e | |||
| 1d4b232491 | |||
| 33f74f8226 | |||
| a74ab6aa06 | |||
| 8b3c6c3481 | |||
| 8a50eaf24c | |||
| d4fddaecf9 | |||
| 7c8800f873 | |||
| 32afb3ad74 | |||
| afd57c8d70 | |||
| 8b4624982c | |||
| 5283ebadc9 | |||
| e7fdf3ce6a | |||
| 7407ba582e | |||
| 6a9112fd20 | |||
| 7d960fd445 | |||
| e443e54548 | |||
| ecb7f9b881 | |||
| 248ffcc5f1 |
@@ -1,8 +1,8 @@
|
||||
#Created by .winboll/winboll_app_build.gradle
|
||||
#Sat Jul 11 20:07:00 HKT 2026
|
||||
stageCount=19
|
||||
#Mon Jun 29 11:28:11 HKT 2026
|
||||
stageCount=18
|
||||
libraryProject=libaes
|
||||
baseVersion=15.20
|
||||
publishVersion=15.20.18
|
||||
publishVersion=15.20.17
|
||||
buildCount=0
|
||||
baseBetaVersion=15.20.19
|
||||
baseBetaVersion=15.20.18
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
</style>
|
||||
|
||||
<style name="MyDebugActivityTheme" parent="Theme.AppCompat.NoActionBar">
|
||||
<item name="android:statusBarColor">?attr/colorPrimaryDark</item>
|
||||
<item name="android:statusBarColor">@color/toolbarBackgroundColor</item>
|
||||
<item name="colorTittle">@color/mainWindowTextColor</item>
|
||||
<item name="colorTittleBackgound">@color/toolbarBackgroundColor</item>
|
||||
<item name="colorText">@color/debugTextColor</item>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
</style>
|
||||
|
||||
<style name="MyDebugActivityTheme" parent="Theme.AppCompat.Light.NoActionBar">
|
||||
<item name="android:statusBarColor">?attr/colorPrimaryDark</item>
|
||||
<item name="android:statusBarColor">@color/toolbarBackgroundColor</item>
|
||||
<item name="colorTittle">@color/mainWindowTextColor</item>
|
||||
<item name="colorTittleBackgound">@color/toolbarBackgroundColor</item>
|
||||
<item name="colorText">@color/debugTextColor</item>
|
||||
|
||||
@@ -33,7 +33,7 @@ android {
|
||||
// versionName 更新后需要手动设置
|
||||
// 项目模块目录的 build.gradle 文件的 stageCount=0
|
||||
// Gradle编译环境下合起来的 versionName 就是 "${versionName}.0"
|
||||
versionName "15.21"
|
||||
versionName "15.20"
|
||||
if(true) {
|
||||
versionName = genVersionName("${versionName}")
|
||||
}
|
||||
@@ -99,8 +99,8 @@ dependencies {
|
||||
implementation 'androidx.biometric:biometric:1.1.0'
|
||||
|
||||
// WinBoLL库 nexus.winboll.cc 地址
|
||||
api 'cc.winboll.studio:libappbase:15.21.+'
|
||||
api 'cc.winboll.studio:libaes:15.21.+'
|
||||
api 'cc.winboll.studio:libappbase:15.20.34'
|
||||
api 'cc.winboll.studio:libaes:15.20.17'
|
||||
|
||||
// 备用库 jitpack.io 地址
|
||||
//api 'com.github.ZhanGSKen:libappbase:appbase-v15.20.33'
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#Created by .winboll/winboll_app_build.gradle
|
||||
#Tue Jul 21 18:53:02 GMT 2026
|
||||
stageCount=0
|
||||
#Thu Jul 09 20:17:02 HKT 2026
|
||||
stageCount=3
|
||||
libraryProject=
|
||||
baseVersion=15.21
|
||||
publishVersion=15.21.0
|
||||
buildCount=1
|
||||
baseBetaVersion=15.21.1
|
||||
baseVersion=15.20
|
||||
publishVersion=15.20.2
|
||||
buildCount=0
|
||||
baseBetaVersion=15.20.3
|
||||
|
||||
@@ -15,9 +15,6 @@
|
||||
<!-- 运行前台服务 -->
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
|
||||
|
||||
<!-- 开机自启权限 -->
|
||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
@@ -54,14 +51,6 @@
|
||||
android:launchMode="singleInstance"
|
||||
android:exported="false"/>
|
||||
|
||||
<receiver
|
||||
android:name=".receivers.ServiceCheckReceiver"
|
||||
android:exported="false">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.BOOT_COMPLETED"/>
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<activity android:name="cc.winboll.studio.bytheway.activities.SettingsActivity"/>
|
||||
|
||||
<activity android:name="cc.winboll.studio.bytheway.activities.AboutActivity"/>
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
package cc.winboll.studio.bytheway;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.ClipData;
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Typeface;
|
||||
@@ -25,7 +23,6 @@ import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
import cc.winboll.studio.libaes.utils.AESThemeUtil;
|
||||
import cc.winboll.studio.libaes.utils.WinBoLLActivityManager;
|
||||
import cc.winboll.studio.bytheway.services.GpsReceiveService;
|
||||
import cc.winboll.studio.libappbase.GlobalApplication;
|
||||
import cc.winboll.studio.libappbase.ToastUtils;
|
||||
import cc.winboll.studio.libappbase.utils.CrashHandleNotifyUtils;
|
||||
@@ -51,7 +48,6 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
||||
public class App extends GlobalApplication {
|
||||
|
||||
private static Handler MAIN_HANDLER = new Handler(Looper.getMainLooper());
|
||||
private BroadcastReceiver screenReceiver;
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
@@ -64,12 +60,6 @@ public class App extends GlobalApplication {
|
||||
|
||||
// 初始化 Toast 工具类(传入应用全局上下文,确保 Toast 可在任意地方调用)
|
||||
ToastUtils.init(getApplicationContext());
|
||||
|
||||
// 检查GPS服务SP标记,系统内存清理后自动恢复服务运行
|
||||
GpsReceiveService.checkAndStartService(this);
|
||||
|
||||
// 动态注册屏幕广播,息屏/亮屏时检查GPS服务运行状态
|
||||
registerScreenReceiver();
|
||||
} catch (Throwable e) {
|
||||
StringWriter sw = new StringWriter();
|
||||
PrintWriter pw = new PrintWriter(sw);
|
||||
@@ -85,34 +75,6 @@ public class App extends GlobalApplication {
|
||||
}
|
||||
}
|
||||
|
||||
private void registerScreenReceiver() {
|
||||
screenReceiver = new BroadcastReceiver() {
|
||||
@Override
|
||||
public void onReceive(final Context context, final Intent intent) {
|
||||
GpsReceiveService.checkAndStartService(context);
|
||||
}
|
||||
};
|
||||
final IntentFilter filter = new IntentFilter();
|
||||
filter.addAction(Intent.ACTION_SCREEN_ON);
|
||||
filter.addAction(Intent.ACTION_SCREEN_OFF);
|
||||
filter.addAction(Intent.ACTION_USER_PRESENT);
|
||||
registerReceiver(screenReceiver, filter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTrimMemory(final int level) {
|
||||
super.onTrimMemory(level);
|
||||
if (level >= TRIM_MEMORY_UI_HIDDEN) {
|
||||
GpsReceiveService.checkAndStartService(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLowMemory() {
|
||||
super.onLowMemory();
|
||||
GpsReceiveService.checkAndStartService(this);
|
||||
}
|
||||
|
||||
public static void write(InputStream input, OutputStream output) throws IOException {
|
||||
byte[] buf = new byte[1024 * 8];
|
||||
int len;
|
||||
|
||||
@@ -2,14 +2,8 @@ package cc.winboll.studio.bytheway;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.util.TypedValue;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.animation.AlphaAnimation;
|
||||
import android.view.animation.Animation;
|
||||
import android.widget.TextView;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import cc.winboll.studio.bytheway.activities.AboutActivity;
|
||||
import cc.winboll.studio.bytheway.activities.BaseWinBoLLActivity;
|
||||
@@ -24,11 +18,6 @@ import cc.winboll.studio.libappbase.ToastUtils;
|
||||
public class MainActivity extends BaseWinBoLLActivity {
|
||||
|
||||
public static final String TAG = "MainActivity";
|
||||
private static final long SPLASH_DURATION = 5000L;
|
||||
private static final long SPLASH_FADE_IN = 800L;
|
||||
private static final long SPLASH_FADE_OUT = 500L;
|
||||
private View splashOverlay;
|
||||
private final Handler splashHandler = new Handler();
|
||||
|
||||
@Override
|
||||
public String getTag() {
|
||||
@@ -44,7 +33,6 @@ public class MainActivity extends BaseWinBoLLActivity {
|
||||
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
initSplash();
|
||||
ToastUtils.show("onCreate");
|
||||
}
|
||||
|
||||
@@ -53,12 +41,6 @@ public class MainActivity extends BaseWinBoLLActivity {
|
||||
super.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
splashHandler.removeCallbacksAndMessages(null);
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
AESThemeUtil.inflateCompatThemeMenu(this, menu);
|
||||
@@ -94,53 +76,4 @@ public class MainActivity extends BaseWinBoLLActivity {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void initSplash() {
|
||||
splashOverlay = findViewById(R.id.splash_overlay);
|
||||
final TextView splashTitle = findViewById(R.id.splash_title);
|
||||
final TextView splashSubtitle = findViewById(R.id.splash_subtitle);
|
||||
|
||||
TypedValue typedValue = new TypedValue();
|
||||
if (getTheme().resolveAttribute(androidx.appcompat.R.attr.colorPrimaryDark, typedValue, true)) {
|
||||
splashOverlay.setBackgroundColor(typedValue.data);
|
||||
}
|
||||
|
||||
splashOverlay.setOnTouchListener(new View.OnTouchListener() {
|
||||
@Override
|
||||
public boolean onTouch(View v, android.view.MotionEvent event) {
|
||||
dismissSplash();
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
AlphaAnimation fadeInTitle = new AlphaAnimation(0f, 1f);
|
||||
fadeInTitle.setDuration(SPLASH_FADE_IN);
|
||||
fadeInTitle.setFillAfter(true);
|
||||
splashTitle.startAnimation(fadeInTitle);
|
||||
|
||||
AlphaAnimation fadeInSubtitle = new AlphaAnimation(0f, 1f);
|
||||
fadeInSubtitle.setDuration(SPLASH_FADE_IN);
|
||||
fadeInSubtitle.setStartOffset(SPLASH_FADE_IN);
|
||||
fadeInSubtitle.setFillAfter(true);
|
||||
splashSubtitle.startAnimation(fadeInSubtitle);
|
||||
|
||||
splashHandler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
dismissSplash();
|
||||
}
|
||||
}, SPLASH_DURATION);
|
||||
}
|
||||
|
||||
private void dismissSplash() {
|
||||
splashHandler.removeCallbacksAndMessages(null);
|
||||
if (splashOverlay == null || splashOverlay.getVisibility() != View.VISIBLE) {
|
||||
return;
|
||||
}
|
||||
splashOverlay.clearAnimation();
|
||||
for (int i = 0; i < ((android.view.ViewGroup) splashOverlay).getChildCount(); i++) {
|
||||
((android.view.ViewGroup) splashOverlay).getChildAt(i).clearAnimation();
|
||||
}
|
||||
splashOverlay.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,10 +2,10 @@ package cc.winboll.studio.bytheway.activities;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import cc.winboll.studio.bytheway.MainActivity;
|
||||
import cc.winboll.studio.bytheway.R;
|
||||
import cc.winboll.studio.libaes.utils.WinBoLLActivityManager;
|
||||
import cc.winboll.studio.libaes.views.ASupportToolbar;
|
||||
import cc.winboll.studio.libappbase.LogUtils;
|
||||
import cc.winboll.studio.libappbase.models.APPInfo;
|
||||
import cc.winboll.studio.libappbase.views.AboutView;
|
||||
@@ -19,7 +19,7 @@ public class AboutActivity extends BaseWinBoLLActivity {
|
||||
|
||||
public static final String TAG = "AboutActivity";
|
||||
|
||||
private ASupportToolbar mToolbar;
|
||||
private Toolbar mToolbar;
|
||||
|
||||
@Override
|
||||
public String getTag() {
|
||||
@@ -35,41 +35,27 @@ public class AboutActivity extends BaseWinBoLLActivity {
|
||||
initToolbar();
|
||||
|
||||
AboutView aboutView = findViewById(R.id.aboutview);
|
||||
if (aboutView != null) {
|
||||
aboutView.setAPPInfo(genDefaultAppInfo());
|
||||
LogUtils.d(TAG, "AboutView初始化完成");
|
||||
} else {
|
||||
LogUtils.e(TAG, "onCreate() | AboutView未找到");
|
||||
}
|
||||
aboutView.setAPPInfo(genDefaultAppInfo());
|
||||
}
|
||||
|
||||
private void initToolbar() {
|
||||
LogUtils.d(TAG, "initToolbar() 开始初始化");
|
||||
View toolbarView = findViewById(R.id.toolbar);
|
||||
if (toolbarView == null) {
|
||||
mToolbar = findViewById(R.id.toolbar);
|
||||
if (mToolbar == null) {
|
||||
LogUtils.e(TAG, "initToolbar() | Toolbar未找到");
|
||||
return;
|
||||
}
|
||||
if (toolbarView instanceof ASupportToolbar) {
|
||||
mToolbar = (ASupportToolbar) toolbarView;
|
||||
LogUtils.d(TAG, "initToolbar() 正确获取到ASupportToolbar");
|
||||
} else {
|
||||
LogUtils.e(TAG, "initToolbar() | 类型转换失败,实际类型: " + toolbarView.getClass().getName());
|
||||
// 尝试直接创建一个新的ASupportToolbar
|
||||
mToolbar = new ASupportToolbar(this);
|
||||
LogUtils.d(TAG, "initToolbar() 已创建新的ASupportToolbar实例");
|
||||
}
|
||||
setSupportActionBar(mToolbar);
|
||||
mToolbar.setSubtitle(getTag());
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
LogUtils.d(TAG, "导航栏 点击返回按钮");
|
||||
WinBoLLActivityManager.getInstance().resumeActivity(MainActivity.class);
|
||||
WinBoLLActivityManager.getInstance().finish(AboutActivity.this);
|
||||
}
|
||||
});
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
LogUtils.d(TAG, "导航栏 点击返回按钮");
|
||||
WinBoLLActivityManager.getInstance().resumeActivity(MainActivity.class);
|
||||
WinBoLLActivityManager.getInstance().finish(AboutActivity.this);
|
||||
}
|
||||
});
|
||||
LogUtils.d(TAG, "initToolbar() 配置完成");
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ public abstract class BaseWinBoLLActivity extends AppCompatActivity implements I
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
AESThemeUtil.applyAppCompatTheme(this);
|
||||
//AESThemeUtil.applyAppCompatTheme(this);
|
||||
mThemeType = AESThemeBean.getThemeStyleType(AESThemeUtil.getThemeTypeID(getApplicationContext()));
|
||||
setTheme(AESThemeUtil.getThemeTypeID(getApplicationContext()));
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
@@ -17,7 +17,7 @@ public class SettingsActivity extends Activity {
|
||||
setContentView(R.layout.activity_settings);
|
||||
|
||||
Switch swGpsReceiveService = findViewById(R.id.sw_gps_receive_service);
|
||||
swGpsReceiveService.setChecked(GpsReceiveService.isServiceShouldRun(SettingsActivity.this));
|
||||
swGpsReceiveService.setChecked(GpsReceiveService.isServiceRunning());
|
||||
swGpsReceiveService.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
|
||||
@@ -1,80 +0,0 @@
|
||||
package cc.winboll.studio.bytheway.models;
|
||||
|
||||
/**
|
||||
* @Author 豆包&BigPickle&ZhanGSKen<zhangsken@qq.com>
|
||||
* @Date 2026/07/10 19:46
|
||||
* @Describe 锚点位置数据模型
|
||||
* 存储轨迹标记锚点:经纬度、排序序号、自定义备注信息
|
||||
* @author 豆包&ZhanGSKen<zhangsken@qq.com>
|
||||
* 创建时间:2026-07-10 13:45:00
|
||||
* 最后编辑时间:2026-07-10 13:48:00
|
||||
*/
|
||||
public class AnchorPositionBean {
|
||||
|
||||
public static final String TAG = "AnchorPositionBean";
|
||||
|
||||
// 数据库自增主键ID
|
||||
private int id;
|
||||
// 锚点纬度
|
||||
private double latitude;
|
||||
// 锚点经度
|
||||
private double longitude;
|
||||
// 锚点排序序号,用于轨迹先后展示
|
||||
private int sortIndex;
|
||||
// 锚点备注文字
|
||||
private String remark;
|
||||
|
||||
// 无参构造(SQLite反射实例化必需)
|
||||
public AnchorPositionBean() {
|
||||
|
||||
}
|
||||
|
||||
// 全参构造
|
||||
public AnchorPositionBean(final double latitude, final double longitude, final int sortIndex, final String remark) {
|
||||
this.latitude = latitude;
|
||||
this.longitude = longitude;
|
||||
this.sortIndex = sortIndex;
|
||||
this.remark = remark;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(final int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public double getLatitude() {
|
||||
return latitude;
|
||||
}
|
||||
|
||||
public void setLatitude(final double latitude) {
|
||||
this.latitude = latitude;
|
||||
}
|
||||
|
||||
public double getLongitude() {
|
||||
return longitude;
|
||||
}
|
||||
|
||||
public void setLongitude(final double longitude) {
|
||||
this.longitude = longitude;
|
||||
}
|
||||
|
||||
public int getSortIndex() {
|
||||
return sortIndex;
|
||||
}
|
||||
|
||||
public void setSortIndex(final int sortIndex) {
|
||||
this.sortIndex = sortIndex;
|
||||
}
|
||||
|
||||
public String getRemark() {
|
||||
return remark;
|
||||
}
|
||||
|
||||
public void setRemark(final String remark) {
|
||||
this.remark = remark;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
package cc.winboll.studio.bytheway.receivers;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import cc.winboll.studio.bytheway.services.GpsReceiveService;
|
||||
import cc.winboll.studio.libappbase.LogUtils;
|
||||
|
||||
/**
|
||||
* 开机广播接收器,系统启动完成后检查GPS服务SP标记并自动恢复运行
|
||||
*/
|
||||
public class ServiceCheckReceiver extends BroadcastReceiver {
|
||||
|
||||
public static final String TAG = "ServiceCheckReceiver";
|
||||
|
||||
@Override
|
||||
public void onReceive(final Context context, final Intent intent) {
|
||||
final String action = intent.getAction();
|
||||
LogUtils.i(TAG, "收到广播: " + action);
|
||||
GpsReceiveService.checkAndStartService(context);
|
||||
}
|
||||
}
|
||||
@@ -3,11 +3,9 @@ package cc.winboll.studio.bytheway.services;
|
||||
import android.app.Notification;
|
||||
import android.app.NotificationChannel;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.PendingIntent;
|
||||
import android.app.Service;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.location.Location;
|
||||
import android.location.LocationListener;
|
||||
import android.location.LocationManager;
|
||||
@@ -15,8 +13,6 @@ import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.IBinder;
|
||||
import android.widget.Toast;
|
||||
import cc.winboll.studio.bytheway.MainActivity;
|
||||
import cc.winboll.studio.bytheway.R;
|
||||
import cc.winboll.studio.bytheway.models.GpsBean;
|
||||
import cc.winboll.studio.bytheway.utils.GpsUtil;
|
||||
import cc.winboll.studio.libappbase.LogUtils;
|
||||
@@ -31,8 +27,6 @@ public class GpsReceiveService extends Service {
|
||||
public static final String TAG = "GpsReceiveService";
|
||||
private static final int NOTIFICATION_ID = 1001;
|
||||
private static final String CHANNEL_ID = "gps_receive_service_channel";
|
||||
private static final String SP_NAME = "gps_receive_service";
|
||||
private static final String KEY_SHOULD_RUN = "service_should_run";
|
||||
|
||||
private static boolean serviceRunning = false;
|
||||
private static GpsReceiveService instance;
|
||||
@@ -57,36 +51,14 @@ public class GpsReceiveService extends Service {
|
||||
return serviceRunning ? instance.currentGpsBean : null;
|
||||
}
|
||||
|
||||
private static SharedPreferences getSp(final Context context) {
|
||||
return context.getApplicationContext().getSharedPreferences(SP_NAME, Context.MODE_PRIVATE);
|
||||
}
|
||||
|
||||
public static boolean isServiceShouldRun(final Context context) {
|
||||
return getSp(context).getBoolean(KEY_SHOULD_RUN, false);
|
||||
}
|
||||
|
||||
private static void setServiceShouldRun(final Context context, final boolean shouldRun) {
|
||||
getSp(context).edit().putBoolean(KEY_SHOULD_RUN, shouldRun).apply();
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查SP标记,若设置为运行且服务未运行则自动启动
|
||||
*/
|
||||
public static void checkAndStartService(final Context context) {
|
||||
if (isServiceShouldRun(context) && !serviceRunning) {
|
||||
startGpsReceiveService(context);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 外部统一静态启动服务
|
||||
*/
|
||||
public static void startGpsReceiveService(final Context context) {
|
||||
if (serviceRunning && instance != null) {
|
||||
if (serviceRunning) {
|
||||
LogUtils.i("GpsReceiveService", "服务已运行,无需重复启动");
|
||||
return;
|
||||
}
|
||||
setServiceShouldRun(context, true);
|
||||
final Intent intent = new Intent(context, GpsReceiveService.class);
|
||||
context.startService(intent);
|
||||
LogUtils.i("GpsReceiveService", "GPS定位消息接收服务启动请求发送");
|
||||
@@ -96,7 +68,6 @@ public class GpsReceiveService extends Service {
|
||||
* 外部统一静态关闭服务
|
||||
*/
|
||||
public static void stopGpsReceiveService(final Context context) {
|
||||
setServiceShouldRun(context, false);
|
||||
if (!serviceRunning) {
|
||||
LogUtils.i("GpsReceiveService", "服务未运行,无需关闭");
|
||||
return;
|
||||
@@ -109,11 +80,6 @@ public class GpsReceiveService extends Service {
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
if (serviceRunning && instance != null) {
|
||||
LogUtils.i("GpsReceiveService", "检测到重复实例,停止当前实例");
|
||||
stopSelf();
|
||||
return;
|
||||
}
|
||||
instance = this;
|
||||
serviceRunning = true;
|
||||
gpsReceiveCount = 0;
|
||||
@@ -144,23 +110,13 @@ public class GpsReceiveService extends Service {
|
||||
contentText = "等待GPS定位数据...";
|
||||
}
|
||||
return new Notification.Builder(this, CHANNEL_ID)
|
||||
.setContentTitle(getString(R.string.app_name))
|
||||
.setContentTitle("ByTheWay")
|
||||
.setContentText(contentText)
|
||||
.setSmallIcon(android.R.drawable.ic_menu_mylocation)
|
||||
.setContentIntent(createContentIntent())
|
||||
.setOngoing(true)
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建通知点击跳转主窗口的PendingIntent
|
||||
*/
|
||||
private PendingIntent createContentIntent() {
|
||||
final Intent intent = new Intent(this, MainActivity.class);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
||||
return PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_IMMUTABLE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新前台服务通知栏显示
|
||||
*/
|
||||
@@ -199,7 +155,7 @@ public class GpsReceiveService extends Service {
|
||||
// 最小时间间隔1秒,最小距离间隔0米,确保每次位置更新都能接收
|
||||
locationManager.requestLocationUpdates(
|
||||
LocationManager.GPS_PROVIDER,
|
||||
5000L,
|
||||
1000L,
|
||||
0f,
|
||||
locationListener
|
||||
);
|
||||
@@ -231,16 +187,8 @@ public class GpsReceiveService extends Service {
|
||||
|
||||
@Override
|
||||
public int onStartCommand(final Intent intent, final int flags, final int startId) {
|
||||
if (!isServiceShouldRun(this)) {
|
||||
LogUtils.i("GpsReceiveService", "SP标记为不运行,停止服务");
|
||||
stopSelf();
|
||||
return START_NOT_STICKY;
|
||||
}
|
||||
if (serviceRunning && instance != null) {
|
||||
LogUtils.i("GpsReceiveService", "服务已在运行,忽略重复启动命令");
|
||||
return START_STICKY;
|
||||
}
|
||||
return START_STICKY;
|
||||
//单例不重启模式,被杀不自动重启
|
||||
return START_NOT_STICKY;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -248,12 +196,6 @@ public class GpsReceiveService extends Service {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTaskRemoved(final Intent rootIntent) {
|
||||
super.onTaskRemoved(rootIntent);
|
||||
LogUtils.i("GpsReceiveService", "应用窗口被移除,前台服务继续运行");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
stopGpsLocationUpdates();
|
||||
|
||||
@@ -9,9 +9,7 @@
|
||||
<cc.winboll.studio.libaes.views.ASupportToolbar
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/toolbar"
|
||||
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
|
||||
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/>
|
||||
android:id="@+id/toolbar"/>
|
||||
|
||||
<cc.winboll.studio.libappbase.views.AboutView
|
||||
android:layout_width="match_parent"
|
||||
|
||||
@@ -1,72 +1,29 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout
|
||||
<LinearLayout
|
||||
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">
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<cc.winboll.studio.libaes.views.ASupportToolbar
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/toolbar"/>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1.0"
|
||||
android:gravity="center_vertical|center_horizontal">
|
||||
|
||||
<cc.winboll.studio.libaes.views.ASupportToolbar
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/toolbar"/>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1.0"
|
||||
android:gravity="center_vertical|center_horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="ByTheWay"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"/>
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/splash_overlay"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/splashBackground"
|
||||
android:clickable="true"
|
||||
android:focusable="true">
|
||||
|
||||
<LinearLayout
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center"
|
||||
android:padding="32dp">
|
||||
android:text="ByTheWay"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/splash_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/splash_title"
|
||||
android:textColor="@color/splashTitleText"
|
||||
android:textSize="36sp"
|
||||
android:textStyle="bold"
|
||||
android:layout_marginBottom="16dp"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/splash_subtitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/splash_subtitle"
|
||||
android:textColor="@color/splashSubtitleText"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="italic"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
@@ -9,7 +9,4 @@
|
||||
<color name="toolbarBackgroundColor">#1E3A5F</color>
|
||||
<color name="debugTextColor">#00E676</color>
|
||||
<color name="colorTextBackgound">#121212</color>
|
||||
<color name="splashBackground">#1565C0</color>
|
||||
<color name="splashTitleText">#FFFFFF</color>
|
||||
<color name="splashSubtitleText">#B3FFFFFF</color>
|
||||
</resources>
|
||||
@@ -9,7 +9,4 @@
|
||||
<color name="toolbarBackgroundColor">#1565C0</color>
|
||||
<color name="debugTextColor">#616161</color>
|
||||
<color name="colorTextBackgound">#FAFAFA</color>
|
||||
<color name="splashBackground">#1565C0</color>
|
||||
<color name="splashTitleText">#FFFFFF</color>
|
||||
<color name="splashSubtitleText">#B3FFFFFF</color>
|
||||
</resources>
|
||||
@@ -4,7 +4,5 @@
|
||||
<string name="action_gps_list">GPS列表</string>
|
||||
<string name="action_about">应用介绍</string>
|
||||
<string name="app_description">The [ByTheWay] project is designed to quickly schedule task reminders related to time and location. Its main feature is the ability to quickly create task-related data.</string>
|
||||
<string name="splash_title">ByTheWay</string>
|
||||
<string name="splash_subtitle">By the way, I mention this for you.</string>
|
||||
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#Created by .winboll/winboll_app_build.gradle
|
||||
#Sat Jul 11 20:07:00 HKT 2026
|
||||
stageCount=19
|
||||
#Mon Jun 29 11:28:11 HKT 2026
|
||||
stageCount=18
|
||||
libraryProject=libaes
|
||||
baseVersion=15.20
|
||||
publishVersion=15.20.18
|
||||
publishVersion=15.20.17
|
||||
buildCount=0
|
||||
baseBetaVersion=15.20.19
|
||||
baseBetaVersion=15.20.18
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
<item name="mainWindowTextColor">@color/mainWindowTextColor</item>
|
||||
<item name="mainWindowDarkBackgroundColor">@color/mainWindowBackgroundColor</item>
|
||||
<item name="mainWindowDarkTextColor">@color/mainWindowTextColor</item>
|
||||
<item name="android:statusBarColor">?attr/colorPrimaryDark</item>
|
||||
<item name="android:statusBarColor">@color/toolbarBackgroundColor</item>
|
||||
|
||||
<item name="aToolbar">@style/AESAToolbar</item>
|
||||
<item name="aSupportToolbar">@style/AESASupportToolbar</item>
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
<item name="mainWindowTextColor">@color/mainWindowTextColor</item>
|
||||
<item name="mainWindowDarkBackgroundColor">@color/mainWindowBackgroundColor</item>
|
||||
<item name="mainWindowDarkTextColor">@color/mainWindowTextColor</item>
|
||||
<item name="android:statusBarColor">?attr/colorPrimaryDark</item>
|
||||
<item name="android:statusBarColor">@color/toolbarBackgroundColor</item>
|
||||
|
||||
<item name="aToolbar">@style/AESAToolbar</item>
|
||||
<item name="aSupportToolbar">@style/AESASupportToolbar</item>
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
// ByTheWay 项目编译设置
|
||||
include ':bytheway'
|
||||
rootProject.name = "bytheway"
|
||||
rootProject.name = "bytheway"
|
||||
@@ -4,4 +4,4 @@
|
||||
|
||||
// ByTheWay 项目编译设置
|
||||
//include ':bytheway'
|
||||
//rootProject.name = "bytheway"
|
||||
//rootProject.name = "bytheway"
|
||||
Reference in New Issue
Block a user