命名空间调整
This commit is contained in:
parent
6e8e32c497
commit
2a9ec064f9
@ -1,8 +1,8 @@
|
||||
#Created by .winboll/winboll_app_build.gradle
|
||||
#Fri Mar 28 18:48:42 HKT 2025
|
||||
#Fri Mar 28 12:21:28 GMT 2025
|
||||
stageCount=19
|
||||
libraryProject=libapputils
|
||||
baseVersion=15.0
|
||||
publishVersion=15.0.18
|
||||
buildCount=0
|
||||
buildCount=5
|
||||
baseBetaVersion=15.0.19
|
||||
|
@ -13,10 +13,10 @@ import android.os.Bundle;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.widget.Toolbar;
|
||||
import cc.winboll.studio.apputils.R;
|
||||
import cc.winboll.studio.libappbase.LogUtils;
|
||||
import cc.winboll.studio.libappbase.winboll.IWinBollActivity;
|
||||
import cc.winboll.studio.apputils.R;
|
||||
import cc.winboll.studio.libapputils.view.SimpleWebView;
|
||||
import cc.winboll.studio.libapputils.views.SimpleWebView;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
|
@ -8,7 +8,7 @@ import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.widget.Toolbar;
|
||||
import cc.winboll.studio.apputils.R;
|
||||
import cc.winboll.studio.libapputils.view.StringToQrCodeView;
|
||||
import cc.winboll.studio.libapputils.views.StringToQrCodeView;
|
||||
|
||||
public class TestStringToQRCodeViewActivity extends Activity {
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/toolbar"/>
|
||||
|
||||
<cc.winboll.studio.libapputils.view.SimpleWebView
|
||||
<cc.winboll.studio.libapputils.views.SimpleWebView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1.0"
|
||||
|
@ -17,7 +17,7 @@
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1.0">
|
||||
|
||||
<cc.winboll.studio.libapputils.view.StringToQrCodeView
|
||||
<cc.winboll.studio.libapputils.views.StringToQrCodeView
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="300dp"
|
||||
android:id="@+id/activityteststringtoqrcodeviewStringToQrCodeView1"/>
|
||||
|
@ -42,7 +42,7 @@ dependencies {
|
||||
// https://mvnrepository.com/artifact/com.android.support/recyclerview-v7
|
||||
api 'com.android.support:recyclerview-v7:28.0.0'
|
||||
|
||||
api 'cc.winboll.studio:libappbase:15.1.3'
|
||||
api 'cc.winboll.studio:libappbase:15.1.4'
|
||||
|
||||
// 二维码类库
|
||||
api 'com.google.zxing:core:3.4.1'
|
||||
|
@ -1,8 +1,8 @@
|
||||
#Created by .winboll/winboll_app_build.gradle
|
||||
#Fri Mar 28 18:48:07 HKT 2025
|
||||
#Fri Mar 28 12:21:28 GMT 2025
|
||||
stageCount=19
|
||||
libraryProject=libapputils
|
||||
baseVersion=15.0
|
||||
publishVersion=15.0.18
|
||||
buildCount=0
|
||||
buildCount=5
|
||||
baseBetaVersion=15.0.19
|
||||
|
@ -1,95 +0,0 @@
|
||||
package cc.winboll.studio.libapputils.service;
|
||||
|
||||
/**
|
||||
* @Author ZhanGSKen@QQ.COM
|
||||
* @Date 2024/12/08 20:15:42
|
||||
* @Describe 应用主要服务组件类守护进程服务组件类
|
||||
*/
|
||||
import android.app.Service;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.ServiceConnection;
|
||||
import android.os.IBinder;
|
||||
import cc.winboll.studio.libapputils.util.ServiceUtils;
|
||||
|
||||
public class AssistantService extends Service {
|
||||
|
||||
public final static String TAG = "AssistantService";
|
||||
|
||||
WinBollClientServiceBean mWinBollServiceBean;
|
||||
MyServiceConnection mMyServiceConnection;
|
||||
volatile boolean mIsServiceRunning;
|
||||
|
||||
@Override
|
||||
public IBinder onBind(Intent intent) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
mWinBollServiceBean = WinBollClientServiceBean.loadWinBollClientServiceBean(this);
|
||||
if (mMyServiceConnection == null) {
|
||||
mMyServiceConnection = new MyServiceConnection();
|
||||
}
|
||||
// 设置运行参数
|
||||
mIsServiceRunning = false;
|
||||
run();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||
run();
|
||||
return START_STICKY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
mIsServiceRunning = false;
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
//
|
||||
// 运行服务内容
|
||||
//
|
||||
void run() {
|
||||
mWinBollServiceBean = WinBollClientServiceBean.loadWinBollClientServiceBean(this);
|
||||
if (mWinBollServiceBean.isEnable()) {
|
||||
if (mIsServiceRunning == false) {
|
||||
// 设置运行状态
|
||||
mIsServiceRunning = true;
|
||||
// 唤醒和绑定主进程
|
||||
wakeupAndBindMain();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// 唤醒和绑定主进程
|
||||
//
|
||||
void wakeupAndBindMain() {
|
||||
if (ServiceUtils.isServiceAlive(getApplicationContext(), WinBollClientService.class.getName()) == false) {
|
||||
startForegroundService(new Intent(AssistantService.this, WinBollClientService.class));
|
||||
}
|
||||
|
||||
bindService(new Intent(AssistantService.this, WinBollClientService.class), mMyServiceConnection, Context.BIND_IMPORTANT);
|
||||
}
|
||||
|
||||
//
|
||||
// 主进程与守护进程连接时需要用到此类
|
||||
//
|
||||
class MyServiceConnection implements ServiceConnection {
|
||||
@Override
|
||||
public void onServiceConnected(ComponentName name, IBinder service) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onServiceDisconnected(ComponentName name) {
|
||||
mWinBollServiceBean = WinBollClientServiceBean.loadWinBollClientServiceBean(AssistantService.this);
|
||||
if (mWinBollServiceBean.isEnable()) {
|
||||
wakeupAndBindMain();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
package cc.winboll.studio.libapputils.service;
|
||||
|
||||
/**
|
||||
* @Author ZhanGSKen@QQ.COM
|
||||
* @Date 2024/12/09 08:37:31
|
||||
* @Describe WinBoll UI 状态图标枚举
|
||||
*/
|
||||
import cc.winboll.studio.libapputils.R;
|
||||
|
||||
public enum EWUIStatusIconDrawable {
|
||||
NORMAL(0),
|
||||
NEWS(1)
|
||||
;
|
||||
|
||||
static final String TAG = "WUIStatusIconDrawable";
|
||||
|
||||
static String[] _mlistCNName = { "正常", "新的消息" };
|
||||
|
||||
private int value = 0;
|
||||
private EWUIStatusIconDrawable(int value) { //必须是private的,否则编译错误
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public static int getIconDrawableId(EWUIStatusIconDrawable drawableId) {
|
||||
int res;
|
||||
switch(drawableId){
|
||||
case NEWS :
|
||||
res = R.drawable.ic_winbollbeta;
|
||||
break;
|
||||
default :
|
||||
res = R.drawable.ic_winboll;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
package cc.winboll.studio.libapputils.service;
|
||||
|
||||
/**
|
||||
* @Author ZhanGSKen@QQ.COM
|
||||
* @Date 2024/12/08 23:40:05
|
||||
* @Describe WinBollService 服务 Binder。
|
||||
*/
|
||||
import android.graphics.drawable.Drawable;
|
||||
|
||||
public interface IWinBollClientServiceBinder {
|
||||
|
||||
public static final String TAG = "IWinBollClientServiceBinder";
|
||||
|
||||
public WinBollClientService getService();
|
||||
|
||||
public Drawable getCurrentStatusIconDrawable();
|
||||
}
|
@ -1,189 +0,0 @@
|
||||
package cc.winboll.studio.libapputils.service;
|
||||
|
||||
import android.app.Service;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.ServiceConnection;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.IBinder;
|
||||
import cc.winboll.studio.libappbase.LogUtils;
|
||||
import cc.winboll.studio.libappbase.utils.ToastUtils;
|
||||
import cc.winboll.studio.libapputils.util.ServiceUtils;
|
||||
|
||||
/**
|
||||
* @Author ZhanGSKen@QQ.COM
|
||||
* @Date 2024/12/08 19:42:07
|
||||
* @Describe WinBoll 客户端服务
|
||||
*/
|
||||
public class WinBollClientService extends Service implements IWinBollClientServiceBinder {
|
||||
|
||||
public static final String TAG = "WinBollClientService";
|
||||
|
||||
WinBollClientServiceBean mWinBollClientServiceBean;
|
||||
MyServiceConnection mMyServiceConnection;
|
||||
volatile boolean mIsWinBollClientThreadRunning;
|
||||
volatile boolean mIsEnableService;
|
||||
WinBollClientThread mWinBollClientThread;
|
||||
|
||||
public boolean isWinBollClientThreadRunning() {
|
||||
return mIsWinBollClientThreadRunning;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WinBollClientService getService() {
|
||||
return WinBollClientService.this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Drawable getCurrentStatusIconDrawable() {
|
||||
return mIsWinBollClientThreadRunning ?
|
||||
getDrawable(EWUIStatusIconDrawable.getIconDrawableId(EWUIStatusIconDrawable.NORMAL))
|
||||
: getDrawable(EWUIStatusIconDrawable.getIconDrawableId(EWUIStatusIconDrawable.NEWS));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBinder onBind(Intent intent) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
ToastUtils.show("onCreate");
|
||||
super.onCreate();
|
||||
mWinBollClientThread = null;
|
||||
mWinBollClientServiceBean = WinBollClientServiceBean.loadWinBollClientServiceBean(this);
|
||||
mIsEnableService = mWinBollClientServiceBean.isEnable();
|
||||
|
||||
if (mMyServiceConnection == null) {
|
||||
mMyServiceConnection = new MyServiceConnection();
|
||||
}
|
||||
|
||||
// 由系统启动时,应用可以通过下面函数实例化实际服务进程。
|
||||
runMainThread();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||
ToastUtils.show("onStartCommand");
|
||||
// 由应用 Intent 启动时,应用可以通过下面函数实例化实际服务进程。
|
||||
runMainThread();
|
||||
|
||||
// 返回运行参数持久化存储后,服务状态控制参数
|
||||
// 无论 Intent 传入如何,服务状态一直以持久化存储后的参数控制,
|
||||
// PS: 另外当然可以通过 Intent 传入的指标来修改 mWinBollServiceBean,
|
||||
// 不过本服务的应用方向会变得繁琐,
|
||||
// 现阶段只要满足手机端启动与停止本服务,WinBoll 客户端实例运行在手机端就可以了。
|
||||
return mIsEnableService ? Service.START_STICKY: super.onStartCommand(intent, flags, startId);
|
||||
}
|
||||
|
||||
void runMainThread() {
|
||||
if (mWinBollClientThread == null) {
|
||||
ToastUtils.show("runMainThread()");
|
||||
mWinBollClientThread = new WinBollClientThread();
|
||||
mWinBollClientThread.start();
|
||||
}
|
||||
}
|
||||
|
||||
void syncWinBollClientThreadStatus() {
|
||||
mWinBollClientServiceBean = WinBollClientServiceBean.loadWinBollClientServiceBean(this);
|
||||
mIsEnableService = mWinBollClientServiceBean.isEnable();
|
||||
}
|
||||
|
||||
|
||||
// 唤醒和绑定守护进程
|
||||
//
|
||||
void wakeupAndBindAssistant() {
|
||||
if (ServiceUtils.isServiceAlive(getApplicationContext(), AssistantService.class.getName()) == false) {
|
||||
startService(new Intent(WinBollClientService.this, AssistantService.class));
|
||||
//LogUtils.d(TAG, "call wakeupAndBindAssistant() : Binding... AssistantService");
|
||||
bindService(new Intent(WinBollClientService.this, AssistantService.class), mMyServiceConnection, Context.BIND_IMPORTANT);
|
||||
}
|
||||
}
|
||||
|
||||
// 主进程与守护进程连接时需要用到此类
|
||||
//
|
||||
private class MyServiceConnection implements ServiceConnection {
|
||||
@Override
|
||||
public void onServiceConnected(ComponentName name, IBinder service) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onServiceDisconnected(ComponentName name) {
|
||||
mWinBollClientServiceBean = WinBollClientServiceBean.loadWinBollClientServiceBean(WinBollClientService.this);
|
||||
if (mWinBollClientServiceBean.isEnable()) {
|
||||
// 唤醒守护进程
|
||||
wakeupAndBindAssistant();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
ToastUtils.show("onDestroy");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(Intent intent, int startId) {
|
||||
super.onStart(intent, startId);
|
||||
}
|
||||
|
||||
void setWinBollServiceEnableStatus(boolean isEnable) {
|
||||
WinBollClientServiceBean bean = WinBollClientServiceBean.loadWinBollClientServiceBean(this);
|
||||
bean.setIsEnable(isEnable);
|
||||
WinBollClientServiceBean.saveWinBollServiceBean(this, bean);
|
||||
}
|
||||
|
||||
boolean getWinBollServiceEnableStatus(Context context) {
|
||||
mWinBollClientServiceBean = WinBollClientServiceBean.loadWinBollClientServiceBean(context);
|
||||
return mWinBollClientServiceBean.isEnable();
|
||||
}
|
||||
|
||||
/*public interface OnServiceStatusChangeListener {
|
||||
void onServerStatusChange(boolean isServiceAlive);
|
||||
}
|
||||
|
||||
public void setOnServerStatusChangeListener(OnServiceStatusChangeListener l) {
|
||||
mOnServerStatusChangeListener = l;
|
||||
}*/
|
||||
|
||||
class WinBollClientThread extends Thread {
|
||||
@Override
|
||||
public void run() {
|
||||
ToastUtils.show("WinBollClientThread");
|
||||
super.run();
|
||||
syncWinBollClientThreadStatus();
|
||||
if (mIsEnableService) {
|
||||
if (mIsWinBollClientThreadRunning == false) {
|
||||
// 设置运行状态
|
||||
mIsWinBollClientThreadRunning = true;
|
||||
|
||||
ToastUtils.show("run()");
|
||||
|
||||
// 唤醒守护进程
|
||||
//wakeupAndBindAssistant();
|
||||
|
||||
while (mIsEnableService) {
|
||||
// 显示运行状态
|
||||
ToastUtils.show(TAG + " is running.");
|
||||
try {
|
||||
Thread.sleep(2 * 1000);
|
||||
} catch (InterruptedException e) {
|
||||
LogUtils.d(TAG, e, Thread.currentThread().getStackTrace());
|
||||
}
|
||||
syncWinBollClientThreadStatus();
|
||||
//ToastUtils.show("syncServiceThreadStatus OK.");
|
||||
//ToastUtils.show("mIsExist : " + Boolean.toString(!mIsEnableService));
|
||||
//break;
|
||||
}
|
||||
|
||||
// 服务进程退出, 重置进程运行状态
|
||||
mIsWinBollClientThreadRunning = false;
|
||||
mWinBollClientThread = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,77 +0,0 @@
|
||||
package cc.winboll.studio.libapputils.service;
|
||||
import android.content.Context;
|
||||
import android.util.JsonReader;
|
||||
import android.util.JsonWriter;
|
||||
import cc.winboll.studio.libappbase.BaseBean;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* @Author ZhanGSKen@QQ.COM
|
||||
* @Date 2024/12/08 19:44:57
|
||||
* @Describe WinBollService 运行参数配置
|
||||
*/
|
||||
public class WinBollClientServiceBean extends BaseBean {
|
||||
|
||||
public static final String TAG = "WinBollClientServiceBean";
|
||||
|
||||
volatile boolean isEnable;
|
||||
|
||||
public WinBollClientServiceBean() {
|
||||
isEnable = false;
|
||||
}
|
||||
|
||||
public void setIsEnable(boolean isEnable) {
|
||||
this.isEnable = isEnable;
|
||||
}
|
||||
|
||||
public boolean isEnable() {
|
||||
return isEnable;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return WinBollClientServiceBean.class.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeThisToJsonWriter(JsonWriter jsonWriter) throws IOException {
|
||||
super.writeThisToJsonWriter(jsonWriter);
|
||||
WinBollClientServiceBean bean = this;
|
||||
jsonWriter.name("isEnable").value(bean.isEnable());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean initObjectsFromJsonReader(JsonReader jsonReader, String name) throws IOException {
|
||||
if (super.initObjectsFromJsonReader(jsonReader, name)) { return true; } else {
|
||||
if (name.equals("isEnable")) {
|
||||
setIsEnable(jsonReader.nextBoolean());
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseBean readBeanFromJsonReader(JsonReader jsonReader) throws IOException {
|
||||
jsonReader.beginObject();
|
||||
while (jsonReader.hasNext()) {
|
||||
String name = jsonReader.nextName();
|
||||
if (!initObjectsFromJsonReader(jsonReader, name)) {
|
||||
jsonReader.skipValue();
|
||||
}
|
||||
}
|
||||
// 结束 JSON 对象
|
||||
jsonReader.endObject();
|
||||
return this;
|
||||
}
|
||||
|
||||
public static WinBollClientServiceBean loadWinBollClientServiceBean(Context context) {
|
||||
WinBollClientServiceBean bean = WinBollClientServiceBean.loadBean(context, WinBollClientServiceBean.class);
|
||||
return bean == null ? new WinBollClientServiceBean() : bean;
|
||||
}
|
||||
|
||||
public static boolean saveWinBollServiceBean(WinBollClientService service, WinBollClientServiceBean bean) {
|
||||
return WinBollClientServiceBean.saveBean(service, bean);
|
||||
}
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
package cc.winboll.studio.libapputils.service;
|
||||
|
||||
/**
|
||||
* @Author ZhanGSKen@QQ.COM
|
||||
* @Date 2024/12/09 08:19:06
|
||||
* @Describe WinBoll 邮件服务
|
||||
*/
|
||||
import android.app.Service;
|
||||
import android.content.Intent;
|
||||
import android.os.IBinder;
|
||||
|
||||
public class WinBollMail extends Service {
|
||||
|
||||
public static final String TAG = "WinBollMail";
|
||||
|
||||
@Override
|
||||
public IBinder onBind(Intent intent) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package cc.winboll.studio.libapputils.util;
|
||||
package cc.winboll.studio.libapputils.utils;
|
||||
|
||||
/**
|
||||
* @Author ZhanGSKen@AliYun.Com
|
@ -1,4 +1,4 @@
|
||||
package cc.winboll.studio.libapputils.util;
|
||||
package cc.winboll.studio.libapputils.utils;
|
||||
|
||||
/**
|
||||
* @Author ZhanGSKen@QQ.COM
|
@ -1,4 +1,4 @@
|
||||
package cc.winboll.studio.libapputils.util;
|
||||
package cc.winboll.studio.libapputils.utils;
|
||||
|
||||
/**
|
||||
* @Author ZhanGSKen@QQ.COM
|
@ -1,4 +1,4 @@
|
||||
package cc.winboll.studio.libapputils.util;
|
||||
package cc.winboll.studio.libapputils.utils;
|
||||
|
||||
/**
|
||||
* @Author ZhanGSKen@QQ.COM
|
@ -1,4 +1,4 @@
|
||||
package cc.winboll.studio.libapputils.util;
|
||||
package cc.winboll.studio.libapputils.utils;
|
||||
|
||||
/**
|
||||
* @Author ZhanGSKen@QQ.COM
|
@ -1,4 +1,4 @@
|
||||
package cc.winboll.studio.libapputils.util;
|
||||
package cc.winboll.studio.libapputils.utils;
|
||||
|
||||
/**
|
||||
* @Author ZhanGSKen@QQ.COM
|
@ -1,4 +1,4 @@
|
||||
package cc.winboll.studio.libapputils.util;
|
||||
package cc.winboll.studio.libapputils.utils;
|
||||
|
||||
/**
|
||||
* @Author ZhanGSKen@QQ.COM
|
@ -1,4 +1,4 @@
|
||||
package cc.winboll.studio.libapputils.view;
|
||||
package cc.winboll.studio.libapputils.views;
|
||||
|
||||
/**
|
||||
* @Author ZhanGSKen@QQ.COM
|
@ -1,4 +1,4 @@
|
||||
package cc.winboll.studio.libapputils.view;
|
||||
package cc.winboll.studio.libapputils.views;
|
||||
|
||||
/**
|
||||
* @Author ZhanGSKen@QQ.COM
|
||||
@ -14,7 +14,7 @@ import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
import cc.winboll.studio.libapputils.util.QRCodeGenerator;
|
||||
import cc.winboll.studio.libapputils.utils.QRCodeGenerator;
|
||||
import com.journeyapps.barcodescanner.DecoratedBarcodeView;
|
||||
|
||||
public class StringToQrCodeView extends LinearLayout {
|
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<style name="UtilsTheme" parent="@android:style/Theme.Holo.Light.NoActionBar">
|
||||
<style name="UtilsTheme" parent="APPBaseTheme">
|
||||
</style>
|
||||
</resources>
|
||||
|
Loading…
x
Reference in New Issue
Block a user