Merge remote-tracking branch 'origin/appbase' into androidxdemo
This commit is contained in:
commit
5e4f831d00
@ -23,7 +23,7 @@ android {
|
||||
|
||||
defaultConfig {
|
||||
applicationId "cc.winboll.studio.androiddemo"
|
||||
minSdkVersion 26
|
||||
minSdkVersion 24
|
||||
targetSdkVersion 29
|
||||
versionCode 1
|
||||
// versionName 更新后需要手动设置
|
||||
@ -66,6 +66,6 @@ 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.0.9'
|
||||
api 'cc.winboll.studio:libapputils:15.0.11'
|
||||
api 'cc.winboll.studio:libapputils:15.2.1'
|
||||
api 'cc.winboll.studio:libappbase:15.2.2'
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
#Created by .winboll/winboll_app_build.gradle
|
||||
#Fri Mar 28 06:28:08 GMT 2025
|
||||
#Sat Mar 29 04:34:14 GMT 2025
|
||||
stageCount=0
|
||||
libraryProject=
|
||||
baseVersion=15.0
|
||||
publishVersion=15.0.0
|
||||
buildCount=13
|
||||
buildCount=15
|
||||
baseBetaVersion=15.0.1
|
||||
|
@ -30,7 +30,7 @@ android {
|
||||
// versionName 更新后需要手动设置
|
||||
// .winboll/winbollBuildProps.properties 文件的 stageCount=0
|
||||
// Gradle编译环境下合起来的 versionName 就是 "${versionName}.0"
|
||||
versionName "15.1"
|
||||
versionName "15.2"
|
||||
if(true) {
|
||||
versionName = genVersionName("${versionName}")
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
#Created by .winboll/winboll_app_build.gradle
|
||||
#Fri Mar 28 06:24:38 GMT 2025
|
||||
stageCount=1
|
||||
#Sat Mar 29 11:28:02 HKT 2025
|
||||
stageCount=3
|
||||
libraryProject=libappbase
|
||||
baseVersion=15.1
|
||||
publishVersion=15.1.0
|
||||
buildCount=166
|
||||
baseBetaVersion=15.1.1
|
||||
baseVersion=15.2
|
||||
publishVersion=15.2.2
|
||||
buildCount=0
|
||||
baseBetaVersion=15.2.3
|
||||
|
@ -22,7 +22,7 @@ import cc.winboll.studio.libappbase.sos.SOS;
|
||||
import cc.winboll.studio.libappbase.utils.ToastUtils;
|
||||
import cc.winboll.studio.libappbase.widgets.StatusWidget;
|
||||
import cc.winboll.studio.libappbase.winboll.IWinBollActivity;
|
||||
import cc.winboll.studio.libappbase.winboll.WinBollActivityBase;
|
||||
import cc.winboll.studio.libappbase.dialogs.YesNoAlertDialog;
|
||||
|
||||
public class MainActivity extends WinBollActivityBase implements IWinBollActivity {
|
||||
|
||||
@ -69,12 +69,6 @@ public class MainActivity extends WinBollActivityBase implements IWinBollActivit
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
if (item.getItemId() == cc.winboll.studio.appbase.R.id.item_log) {
|
||||
GlobalApplication.getWinBollActivityManager().startLogActivity(this);
|
||||
return true;
|
||||
} else if(item.getItemId() == cc.winboll.studio.appbase.R.id.item_minimal) {
|
||||
moveTaskToBack(true);
|
||||
}
|
||||
// 在switch语句中处理每个ID,并在处理完后返回true,未处理的情况返回false。
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
@ -92,6 +86,7 @@ public class MainActivity extends WinBollActivityBase implements IWinBollActivit
|
||||
public void onSwitchDebugMode(View view) {
|
||||
boolean isDebuging = ((CheckBox)view).isChecked();
|
||||
GlobalApplication.setIsDebuging(isDebuging);
|
||||
GlobalApplication.saveDebugStatus();
|
||||
}
|
||||
|
||||
public void onPreviewGlobalCrashActivity(View view) {
|
||||
@ -143,6 +138,8 @@ public class MainActivity extends WinBollActivityBase implements IWinBollActivit
|
||||
startService(intent);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void onStopTestDemoService(View view) {
|
||||
Intent intent = new Intent(this, TestDemoService.class);
|
||||
|
@ -0,0 +1,82 @@
|
||||
package cc.winboll.studio.appbase;
|
||||
|
||||
/**
|
||||
* @Author ZhanGSKen@AliYun.Com
|
||||
* @Date 2025/03/28 15:34:16
|
||||
* @Describe 应用活动窗口基类
|
||||
*/
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.os.PersistableBundle;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.view.MenuItem;
|
||||
import cc.winboll.studio.appbase.App;
|
||||
import cc.winboll.studio.appbase.R;
|
||||
import cc.winboll.studio.libappbase.GlobalApplication;
|
||||
import cc.winboll.studio.libappbase.dialogs.YesNoAlertDialog;
|
||||
import cc.winboll.studio.libappbase.winboll.IWinBollActivity;
|
||||
import cc.winboll.studio.libappbase.winboll.WinBollActivityManager;
|
||||
|
||||
public class WinBollActivityBase extends AppCompatActivity implements IWinBollActivity {
|
||||
|
||||
public static final String TAG = "WinBollActivityBase";
|
||||
|
||||
@Override
|
||||
public Activity getActivity() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTag() {
|
||||
return TAG;
|
||||
}
|
||||
|
||||
WinBollActivityManager getWinBollActivityManager() {
|
||||
return WinBollActivityManager.getInstance(GlobalApplication.getInstance());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
getWinBollActivityManager().add(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPostCreate(Bundle savedInstanceState, PersistableBundle persistentState) {
|
||||
super.onPostCreate(savedInstanceState, persistentState);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
if (item.getItemId() == cc.winboll.studio.appbase.R.id.item_log) {
|
||||
GlobalApplication.getWinBollActivityManager().startLogActivity(this);
|
||||
return true;
|
||||
} else if(item.getItemId() == cc.winboll.studio.appbase.R.id.item_minimal) {
|
||||
//moveTaskToBack(true);
|
||||
exit();
|
||||
}
|
||||
// 在switch语句中处理每个ID,并在处理完后返回true,未处理的情况返回false。
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
void exit() {
|
||||
YesNoAlertDialog.show(this, "Exit " + getString(R.string.app_name), "Close all activity and exit?", new YesNoAlertDialog.OnDialogResultListener(){
|
||||
|
||||
@Override
|
||||
public void onYes() {
|
||||
App.getWinBollActivityManager().finishAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNo() {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
getWinBollActivityManager().registeRemove(this);
|
||||
}
|
||||
}
|
@ -12,9 +12,9 @@ import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import cc.winboll.studio.appbase.R;
|
||||
import cc.winboll.studio.appbase.WinBollActivityBase;
|
||||
import cc.winboll.studio.libappbase.GlobalApplication;
|
||||
import cc.winboll.studio.libappbase.winboll.IWinBollActivity;
|
||||
import cc.winboll.studio.libappbase.winboll.WinBollActivityBase;
|
||||
|
||||
public class New2Activity extends WinBollActivityBase implements IWinBollActivity {
|
||||
|
||||
@ -76,8 +76,6 @@ public class New2Activity extends WinBollActivityBase implements IWinBollActivit
|
||||
if (item.getItemId() == cc.winboll.studio.appbase.R.id.item_log) {
|
||||
GlobalApplication.getWinBollActivityManager().startLogActivity(this);
|
||||
return true;
|
||||
} else if(item.getItemId() == cc.winboll.studio.appbase.R.id.item_minimal) {
|
||||
moveTaskToBack(true);
|
||||
}
|
||||
// 在switch语句中处理每个ID,并在处理完后返回true,未处理的情况返回false。
|
||||
return super.onOptionsItemSelected(item);
|
||||
|
@ -11,9 +11,9 @@ import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import cc.winboll.studio.appbase.R;
|
||||
import cc.winboll.studio.appbase.WinBollActivityBase;
|
||||
import cc.winboll.studio.libappbase.GlobalApplication;
|
||||
import cc.winboll.studio.libappbase.winboll.IWinBollActivity;
|
||||
import cc.winboll.studio.libappbase.winboll.WinBollActivityBase;
|
||||
|
||||
public class NewActivity extends WinBollActivityBase implements IWinBollActivity {
|
||||
|
||||
@ -74,8 +74,6 @@ public class NewActivity extends WinBollActivityBase implements IWinBollActivity
|
||||
if (item.getItemId() == cc.winboll.studio.appbase.R.id.item_log) {
|
||||
GlobalApplication.getWinBollActivityManager().startLogActivity(this);
|
||||
return true;
|
||||
} else if(item.getItemId() == cc.winboll.studio.appbase.R.id.item_minimal) {
|
||||
moveTaskToBack(true);
|
||||
}
|
||||
// 在switch语句中处理每个ID,并在处理完后返回true,未处理的情况返回false。
|
||||
return super.onOptionsItemSelected(item);
|
||||
|
@ -26,10 +26,11 @@ dependencies {
|
||||
// Android 类库
|
||||
//api 'com.android.support:appcompat-v7:28.0.0'
|
||||
api('com.android.support:appcompat-v7:28.0.0'){
|
||||
exclude group: "com.android.support", module: "support-vector-drawable"
|
||||
//exclude group: "com.android.support", module: "support-vector-drawable"
|
||||
exclude group: "com.android.support:animated-vector-drawable:28.0.0"
|
||||
}
|
||||
// https://mvnrepository.com/artifact/com.android.support/support-compat
|
||||
api 'com.android.support:support-compat:28.0.0' // 保留原有依赖(可选)
|
||||
//api 'com.android.support:support-compat:28.0.0' // 保留原有依赖(可选)
|
||||
// https://mvnrepository.com/artifact/com.android.support/support-v4
|
||||
api 'com.android.support:support-v4:28.0.0'
|
||||
// https://mvnrepository.com/artifact/com.android.support/support-media-compat
|
||||
|
@ -1,8 +1,8 @@
|
||||
#Created by .winboll/winboll_app_build.gradle
|
||||
#Fri Mar 28 06:24:38 GMT 2025
|
||||
stageCount=1
|
||||
#Sat Mar 29 11:27:54 HKT 2025
|
||||
stageCount=3
|
||||
libraryProject=libappbase
|
||||
baseVersion=15.1
|
||||
publishVersion=15.1.0
|
||||
buildCount=166
|
||||
baseBetaVersion=15.1.1
|
||||
baseVersion=15.2
|
||||
publishVersion=15.2.2
|
||||
buildCount=0
|
||||
baseBetaVersion=15.2.3
|
||||
|
@ -25,9 +25,12 @@ public class GlobalApplication extends Application {
|
||||
MyActivityLifecycleCallbacks mMyActivityLifecycleCallbacks;
|
||||
|
||||
public static void setIsDebuging(boolean isDebuging) {
|
||||
GlobalApplication.isDebuging = isDebuging;
|
||||
}
|
||||
|
||||
public static void saveDebugStatus() {
|
||||
if (_GlobalApplication != null) {
|
||||
GlobalApplication.isDebuging = isDebuging;
|
||||
APPBaseModel.saveBeanToFile(getAPPBaseModelFilePath(), new APPBaseModel(isDebuging));
|
||||
APPBaseModel.saveBeanToFile(getAPPBaseModelFilePath(), new APPBaseModel(GlobalApplication.isDebuging));
|
||||
}
|
||||
}
|
||||
|
||||
@ -69,6 +72,7 @@ public class GlobalApplication extends Application {
|
||||
APPBaseModel appBaseModel = APPBaseModel.loadBeanFromFile(getAPPBaseModelFilePath(), APPBaseModel.class);
|
||||
if (appBaseModel == null) {
|
||||
setIsDebuging(false);
|
||||
saveDebugStatus();
|
||||
} else {
|
||||
setIsDebuging(appBaseModel.isDebuging());
|
||||
}
|
||||
|
@ -220,7 +220,17 @@ public class LogUtils {
|
||||
}
|
||||
|
||||
static boolean isLoggable(String tag, LOG_LEVEL logLevel) {
|
||||
return _IsInited && mapTAGList.get(tag) && isInTheLevel(logLevel);
|
||||
if (!_IsInited) {
|
||||
return false;
|
||||
}
|
||||
if (mapTAGList.get(tag) == null
|
||||
|| !mapTAGList.get(tag)) {
|
||||
return false;
|
||||
}
|
||||
if (!isInTheLevel(logLevel)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static boolean isInTheLevel(LOG_LEVEL logLevel) {
|
||||
|
@ -0,0 +1,60 @@
|
||||
package cc.winboll.studio.libappbase.dialogs;
|
||||
|
||||
/**
|
||||
* @Author ZhanGSKen@AliYun.Com
|
||||
* @Date 2025/03/28 17:40:47
|
||||
* @Date 2024/08/12 14:46:25
|
||||
* @Describe 询问用户确定与否的选择框
|
||||
*/
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
|
||||
public class YesNoAlertDialog {
|
||||
|
||||
public static final String TAG = "YesNoAlertDialog";
|
||||
|
||||
public static void show(Context context, String szTitle, String szMessage, final OnDialogResultListener listener) {
|
||||
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(
|
||||
context);
|
||||
|
||||
// set title
|
||||
alertDialogBuilder.setTitle(szTitle);
|
||||
|
||||
// set dialog message
|
||||
alertDialogBuilder
|
||||
.setMessage(szMessage)
|
||||
.setCancelable(true)
|
||||
.setOnCancelListener(new DialogInterface.OnCancelListener(){
|
||||
@Override
|
||||
public void onCancel(DialogInterface dialog) {
|
||||
listener.onNo();
|
||||
}
|
||||
})
|
||||
.setPositiveButton("YES", new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
// if this button is clicked, close
|
||||
// current activity
|
||||
listener.onYes();
|
||||
}
|
||||
})
|
||||
.setNegativeButton("NO", new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
// if this button is clicked, just close
|
||||
// the dialog box and do nothing
|
||||
dialog.cancel();
|
||||
}
|
||||
});
|
||||
|
||||
// create alert dialog
|
||||
AlertDialog alertDialog = alertDialogBuilder.create();
|
||||
|
||||
// show it
|
||||
alertDialog.show();
|
||||
}
|
||||
|
||||
public interface OnDialogResultListener {
|
||||
abstract void onYes();
|
||||
abstract void onNo();
|
||||
}
|
||||
}
|
@ -47,7 +47,7 @@ public class MyActivityLifecycleCallbacks implements Application.ActivityLifecyc
|
||||
}
|
||||
|
||||
public void showActivityeInfo() {
|
||||
ToastUtils.show("ActivityeInfo : " + mInfo);
|
||||
//ToastUtils.show("ActivityeInfo : " + mInfo);
|
||||
LogUtils.d(TAG, "ActivityeInfo : " + mInfo);
|
||||
}
|
||||
|
||||
|
@ -1,53 +0,0 @@
|
||||
package cc.winboll.studio.libappbase.winboll;
|
||||
|
||||
/**
|
||||
* @Author ZhanGSKen@AliYun.Com
|
||||
* @Date 2025/03/28 13:35:28
|
||||
* @Describe WinBoll应用窗口基类
|
||||
*/
|
||||
import android.app.Activity;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.PersistableBundle;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import cc.winboll.studio.libappbase.GlobalApplication;
|
||||
import cc.winboll.studio.libappbase.R;
|
||||
|
||||
public class WinBollActivityBase extends AppCompatActivity implements IWinBollActivity {
|
||||
|
||||
public static final String TAG = "WinBollActivityBase";
|
||||
|
||||
@Override
|
||||
public Activity getActivity() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTag() {
|
||||
return TAG;
|
||||
}
|
||||
|
||||
WinBollActivityManager getWinBollActivityManager() {
|
||||
return WinBollActivityManager.getInstance(GlobalApplication.getInstance());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
getWinBollActivityManager().add(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPostCreate(Bundle savedInstanceState, PersistableBundle persistentState) {
|
||||
super.onPostCreate(savedInstanceState, persistentState);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
getWinBollActivityManager().registeRemove(this);
|
||||
}
|
||||
}
|
@ -102,7 +102,7 @@ public class WinBollActivityManager {
|
||||
resumeActivity(context, tag);
|
||||
return;
|
||||
}
|
||||
ToastUtils.show("startWinBollActivity(Context context, Class<T> clazz)");
|
||||
//ToastUtils.show("startWinBollActivity(Context context, Class<T> clazz)");
|
||||
|
||||
// 新建一个任务窗口
|
||||
Intent intent = new Intent(context, clazz);
|
||||
|
Loading…
x
Reference in New Issue
Block a user