日志窗口函数重构
This commit is contained in:
		@@ -1,8 +1,8 @@
 | 
			
		||||
#Created by .winboll/winboll_app_build.gradle
 | 
			
		||||
#Wed Mar 26 15:43:21 HKT 2025
 | 
			
		||||
#Wed Mar 26 11:30:27 GMT 2025
 | 
			
		||||
stageCount=1
 | 
			
		||||
libraryProject=libappbase
 | 
			
		||||
baseVersion=15.1
 | 
			
		||||
publishVersion=15.1.0
 | 
			
		||||
buildCount=0
 | 
			
		||||
buildCount=17
 | 
			
		||||
baseBetaVersion=15.1.1
 | 
			
		||||
 
 | 
			
		||||
@@ -71,7 +71,7 @@ public class MainActivity extends AppCompatActivity implements IWinBollActivity
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onOptionsItemSelected(MenuItem item) {
 | 
			
		||||
        if (item.getItemId() == cc.winboll.studio.appbase.R.id.item_log) {
 | 
			
		||||
            onLogActivity();
 | 
			
		||||
            WinBollActivityManager.getInstance(this).startLogActivity(this);
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
        // 在switch语句中处理每个ID,并在处理完后返回true,未处理的情况返回false。
 | 
			
		||||
@@ -176,23 +176,5 @@ public class MainActivity extends AppCompatActivity implements IWinBollActivity
 | 
			
		||||
        WinBollActivityManager.getInstance(this).startWinBollActivity(this, NewActivity.class);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void onLogActivity() {
 | 
			
		||||
    
 | 
			
		||||
        
 | 
			
		||||
        Intent intent = new Intent(MainActivity.this, LogActivity.class);
 | 
			
		||||
        intent.addFlags(Intent.FLAG_ACTIVITY_LAUNCH_ADJACENT);
 | 
			
		||||
        // Define the bounds.
 | 
			
		||||
        Rect bounds = new Rect(500, 300, 100, 0);
 | 
			
		||||
 | 
			
		||||
// Set the bounds as an activity option.
 | 
			
		||||
 | 
			
		||||
        ActivityOptions options = ActivityOptions.makeBasic();
 | 
			
		||||
 | 
			
		||||
        options.setLaunchBounds(bounds);
 | 
			
		||||
 | 
			
		||||
        //Intent intent = new Intent(this, LpgActivity.class);
 | 
			
		||||
 | 
			
		||||
        startActivity(intent, options.toBundle());
 | 
			
		||||
        //WinBollActivityManager.getInstance(this).startWinBollActivity(this, intent, LogActivity.class);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -30,13 +30,6 @@
 | 
			
		||||
		android:textAllCaps="false"
 | 
			
		||||
		android:onClick="onCloseAllActivity"/>
 | 
			
		||||
 | 
			
		||||
	<Button
 | 
			
		||||
		android:layout_width="wrap_content"
 | 
			
		||||
		android:layout_height="wrap_content"
 | 
			
		||||
		android:text="CloseAllActivity"
 | 
			
		||||
		android:textAllCaps="false"
 | 
			
		||||
		android:onClick="onCloseAllActivity"/>
 | 
			
		||||
 | 
			
		||||
	<Button
 | 
			
		||||
		android:layout_width="wrap_content"
 | 
			
		||||
		android:layout_height="wrap_content"
 | 
			
		||||
 
 | 
			
		||||
@@ -1,8 +1,8 @@
 | 
			
		||||
#Created by .winboll/winboll_app_build.gradle
 | 
			
		||||
#Wed Mar 26 15:43:05 HKT 2025
 | 
			
		||||
#Wed Mar 26 11:30:27 GMT 2025
 | 
			
		||||
stageCount=1
 | 
			
		||||
libraryProject=libappbase
 | 
			
		||||
baseVersion=15.1
 | 
			
		||||
publishVersion=15.1.0
 | 
			
		||||
buildCount=0
 | 
			
		||||
buildCount=17
 | 
			
		||||
baseBetaVersion=15.1.1
 | 
			
		||||
 
 | 
			
		||||
@@ -87,11 +87,11 @@ public class GlobalApplication extends Application {
 | 
			
		||||
        // 初始化 Toast 框架
 | 
			
		||||
        ToastUtils.init(this);
 | 
			
		||||
 | 
			
		||||
//        mWinBollActivityManager = WinBollActivityManager.getInstance(this);
 | 
			
		||||
//        mWinBollActivityManager.setWinBollUI_TYPE(WinBollActivityManager.WinBollUI_TYPE.Service);
 | 
			
		||||
//        // 注册回调
 | 
			
		||||
//        mMyActivityLifecycleCallbacks = new MyActivityLifecycleCallbacks(mWinBollActivityManager);
 | 
			
		||||
//        registerActivityLifecycleCallbacks(mMyActivityLifecycleCallbacks);
 | 
			
		||||
        mWinBollActivityManager = WinBollActivityManager.getInstance(this);
 | 
			
		||||
        mWinBollActivityManager.setWinBollUI_TYPE(WinBollActivityManager.WinBollUI_TYPE.Service);
 | 
			
		||||
        // 注册回调
 | 
			
		||||
        mMyActivityLifecycleCallbacks = new MyActivityLifecycleCallbacks(mWinBollActivityManager);
 | 
			
		||||
        registerActivityLifecycleCallbacks(mMyActivityLifecycleCallbacks);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -9,9 +9,11 @@ package cc.winboll.studio.libappbase.winboll;
 | 
			
		||||
 * https://blog.csdn.net/qq_29364417/article/details/109379915?app_version=6.4.2&code=app_1562916241&csdn_share_tail=%7B%22type%22%3A%22blog%22%2C%22rType%22%3A%22article%22%2C%22rId%22%3A%22109379915%22%2C%22source%22%3A%22weixin_38986226%22%7D&uLinkId=usr1mkqgl919blen&utm_source=app
 | 
			
		||||
 */
 | 
			
		||||
import android.app.ActivityManager;
 | 
			
		||||
import android.app.ActivityOptions;
 | 
			
		||||
import android.app.TaskStackBuilder;
 | 
			
		||||
import android.content.Context;
 | 
			
		||||
import android.content.Intent;
 | 
			
		||||
import android.graphics.Rect;
 | 
			
		||||
import cc.winboll.studio.libappbase.LogUtils;
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Iterator;
 | 
			
		||||
@@ -134,6 +136,33 @@ public class WinBollActivityManager {
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public <T extends IWinBollActivity> void startLogActivity(Context context) {
 | 
			
		||||
        // 如果窗口已存在就重启窗口
 | 
			
		||||
        String tag = LogActivity.TAG;
 | 
			
		||||
        if (isActive(tag)) {
 | 
			
		||||
            resumeActivity(context, tag);
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // 新建一个任务窗口
 | 
			
		||||
        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);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public boolean isFirstIWinBollActivity(IWinBollActivity iWinBollActivity) {
 | 
			
		||||
        return firstIWinBollActivity != null && firstIWinBollActivity == iWinBollActivity;
 | 
			
		||||
    }
 | 
			
		||||
@@ -142,7 +171,7 @@ public class WinBollActivityManager {
 | 
			
		||||
    // 判断 tag绑定的 MyActivity是否存在
 | 
			
		||||
    //
 | 
			
		||||
    public boolean isActive(String tag) {
 | 
			
		||||
        //printAvtivityListInfo();
 | 
			
		||||
        printIWinBollListInfo();
 | 
			
		||||
        IWinBollActivity iWinBoll = getIWinBoll(tag);
 | 
			
		||||
        if (iWinBoll != null) {
 | 
			
		||||
            LogUtils.d(TAG, "isActive(...) activity != null tag " + tag);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user