命名空间重构

This commit is contained in:
ZhanGSKen
2025-02-27 11:05:15 +08:00
parent 820574a4ba
commit fb7017a857
16 changed files with 240 additions and 201 deletions

View File

@@ -20,13 +20,23 @@ android {
}
dependencies {
api 'com.github.getActivity:ToastUtils:10.5'
implementation fileTree(dir: 'libs', include: ['*.jar'])
api 'androidx.appcompat:appcompat:1.3.1'
api 'androidx.vectordrawable:vectordrawable:1.1.0'
api 'androidx.vectordrawable:vectordrawable-animated:1.1.0'
api 'androidx.fragment:fragment:1.1.0'
api 'com.google.android.material:material:1.1.0'
// 二维码类库
implementation 'com.google.zxing:core:3.4.1'
implementation 'com.journeyapps:zxing-android-embedded:3.6.0'
// 应用介绍页类库
implementation 'io.github.medyo:android-about-page:2.0.0'
// 吐司类库
implementation 'com.github.getActivity:ToastUtils:10.5'
// 网络连接类库
implementation 'com.squareup.okhttp3:okhttp:4.4.1'
api fileTree(dir: 'libs', include: ['*.jar'])
// Android 类库
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.viewpager:viewpager:1.0.0'
implementation 'androidx.vectordrawable:vectordrawable:1.1.0'
implementation 'androidx.vectordrawable:vectordrawable-animated:1.1.0'
implementation 'androidx.fragment:fragment:1.1.0'
implementation 'com.google.android.material:material:1.4.0'
}

View File

@@ -1,8 +1,8 @@
#Created by .winboll/winboll_app_build.gradle
#Tue Feb 25 16:51:09 HKT 2025
#Thu Feb 27 02:21:32 GMT 2025
stageCount=3
libraryProject=libappbase
baseVersion=2.0
publishVersion=2.0.2
buildCount=0
buildCount=4
baseBetaVersion=2.0.3

View File

