Compare commits
7 Commits
powerbell-
...
appbase-v1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f10438d3d3 | ||
|
|
1e697bc12d | ||
|
|
d5a3c626b3 | ||
|
|
56692db142 | ||
|
|
934d54963a | ||
|
|
c105123e7b | ||
|
|
d8c534bbc8 |
@@ -1,8 +1,8 @@
|
|||||||
#Created by .winboll/winboll_app_build.gradle
|
#Created by .winboll/winboll_app_build.gradle
|
||||||
#Tue May 20 03:28:00 GMT 2025
|
#Sun Jun 01 15:41:38 HKT 2025
|
||||||
stageCount=2
|
stageCount=3
|
||||||
libraryProject=libappbase
|
libraryProject=libappbase
|
||||||
baseVersion=15.8
|
baseVersion=15.8
|
||||||
publishVersion=15.8.1
|
publishVersion=15.8.2
|
||||||
buildCount=1
|
buildCount=0
|
||||||
baseBetaVersion=15.8.2
|
baseBetaVersion=15.8.3
|
||||||
|
|||||||
@@ -40,7 +40,6 @@ public class MainActivity extends WinBoLLActivity implements IWinBoLLActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Toolbar mToolbar;
|
Toolbar mToolbar;
|
||||||
LogView mLogView;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
@@ -53,14 +52,11 @@ public class MainActivity extends WinBoLLActivity implements IWinBoLLActivity {
|
|||||||
|
|
||||||
CheckBox cbIsDebugMode = findViewById(R.id.activitymainCheckBox1);
|
CheckBox cbIsDebugMode = findViewById(R.id.activitymainCheckBox1);
|
||||||
cbIsDebugMode.setChecked(GlobalApplication.isDebuging());
|
cbIsDebugMode.setChecked(GlobalApplication.isDebuging());
|
||||||
mLogView = findViewById(R.id.logview);
|
|
||||||
mLogView.start();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
getMenuInflater().inflate(R.menu.toolbar_main, menu);
|
getMenuInflater().inflate(R.menu.toolbar_main, menu);
|
||||||
getMenuInflater().inflate(R.menu.toolbar_appbase, menu);
|
|
||||||
return super.onCreateOptionsMenu(menu);
|
return super.onCreateOptionsMenu(menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -176,8 +172,7 @@ public class MainActivity extends WinBoLLActivity implements IWinBoLLActivity {
|
|||||||
@Override
|
@Override
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
mLogView.start();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,16 +66,11 @@ public class New2Activity extends WinBoLLActivity implements IWinBoLLActivity {
|
|||||||
@Override
|
@Override
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
getMenuInflater().inflate(R.menu.toolbar_main, menu);
|
getMenuInflater().inflate(R.menu.toolbar_main, menu);
|
||||||
getMenuInflater().inflate(R.menu.toolbar_appbase, menu);
|
|
||||||
return super.onCreateOptionsMenu(menu);
|
return super.onCreateOptionsMenu(menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
if (item.getItemId() == cc.winboll.studio.appbase.R.id.item_log) {
|
|
||||||
//GlobalApplication.getWinBoLLActivityManager().startLogActivity(this);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
// 在switch语句中处理每个ID,并在处理完后返回true,未处理的情况返回false。
|
// 在switch语句中处理每个ID,并在处理完后返回true,未处理的情况返回false。
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,16 +64,11 @@ public class NewActivity extends WinBoLLActivity implements IWinBoLLActivity {
|
|||||||
@Override
|
@Override
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
getMenuInflater().inflate(R.menu.toolbar_main, menu);
|
getMenuInflater().inflate(R.menu.toolbar_main, menu);
|
||||||
getMenuInflater().inflate(R.menu.toolbar_appbase, menu);
|
|
||||||
return super.onCreateOptionsMenu(menu);
|
return super.onCreateOptionsMenu(menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
if (item.getItemId() == cc.winboll.studio.appbase.R.id.item_log) {
|
|
||||||
//GlobalApplication.getWinBoLLActivityManager().startLogActivity(this);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
// 在switch语句中处理每个ID,并在处理完后返回true,未处理的情况返回false。
|
// 在switch语句中处理每个ID,并在处理完后返回true,未处理的情况返回false。
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,12 @@ package cc.winboll.studio.appbase.activities;
|
|||||||
* @Describe WinBoLL 窗口基础类
|
* @Describe WinBoLL 窗口基础类
|
||||||
*/
|
*/
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.MenuItem;
|
||||||
|
import cc.winboll.studio.appbase.MainActivity;
|
||||||
|
import cc.winboll.studio.appbase.R;
|
||||||
|
import cc.winboll.studio.libappbase.GlobalApplication;
|
||||||
|
import cc.winboll.studio.libappbase.LogUtils;
|
||||||
import cc.winboll.studio.libappbase.winboll.IWinBoLLActivity;
|
import cc.winboll.studio.libappbase.winboll.IWinBoLLActivity;
|
||||||
|
|
||||||
public class WinBoLLActivity extends Activity implements IWinBoLLActivity {
|
public class WinBoLLActivity extends Activity implements IWinBoLLActivity {
|
||||||
@@ -21,4 +27,35 @@ public class WinBoLLActivity extends Activity implements IWinBoLLActivity {
|
|||||||
public String getTag() {
|
public String getTag() {
|
||||||
return TAG;
|
return TAG;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
LogUtils.d(TAG, String.format("onResume %s", getTag()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
if (item.getItemId() == R.id.item_log) {
|
||||||
|
GlobalApplication.getWinBoLLActivityManager().startLogActivity(this);
|
||||||
|
return true;
|
||||||
|
} else if (item.getItemId() == R.id.item_home) {
|
||||||
|
GlobalApplication.getWinBoLLActivityManager().startWinBoLLActivity(getApplicationContext(), MainActivity.class);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
// 在switch语句中处理每个ID,并在处理完后返回true,未处理的情况返回false。
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPostCreate(Bundle savedInstanceState) {
|
||||||
|
super.onPostCreate(savedInstanceState);
|
||||||
|
GlobalApplication.getWinBoLLActivityManager().add(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
GlobalApplication.getWinBoLLActivityManager().registeRemove(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,13 +32,19 @@
|
|||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Hello, WinBoLL!"/>
|
android:text="安卓R对应的是Android 11,其API级别是30。以下是Android 11中一些重要的API相关特性:
|
||||||
|
|
||||||
<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,但可能需要注意兼容性和配置问题。"/>
|
|
||||||
|
|
||||||
|
\n- 隐私保护方面:引入单次授权,让用户可以选择授予应用对位置信息、麦克风和摄像头的临时访问权限。还增加了数据访问审核功能,能让开发者深入了解应用在何处访问私密数据。
|
||||||
|
|
||||||
|
\n- 系统功能方面:提供了ControlsProviderService API,用于向连接的外部设备提供控件,这些控件显示于Android电源菜单中的设备控件下。媒体控件也得到更新,显示于快捷设置旁,来自多个应用的会话排列在一个可滑动的轮播界面中。
|
||||||
|
|
||||||
|
\n- 硬件支持方面:提供了一些API以支持瀑布屏,通过将窗口布局属性 layoutInDisplayCutoutMode 设为 LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS ,可允许窗口延伸到屏幕各个边缘上的刘海和瀑布区域。对于合页式屏幕配置的设备,提供了具有 TYPE_HINGE_ANGLE 的新传感器以及新的 SensorEvent ,用于监控合页角度。
|
||||||
|
|
||||||
|
\n- 安全方面:对生物识别身份验证机制进行了更新,引入了 BiometricManager.Authenticators 接口,定义了 BIOMETRIC_STRONG 、 BIOMETRIC_WEAK 、 DEVICE_CREDENTIAL 等身份验证类型。还在 BiometricPrompt 类中提供了对“每次使用时进行身份验证”密钥的更多支持。
|
||||||
|
|
||||||
|
\n- 性能和质量方面:支持无线调试,通过Android调试桥(adb)从工作站以无线方式部署和调试应用,避免了常见的USB连接问题。"/>
|
||||||
|
|
||||||
|
|
||||||
<HorizontalScrollView
|
<HorizontalScrollView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
@@ -211,11 +217,5 @@
|
|||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
|
||||||
<cc.winboll.studio.libappbase.LogView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="300dp"
|
|
||||||
android:id="@+id/logview"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,12 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
<item
|
||||||
|
android:id="@+id/item_home"
|
||||||
|
android:title="HOME"
|
||||||
|
android:icon="@drawable/ic_winboll"/>
|
||||||
|
<item
|
||||||
|
android:id="@+id/item_log"
|
||||||
|
android:title="LOG"
|
||||||
|
android:icon="@drawable/ic_winboll_log"/>
|
||||||
</menu>
|
</menu>
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#Created by .winboll/winboll_app_build.gradle
|
#Created by .winboll/winboll_app_build.gradle
|
||||||
#Tue May 20 03:28:00 GMT 2025
|
#Sun Jun 01 15:41:38 HKT 2025
|
||||||
stageCount=2
|
stageCount=3
|
||||||
libraryProject=libappbase
|
libraryProject=libappbase
|
||||||
baseVersion=15.8
|
baseVersion=15.8
|
||||||
publishVersion=15.8.1
|
publishVersion=15.8.2
|
||||||
buildCount=1
|
buildCount=0
|
||||||
baseBetaVersion=15.8.2
|
baseBetaVersion=15.8.3
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ public class GlobalApplication extends Application {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static WinBoLLActivityManager getWinBoLLActivityManager() {
|
public static WinBoLLActivityManager getWinBoLLActivityManager() {
|
||||||
return WinBoLLActivityManager.getInstance(_GlobalApplication);
|
return WinBoLLActivityManager.getInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -22,7 +22,9 @@ import java.util.Map;
|
|||||||
|
|
||||||
public class WinBoLLActivityManager {
|
public class WinBoLLActivityManager {
|
||||||
|
|
||||||
public static final String TAG = "IWinBoLLActivityManager";
|
public static final String TAG = "WinBoLLActivityManager";
|
||||||
|
|
||||||
|
public static final String EXTRA_TAG = "EXTRA_TAG";
|
||||||
|
|
||||||
|
|
||||||
public enum WinBoLLUI_TYPE { Aplication, Service }
|
public enum WinBoLLUI_TYPE { Aplication, Service }
|
||||||
@@ -39,14 +41,14 @@ public class WinBoLLActivityManager {
|
|||||||
public static WinBoLLUI_TYPE getWinBoLLUI_TYPE() {
|
public static WinBoLLUI_TYPE getWinBoLLUI_TYPE() {
|
||||||
return _WinBoLLUI_TYPE;
|
return _WinBoLLUI_TYPE;
|
||||||
}
|
}
|
||||||
WinBoLLActivityManager(Context context) {
|
WinBoLLActivityManager() {
|
||||||
mContext = context;
|
mContext = GlobalApplication.getInstance();
|
||||||
mActivityListMap = new HashMap<String, IWinBoLLActivity>();
|
mActivityListMap = new HashMap<String, IWinBoLLActivity>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static synchronized WinBoLLActivityManager getInstance(Context context) {
|
public static synchronized WinBoLLActivityManager getInstance() {
|
||||||
if (_mIWinBoLLActivityManager == null) {
|
if (_mIWinBoLLActivityManager == null) {
|
||||||
_mIWinBoLLActivityManager = new WinBoLLActivityManager(context);
|
_mIWinBoLLActivityManager = new WinBoLLActivityManager();
|
||||||
}
|
}
|
||||||
return _mIWinBoLLActivityManager;
|
return _mIWinBoLLActivityManager;
|
||||||
}
|
}
|
||||||
@@ -55,7 +57,7 @@ public class WinBoLLActivityManager {
|
|||||||
* 把Activity添加到管理中
|
* 把Activity添加到管理中
|
||||||
*/
|
*/
|
||||||
public <T extends IWinBoLLActivity> void add(T activity) {
|
public <T extends IWinBoLLActivity> void add(T activity) {
|
||||||
if (isActive(activity.getTag())) {
|
if (isActivityActive(activity.getTag())) {
|
||||||
LogUtils.d(TAG, String.format("add(...) %s is active.", activity.getTag()));
|
LogUtils.d(TAG, String.format("add(...) %s is active.", activity.getTag()));
|
||||||
} else {
|
} else {
|
||||||
mActivityListMap.put(activity.getTag(), activity);
|
mActivityListMap.put(activity.getTag(), activity);
|
||||||
@@ -70,106 +72,107 @@ public class WinBoLLActivityManager {
|
|||||||
// intent.putExtra 函数 "tag" 参数为 activity.getTag()
|
// intent.putExtra 函数 "tag" 参数为 activity.getTag()
|
||||||
//
|
//
|
||||||
public <T extends IWinBoLLActivity> void startWinBoLLActivity(Context context, Class<T> clazz) {
|
public <T extends IWinBoLLActivity> void startWinBoLLActivity(Context context, Class<T> clazz) {
|
||||||
try {
|
// 如果窗口已存在就重启窗口
|
||||||
// 如果窗口已存在就重启窗口
|
if (!resumeActivity(clazz)) {
|
||||||
String tag = clazz.newInstance().getTag();
|
|
||||||
if (isActive(tag)) {
|
|
||||||
resumeActivity(context, tag);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 新建一个任务窗口
|
// 新建一个任务窗口
|
||||||
Intent intent = new Intent(context, clazz);
|
Intent intent = new Intent(context, clazz);
|
||||||
//打开多任务窗口 flags
|
//打开多任务窗口 flags
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT);
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT);
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
|
intent.addFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
|
||||||
intent.putExtra("tag", tag);
|
//intent.putExtra("tag", tag);
|
||||||
mContext.startActivity(intent);
|
context.startActivity(intent);
|
||||||
} catch (InstantiationException | IllegalAccessException e) {
|
|
||||||
LogUtils.d(TAG, e, Thread.currentThread().getStackTrace());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T extends IWinBoLLActivity> void startWinBoLLActivity(Context context, Intent intent, Class<T> clazz) {
|
public <T extends IWinBoLLActivity> void startWinBoLLActivity(Context context, Intent intent, Class<T> clazz) {
|
||||||
try {
|
// 如果窗口已存在就重启窗口
|
||||||
// 如果窗口已存在就重启窗口
|
if (!resumeActivity(clazz)) {
|
||||||
String tag = clazz.newInstance().getTag();
|
|
||||||
if (isActive(tag)) {
|
|
||||||
resumeActivity(context, tag);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 新建一个任务窗口
|
// 新建一个任务窗口
|
||||||
//Intent intent = new Intent(context, clazz);
|
//Intent intent = new Intent(context, clazz);
|
||||||
//打开多任务窗口 flags
|
//打开多任务窗口 flags
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT);
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT);
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
|
intent.addFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
|
||||||
intent.putExtra("tag", tag);
|
//intent.putExtra("tag", tag);
|
||||||
mContext.startActivity(intent);
|
context.startActivity(intent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public <T extends IWinBoLLActivity> void startLogActivity(Context context) {
|
||||||
|
// 如果窗口已存在就重启窗口
|
||||||
|
//if (!resumeActivity(LogActivity.class)) {
|
||||||
|
// 新建一个任务窗口
|
||||||
|
Intent intent = new Intent(context, LogActivity.class);
|
||||||
|
//打开多任务窗口 flags
|
||||||
|
// Define the bounds.
|
||||||
|
// Rect bounds = new Rect(0, 0, 800, 200);
|
||||||
|
// // Set the bounds as an activity option.
|
||||||
|
// ActivityOptions options = ActivityOptions.makeBasic();
|
||||||
|
// options.setLaunchBounds(bounds);
|
||||||
|
intent.addFlags(Intent.FLAG_ACTIVITY_LAUNCH_ADJACENT);
|
||||||
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT);
|
||||||
|
intent.addFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
|
||||||
|
|
||||||
|
//intent.putExtra(EXTRA_TAG, tag);
|
||||||
|
|
||||||
|
//context.startActivity(intent, options.toBundle());
|
||||||
|
context.startActivity(intent);
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// 判断 tag 绑定的 Activity 是否已经创建
|
||||||
|
//
|
||||||
|
public boolean isActivityActive(String tag) {
|
||||||
|
return mActivityListMap.get(tag) != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Activity getActivityByTag(String tag) {
|
||||||
|
return (mActivityListMap.get(tag) == null) ?null: mActivityListMap.get(tag).getActivity();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// 找到tag 绑定的 BaseActivity ,通过 getTaskId() 移动到前台
|
||||||
|
//
|
||||||
|
public <T extends IWinBoLLActivity> boolean resumeActivity(Class<T> clazz) {
|
||||||
|
try {
|
||||||
|
Activity activity = getActivityByTag(clazz.newInstance().getTag());
|
||||||
|
if (activity != null) {
|
||||||
|
return resumeActivity(activity);
|
||||||
|
}
|
||||||
} catch (InstantiationException | IllegalAccessException e) {
|
} catch (InstantiationException | IllegalAccessException e) {
|
||||||
LogUtils.d(TAG, e, Thread.currentThread().getStackTrace());
|
LogUtils.d(TAG, e, Thread.currentThread().getStackTrace());
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
//
|
||||||
* 判断 tag绑定的 MyActivity是否存在
|
// 找到tag 绑定的 BaseActivity ,通过 getTaskId() 移动到前台
|
||||||
*/
|
//
|
||||||
public boolean isActive(String tag) {
|
public <T extends IWinBoLLActivity> boolean resumeActivity(String tag) {
|
||||||
//printAvtivityListInfo();
|
Activity activity = getActivityByTag(tag);
|
||||||
IWinBoLLActivity iWinBoLLActivity = getIWinBoLLActivity(tag);
|
if (activity != null) {
|
||||||
if (iWinBoLLActivity != null) {
|
return resumeActivity(activity);
|
||||||
Activity activity = iWinBoLLActivity.getActivity();
|
|
||||||
if (activity != null) {
|
|
||||||
LogUtils.d(TAG, "isActive(...) activity != null tag " + tag);
|
|
||||||
//ToastUtils.show("activity != null tag " + tag);
|
|
||||||
//判断是否为 BaseActivity,如果已经销毁,则移除
|
|
||||||
if (activity.isFinishing() || activity.isDestroyed()) {
|
|
||||||
mActivityListMap.remove(iWinBoLLActivity.getTag());
|
|
||||||
//_mIWinBoLLActivityList.remove(activity);
|
|
||||||
LogUtils.d(TAG, String.format("isActive(...) remove activity.\ntag : %s", tag));
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
LogUtils.d(TAG, String.format("isActive(...) activity is exist.\ntag : %s", tag));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
IWinBoLLActivity getIWinBoLLActivity(String tag) {
|
//
|
||||||
return mActivityListMap.get(tag);
|
// 找到tag 绑定的 BaseActivity ,通过 getTaskId() 移动到前台
|
||||||
}
|
//
|
||||||
|
public <T extends IWinBoLLActivity> boolean resumeActivity(Activity activity) {
|
||||||
/**
|
ActivityManager am = (ActivityManager) activity.getSystemService(Context.ACTIVITY_SERVICE);
|
||||||
* 找到tag 绑定的 BaseActivity ,通过 getTaskId() 移动到前台
|
|
||||||
*/
|
|
||||||
public <T extends IWinBoLLActivity> void resumeActivity(Context context, String tag) {
|
|
||||||
LogUtils.d(TAG, "resumeActivty");
|
|
||||||
T iWinBoLLActivity = (T)getIWinBoLLActivity(tag);
|
|
||||||
LogUtils.d(TAG, "activity " + iWinBoLLActivity.getTag());
|
|
||||||
if (iWinBoLLActivity != null && iWinBoLLActivity.getActivity() != null && !iWinBoLLActivity.getActivity().isFinishing() && !iWinBoLLActivity.getActivity().isDestroyed()) {
|
|
||||||
resumeActivity(context, iWinBoLLActivity);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 找到tag 绑定的 BaseActivity ,通过 getTaskId() 移动到前台
|
|
||||||
*/
|
|
||||||
public <T extends IWinBoLLActivity> void resumeActivity(Context context, T activity) {
|
|
||||||
ActivityManager am = (ActivityManager) activity.getActivity().getSystemService(Context.ACTIVITY_SERVICE);
|
|
||||||
//返回启动它的根任务(home 或者 MainActivity)
|
//返回启动它的根任务(home 或者 MainActivity)
|
||||||
Intent intent = new Intent(context, activity.getClass());
|
//Intent intent = new Intent(mContext, activity.getClass());
|
||||||
TaskStackBuilder stackBuilder = TaskStackBuilder.create(context);
|
//TaskStackBuilder stackBuilder = TaskStackBuilder.create(mContext);
|
||||||
stackBuilder.addNextIntentWithParentStack(intent);
|
//stackBuilder.addNextIntentWithParentStack(intent);
|
||||||
stackBuilder.startActivities();
|
//stackBuilder.startActivities();
|
||||||
//moveTaskToFront(YourTaskId, 0);
|
am.moveTaskToFront(activity.getTaskId(), ActivityManager.MOVE_TASK_NO_USER_ACTION);
|
||||||
LogUtils.d(TAG, "am.moveTaskToFront");
|
//ToastUtils.show("resumeActivity");
|
||||||
//ToastUtils.show("resumeActivity am.moveTaskToFront");
|
return true;
|
||||||
am.moveTaskToFront(activity.getActivity().getTaskId(), ActivityManager.MOVE_TASK_NO_USER_ACTION);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -221,10 +224,10 @@ public class WinBoLLActivityManager {
|
|||||||
// ★:0 1 2 [3] 4 >> 2
|
// ★:0 1 2 [3] 4 >> 2
|
||||||
// ★:0 1 2 3 [4] >> 3
|
// ★:0 1 2 3 [4] >> 3
|
||||||
// ★:[0] >> 直接关闭当前窗口
|
// ★:[0] >> 直接关闭当前窗口
|
||||||
IWinBoLLActivity preActivity = getPreActivity(iWinBoLLActivity);
|
Activity preActivity = getPreActivity(iWinBoLLActivity);
|
||||||
iWinBoLLActivity.getActivity().finish();
|
iWinBoLLActivity.getActivity().finish();
|
||||||
if (preActivity != null) {
|
if (preActivity != null) {
|
||||||
resumeActivity(mContext, preActivity);
|
resumeActivity(preActivity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -233,7 +236,7 @@ public class WinBoLLActivityManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IWinBoLLActivity getPreActivity(IWinBoLLActivity iWinBoLLActivity) {
|
Activity getPreActivity(IWinBoLLActivity iWinBoLLActivity) {
|
||||||
try {
|
try {
|
||||||
boolean bingo = false;
|
boolean bingo = false;
|
||||||
IWinBoLLActivity preIWinBoLLActivity = null;
|
IWinBoLLActivity preIWinBoLLActivity = null;
|
||||||
@@ -247,7 +250,7 @@ public class WinBoLLActivityManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (bingo) {
|
if (bingo) {
|
||||||
return preIWinBoLLActivity;
|
return preIWinBoLLActivity.getActivity();
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LogUtils.d(TAG, e, Thread.currentThread().getStackTrace());
|
LogUtils.d(TAG, e, Thread.currentThread().getStackTrace());
|
||||||
|
|||||||
@@ -1,20 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<item
|
|
||||||
android:id="@+id/item_minimal"
|
|
||||||
android:title="MINIMAL"
|
|
||||||
android:icon="@drawable/ic_winboll_point"/>
|
|
||||||
<item
|
|
||||||
android:id="@+id/item_about"
|
|
||||||
android:title="ABOUT"
|
|
||||||
android:icon="@drawable/ic_winboll_logo"/>
|
|
||||||
<item
|
|
||||||
android:id="@+id/item_help"
|
|
||||||
android:title="HELP"
|
|
||||||
android:icon="@drawable/ic_winboll_help"/>
|
|
||||||
|
|
||||||
<item
|
|
||||||
android:id="@+id/item_log"
|
|
||||||
android:title="LOG"
|
|
||||||
android:icon="@drawable/ic_winboll_log"/>
|
|
||||||
</menu>
|
|
||||||
Reference in New Issue
Block a user