Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e7fdf3ce6a | |||
| 7407ba582e | |||
| 6a9112fd20 | |||
| 7d960fd445 | |||
| e443e54548 | |||
| ecb7f9b881 | |||
| 248ffcc5f1 |
@@ -0,0 +1 @@
|
||||
/build
|
||||
@@ -0,0 +1,39 @@
|
||||
# [ByTheWay]
|
||||
#【老君道说】
|
||||
|
||||
#### 介绍
|
||||
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.
|
||||
【老君道说】项目应用应用于快速安排一个以时间和位置有关的任务提醒事项。
|
||||
其主要的特点是能快速建立事项任务数据。
|
||||
|
||||
#### 软件架构
|
||||
适配安卓应用 [AIDE Pro] 的 Gradle 编译结构。
|
||||
也适配安卓应用 [AndroidIDE] 的 Gradle 编译结构。
|
||||
|
||||
|
||||
#### Gradle 编译说明
|
||||
调试版编译命令 :gradle assembleBetaDebug
|
||||
阶段版编译命令 :bash .winboll/bashPublishAPKAddTag.sh bytheway
|
||||
|
||||
#### 使用说明
|
||||
在安卓操作系统里使用。
|
||||
|
||||
#### 参与贡献
|
||||
|
||||
1. Fork 本仓库
|
||||
2. 新建 Feat_xxx 分支
|
||||
3. 提交代码 : ZhanGSKen(ZhanGSKen<ZhanGSKen@QQ.COM>)
|
||||
4. 新建 Pull Request
|
||||
|
||||
|
||||
#### 特技
|
||||
|
||||
1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md
|
||||
2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com)
|
||||
3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目
|
||||
4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目
|
||||
5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help)
|
||||
6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
|
||||
|
||||
#### 参考文档
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1,110 @@
|
||||
apply plugin: 'com.android.application'
|
||||
apply from: '../.winboll/winboll_app_build.gradle'
|
||||
apply from: '../.winboll/winboll_lint_build.gradle'
|
||||
|
||||
def genVersionName(def versionName){
|
||||
// 检查编译标志位配置
|
||||
assert (winbollBuildProps['stageCount'] != null)
|
||||
assert (winbollBuildProps['baseVersion'] != null)
|
||||
// 保存基础版本号
|
||||
winbollBuildProps.setProperty("baseVersion", "${versionName}");
|
||||
//保存编译标志配置
|
||||
FileOutputStream fos = new FileOutputStream(winbollBuildPropsFile)
|
||||
winbollBuildProps.store(fos, "${winbollBuildPropsDesc}");
|
||||
fos.close();
|
||||
|
||||
// 返回编译版本号
|
||||
return "${versionName}." + winbollBuildProps['stageCount']
|
||||
}
|
||||
|
||||
android {
|
||||
// 适配MIUI12
|
||||
compileSdkVersion 30
|
||||
buildToolsVersion "30.0.3"
|
||||
|
||||
defaultConfig {
|
||||
applicationId "cc.winboll.studio.bytheway"
|
||||
minSdkVersion 26
|
||||
targetSdkVersion 30
|
||||
//1. Android 官方规则
|
||||
//- versionCode 类型:int 整型
|
||||
//- Java int 最大值:2147483647
|
||||
versionCode 1520000
|
||||
// versionName 更新后需要手动设置
|
||||
// 项目模块目录的 build.gradle 文件的 stageCount=0
|
||||
// Gradle编译环境下合起来的 versionName 就是 "${versionName}.0"
|
||||
versionName "15.20"
|
||||
if(true) {
|
||||
versionName = genVersionName("${versionName}")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
dependencies {
|
||||
api 'com.google.code.gson:gson:2.10.1'
|
||||
|
||||
// 下拉控件
|
||||
api 'com.baoyz.pullrefreshlayout:library:1.2.0'
|
||||
|
||||
// SSH
|
||||
api 'com.jcraft:jsch:0.1.55'
|
||||
// Html 解析
|
||||
api 'org.jsoup:jsoup:1.13.1'
|
||||
// 二维码类库
|
||||
api 'com.google.zxing:core:3.4.1'
|
||||
api 'com.journeyapps:zxing-android-embedded:3.6.0'
|
||||
// 应用介绍页类库
|
||||
api 'io.github.medyo:android-about-page:2.0.0'
|
||||
// 网络连接类库
|
||||
api 'com.squareup.okhttp3:okhttp:4.4.1'
|
||||
// FastJSON解析
|
||||
implementation 'com.alibaba:fastjson:1.2.76'
|
||||
|
||||
// AndroidX 类库
|
||||
/*api 'androidx.appcompat:appcompat:1.1.0'
|
||||
//api 'com.google.android.material:material:1.4.0'
|
||||
//api 'androidx.viewpager:viewpager:1.0.0'
|
||||
//api 'androidx.vectordrawable:vectordrawable:1.1.0'
|
||||
//api 'androidx.vectordrawable:vectordrawable-animated:1.1.0'
|
||||
//api 'androidx.fragment:fragment:1.1.0'*/
|
||||
|
||||
|
||||
// 米盟
|
||||
//api 'com.miui.zeus:mimo-ad-sdk:5.3.+'//请使用最新版sdk
|
||||
//注意:以下5个库必须要引入
|
||||
//implementation 'androidx.appcompat:appcompat:1.4.1'
|
||||
api 'androidx.recyclerview:recyclerview:1.0.0'
|
||||
api 'com.github.bumptech.glide:glide:4.9.0'
|
||||
//annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
|
||||
|
||||
implementation "androidx.annotation:annotation:1.3.0"
|
||||
implementation "androidx.core:core:1.6.0"
|
||||
implementation "androidx.drawerlayout:drawerlayout:1.1.1"
|
||||
implementation "androidx.preference:preference:1.1.1"
|
||||
implementation "androidx.viewpager:viewpager:1.0.0"
|
||||
implementation "com.google.android.material:material:1.4.0"
|
||||
implementation "com.google.guava:guava:24.1-jre"
|
||||
/*
|
||||
implementation "io.noties.markwon:core:$markwonVersion"
|
||||
implementation "io.noties.markwon:ext-strikethrough:$markwonVersion"
|
||||
implementation "io.noties.markwon:linkify:$markwonVersion"
|
||||
implementation "io.noties.markwon:recycler:$markwonVersion"
|
||||
*/
|
||||
implementation 'com.termux:terminal-emulator:0.118.0'
|
||||
implementation 'com.termux:terminal-view:0.118.0'
|
||||
implementation 'com.termux:termux-shared:0.118.0'
|
||||
|
||||
// Biometric (指纹识别)
|
||||
implementation 'androidx.biometric:biometric:1.1.0'
|
||||
|
||||
// WinBoLL库 nexus.winboll.cc 地址
|
||||
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'
|
||||
//api 'com.github.ZhanGSKen:libaes:aes-v15.20.16'
|
||||
|
||||
api fileTree(dir: 'libs', include: ['*.jar'])
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
#Created by .winboll/winboll_app_build.gradle
|
||||
#Fri Jul 03 13:02:58 HKT 2026
|
||||
stageCount=2
|
||||
libraryProject=
|
||||
baseVersion=15.20
|
||||
publishVersion=15.20.1
|
||||
buildCount=0
|
||||
baseBetaVersion=15.20.2
|
||||
@@ -0,0 +1,137 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# By default, the flags in this file are appended to flags specified
|
||||
# in C:\tools\adt-bundle-windows-x86_64-20131030\sdk/tools/proguard/proguard-android.txt
|
||||
# You can edit the include path and order by changing the proguardFiles
|
||||
# directive in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# Add any project specific keep options here:
|
||||
|
||||
# ============================== 基础通用规则 ==============================
|
||||
# 保留系统组件
|
||||
-keep public class * extends android.app.Activity
|
||||
-keep public class * extends android.app.Service
|
||||
-keep public class * extends android.content.BroadcastReceiver
|
||||
-keep public class * extends android.content.ContentProvider
|
||||
-keep public class * extends android.app.backup.BackupAgentHelper
|
||||
-keep public class * extends android.preference.Preference
|
||||
|
||||
# 保留 WinBoLL 核心包及子类(合并简化规则)
|
||||
-keep class cc.winboll.studio.** { *; }
|
||||
-keepclassmembers class cc.winboll.studio.** { *; }
|
||||
|
||||
# 保留所有类中的 public static final String TAG 字段(便于日志定位)
|
||||
-keepclassmembers class * {
|
||||
public static final java.lang.String TAG;
|
||||
}
|
||||
|
||||
# 保留序列化类(避免Parcelable/Gson解析异常)
|
||||
-keep class * implements android.os.Parcelable {
|
||||
public static final android.os.Parcelable$Creator *;
|
||||
}
|
||||
-keepclassmembers class * implements java.io.Serializable {
|
||||
static final long serialVersionUID;
|
||||
private static final java.io.ObjectStreamField[] serialPersistentFields;
|
||||
private void writeObject(java.io.ObjectOutputStream);
|
||||
private void readObject(java.io.ObjectInputStream);
|
||||
java.lang.Object writeReplace();
|
||||
java.lang.Object readResolve();
|
||||
}
|
||||
|
||||
# 保留 R 文件(避免资源ID混淆)
|
||||
-keepclassmembers class **.R$* {
|
||||
public static <fields>;
|
||||
}
|
||||
|
||||
# 保留 native 方法(避免JNI调用失败)
|
||||
-keepclasseswithmembernames class * {
|
||||
native <methods>;
|
||||
}
|
||||
|
||||
# 保留注解和泛型(避免反射/序列化异常)
|
||||
-keepattributes *Annotation*
|
||||
-keepattributes Signature
|
||||
|
||||
# 屏蔽 Java 8+ 警告(适配 Java 7 语法)
|
||||
-dontwarn java.lang.invoke.*
|
||||
-dontwarn android.support.v8.renderscript.*
|
||||
-dontwarn java.util.function.**
|
||||
|
||||
# ============================== 第三方框架专项规则 ==============================
|
||||
# OkHttp 4.4.1(米盟广告请求依赖,完善Lambda兼容)
|
||||
-keep class okhttp3.** { *; }
|
||||
-keep interface okhttp3.** { *; }
|
||||
-keep class okhttp3.internal.** { *; }
|
||||
-keep class okio.** { *; }
|
||||
-dontwarn okhttp3.internal.platform.**
|
||||
-dontwarn okio.**
|
||||
|
||||
# Glide 4.9.0(米盟广告图片加载依赖)
|
||||
-keep public class * implements com.bumptech.glide.module.GlideModule
|
||||
-keep public class * extends com.bumptech.glide.module.AppGlideModule
|
||||
-keep public enum com.bumptech.glide.load.ImageHeaderParser$ImageType {
|
||||
**[] $VALUES;
|
||||
public *;
|
||||
}
|
||||
-keepclassmembers class * implements com.bumptech.glide.module.AppGlideModule {
|
||||
<init>();
|
||||
}
|
||||
-dontwarn com.bumptech.glide.**
|
||||
|
||||
# Gson 2.8.5(米盟广告数据序列化依赖)
|
||||
-keep class com.google.gson.** { *; }
|
||||
-keep interface com.google.gson.** { *; }
|
||||
-keepclassmembers class * {
|
||||
@com.google.gson.annotations.SerializedName <fields>;
|
||||
}
|
||||
|
||||
# 米盟 SDK(核心广告组件,完整保留避免加载失败)
|
||||
-keep class com.miui.zeus.** { *; }
|
||||
-keep interface com.miui.zeus.** { *; }
|
||||
# 保留米盟日志字段(便于广告加载失败排查)
|
||||
-keepclassmembers class com.miui.zeus.mimo.sdk.** {
|
||||
public static final java.lang.String TAG;
|
||||
}
|
||||
|
||||
# RecyclerView 1.0.0(米盟广告布局渲染依赖)
|
||||
-keep class androidx.recyclerview.** { *; }
|
||||
-keep interface androidx.recyclerview.** { *; }
|
||||
-keepclassmembers class androidx.recyclerview.widget.RecyclerView$Adapter {
|
||||
public *;
|
||||
}
|
||||
|
||||
# 其他第三方框架(按引入依赖保留,无则可删除)
|
||||
# XXPermissions 18.63
|
||||
-keep class com.hjq.permissions.** { *; }
|
||||
-keep interface com.hjq.permissions.** { *; }
|
||||
|
||||
# ZXing 二维码(核心解析组件)
|
||||
-keep class com.google.zxing.** { *; }
|
||||
-keep class com.journeyapps.zxing.** { *; }
|
||||
|
||||
# Jsoup HTML解析
|
||||
-keep class org.jsoup.** { *; }
|
||||
|
||||
# Pinyin4j 拼音搜索
|
||||
-keep class net.sourceforge.pinyin4j.** { *; }
|
||||
|
||||
# JSch SSH组件
|
||||
-keep class com.jcraft.jsch.** { *; }
|
||||
|
||||
# AndroidX 基础组件
|
||||
-keep class androidx.appcompat.** { *; }
|
||||
-keep interface androidx.appcompat.** { *; }
|
||||
|
||||
# ============================== 优化与调试配置 ==============================
|
||||
# 优化级别(平衡混淆效果与性能)
|
||||
-optimizationpasses 5
|
||||
-optimizations !code/simplification/arithmetic,!code/simplification/cast,!field/*,!class/merging/*
|
||||
|
||||
# 调试辅助(保留行号便于崩溃定位)
|
||||
-verbose
|
||||
-dontpreverify
|
||||
-dontusemixedcaseclassnames
|
||||
-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools" >
|
||||
|
||||
<application>
|
||||
|
||||
<!-- Put flavor specific code here -->
|
||||
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="app_name">顺道说☯</string>string>
|
||||
</resources>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<string name="app_name">ByTheWay +</string>
|
||||
|
||||
</resources>
|
||||
@@ -0,0 +1,58 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<manifest
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="cc.winboll.studio.bytheway">
|
||||
|
||||
<!-- 只能在前台获取精确的位置信息 -->
|
||||
<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_BACKGROUND_LOCATION"/>
|
||||
|
||||
<!-- 前台服务 -->
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/MyAppTheme"
|
||||
android:resizeableActivity="true"
|
||||
android:name=".App">
|
||||
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:label="@string/app_name">
|
||||
|
||||
<intent-filter>
|
||||
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
|
||||
</intent-filter>
|
||||
|
||||
</activity>
|
||||
|
||||
<meta-data
|
||||
android:name="android.max_aspect"
|
||||
android:value="4.0"/>
|
||||
|
||||
<activity
|
||||
android:name=".activities.GpsListActivity"
|
||||
android:exported="true"/>
|
||||
|
||||
<service
|
||||
android:name=".services.GpsReceiveService"
|
||||
android:launchMode="singleInstance"
|
||||
android:exported="false"/>
|
||||
|
||||
<activity android:name="cc.winboll.studio.bytheway.activities.SettingsActivity"/>
|
||||
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -0,0 +1,358 @@
|
||||
package cc.winboll.studio.bytheway;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.ClipData;
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Typeface;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.HorizontalScrollView;
|
||||
import android.widget.ScrollView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
import cc.winboll.studio.libappbase.CrashActivity;
|
||||
import cc.winboll.studio.libappbase.GlobalApplication;
|
||||
import cc.winboll.studio.libappbase.ToastUtils;
|
||||
import cc.winboll.studio.libappbase.utils.CrashHandleNotifyUtils;
|
||||
import cc.winboll.studio.libaes.utils.AESThemeUtil;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.Closeable;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.lang.Thread.UncaughtExceptionHandler;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
public class App extends GlobalApplication {
|
||||
|
||||
private static Handler MAIN_HANDLER = new Handler(Looper.getMainLooper());
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
try {
|
||||
super.onCreate();
|
||||
|
||||
// 初始化主题样式ID列表
|
||||
AESThemeUtil.init(null);
|
||||
|
||||
// 初始化 Toast 工具类(传入应用全局上下文,确保 Toast 可在任意地方调用)
|
||||
ToastUtils.init(getApplicationContext());
|
||||
} catch (Throwable e) {
|
||||
StringWriter sw = new StringWriter();
|
||||
PrintWriter pw = new PrintWriter(sw);
|
||||
e.printStackTrace(pw);
|
||||
pw.close();
|
||||
String stackTraceStr = sw.toString();
|
||||
CrashHandleNotifyUtils.handleUncaughtException(
|
||||
this,
|
||||
getPackageName(),
|
||||
stackTraceStr,
|
||||
CrashActivity.class
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public static void write(InputStream input, OutputStream output) throws IOException {
|
||||
byte[] buf = new byte[1024 * 8];
|
||||
int len;
|
||||
while ((len = input.read(buf)) != -1) {
|
||||
output.write(buf, 0, len);
|
||||
}
|
||||
}
|
||||
|
||||
public static void write(File file, byte[] data) throws IOException {
|
||||
File parent = file.getParentFile();
|
||||
if (parent != null && !parent.exists()) parent.mkdirs();
|
||||
|
||||
ByteArrayInputStream input = new ByteArrayInputStream(data);
|
||||
FileOutputStream output = new FileOutputStream(file);
|
||||
try {
|
||||
write(input, output);
|
||||
} finally {
|
||||
closeIO(input, output);
|
||||
}
|
||||
}
|
||||
|
||||
public static String toString(InputStream input) throws IOException {
|
||||
ByteArrayOutputStream output = new ByteArrayOutputStream();
|
||||
write(input, output);
|
||||
try {
|
||||
return output.toString("UTF-8");
|
||||
} finally {
|
||||
closeIO(input, output);
|
||||
}
|
||||
}
|
||||
|
||||
public static void closeIO(Closeable... closeables) {
|
||||
for (Closeable closeable : closeables) {
|
||||
try {
|
||||
if (closeable != null) closeable.close();
|
||||
} catch (IOException ignored) {}
|
||||
}
|
||||
}
|
||||
|
||||
public static class CrashHandler {
|
||||
|
||||
public static final UncaughtExceptionHandler DEFAULT_UNCAUGHT_EXCEPTION_HANDLER = Thread.getDefaultUncaughtExceptionHandler();
|
||||
|
||||
private static CrashHandler sInstance;
|
||||
|
||||
private PartCrashHandler mPartCrashHandler;
|
||||
|
||||
public static CrashHandler getInstance() {
|
||||
if (sInstance == null) {
|
||||
sInstance = new CrashHandler();
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public void registerGlobal(Context context) {
|
||||
registerGlobal(context, null);
|
||||
}
|
||||
|
||||
public void registerGlobal(Context context, String crashDir) {
|
||||
Thread.setDefaultUncaughtExceptionHandler(new UncaughtExceptionHandlerImpl(context.getApplicationContext(), crashDir));
|
||||
}
|
||||
|
||||
public void unregister() {
|
||||
Thread.setDefaultUncaughtExceptionHandler(DEFAULT_UNCAUGHT_EXCEPTION_HANDLER);
|
||||
}
|
||||
|
||||
public void registerPart(Context context) {
|
||||
unregisterPart(context);
|
||||
mPartCrashHandler = new PartCrashHandler(context.getApplicationContext());
|
||||
MAIN_HANDLER.postAtFrontOfQueue(mPartCrashHandler);
|
||||
}
|
||||
|
||||
public void unregisterPart(Context context) {
|
||||
if (mPartCrashHandler != null) {
|
||||
mPartCrashHandler.isRunning.set(false);
|
||||
mPartCrashHandler = null;
|
||||
}
|
||||
}
|
||||
|
||||
private static class PartCrashHandler implements Runnable {
|
||||
|
||||
private final Context mContext;
|
||||
|
||||
public AtomicBoolean isRunning = new AtomicBoolean(true);
|
||||
|
||||
public PartCrashHandler(Context context) {
|
||||
this.mContext = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
while (isRunning.get()) {
|
||||
try {
|
||||
Looper.loop();
|
||||
} catch (final Throwable e) {
|
||||
e.printStackTrace();
|
||||
if (isRunning.get()) {
|
||||
MAIN_HANDLER.post(new Runnable(){
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
Toast.makeText(mContext, e.toString(), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
if (e instanceof RuntimeException) {
|
||||
throw (RuntimeException)e;
|
||||
} else {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static class UncaughtExceptionHandlerImpl implements UncaughtExceptionHandler {
|
||||
|
||||
private static DateFormat DATE_FORMAT = new SimpleDateFormat("yyyy_MM_dd-HH_mm_ss");
|
||||
|
||||
private final Context mContext;
|
||||
|
||||
private final File mCrashDir;
|
||||
|
||||
public UncaughtExceptionHandlerImpl(Context context, String crashDir) {
|
||||
this.mContext = context;
|
||||
this.mCrashDir = TextUtils.isEmpty(crashDir) ? new File(mContext.getExternalCacheDir(), "crash") : new File(crashDir);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uncaughtException(Thread thread, Throwable throwable) {
|
||||
try {
|
||||
|
||||
String log = buildLog(throwable);
|
||||
writeLog(log);
|
||||
|
||||
try {
|
||||
Intent intent = new Intent(mContext, CrashActivity.class);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
intent.putExtra(Intent.EXTRA_TEXT, log);
|
||||
mContext.startActivity(intent);
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
writeLog(e.toString());
|
||||
}
|
||||
|
||||
throwable.printStackTrace();
|
||||
android.os.Process.killProcess(android.os.Process.myPid());
|
||||
System.exit(0);
|
||||
|
||||
} catch (Throwable e) {
|
||||
if (DEFAULT_UNCAUGHT_EXCEPTION_HANDLER != null) DEFAULT_UNCAUGHT_EXCEPTION_HANDLER.uncaughtException(thread, throwable);
|
||||
}
|
||||
}
|
||||
|
||||
private String buildLog(Throwable throwable) {
|
||||
String time = DATE_FORMAT.format(new Date());
|
||||
|
||||
String versionName = "unknown";
|
||||
long versionCode = 0;
|
||||
try {
|
||||
PackageInfo packageInfo = mContext.getPackageManager().getPackageInfo(mContext.getPackageName(), 0);
|
||||
versionName = packageInfo.versionName;
|
||||
versionCode = Build.VERSION.SDK_INT >= 28 ? packageInfo.getLongVersionCode() : packageInfo.versionCode;
|
||||
} catch (Throwable ignored) {}
|
||||
|
||||
LinkedHashMap<String, String> head = new LinkedHashMap<String, String>();
|
||||
head.put("Time Of Crash", time);
|
||||
head.put("Device", String.format("%s, %s", Build.MANUFACTURER, Build.MODEL));
|
||||
head.put("Android Version", String.format("%s (%d)", Build.VERSION.RELEASE, Build.VERSION.SDK_INT));
|
||||
head.put("App Version", String.format("%s (%d)", versionName, versionCode));
|
||||
head.put("Kernel", getKernel());
|
||||
head.put("Support Abis", Build.VERSION.SDK_INT >= 21 && Build.SUPPORTED_ABIS != null ? Arrays.toString(Build.SUPPORTED_ABIS): "unknown");
|
||||
head.put("Fingerprint", Build.FINGERPRINT);
|
||||
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
for (String key : head.keySet()) {
|
||||
if (builder.length() != 0) builder.append("\n");
|
||||
builder.append(key);
|
||||
builder.append(" : ");
|
||||
builder.append(head.get(key));
|
||||
}
|
||||
|
||||
builder.append("\n\n");
|
||||
builder.append(Log.getStackTraceString(throwable));
|
||||
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
private void writeLog(String log) {
|
||||
String time = DATE_FORMAT.format(new Date());
|
||||
File file = new File(mCrashDir, "crash_" + time + ".txt");
|
||||
try {
|
||||
write(file, log.getBytes("UTF-8"));
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private static String getKernel() {
|
||||
try {
|
||||
return App.toString(new FileInputStream("/proc/version")).trim();
|
||||
} catch (Throwable e) {
|
||||
return e.getMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static final class CrashActivity extends Activity {
|
||||
|
||||
private String mLog;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
setTheme(android.R.style.Theme_DeviceDefault);
|
||||
setTitle("App Crash");
|
||||
|
||||
mLog = getIntent().getStringExtra(Intent.EXTRA_TEXT);
|
||||
|
||||
ScrollView contentView = new ScrollView(this);
|
||||
contentView.setFillViewport(true);
|
||||
|
||||
HorizontalScrollView horizontalScrollView = new HorizontalScrollView(this);
|
||||
|
||||
TextView textView = new TextView(this);
|
||||
int padding = dp2px(16);
|
||||
textView.setPadding(padding, padding, padding, padding);
|
||||
textView.setText(mLog);
|
||||
textView.setTextIsSelectable(true);
|
||||
textView.setTypeface(Typeface.DEFAULT);
|
||||
textView.setLinksClickable(true);
|
||||
|
||||
horizontalScrollView.addView(textView);
|
||||
contentView.addView(horizontalScrollView, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
|
||||
|
||||
setContentView(contentView);
|
||||
}
|
||||
|
||||
private void restart() {
|
||||
Intent intent = getPackageManager().getLaunchIntentForPackage(getPackageName());
|
||||
if (intent != null) {
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
startActivity(intent);
|
||||
}
|
||||
finish();
|
||||
android.os.Process.killProcess(android.os.Process.myPid());
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
private static int dp2px(float dpValue) {
|
||||
final float scale = Resources.getSystem().getDisplayMetrics().density;
|
||||
return (int) (dpValue * scale + 0.5f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
menu.add(0, android.R.id.copy, 0, android.R.string.copy)
|
||||
.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
|
||||
return super.onCreateOptionsMenu(menu);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.copy:
|
||||
ClipboardManager cm = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
cm.setPrimaryClip(ClipData.newPlainText(getPackageName(), mLog));
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
restart();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package cc.winboll.studio.bytheway;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import cc.winboll.studio.bytheway.activities.GpsListActivity;
|
||||
import cc.winboll.studio.bytheway.activities.SettingsActivity;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import cc.winboll.studio.libappbase.GlobalApplication;
|
||||
import cc.winboll.studio.libappbase.LogUtils;
|
||||
import cc.winboll.studio.libappbase.LogView;
|
||||
import cc.winboll.studio.libappbase.ToastUtils;
|
||||
import cc.winboll.studio.libaes.utils.AESThemeUtil;
|
||||
import cc.winboll.studio.libaes.utils.DevelopUtils;
|
||||
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
|
||||
public static final String TAG = "MainActivity";
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
AESThemeUtil.applyAppCompatTheme(this);
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
|
||||
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
ToastUtils.show("onCreate");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
AESThemeUtil.inflateCompatThemeMenu(this, menu);
|
||||
if (GlobalApplication.isDebugging()) {
|
||||
DevelopUtils.inflateMenu(this, menu);
|
||||
}
|
||||
getMenuInflater().inflate(cc.winboll.studio.libaes.R.menu.toolbar_drawerbase, menu);
|
||||
getMenuInflater().inflate(R.menu.activity_main, menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
if (AESThemeUtil.onWinBoLLThemeItemSelected(this, item)) {
|
||||
recreate();
|
||||
}
|
||||
if (item.getItemId() == R.id.action_gps_list) {
|
||||
startActivity(new Intent(this, GpsListActivity.class));
|
||||
return true;
|
||||
}
|
||||
if (item.getItemId() == R.id.action_settings) {
|
||||
startActivity(new Intent(this, SettingsActivity.class));
|
||||
return true;
|
||||
}
|
||||
if (DevelopUtils.onDevelopItemSelected(this, item)) {
|
||||
LogUtils.d(TAG, String.format("onOptionsItemSelected item.getItemId() %d ", item.getItemId()));
|
||||
} else {
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package cc.winboll.studio.bytheway.activities;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
import cc.winboll.studio.bytheway.R;
|
||||
import cc.winboll.studio.bytheway.adapters.GpsAdapter;
|
||||
import cc.winboll.studio.bytheway.helpers.GpsDbManager;
|
||||
import cc.winboll.studio.bytheway.models.GpsBean;
|
||||
import cc.winboll.studio.libappbase.LogUtils;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* GPS定位数据列表展示页面
|
||||
* 支持下拉刷新SQLite本地数据库定位轨迹信息
|
||||
* @author 豆包&ZhanGSKen<zhangsken@qq.com>
|
||||
* 创建时间:2026-07-02 14:49:00
|
||||
* 最后编辑时间:2026-07-02 16:32:13
|
||||
*/
|
||||
public class GpsListActivity extends AppCompatActivity {
|
||||
|
||||
private SwipeRefreshLayout swipeRefresh;
|
||||
private RecyclerView rvGps;
|
||||
private GpsDbManager dbManager;
|
||||
private GpsAdapter adapter;
|
||||
|
||||
@Override
|
||||
protected void onCreate(final Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_gps_list);
|
||||
LogUtils.i("GpsListActivity", "页面初始化");
|
||||
|
||||
initView();
|
||||
initData();
|
||||
setSwipeRefreshListener();
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
swipeRefresh = findViewById(R.id.swipe_refresh_layout);
|
||||
rvGps = findViewById(R.id.rv_gps_list);
|
||||
dbManager = new GpsDbManager(this);
|
||||
rvGps.setLayoutManager(new LinearLayoutManager(this));
|
||||
LogUtils.i("GpsListActivity", "控件初始化完成");
|
||||
}
|
||||
|
||||
private void initData() {
|
||||
LogUtils.i("GpsListActivity", "开始加载GPS数据库数据");
|
||||
refreshGpsData();
|
||||
}
|
||||
|
||||
private void setSwipeRefreshListener() {
|
||||
swipeRefresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
|
||||
@Override
|
||||
public void onRefresh() {
|
||||
refreshGpsData();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void refreshGpsData() {
|
||||
new Handler().postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
final List<GpsBean> gpsDataList = dbManager.queryAllGps();
|
||||
LogUtils.i("GpsListActivity", "查询GPS数据条数:" + gpsDataList.size());
|
||||
|
||||
adapter = new GpsAdapter(GpsListActivity.this, gpsDataList);
|
||||
rvGps.setAdapter(adapter);
|
||||
swipeRefresh.setRefreshing(false);
|
||||
}
|
||||
}, 500);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package cc.winboll.studio.bytheway.activities;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.Switch;
|
||||
import cc.winboll.studio.bytheway.R;
|
||||
import cc.winboll.studio.bytheway.services.GpsReceiveService;
|
||||
|
||||
public class SettingsActivity extends Activity {
|
||||
|
||||
public static final String TAG = "SettingsActivity";
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_settings);
|
||||
|
||||
Switch swGpsService = findViewById(R.id.sw_gps_service);
|
||||
swGpsService.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
if (isChecked) {
|
||||
GpsReceiveService.startGpsService(SettingsActivity.this);
|
||||
} else {
|
||||
GpsReceiveService.stopGpsService(SettingsActivity.this);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package cc.winboll.studio.bytheway.adapters;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import cc.winboll.studio.bytheway.R;
|
||||
import cc.winboll.studio.bytheway.models.GpsBean;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author 豆包&BigPickle&ZhanGSKen<zhangsken@qq.com>
|
||||
* @Date 2026/07/02 15:10
|
||||
*/
|
||||
public class GpsAdapter extends RecyclerView.Adapter<GpsAdapter.GpsHolder> {
|
||||
|
||||
private final Context context;
|
||||
private final List<GpsBean> gpsList;
|
||||
private final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
public GpsAdapter(Context context, List<GpsBean> gpsList) {
|
||||
this.context = context;
|
||||
this.gpsList = gpsList;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public GpsHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(context).inflate(R.layout.item_gps, parent, false);
|
||||
return new GpsHolder(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull GpsHolder holder, int position) {
|
||||
GpsBean bean = gpsList.get(position);
|
||||
|
||||
//时间格式化
|
||||
String time = sdf.format(new Date(bean.getReceiveTime()));
|
||||
holder.tvTime.setText("接收时间:" + time);
|
||||
|
||||
//经纬度
|
||||
holder.tvLatLng.setText("纬度:" + bean.getLatitude() + " 经度:" + bean.getLongitude());
|
||||
|
||||
//海拔、精度、速度
|
||||
holder.tvOther.setText("精度:"+bean.getAccuracy()+"m 海拔:"+bean.getAltitude()+"m 速度:"+bean.getSpeed()+"m/s");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return gpsList.size();
|
||||
}
|
||||
|
||||
public static class GpsHolder extends RecyclerView.ViewHolder {
|
||||
TextView tvTime, tvLatLng, tvOther;
|
||||
|
||||
public GpsHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
tvTime = itemView.findViewById(R.id.tv_time);
|
||||
tvLatLng = itemView.findViewById(R.id.tv_lat_lng);
|
||||
tvOther = itemView.findViewById(R.id.tv_other);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package cc.winboll.studio.bytheway.helpers;
|
||||
|
||||
import android.content.Context;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.database.sqlite.SQLiteOpenHelper;
|
||||
|
||||
/**
|
||||
* GPS数据库创建、版本升级管理
|
||||
* @author 豆包&ZhanGSKen<zhangsken@qq.com>
|
||||
* 创建时间:2026-07-02 15:00:00
|
||||
* 最后编辑时间:2026-07-02 16:35:41
|
||||
*/
|
||||
public class GpsDbHelper extends SQLiteOpenHelper {
|
||||
|
||||
private static final String DB_NAME = "GpsLocation.db";
|
||||
private static final int DB_VERSION = 1;
|
||||
public static final String TABLE_GPS = "gps_table";
|
||||
|
||||
private static final String CREATE_TABLE = "CREATE TABLE " + TABLE_GPS + " ("
|
||||
+ "_id INTEGER PRIMARY KEY AUTOINCREMENT,"
|
||||
+ "latitude REAL,"
|
||||
+ "longitude REAL,"
|
||||
+ "accuracy REAL,"
|
||||
+ "altitude REAL,"
|
||||
+ "speed REAL,"
|
||||
+ "receive_time INTEGER"
|
||||
+ ")";
|
||||
|
||||
public GpsDbHelper(final Context context) {
|
||||
super(context, DB_NAME, null, DB_VERSION);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(final SQLiteDatabase db) {
|
||||
db.execSQL(CREATE_TABLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpgrade(final SQLiteDatabase db, final int oldVersion, final int newVersion) {
|
||||
db.execSQL("DROP TABLE IF EXISTS " + TABLE_GPS);
|
||||
onCreate(db);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,112 @@
|
||||
package cc.winboll.studio.bytheway.helpers;
|
||||
|
||||
import android.content.ContentValues;
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import cc.winboll.studio.bytheway.models.GpsBean;
|
||||
import cc.winboll.studio.libappbase.LogUtils;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* GPS SQLite数据库数据管理工具
|
||||
* 负责本地定位轨迹插入、查询、时间段筛选、清空操作
|
||||
* @author 豆包&ZhanGSKen<zhangsken@qq.com>
|
||||
* 创建时间:2026-07-02 15:03:00
|
||||
* 最后编辑时间:2026-07-02 16:35:41
|
||||
*/
|
||||
public class GpsDbManager {
|
||||
|
||||
private static final String TABLE_GPS = "gps_table";
|
||||
private final GpsDbHelper dbHelper;
|
||||
|
||||
public GpsDbManager(final Context context) {
|
||||
dbHelper = new GpsDbHelper(context);
|
||||
}
|
||||
|
||||
//插入单条GPS定位数据
|
||||
public void insertGps(final GpsBean bean) {
|
||||
final SQLiteDatabase db = dbHelper.getWritableDatabase();
|
||||
final ContentValues values = new ContentValues();
|
||||
|
||||
values.put("latitude", bean.getLatitude());
|
||||
values.put("longitude", bean.getLongitude());
|
||||
values.put("accuracy", bean.getAccuracy());
|
||||
values.put("altitude", bean.getAltitude());
|
||||
values.put("speed", bean.getSpeed());
|
||||
values.put("receive_time", bean.getReceiveTime());
|
||||
|
||||
db.insert(TABLE_GPS, null, values);
|
||||
LogUtils.i("GpsDbManager", "GPS数据插入成功");
|
||||
db.close();
|
||||
}
|
||||
|
||||
//查询全部GPS记录,按时间倒序排列
|
||||
public List<GpsBean> queryAllGps() {
|
||||
final List<GpsBean> list = new ArrayList<GpsBean>();
|
||||
final SQLiteDatabase db = dbHelper.getReadableDatabase();
|
||||
|
||||
final Cursor cursor = db.query(TABLE_GPS, null, null, null, null, null, "receive_time DESC");
|
||||
|
||||
if (cursor.moveToFirst()) {
|
||||
do {
|
||||
final GpsBean bean = new GpsBean();
|
||||
bean.setId(cursor.getInt(0));
|
||||
bean.setLatitude(cursor.getDouble(1));
|
||||
bean.setLongitude(cursor.getDouble(2));
|
||||
bean.setAccuracy(cursor.getFloat(3));
|
||||
bean.setAltitude(cursor.getDouble(4));
|
||||
bean.setSpeed(cursor.getFloat(5));
|
||||
bean.setReceiveTime(cursor.getLong(6));
|
||||
|
||||
list.add(bean);
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
|
||||
LogUtils.i("GpsDbManager", "查询全部GPS条数:" + list.size());
|
||||
cursor.close();
|
||||
db.close();
|
||||
return list;
|
||||
}
|
||||
|
||||
//根据时间区间查询GPS轨迹
|
||||
public List<GpsBean> queryByTime(final long startTime, final long endTime) {
|
||||
final List<GpsBean> list = new ArrayList<GpsBean>();
|
||||
final SQLiteDatabase db = dbHelper.getReadableDatabase();
|
||||
|
||||
final String where = "receive_time >= ? AND receive_time <= ?";
|
||||
final String[] args = {String.valueOf(startTime), String.valueOf(endTime)};
|
||||
|
||||
final Cursor cursor = db.query(TABLE_GPS, null, where, args, null, null, "receive_time ASC");
|
||||
|
||||
if (cursor.moveToFirst()) {
|
||||
do {
|
||||
final GpsBean bean = new GpsBean();
|
||||
bean.setId(cursor.getInt(0));
|
||||
bean.setLatitude(cursor.getDouble(1));
|
||||
bean.setLongitude(cursor.getDouble(2));
|
||||
bean.setAccuracy(cursor.getFloat(3));
|
||||
bean.setAltitude(cursor.getDouble(4));
|
||||
bean.setSpeed(cursor.getFloat(5));
|
||||
bean.setReceiveTime(cursor.getLong(6));
|
||||
|
||||
list.add(bean);
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
|
||||
LogUtils.i("GpsDbManager", "时间段查询GPS条数:" + list.size());
|
||||
cursor.close();
|
||||
db.close();
|
||||
return list;
|
||||
}
|
||||
|
||||
//清空所有本地GPS历史数据
|
||||
public void clearAllGps() {
|
||||
final SQLiteDatabase db = dbHelper.getWritableDatabase();
|
||||
db.delete(TABLE_GPS, null, null);
|
||||
LogUtils.i("GpsDbManager", "已清空全部GPS数据库数据");
|
||||
db.close();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package cc.winboll.studio.bytheway.models;
|
||||
|
||||
import java.util.Date;
|
||||
/**
|
||||
* @Author 豆包&BigPickle&ZhanGSKen<zhangsken@qq.com>
|
||||
* @Date 2026/07/02 14:56
|
||||
*/
|
||||
public class GpsBean {
|
||||
private int id;
|
||||
private double latitude; //纬度
|
||||
private double longitude; //经度
|
||||
private float accuracy; //精度
|
||||
private double altitude; //海拔
|
||||
private float speed; //速度
|
||||
private long receiveTime; //接收时间戳
|
||||
|
||||
public GpsBean() {}
|
||||
|
||||
public GpsBean(double latitude, double longitude, float accuracy, double altitude, float speed, long receiveTime) {
|
||||
this.latitude = latitude;
|
||||
this.longitude = longitude;
|
||||
this.accuracy = accuracy;
|
||||
this.altitude = altitude;
|
||||
this.speed = speed;
|
||||
this.receiveTime = receiveTime;
|
||||
}
|
||||
|
||||
//get set 方法
|
||||
public int getId() { return id; }
|
||||
public void setId(int id) { this.id = id; }
|
||||
public double getLatitude() { return latitude; }
|
||||
public void setLatitude(double latitude) { this.latitude = latitude; }
|
||||
public double getLongitude() { return longitude; }
|
||||
public void setLongitude(double longitude) { this.longitude = longitude; }
|
||||
public float getAccuracy() { return accuracy; }
|
||||
public void setAccuracy(float accuracy) { this.accuracy = accuracy; }
|
||||
public double getAltitude() { return altitude; }
|
||||
public void setAltitude(double altitude) { this.altitude = altitude; }
|
||||
public float getSpeed() { return speed; }
|
||||
public void setSpeed(float speed) { this.speed = speed; }
|
||||
public long getReceiveTime() { return receiveTime; }
|
||||
public void setReceiveTime(long receiveTime) { this.receiveTime = receiveTime; }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,152 @@
|
||||
package cc.winboll.studio.bytheway.services;
|
||||
|
||||
import android.app.Notification;
|
||||
import android.app.NotificationChannel;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.Service;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.os.Build;
|
||||
import android.os.IBinder;
|
||||
import android.widget.Toast;
|
||||
import cc.winboll.studio.bytheway.helpers.GpsDbManager;
|
||||
import cc.winboll.studio.bytheway.models.GpsBean;
|
||||
import cc.winboll.studio.libappbase.LogUtils;
|
||||
|
||||
/**
|
||||
* @Author 豆包&BigPickle&ZhanGSKen<zhangsken@qq.com>
|
||||
* @Date 2026/07/02 15:33
|
||||
* @Describe 动态注册定位广播,接收GPS数据并持久化存入SQLite数据库。单例独占模式,自带重复启动拦截,对外静态统一启停接口
|
||||
*/
|
||||
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_service_channel";
|
||||
|
||||
private static boolean serviceRunning = false;
|
||||
private GpsDbManager dbManager;
|
||||
private BroadcastReceiver gpsBroadcastReceiver;
|
||||
|
||||
/**
|
||||
* 外部统一静态启动服务
|
||||
*/
|
||||
public static void startGpsService(final Context context) {
|
||||
if (serviceRunning) {
|
||||
LogUtils.i("GpsReceiveService", "服务已运行,无需重复启动");
|
||||
return;
|
||||
}
|
||||
final Intent intent = new Intent(context, GpsReceiveService.class);
|
||||
context.startService(intent);
|
||||
LogUtils.i("GpsReceiveService", "GPS接收服务启动请求发送");
|
||||
}
|
||||
|
||||
/**
|
||||
* 外部统一静态关闭服务
|
||||
*/
|
||||
public static void stopGpsService(final Context context) {
|
||||
if (!serviceRunning) {
|
||||
LogUtils.i("GpsReceiveService", "服务未运行,无需关闭");
|
||||
return;
|
||||
}
|
||||
final Intent intent = new Intent(context, GpsReceiveService.class);
|
||||
context.stopService(intent);
|
||||
LogUtils.i("GpsReceiveService", "GPS接收服务停止请求发送");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
serviceRunning = true;
|
||||
dbManager = new GpsDbManager(getApplicationContext());
|
||||
registerGpsBroadcast();
|
||||
startForeground(NOTIFICATION_ID, createNotification());
|
||||
LogUtils.i("GpsReceiveService", "GPS接收服务创建完成");
|
||||
Toast.makeText(this, "GPS定位服务已开启", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
private Notification createNotification() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
NotificationChannel channel = new NotificationChannel(
|
||||
CHANNEL_ID,
|
||||
"GPS定位服务",
|
||||
NotificationManager.IMPORTANCE_LOW
|
||||
);
|
||||
NotificationManager manager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
|
||||
manager.createNotificationChannel(channel);
|
||||
}
|
||||
return new Notification.Builder(this, CHANNEL_ID)
|
||||
.setContentTitle("ByTheWay")
|
||||
.setContentText("GPS定位服务运行中")
|
||||
.setSmallIcon(android.R.drawable.ic_menu_mylocation)
|
||||
.setOngoing(true)
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 动态注册GPS定位广播接收器
|
||||
*/
|
||||
private void registerGpsBroadcast() {
|
||||
gpsBroadcastReceiver = new BroadcastReceiver() {
|
||||
@Override
|
||||
public void onReceive(final Context context, final Intent intent) {
|
||||
parseAndSaveGpsData(intent);
|
||||
}
|
||||
};
|
||||
final IntentFilter filter = new IntentFilter();
|
||||
//GPS定位广播动作,与你定位发送广播对应
|
||||
filter.addAction("android.location.GPS_LOCATION_BROADCAST");
|
||||
registerReceiver(gpsBroadcastReceiver, filter);
|
||||
LogUtils.i("GpsReceiveService", "GPS广播动态注册成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析广播GPS数据并写入SQLite数据库
|
||||
*/
|
||||
private void parseAndSaveGpsData(final Intent intent) {
|
||||
final double latitude = intent.getDoubleExtra("latitude", 0);
|
||||
final double longitude = intent.getDoubleExtra("longitude", 0);
|
||||
final float accuracy = intent.getFloatExtra("accuracy", 0);
|
||||
final double altitude = intent.getDoubleExtra("altitude", 0);
|
||||
final float speed = intent.getFloatExtra("speed", 0);
|
||||
final long time = intent.getLongExtra("receive_time", System.currentTimeMillis());
|
||||
|
||||
final GpsBean bean = new GpsBean();
|
||||
bean.setLatitude(latitude);
|
||||
bean.setLongitude(longitude);
|
||||
bean.setAccuracy(accuracy);
|
||||
bean.setAltitude(altitude);
|
||||
bean.setSpeed(speed);
|
||||
bean.setReceiveTime(time);
|
||||
|
||||
dbManager.insertGps(bean);
|
||||
LogUtils.d("GpsReceiveService", "收到GPS广播,已保存定位数据");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int onStartCommand(final Intent intent, final int flags, final int startId) {
|
||||
//单例不重启模式,被杀不自动重启
|
||||
return START_NOT_STICKY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBinder onBind(final Intent intent) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
stopForeground(true);
|
||||
serviceRunning = false;
|
||||
//反注册广播,防止内存泄漏
|
||||
if (gpsBroadcastReceiver != null) {
|
||||
unregisterReceiver(gpsBroadcastReceiver);
|
||||
}
|
||||
LogUtils.i("GpsReceiveService", "GPS接收服务已销毁,广播已解绑");
|
||||
Toast.makeText(this, "GPS定位服务已关闭", Toast.LENGTH_SHORT).show();
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:aapt="http://schemas.android.com/aapt"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportHeight="108"
|
||||
android:viewportWidth="108">
|
||||
<path
|
||||
android:fillType="evenOdd"
|
||||
android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z"
|
||||
android:strokeColor="#00000000"
|
||||
android:strokeWidth="1">
|
||||
<aapt:attr name="android:fillColor">
|
||||
<gradient
|
||||
android:endX="78.5885"
|
||||
android:endY="90.9159"
|
||||
android:startX="48.7653"
|
||||
android:startY="61.0927"
|
||||
android:type="linear">
|
||||
<item
|
||||
android:color="#44000000"
|
||||
android:offset="0.0" />
|
||||
<item
|
||||
android:color="#00000000"
|
||||
android:offset="1.0" />
|
||||
</gradient>
|
||||
</aapt:attr>
|
||||
</path>
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:fillType="nonZero"
|
||||
android:pathData="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z"
|
||||
android:strokeColor="#00000000"
|
||||
android:strokeWidth="1" />
|
||||
</vector>
|
||||
@@ -0,0 +1,170 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportHeight="108"
|
||||
android:viewportWidth="108">
|
||||
<path
|
||||
android:fillColor="#26A69A"
|
||||
android:pathData="M0,0h108v108h-108z" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M9,0L9,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,0L19,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,0L29,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,0L39,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,0L49,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,0L59,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,0L69,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,0L79,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M89,0L89,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M99,0L99,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,9L108,9"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,19L108,19"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,29L108,29"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,39L108,39"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,49L108,49"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,59L108,59"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,69L108,69"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,79L108,79"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,89L108,89"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,99L108,99"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,29L89,29"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,39L89,39"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,49L89,49"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,59L89,59"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,69L89,69"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,79L89,79"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,19L29,89"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,19L39,89"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,19L49,89"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,19L59,89"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,19L69,89"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,19L79,89"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
</vector>
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/swipe_refresh_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_gps_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<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: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="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>
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="16dp">
|
||||
|
||||
<Switch
|
||||
android:id="@+id/sw_gps_service"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="GPS定位服务" />
|
||||
|
||||
</LinearLayout>
|
||||
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="12dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_time"
|
||||
android:textSize="14sp"
|
||||
android:textColor="#333"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_lat_lng"
|
||||
android:textSize="13sp"
|
||||
android:layout_marginTop="4dp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_other"
|
||||
android:textSize="12sp"
|
||||
android:layout_marginTop="2dp"
|
||||
android:textColor="#666"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<item
|
||||
android:id="@+id/action_gps_list"
|
||||
android:icon="@android:drawable/ic_menu_mapmode"
|
||||
android:title="@string/action_gps_list"
|
||||
app:showAsAction="never" />
|
||||
|
||||
<item
|
||||
android:id="@+id/action_settings"
|
||||
android:icon="@android:drawable/ic_menu_preferences"
|
||||
android:title="@string/action_settings"
|
||||
app:showAsAction="never" />
|
||||
|
||||
</menu>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
||||
|
After Width: | Height: | Size: 3.0 KiB |
|
After Width: | Height: | Size: 4.9 KiB |
|
After Width: | Height: | Size: 2.0 KiB |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 4.5 KiB |
|
After Width: | Height: | Size: 6.9 KiB |
|
After Width: | Height: | Size: 6.3 KiB |
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 9.0 KiB |
|
After Width: | Height: | Size: 15 KiB |
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="colorPrimary">#42A5F5</color>
|
||||
<color name="colorPrimaryDark">#1565C0</color>
|
||||
<color name="colorAccent">#FFD740</color>
|
||||
<color name="mainWindowBackgroundColor">#121212</color>
|
||||
<color name="mainWindowTextColor">#E0E0E0</color>
|
||||
<color name="toolbarTextColor">#FFFFFF</color>
|
||||
<color name="toolbarBackgroundColor">#1E3A5F</color>
|
||||
<color name="debugTextColor">#00E676</color>
|
||||
<color name="colorTextBackgound">#121212</color>
|
||||
</resources>
|
||||
@@ -0,0 +1,29 @@
|
||||
<resources>
|
||||
|
||||
<style name="MyAppTheme" parent="Theme.AppCompat.NoActionBar">
|
||||
<item name="aSupportToolbar">@style/MyAESASupportToolbar</item>
|
||||
<item name="themeDebug">@style/MyDebugActivityTheme</item>
|
||||
<item name="aboutViewBackgroundColor">?attr/mainWindowDarkBackgroundColor</item>
|
||||
<item name="aboutViewTextColor">?attr/mainWindowDarkTextColor</item>
|
||||
<item name="aboutViewTitleColor">?attr/mainWindowDarkTextColor</item>
|
||||
<item name="aboutViewDividerColor">?attr/mainWindowTextColor</item>
|
||||
<item name="dialogBackgroundColor">?attr/mainWindowDarkBackgroundColor</item>
|
||||
<item name="dialogTextColor">?attr/mainWindowDarkTextColor</item>
|
||||
<item name="toolbarBackgroundColor">@color/toolbarBackgroundColor</item>
|
||||
<item name="toolbarTextColor">@color/toolbarTextColor</item>
|
||||
<item name="textViewBackgroundColor">?attr/mainWindowDarkBackgroundColor</item>
|
||||
<item name="textViewTextColor">?attr/mainWindowDarkTextColor</item>
|
||||
<item name="editTextBackgroundColor">?attr/mainWindowDarkBackgroundColor</item>
|
||||
<item name="editTextTextColor">?attr/mainWindowDarkTextColor</item>
|
||||
<item name="scrollViewBackgroundColor">?attr/mainWindowDarkBackgroundColor</item>
|
||||
<item name="activityBackgroundColor">?attr/mainWindowDarkBackgroundColor</item>
|
||||
<item name="activityTextColor">?attr/mainWindowDarkTextColor</item>
|
||||
<item name="mainWindowBackgroundColor">@color/mainWindowBackgroundColor</item>
|
||||
<item name="mainWindowTextColor">@color/mainWindowTextColor</item>
|
||||
<item name="mainWindowDarkBackgroundColor">@color/mainWindowBackgroundColor</item>
|
||||
<item name="mainWindowDarkTextColor">@color/mainWindowTextColor</item>
|
||||
</style>
|
||||
|
||||
<style name="MyAESASupportToolbar" parent="AESASupportToolbar" />
|
||||
|
||||
</resources>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="app_name">顺道说</string>
|
||||
|
||||
</resources>
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="colorPrimary">#1565C0</color>
|
||||
<color name="colorPrimaryDark">#0D47A1</color>
|
||||
<color name="colorAccent">#FF6F00</color>
|
||||
<color name="mainWindowBackgroundColor">#FAFAFA</color>
|
||||
<color name="mainWindowTextColor">#212121</color>
|
||||
<color name="toolbarTextColor">#FFFFFF</color>
|
||||
<color name="toolbarBackgroundColor">#1565C0</color>
|
||||
<color name="debugTextColor">#616161</color>
|
||||
<color name="colorTextBackgound">#FAFAFA</color>
|
||||
</resources>
|
||||
@@ -0,0 +1,5 @@
|
||||
<resources>
|
||||
<string name="app_name">ByTheWay</string>
|
||||
<string name="action_settings">设置</string>
|
||||
<string name="action_gps_list">GPS列表</string>
|
||||
</resources>
|
||||
@@ -0,0 +1,37 @@
|
||||
<resources>
|
||||
|
||||
<style name="MyAppTheme" parent="Theme.AppCompat.Light.NoActionBar">
|
||||
<item name="aSupportToolbar">@style/MyAESASupportToolbar</item>
|
||||
<item name="themeDebug">@style/MyDebugActivityTheme</item>
|
||||
<item name="aboutViewBackgroundColor">?attr/mainWindowBackgroundColor</item>
|
||||
<item name="aboutViewTextColor">?attr/mainWindowTextColor</item>
|
||||
<item name="aboutViewTitleColor">?attr/mainWindowTextColor</item>
|
||||
<item name="aboutViewDividerColor">?attr/mainWindowDarkTextColor</item>
|
||||
<item name="dialogBackgroundColor">?attr/mainWindowBackgroundColor</item>
|
||||
<item name="dialogTextColor">?attr/mainWindowTextColor</item>
|
||||
<item name="toolbarBackgroundColor">@color/toolbarBackgroundColor</item>
|
||||
<item name="toolbarTextColor">@color/toolbarTextColor</item>
|
||||
<item name="textViewBackgroundColor">?attr/mainWindowBackgroundColor</item>
|
||||
<item name="textViewTextColor">?attr/mainWindowTextColor</item>
|
||||
<item name="editTextBackgroundColor">?attr/mainWindowBackgroundColor</item>
|
||||
<item name="editTextTextColor">?attr/mainWindowTextColor</item>
|
||||
<item name="scrollViewBackgroundColor">?attr/mainWindowBackgroundColor</item>
|
||||
<item name="activityBackgroundColor">?attr/mainWindowBackgroundColor</item>
|
||||
<item name="activityTextColor">?attr/mainWindowTextColor</item>
|
||||
<item name="mainWindowBackgroundColor">@color/mainWindowBackgroundColor</item>
|
||||
<item name="mainWindowTextColor">@color/mainWindowTextColor</item>
|
||||
<item name="mainWindowDarkBackgroundColor">@color/mainWindowBackgroundColor</item>
|
||||
<item name="mainWindowDarkTextColor">@color/mainWindowTextColor</item>
|
||||
</style>
|
||||
|
||||
<style name="MyDebugActivityTheme" parent="DebugActivityTheme">
|
||||
<item name="colorTittle">?attr/mainWindowTextColor</item>
|
||||
<item name="colorTittleBackgound">?attr/toolbarBackgroundColor</item>
|
||||
<item name="colorText">?attr/debugTextColor</item>
|
||||
<item name="colorTextBackgound">?attr/mainWindowBackgroundColor</item>
|
||||
<item name="toolbarTextColor">@color/toolbarTextColor</item>
|
||||
</style>
|
||||
|
||||
<style name="MyAESASupportToolbar" parent="AESASupportToolbar" />
|
||||
|
||||
</resources>
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools" >
|
||||
|
||||
<application>
|
||||
|
||||
<!-- Put flavor specific code here -->
|
||||
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<!-- Put flavor specific strings here -->
|
||||
|
||||
</resources>
|
||||
@@ -1,3 +1,3 @@
|
||||
// MyWinBoLL 项目编译设置
|
||||
include ':mywinboll'
|
||||
rootProject.name = "mywinboll"
|
||||
// ByTheWay 项目编译设置
|
||||
include ':bytheway'
|
||||
rootProject.name = "bytheway"
|
||||
@@ -1,3 +1,7 @@
|
||||
// MyWinBoLL 项目编译设置
|
||||
//include ':mywinboll'
|
||||
//rootProject.name = "mywinboll"
|
||||
//rootProject.name = "mywinboll"
|
||||
|
||||
// ByTheWay 项目编译设置
|
||||
//include ':bytheway'
|
||||
//rootProject.name = "bytheway"
|
||||