@@ -10,22 +10,24 @@ import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.IBinder;
import cc.winboll.studio.libappbase.bean.APPSOSBean;
import cc.winboll.studio.libappbase.bean.APPNewsBean;
import java.util.ArrayList;
public class SOS {
public class WinBoll {
public static final String TAG = "SOS";
public static final String TAG = "WinBoll";
public static final String ACTION_SOS = SOS.class.getName() + ".ACTION_SOS";
public static final String ACTION_BIND = SOS.class.getName() + ".ACTION_BIND";
public static final String ACTION_SERVICE_ENABLE = SOS.class.getName() + ".ACTION_SERVICE_ENABLE";
public static final String ACTION_SERVICE_DISABLE = SOS.class.getName() + ".ACTION_SERVICE_DISENABLE";
public static final String ACTION_SOS = WinBoll.class.getName() + ".ACTION_SOS";
public static final String ACTION_BIND = WinBoll.class.getName() + ".ACTION_BIND";
public static final String ACTION_SERVICE_ENABLE = WinBoll.class.getName() + ".ACTION_SERVICE_ENABLE";
public static final String ACTION_SERVICE_DISABLE = WinBoll.class.getName() + ".ACTION_SERVICE_DISENABLE";
public static final String EXTRA_SOS = "EXTRA_SOS";
public static final String EXTRA_APPNEWSBEAN = "EXTRA_APPNEWSBEAN";
public static void sosWinBollService(Context context, APPSOSBean bean) {
public static void sosService(Context context, APPNewsBean bean) {
Intent intent = new Intent(ACTION_SOS);
intent.putExtra("SOS", "Service");
intent.putExtra("APPSOSBean", bean.toString());
intent.putExtra(EXTRA_SOS, "Service");
intent.putExtra(EXTRA_APPNEWSBEAN, bean.toString());
String szToPackage = "";
if (GlobalApplication.isDebuging()) {
szToPackage = "cc.winboll.studio.appbase.beta";
@@ -39,10 +41,10 @@ public class SOS {
//ToastUtils.show("SOS Send To WinBoll");
}
public static void bindToAPPService(Context context, APPSOSBean bean) {
public static void bindToAPPBase(Context context, APPNewsBean bean) {
Intent intent = new Intent(ACTION_BIND);
intent.putExtra("SOS", "Service");
intent.putExtra("APPSOSBean", bean.toString());
intent.putExtra(EXTRA_SOS, "Service");
intent.putExtra(EXTRA_APPNEWSBEAN, bean.toString());
String szToPackage = "";
if (GlobalApplication.isDebuging()) {
szToPackage = "cc.winboll.studio.appbase.beta";

View File

@@ -11,59 +11,59 @@ import cc.winboll.studio.libappbase.BaseBean;
import java.io.IOException;
import java.io.Serializable;
public class APPSOSBean extends BaseBean {
public class APPNewsBean extends BaseBean {
public static final String TAG = "APPSOSBean";
public static final String TAG = "APPNewsBean";
protected String sosPackage;
protected String sosClassName;
protected String newsPackageName;
protected String newsClassName;
public APPSOSBean() {
this.sosPackage = "";
this.sosClassName = "";
public APPNewsBean() {
this.newsPackageName = "";
this.newsClassName = "";
}
public APPSOSBean(String sosPackage, String sosClassName) {
this.sosPackage = sosPackage;
this.sosClassName = sosClassName;
public APPNewsBean(String newsPackageName, String newsClassName) {
this.newsPackageName = newsPackageName;
this.newsClassName = newsClassName;
}
public void setSosPackage(String sosPackage) {
this.sosPackage = sosPackage;
public void setNewsPackageName(String newsPackageName) {
this.newsPackageName = newsPackageName;
}
public String getSosPackage() {
return sosPackage;
public String getNewsPackageName() {
return newsPackageName;
}
public void setSosClassName(String sosClassName) {
this.sosClassName = sosClassName;
public void setNewsClassName(String sosClassName) {
this.newsClassName = sosClassName;
}
public String getSosClassName() {
return sosClassName;
public String getNewsClassName() {
return newsClassName;
}
@Override
public String getName() {
return APPSOSBean.class.getName();
return APPNewsBean.class.getName();
}
@Override
public void writeThisToJsonWriter(JsonWriter jsonWriter) throws IOException {
super.writeThisToJsonWriter(jsonWriter);
jsonWriter.name("sosPackage").value(getSosPackage());
jsonWriter.name("sosClassName").value(getSosClassName());
jsonWriter.name("newsPackageName").value(getNewsPackageName());
jsonWriter.name("newsClassName").value(getNewsClassName());
}
@Override
public boolean initObjectsFromJsonReader(JsonReader jsonReader, String name) throws IOException {
if (super.initObjectsFromJsonReader(jsonReader, name)) { return true; } else {
if (name.equals("sosPackage")) {
setSosPackage(jsonReader.nextString());
} else if (name.equals("sosClassName")) {
setSosClassName(jsonReader.nextString());
if (name.equals("newsPackageName")) {
setNewsPackageName(jsonReader.nextString());
} else if (name.equals("newsClassName")) {
setNewsClassName(jsonReader.nextString());
} else {
return false;
}

View File

@@ -11,8 +11,8 @@ import android.content.Intent;
import android.os.Binder;
import android.os.IBinder;
import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.libappbase.SOS;
import cc.winboll.studio.libappbase.bean.APPSOSBean;
import cc.winboll.studio.libappbase.WinBoll;
import cc.winboll.studio.libappbase.bean.APPNewsBean;
import cc.winboll.studio.libappbase.bean.TestServiceBean;
public class TestService extends Service {
@@ -58,11 +58,11 @@ public class TestService extends Service {
if (bean == null) {
bean = new TestServiceBean();
}
if (intent.getAction() != null && intent.getAction().equals(SOS.ACTION_SERVICE_ENABLE)) {
if (intent.getAction() != null && intent.getAction().equals(WinBoll.ACTION_SERVICE_ENABLE)) {
bean.setIsEnable(true);
TestServiceBean.saveBean(this, bean);
run();
} else if (intent.getAction() != null && intent.getAction().equals(SOS.ACTION_SERVICE_DISABLE)) {
} else if (intent.getAction() != null && intent.getAction().equals(WinBoll.ACTION_SERVICE_DISABLE)) {
bean.setIsEnable(false);
TestServiceBean.saveBean(this, bean);
}
@@ -130,7 +130,7 @@ public class TestService extends Service {
isStarted = true;
super.run();
LogUtils.d(TAG, "run() start");
SOS.bindToAPPService(mContext, new APPSOSBean(mContext.getPackageName(), TestService.class.getName()));
WinBoll.bindToAPPBase(mContext, new APPNewsBean(mContext.getPackageName(), TestService.class.getName()));
while (!isExit()) {
LogUtils.d(TAG, "run()");