Compare commits
10 Commits
appbase-v1
...
appbase-v2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9b1264234e | ||
|
|
d207a9ea9b | ||
|
|
404239de23 | ||
|
|
e849e54960 | ||
|
|
8b2866419c | ||
|
|
22a4a71203 | ||
|
|
292f7c553f | ||
|
|
df9970c6df | ||
|
|
0312ca50d2 | ||
|
|
56187b588f |
@@ -18,18 +18,18 @@ def genVersionName(def versionName){
|
|||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 32
|
compileSdkVersion 30
|
||||||
buildToolsVersion "33.0.3"
|
buildToolsVersion "30.0.3"
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "cc.winboll.studio.appbase"
|
applicationId "cc.winboll.studio.appbase"
|
||||||
minSdkVersion 21
|
minSdkVersion 26
|
||||||
targetSdkVersion 30
|
targetSdkVersion 29
|
||||||
versionCode 1
|
versionCode 1
|
||||||
// versionName 更新后需要手动设置
|
// versionName 更新后需要手动设置
|
||||||
// .winboll/winbollBuildProps.properties 文件的 stageCount=0
|
// .winboll/winbollBuildProps.properties 文件的 stageCount=0
|
||||||
// Gradle编译环境下合起来的 versionName 就是 "${versionName}.0"
|
// Gradle编译环境下合起来的 versionName 就是 "${versionName}.0"
|
||||||
versionName "1.5"
|
versionName "2.0"
|
||||||
if(true) {
|
if(true) {
|
||||||
versionName = genVersionName("${versionName}")
|
versionName = genVersionName("${versionName}")
|
||||||
}
|
}
|
||||||
@@ -41,11 +41,6 @@ android {
|
|||||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
compileOptions {
|
|
||||||
sourceCompatibility JavaVersion.VERSION_11
|
|
||||||
targetCompatibility JavaVersion.VERSION_11
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#Created by .winboll/winboll_app_build.gradle
|
#Created by .winboll/winboll_app_build.gradle
|
||||||
#Wed Feb 19 19:57:00 HKT 2025
|
#Tue Feb 25 08:02:20 GMT 2025
|
||||||
stageCount=5
|
stageCount=0
|
||||||
libraryProject=libappbase
|
libraryProject=libappbase
|
||||||
baseVersion=1.5
|
baseVersion=2.0
|
||||||
publishVersion=1.5.4
|
publishVersion=2.0.0
|
||||||
buildCount=0
|
buildCount=1
|
||||||
baseBetaVersion=1.5.5
|
baseBetaVersion=2.0.1
|
||||||
|
|||||||
@@ -64,6 +64,8 @@
|
|||||||
android:exported="true">
|
android:exported="true">
|
||||||
|
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
|
<action android:name="cc.winboll.studio.appbase.widgets.SOSWidget.ACTION_WAKEUP_SERVICE"/>
|
||||||
|
<action android:name="cc.winboll.studio.appbase.widgets.SOSWidget.ACTION_RELOAD_REPORT"/>
|
||||||
<action android:name="android.appwidget.action.APPWIDGET_UPDATE"/>
|
<action android:name="android.appwidget.action.APPWIDGET_UPDATE"/>
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
|
||||||
|
|||||||
@@ -100,8 +100,9 @@ public class MainReceiver extends BroadcastReceiver {
|
|||||||
sbLine.append("] Power to ");
|
sbLine.append("] Power to ");
|
||||||
sbLine.append(appName);
|
sbLine.append(appName);
|
||||||
appSOSReportBean.setSosReport(sbLine.toString());
|
appSOSReportBean.setSosReport(sbLine.toString());
|
||||||
|
|
||||||
SOSWidget.addAPPSOSReportBean(context, appSOSReportBean);
|
SOSWidget.addAPPSOSReportBean(context, appSOSReportBean);
|
||||||
|
|
||||||
Intent intentWidget = new Intent(context, SOSWidget.class);
|
Intent intentWidget = new Intent(context, SOSWidget.class);
|
||||||
intentWidget.setAction(SOSWidget.ACTION_RELOAD_REPORT);
|
intentWidget.setAction(SOSWidget.ACTION_RELOAD_REPORT);
|
||||||
context.sendBroadcast(intentWidget);
|
context.sendBroadcast(intentWidget);
|
||||||
|
|||||||
@@ -210,6 +210,12 @@ public class MainService extends Service {
|
|||||||
intentService.setComponent(new ComponentName(bean.getSosPackage(), bean.getSosClassName()));
|
intentService.setComponent(new ComponentName(bean.getSosPackage(), bean.getSosClassName()));
|
||||||
bindService(intentService, sosConnection, Context.BIND_IMPORTANT);
|
bindService(intentService, sosConnection, Context.BIND_IMPORTANT);
|
||||||
mSOSConnectionList.add(sosConnection);
|
mSOSConnectionList.add(sosConnection);
|
||||||
|
|
||||||
|
Intent intentWidget = new Intent(this, SOSWidget.class);
|
||||||
|
intentWidget.setAction(SOSWidget.ACTION_WAKEUP_SERVICE);
|
||||||
|
APPSOSBean appSOSBean = new APPSOSBean(bean.getSosPackage(), bean.getSosClassName());
|
||||||
|
intentWidget.putExtra("APPSOSBean", appSOSBean.toString());
|
||||||
|
sendBroadcast(intentWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class SOSConnection implements ServiceConnection {
|
public class SOSConnection implements ServiceConnection {
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
package cc.winboll.studio.appbase.services;
|
|
||||||
|
|
||||||
|
|
||||||
@@ -24,8 +24,8 @@ import java.util.Date;
|
|||||||
public class SOSWidget extends AppWidgetProvider {
|
public class SOSWidget extends AppWidgetProvider {
|
||||||
|
|
||||||
public static final String TAG = "SOSWidget";
|
public static final String TAG = "SOSWidget";
|
||||||
|
|
||||||
public static final String ACTION_SOS = "cc.winboll.studio.appbase.widgets.SOSWidget.ACTION_SOS";
|
public static final String ACTION_WAKEUP_SERVICE = "cc.winboll.studio.appbase.widgets.SOSWidget.ACTION_WAKEUP_SERVICE";
|
||||||
public static final String ACTION_RELOAD_REPORT = "cc.winboll.studio.appbase.widgets.SOSWidget.ACTION_RELOAD_REPORT";
|
public static final String ACTION_RELOAD_REPORT = "cc.winboll.studio.appbase.widgets.SOSWidget.ACTION_RELOAD_REPORT";
|
||||||
|
|
||||||
|
|
||||||
@@ -53,6 +53,44 @@ public class SOSWidget extends AppWidgetProvider {
|
|||||||
for (int appWidgetId : appWidgetIds) {
|
for (int appWidgetId : appWidgetIds) {
|
||||||
updateAppWidget(context, appWidgetManager, appWidgetId);
|
updateAppWidget(context, appWidgetManager, appWidgetId);
|
||||||
}
|
}
|
||||||
|
}else if (intent.getAction().equals(ACTION_WAKEUP_SERVICE)) {
|
||||||
|
LogUtils.d(TAG, "ACTION_WAKEUP_SERVICE");
|
||||||
|
String szAPPSOSBean = intent.getStringExtra("APPSOSBean");
|
||||||
|
LogUtils.d(TAG, String.format("szAPPSOSBean %s", szAPPSOSBean));
|
||||||
|
if (szAPPSOSBean != null && !szAPPSOSBean.equals("")) {
|
||||||
|
try {
|
||||||
|
APPSOSBean bean = APPSOSBean.parseStringToBean(szAPPSOSBean, APPSOSBean.class);
|
||||||
|
if (bean != null) {
|
||||||
|
String sosPackage = bean.getSosPackage();
|
||||||
|
LogUtils.d(TAG, String.format("sosPackage %s", sosPackage));
|
||||||
|
String sosClassName = bean.getSosClassName();
|
||||||
|
LogUtils.d(TAG, String.format("sosClassName %s", sosClassName));
|
||||||
|
|
||||||
|
|
||||||
|
String appName = AppUtils.getAppNameByPackageName(context, sosPackage);
|
||||||
|
LogUtils.d(TAG, String.format("appName %s", appName));
|
||||||
|
SOSReportBean appSOSReportBean = new SOSReportBean(appName);
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
|
||||||
|
String currentTime = sdf.format(new Date());
|
||||||
|
StringBuilder sbLine = new StringBuilder();
|
||||||
|
sbLine.append("[");
|
||||||
|
sbLine.append(currentTime);
|
||||||
|
sbLine.append("] Wake up ");
|
||||||
|
sbLine.append(appName);
|
||||||
|
appSOSReportBean.setSosReport(sbLine.toString());
|
||||||
|
|
||||||
|
addAPPSOSReportBean(context, appSOSReportBean);
|
||||||
|
|
||||||
|
AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context);
|
||||||
|
int[] appWidgetIds = appWidgetManager.getAppWidgetIds(new ComponentName(context, SOSWidget.class));
|
||||||
|
for (int appWidgetId : appWidgetIds) {
|
||||||
|
updateAppWidget(context, appWidgetManager, appWidgetId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
LogUtils.d(TAG, e, Thread.currentThread().getStackTrace());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,13 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Hello, WinBoll!"/>
|
android:text="Hello, WinBoll!"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Android版本10的代号是“Q”,API级别是29。 Android 10开始谷歌不再公开使用甜品作为版本代号,但内部仍保留了大量与“Q”相关的元素。Android 10本身并没有严格对应某个特定的Java版本,但在开发Android 10应用时,通常可以使用Java 8或更高版本。
|
||||||
|
|
||||||
|
Java 8为Android开发带来了诸如Lambda表达式、方法引用等新特性,能提高开发效率和代码可读性,与Android 10开发适配良好。Java 9及更高版本也可用于Android 10开发,能使用一些新的语言特性和API,但可能需要注意兼容性和配置问题。"/>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@@ -61,33 +68,33 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="StartTestService"
|
android:text="StartTestService"
|
||||||
android:textAllCaps="false"
|
android:textAllCaps="false"
|
||||||
android:onClick="onStartTestService"/>
|
android:onClick="onStartTestService"/>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="StopTestService"
|
android:text="StopTestService"
|
||||||
android:textAllCaps="false"
|
android:textAllCaps="false"
|
||||||
android:onClick="onStopTestService"/>
|
android:onClick="onStopTestService"/>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="StopTestServiceNoSettings"
|
android:text="StopTestServiceNoSettings"
|
||||||
android:textAllCaps="false"
|
android:textAllCaps="false"
|
||||||
android:onClick="onStopTestServiceNoSettings"/>
|
android:onClick="onStopTestServiceNoSettings"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</HorizontalScrollView>
|
</HorizontalScrollView>
|
||||||
|
|
||||||
|
|||||||
@@ -69,6 +69,14 @@ allprojects {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
subprojects {
|
||||||
|
tasks.withType(JavaCompile) {
|
||||||
|
options.compilerArgs << "-parameters"
|
||||||
|
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||||
|
targetCompatibility = JavaVersion.VERSION_1_8
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
task clean(type: Delete) {
|
task clean(type: Delete) {
|
||||||
|
|||||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,5 +1,5 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl = https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
|
distributionUrl=https://services.gradle.org/distributions/gradle-7.5-all.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|||||||
@@ -4,14 +4,12 @@ apply from: '../.winboll/winboll_lib_build.gradle'
|
|||||||
apply from: '../.winboll/winboll_lint_build.gradle'
|
apply from: '../.winboll/winboll_lint_build.gradle'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
namespace 'cc.winboll.studio.libappbase'
|
compileSdkVersion 30
|
||||||
|
buildToolsVersion "30.0.3"
|
||||||
compileSdkVersion 32
|
|
||||||
buildToolsVersion "33.0.3"
|
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 21
|
minSdkVersion 26
|
||||||
targetSdkVersion 30
|
targetSdkVersion 29
|
||||||
}
|
}
|
||||||
buildTypes {
|
buildTypes {
|
||||||
release {
|
release {
|
||||||
@@ -19,10 +17,6 @@ android {
|
|||||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
compileOptions {
|
|
||||||
sourceCompatibility JavaVersion.VERSION_11
|
|
||||||
targetCompatibility JavaVersion.VERSION_11
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#Created by .winboll/winboll_app_build.gradle
|
#Created by .winboll/winboll_app_build.gradle
|
||||||
#Wed Feb 19 19:57:00 HKT 2025
|
#Tue Feb 25 08:02:20 GMT 2025
|
||||||
stageCount=5
|
stageCount=0
|
||||||
libraryProject=libappbase
|
libraryProject=libappbase
|
||||||
baseVersion=1.5
|
baseVersion=2.0
|
||||||
publishVersion=1.5.4
|
publishVersion=2.0.0
|
||||||
buildCount=0
|
buildCount=1
|
||||||
baseBetaVersion=1.5.5
|
baseBetaVersion=2.0.1
|
||||||
|
|||||||
@@ -118,7 +118,11 @@ public abstract class BaseBean<T extends BaseBean> {
|
|||||||
|
|
||||||
public static <T extends BaseBean> boolean parseStringToBeanList(String szBeanList, ArrayList<T> beanList, Class<T> clazz) {
|
public static <T extends BaseBean> boolean parseStringToBeanList(String szBeanList, ArrayList<T> beanList, Class<T> clazz) {
|
||||||
try {
|
try {
|
||||||
beanList.clear();
|
if(beanList == null) {
|
||||||
|
beanList = new ArrayList<T>();
|
||||||
|
} else {
|
||||||
|
beanList.clear();
|
||||||
|
}
|
||||||
StringReader stringReader = new StringReader(szBeanList);
|
StringReader stringReader = new StringReader(szBeanList);
|
||||||
JsonReader jsonReader = new JsonReader(stringReader);
|
JsonReader jsonReader = new JsonReader(stringReader);
|
||||||
jsonReader.beginArray();
|
jsonReader.beginArray();
|
||||||
|
|||||||
Reference in New Issue
Block a user