0959
This commit is contained in:
		@@ -18,8 +18,8 @@ def genVersionName(def versionName){
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
android {
 | 
			
		||||
    compileSdkVersion 30
 | 
			
		||||
    buildToolsVersion "30.0.3"
 | 
			
		||||
    compileSdkVersion 32
 | 
			
		||||
    buildToolsVersion "32.0.0"
 | 
			
		||||
 | 
			
		||||
    defaultConfig {
 | 
			
		||||
        applicationId "cc.winboll.studio.aes"
 | 
			
		||||
@@ -46,32 +46,4 @@ android {
 | 
			
		||||
dependencies {
 | 
			
		||||
	api project(':libaes')
 | 
			
		||||
    api fileTree(dir: 'libs', include: ['*.jar'])
 | 
			
		||||
    
 | 
			
		||||
    // 权限请求框架:https://github.com/getActivity/XXPermissions
 | 
			
		||||
    implementation 'com.github.getActivity:XXPermissions:18.63'
 | 
			
		||||
    // 下拉控件
 | 
			
		||||
    implementation 'com.baoyz.pullrefreshlayout:library:1.2.0'
 | 
			
		||||
    // 拼音搜索
 | 
			
		||||
    // https://mvnrepository.com/artifact/com.github.open-android/pinyin4j
 | 
			
		||||
    implementation 'com.github.open-android:pinyin4j:2.5.0'
 | 
			
		||||
    // SSH
 | 
			
		||||
    implementation 'com.jcraft:jsch:0.1.55'
 | 
			
		||||
    // Html 解析
 | 
			
		||||
    implementation 'org.jsoup:jsoup:1.13.1'
 | 
			
		||||
    // 二维码类库
 | 
			
		||||
    implementation 'com.google.zxing:core:3.4.1'
 | 
			
		||||
    implementation 'com.journeyapps:zxing-android-embedded:3.6.0'
 | 
			
		||||
    // 网络连接类库
 | 
			
		||||
    implementation 'com.squareup.okhttp3:okhttp:4.4.1'
 | 
			
		||||
    
 | 
			
		||||
    // 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.0.0'
 | 
			
		||||
    
 | 
			
		||||
    implementation 'cc.winboll.studio:libappbase:15.0.5'
 | 
			
		||||
    implementation 'cc.winboll.studio:libapputils:15.0.6'
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
#Created by .winboll/winboll_app_build.gradle
 | 
			
		||||
#Tue Mar 18 04:22:06 GMT 2025
 | 
			
		||||
#Mon Mar 24 01:56:29 GMT 2025
 | 
			
		||||
stageCount=13
 | 
			
		||||
libraryProject=libaes
 | 
			
		||||
baseVersion=7.6
 | 
			
		||||
 
 | 
			
		||||
@@ -12,6 +12,7 @@ import android.view.MenuItem;
 | 
			
		||||
import android.view.View;
 | 
			
		||||
import android.widget.AdapterView;
 | 
			
		||||
import android.widget.Toast;
 | 
			
		||||
import android.widget.Toolbar;
 | 
			
		||||
import androidx.appcompat.app.AppCompatActivity;
 | 
			
		||||
import cc.winboll.studio.aes.R;
 | 
			
		||||
import cc.winboll.studio.libaes.activitys.DrawerFragmentActivity;
 | 
			
		||||
@@ -24,13 +25,12 @@ import cc.winboll.studio.libaes.unittests.TestASupportToolbarActivity;
 | 
			
		||||
import cc.winboll.studio.libaes.unittests.TestAToolbarActivity;
 | 
			
		||||
import cc.winboll.studio.libaes.unittests.TestDrawerFragmentActivity;
 | 
			
		||||
import cc.winboll.studio.libaes.unittests.TestViewPageFragment;
 | 
			
		||||
import cc.winboll.studio.libaes.winboll.IWinBollActivity;
 | 
			
		||||
import cc.winboll.studio.libappbase.LogUtils;
 | 
			
		||||
import cc.winboll.studio.libapputils.app.AboutActivityFactory;
 | 
			
		||||
import cc.winboll.studio.libapputils.app.IWinBollActivity;
 | 
			
		||||
import cc.winboll.studio.libapputils.bean.APPInfo;
 | 
			
		||||
import com.a4455jkjh.colorpicker.ColorPickerDialog;
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import android.widget.Toolbar;
 | 
			
		||||
 | 
			
		||||
public class MainActivity extends DrawerFragmentActivity implements IWinBollActivity {
 | 
			
		||||
 | 
			
		||||
@@ -39,11 +39,6 @@ public class MainActivity extends DrawerFragmentActivity implements IWinBollActi
 | 
			
		||||
    TestAButtonFragment mTestAButtonFragment;
 | 
			
		||||
    TestViewPageFragment mTestViewPageFragment;
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public AppCompatActivity getActivity() {
 | 
			
		||||
        return this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public APPInfo getAppInfo() {
 | 
			
		||||
        String szBranchName = "aes";
 | 
			
		||||
@@ -70,7 +65,7 @@ public class MainActivity extends DrawerFragmentActivity implements IWinBollActi
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public Toolbar initToolBar() {
 | 
			
		||||
        return mToolbar;
 | 
			
		||||
        return null;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
 
 | 
			
		||||
@@ -4,8 +4,8 @@ apply from: '../.winboll/winboll_lib_build.gradle'
 | 
			
		||||
apply from: '../.winboll/winboll_lint_build.gradle'
 | 
			
		||||
 | 
			
		||||
android {
 | 
			
		||||
    compileSdkVersion 30
 | 
			
		||||
    buildToolsVersion "30.0.3"
 | 
			
		||||
    compileSdkVersion 32
 | 
			
		||||
    buildToolsVersion "32.0.0"
 | 
			
		||||
 | 
			
		||||
    defaultConfig {
 | 
			
		||||
        minSdkVersion 26
 | 
			
		||||
@@ -21,32 +21,31 @@ android {
 | 
			
		||||
 | 
			
		||||
dependencies {
 | 
			
		||||
    api fileTree(dir: 'libs', include: ['*.jar'])
 | 
			
		||||
    api 'cc.winboll.studio:libappbase:15.0.8'
 | 
			
		||||
    api 'cc.winboll.studio:libapputils:15.0.11'
 | 
			
		||||
    
 | 
			
		||||
    // 权限请求框架:https://github.com/getActivity/XXPermissions
 | 
			
		||||
    implementation 'com.github.getActivity:XXPermissions:18.63'
 | 
			
		||||
    api 'com.github.getActivity:XXPermissions:18.63'
 | 
			
		||||
    // 下拉控件
 | 
			
		||||
    implementation 'com.baoyz.pullrefreshlayout:library:1.2.0'
 | 
			
		||||
    api 'com.baoyz.pullrefreshlayout:library:1.2.0'
 | 
			
		||||
    // 拼音搜索
 | 
			
		||||
    // https://mvnrepository.com/artifact/com.github.open-android/pinyin4j
 | 
			
		||||
    implementation 'com.github.open-android:pinyin4j:2.5.0'
 | 
			
		||||
    api 'com.github.open-android:pinyin4j:2.5.0'
 | 
			
		||||
    // SSH
 | 
			
		||||
    implementation 'com.jcraft:jsch:0.1.55'
 | 
			
		||||
    api 'com.jcraft:jsch:0.1.55'
 | 
			
		||||
    // Html 解析
 | 
			
		||||
    implementation 'org.jsoup:jsoup:1.13.1'
 | 
			
		||||
    api 'org.jsoup:jsoup:1.13.1'
 | 
			
		||||
    // 二维码类库
 | 
			
		||||
    implementation 'com.google.zxing:core:3.4.1'
 | 
			
		||||
    implementation 'com.journeyapps:zxing-android-embedded:3.6.0'
 | 
			
		||||
    api 'com.google.zxing:core:3.4.1'
 | 
			
		||||
    api 'com.journeyapps:zxing-android-embedded:3.6.0'
 | 
			
		||||
    // 网络连接类库
 | 
			
		||||
    implementation 'com.squareup.okhttp3:okhttp:4.4.1'
 | 
			
		||||
    api 'com.squareup.okhttp3:okhttp:4.4.1'
 | 
			
		||||
    
 | 
			
		||||
    // 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.0.0'
 | 
			
		||||
    
 | 
			
		||||
    implementation 'cc.winboll.studio:libappbase:15.0.5'
 | 
			
		||||
    implementation 'cc.winboll.studio:libapputils:15.0.6'
 | 
			
		||||
    api 'androidx.appcompat:appcompat:1.1.0'
 | 
			
		||||
    api 'androidx.viewpager:viewpager:1.0.0'
 | 
			
		||||
    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.0.0'
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -27,9 +27,10 @@ import cc.winboll.studio.libaes.beans.DrawerMenuBean;
 | 
			
		||||
import cc.winboll.studio.libaes.utils.AESThemeUtil;
 | 
			
		||||
import cc.winboll.studio.libaes.views.ADrawerMenuListView;
 | 
			
		||||
import cc.winboll.studio.libappbase.LogUtils;
 | 
			
		||||
import cc.winboll.studio.libapputils.app.IWinBollActivity;
 | 
			
		||||
import com.baoyz.widget.PullRefreshLayout;
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import cc.winboll.studio.libaes.winboll.IWinBollActivity;
 | 
			
		||||
import androidx.appcompat.widget.Toolbar;
 | 
			
		||||
 | 
			
		||||
public abstract class DrawerFragmentActivity extends AppCompatActivity implements IWinBollActivity,AdapterView.OnItemClickListener {
 | 
			
		||||
 | 
			
		||||
@@ -194,7 +195,7 @@ public abstract class DrawerFragmentActivity extends AppCompatActivity implement
 | 
			
		||||
        setContentView(R.layout.activity_drawerfragment);
 | 
			
		||||
 | 
			
		||||
        mToolbar = findViewById(R.id.activitydrawerfragmentASupportToolbar1);
 | 
			
		||||
        setActionBar(mToolbar);
 | 
			
		||||
        setSupportActionBar(mToolbar);
 | 
			
		||||
 | 
			
		||||
        if (mActivityType == ActivityType.Main) {
 | 
			
		||||
            initMainRootView();
 | 
			
		||||
 
 | 
			
		||||
@@ -9,23 +9,19 @@ import cc.winboll.studio.libaes.activitys.DrawerFragmentActivity;
 | 
			
		||||
import cc.winboll.studio.libapputils.bean.APPInfo;
 | 
			
		||||
import androidx.appcompat.app.AppCompatActivity;
 | 
			
		||||
import android.widget.Toolbar;
 | 
			
		||||
import cc.winboll.studio.libaes.winboll.IWinBollActivity;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @Author ZhanGSKen@QQ.COM
 | 
			
		||||
 * @Date 2024/06/15 00:58:10
 | 
			
		||||
 * @Describe 第二级窗口
 | 
			
		||||
 */
 | 
			
		||||
public class SecondaryLibraryActivity extends DrawerFragmentActivity {
 | 
			
		||||
public class SecondaryLibraryActivity extends DrawerFragmentActivity implements IWinBollActivity {
 | 
			
		||||
 | 
			
		||||
    public static final String TAG = "SecondaryLibraryActivity";
 | 
			
		||||
 | 
			
		||||
    SecondaryLibraryFragment mSecondaryLibraryFragment;
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public AppCompatActivity getActivity() {
 | 
			
		||||
        return this;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    @Override
 | 
			
		||||
    public APPInfo getAppInfo() {
 | 
			
		||||
        return null;
 | 
			
		||||
 
 | 
			
		||||
@@ -16,18 +16,13 @@ import androidx.fragment.app.Fragment;
 | 
			
		||||
import cc.winboll.studio.libaes.R;
 | 
			
		||||
import cc.winboll.studio.libaes.activitys.DrawerFragmentActivity;
 | 
			
		||||
import cc.winboll.studio.libaes.beans.DrawerMenuBean;
 | 
			
		||||
import cc.winboll.studio.libaes.winboll.IWinBollActivity;
 | 
			
		||||
import cc.winboll.studio.libappbase.LogUtils;
 | 
			
		||||
import cc.winboll.studio.libapputils.app.IWinBollActivity;
 | 
			
		||||
import cc.winboll.studio.libapputils.bean.APPInfo;
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
 | 
			
		||||
public class TestDrawerFragmentActivity extends DrawerFragmentActivity implements IWinBollActivity {
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public Activity getActivity() {
 | 
			
		||||
        return g;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public APPInfo getAppInfo() {
 | 
			
		||||
        return null;
 | 
			
		||||
 
 | 
			
		||||
@@ -42,7 +42,7 @@ public class TestViewPageFragment extends Fragment implements ViewPager.OnPageCh
 | 
			
		||||
    @Override
 | 
			
		||||
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
 | 
			
		||||
        mView = inflater.inflate(R.layout.fragment_viewpage, container, false);
 | 
			
		||||
        mContext = getActivity().getContext();
 | 
			
		||||
        mContext = getActivity();
 | 
			
		||||
        
 | 
			
		||||
        mLogView = mView.findViewById(R.id.logview);
 | 
			
		||||
        mLogView.start();
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,23 @@
 | 
			
		||||
package cc.winboll.studio.libaes.winboll;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @Author ZhanGSKen@AliYun.Com
 | 
			
		||||
 * @Date 2025/03/24 08:23:40
 | 
			
		||||
 * @Describe WinBoll 活动窗口通用接口
 | 
			
		||||
 */
 | 
			
		||||
import android.content.Context;
 | 
			
		||||
import android.widget.Toolbar;
 | 
			
		||||
import cc.winboll.studio.libapputils.bean.APPInfo;
 | 
			
		||||
 | 
			
		||||
public interface IWinBollActivity {
 | 
			
		||||
 | 
			
		||||
    public static final String TAG = "IWinBollActivity";
 | 
			
		||||
 | 
			
		||||
    // 获取应用资源上下文
 | 
			
		||||
    abstract public Context getApplicationContext();
 | 
			
		||||
    abstract public APPInfo getAppInfo();
 | 
			
		||||
    abstract public String getTag();
 | 
			
		||||
    abstract public Toolbar initToolBar();
 | 
			
		||||
    abstract public boolean isEnableDisplayHomeAsUp();
 | 
			
		||||
    abstract public boolean isAddWinBollToolBar();
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,97 @@
 | 
			
		||||
package cc.winboll.studio.libaes.winboll;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @Author ZhanGSKen@AliYun.Com
 | 
			
		||||
 * @Date 2025/03/24 08:24:52
 | 
			
		||||
 */
 | 
			
		||||
import android.app.Activity;
 | 
			
		||||
import android.app.Application;
 | 
			
		||||
import android.content.Intent;
 | 
			
		||||
import android.os.Bundle;
 | 
			
		||||
import cc.winboll.studio.libappbase.LogUtils;
 | 
			
		||||
import cc.winboll.studio.libappbase.utils.ToastUtils; 
 | 
			
		||||
 | 
			
		||||
public class MyActivityLifecycleCallbacks implements Application.ActivityLifecycleCallbacks { 
 | 
			
		||||
 | 
			
		||||
    public static final String TAG = "MyActivityLifecycleCallbacks";
 | 
			
		||||
 | 
			
		||||
    public String mInfo = "";
 | 
			
		||||
 | 
			
		||||
    public MyActivityLifecycleCallbacks() {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    void createActivityeInfo(Activity activity) {
 | 
			
		||||
        StringBuilder sb = new StringBuilder();
 | 
			
		||||
        Intent receivedIntent = activity.getIntent();
 | 
			
		||||
        sb.append("\nCallingActivity : \n");
 | 
			
		||||
        if (activity.getCallingActivity() != null) {
 | 
			
		||||
            sb.append(activity.getCallingActivity().getPackageName());
 | 
			
		||||
        }
 | 
			
		||||
        sb.append("\nReceived Intent Package : \n");
 | 
			
		||||
        sb.append(receivedIntent.getPackage());
 | 
			
		||||
 | 
			
		||||
        Bundle extras = receivedIntent.getExtras();
 | 
			
		||||
        if (extras != null) {
 | 
			
		||||
            for (String key : extras.keySet()) {
 | 
			
		||||
                sb.append("\nIntentInfo");
 | 
			
		||||
                sb.append("\n键: ");
 | 
			
		||||
                sb.append(key);
 | 
			
		||||
                sb.append(", 值: ");
 | 
			
		||||
                sb.append(extras.get(key));
 | 
			
		||||
                //Log.d("IntentInfo", "键: " + key + ", 值: " + extras.get(key));
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        mInfo = sb.toString();
 | 
			
		||||
        //Log.d("IntentInfo", "发送Intent的应用包名: " + senderPackage);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void showActivityeInfo() {
 | 
			
		||||
        ToastUtils.show("ActivityeInfo : " + mInfo);
 | 
			
		||||
        LogUtils.d(TAG, "ActivityeInfo : " + mInfo);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override 
 | 
			
		||||
    public void onActivityCreated(Activity activity, Bundle savedInstanceState) { 
 | 
			
		||||
        // 在这里可以做一些初始化相关的操作,例如记录Activity的创建时间等 
 | 
			
		||||
        //System.out.println(activity.getLocalClassName() + " was created"); 
 | 
			
		||||
        LogUtils.d(TAG, activity.getLocalClassName() + " was created");
 | 
			
		||||
        createActivityeInfo(activity);
 | 
			
		||||
    } 
 | 
			
		||||
 | 
			
		||||
    @Override 
 | 
			
		||||
    public void onActivityStarted(Activity activity) { 
 | 
			
		||||
        //System.out.println(activity.getLocalClassName() + " was started");
 | 
			
		||||
        LogUtils.d(TAG, activity.getLocalClassName() + " was started");
 | 
			
		||||
        //createActivityeInfo(activity);
 | 
			
		||||
    } 
 | 
			
		||||
 | 
			
		||||
    @Override 
 | 
			
		||||
    public void onActivityResumed(Activity activity) { 
 | 
			
		||||
        //System.out.println(activity.getLocalClassName() + " was resumed");
 | 
			
		||||
        LogUtils.d(TAG, activity.getLocalClassName() + " was resumed");
 | 
			
		||||
        //createActivityeInfo(activity);
 | 
			
		||||
    } 
 | 
			
		||||
 | 
			
		||||
    @Override 
 | 
			
		||||
    public void onActivityPaused(Activity activity) { 
 | 
			
		||||
        //System.out.println(activity.getLocalClassName() + " was paused");
 | 
			
		||||
        LogUtils.d(TAG, activity.getLocalClassName() + " was paused");
 | 
			
		||||
    } 
 | 
			
		||||
 | 
			
		||||
    @Override 
 | 
			
		||||
    public void onActivityStopped(Activity activity) { 
 | 
			
		||||
        //System.out.println(activity.getLocalClassName() + " was stopped");
 | 
			
		||||
        LogUtils.d(TAG, activity.getLocalClassName() + " was stopped");
 | 
			
		||||
    } 
 | 
			
		||||
 | 
			
		||||
    @Override 
 | 
			
		||||
    public void onActivitySaveInstanceState(Activity activity, Bundle outState) { 
 | 
			
		||||
        // 可以在这里添加保存状态的自定义逻辑 
 | 
			
		||||
    } 
 | 
			
		||||
 | 
			
		||||
    @Override 
 | 
			
		||||
    public void onActivityDestroyed(Activity activity) { 
 | 
			
		||||
        //System.out.println(activity.getLocalClassName() + " was destroyed");
 | 
			
		||||
        LogUtils.d(TAG, activity.getLocalClassName() + " was destroyed");
 | 
			
		||||
    } 
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,318 @@
 | 
			
		||||
package cc.winboll.studio.libaes.winboll;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @Author ZhanGSKen@AliYun.Com
 | 
			
		||||
 * @Date 2025/03/24 08:25:43
 | 
			
		||||
 * @Describe 应用活动窗口管理器
 | 
			
		||||
 * 参考 :
 | 
			
		||||
 * android 类似微信小程序多任务窗口 及 设置 TaskDescription 修改 icon 和 label
 | 
			
		||||
 * 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.TaskStackBuilder;
 | 
			
		||||
import android.content.Context;
 | 
			
		||||
import android.content.Intent;
 | 
			
		||||
import cc.winboll.studio.libappbase.LogUtils;
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Iterator;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
public class WinBollActivityManager {
 | 
			
		||||
 | 
			
		||||
//    public static final String TAG = "WinBollActivityManager";
 | 
			
		||||
//    public static final String EXTRA_TAG = "EXTRA_TAG";
 | 
			
		||||
//
 | 
			
		||||
//    public static enum WinBollUI_TYPE {
 | 
			
		||||
//        Aplication, // 退出应用后,保持最近任务栏任务记录主窗口
 | 
			
		||||
//        Service // 退出应用后,清理所有最近任务栏任务记录窗口
 | 
			
		||||
//        };
 | 
			
		||||
//
 | 
			
		||||
//    // 应用类型标志
 | 
			
		||||
//    volatile static WinBollUI_TYPE _mWinBollUI_TYPE = WinBollUI_TYPE.Service;
 | 
			
		||||
//
 | 
			
		||||
//    Context mContext;
 | 
			
		||||
//    MyActivityLifecycleCallbacks mMyActivityLifecycleCallbacks;
 | 
			
		||||
//    static WinBollActivityManager _mWinBollActivityManager;
 | 
			
		||||
//    static Map<String, IWinBollActivity> _mapIWinBollList;
 | 
			
		||||
//    IWinBollActivity firstIWinBollActivity;
 | 
			
		||||
//
 | 
			
		||||
//    public WinBollActivityManager(Context context) {
 | 
			
		||||
//        mContext = context;
 | 
			
		||||
//        LogUtils.d(TAG, "WinBollActivityManager()");
 | 
			
		||||
//        _mapIWinBollList = new HashMap<String, IWinBollActivity>();
 | 
			
		||||
//    }
 | 
			
		||||
//
 | 
			
		||||
//    public static synchronized WinBollActivityManager getInstance(Context context) {
 | 
			
		||||
//        LogUtils.d(TAG, "getInstance");
 | 
			
		||||
//        if (_mWinBollActivityManager == null) {
 | 
			
		||||
//            LogUtils.d(TAG, "_mWinBollActivityManager == null");
 | 
			
		||||
//            _mWinBollActivityManager = new WinBollActivityManager(context);
 | 
			
		||||
//        }
 | 
			
		||||
//        return _mWinBollActivityManager;
 | 
			
		||||
//    }
 | 
			
		||||
//
 | 
			
		||||
//    //
 | 
			
		||||
//    // 设置 WinBoll 应用 UI 类型
 | 
			
		||||
//    //
 | 
			
		||||
//    public synchronized static void setWinBollUI_TYPE(WinBollUI_TYPE mWinBollUI_TYPE) {
 | 
			
		||||
//        _mWinBollUI_TYPE = mWinBollUI_TYPE;
 | 
			
		||||
//    }
 | 
			
		||||
//
 | 
			
		||||
//    //
 | 
			
		||||
//    // 获取 WinBoll 应用 UI 类型
 | 
			
		||||
//    //
 | 
			
		||||
//    public synchronized static WinBollUI_TYPE getWinBollUI_TYPE() {
 | 
			
		||||
//        return _mWinBollUI_TYPE;
 | 
			
		||||
//    }
 | 
			
		||||
//
 | 
			
		||||
//    //
 | 
			
		||||
//    // 把Activity添加到管理中
 | 
			
		||||
//    //
 | 
			
		||||
//    public <T extends IWinBollActivity> void add(T iWinBoll) {
 | 
			
		||||
//        if (isActive(iWinBoll.getTag())) {
 | 
			
		||||
//            LogUtils.d(TAG, String.format("add(...) %s is active.", iWinBoll.getTag()));
 | 
			
		||||
//        } else {
 | 
			
		||||
//            // 设置起始活动窗口,以便最后退出时提问
 | 
			
		||||
//            if (firstIWinBollActivity == null && _mapIWinBollList.size() == 0) {
 | 
			
		||||
//                firstIWinBollActivity = iWinBoll;
 | 
			
		||||
//            }
 | 
			
		||||
//
 | 
			
		||||
//            // 添加到活动窗口列表
 | 
			
		||||
//            _mapIWinBollList.put(iWinBoll.getTag(), iWinBoll);
 | 
			
		||||
//            LogUtils.d(TAG, String.format("Add activity : %s\n_mapActivityList.size() : %d", iWinBoll.getTag(), _mapIWinBollList.size()));
 | 
			
		||||
//        }
 | 
			
		||||
//    }
 | 
			
		||||
//
 | 
			
		||||
//
 | 
			
		||||
//    //
 | 
			
		||||
//    // activity: 为 null 时,
 | 
			
		||||
//    // intent.putExtra 函数 EXTRA_TAG 参数为 tag
 | 
			
		||||
//    // activity: 不为 null 时,
 | 
			
		||||
//    // intent.putExtra 函数 "tag" 参数为 activity.getTag()
 | 
			
		||||
//    //
 | 
			
		||||
//    public <T extends IWinBollActivity> void startWinBollActivity(Context context, Class<T> clazz) {
 | 
			
		||||
//        try {
 | 
			
		||||
//            // 如果窗口已存在就重启窗口
 | 
			
		||||
//            String tag = clazz.newInstance().getTag();
 | 
			
		||||
//            if (isActive(tag)) {
 | 
			
		||||
//                resumeActivity(context, tag);
 | 
			
		||||
//                return;
 | 
			
		||||
//            }
 | 
			
		||||
//
 | 
			
		||||
//            // 新建一个任务窗口
 | 
			
		||||
//            Intent intent = new Intent(context, clazz);
 | 
			
		||||
//            //打开多任务窗口 flags
 | 
			
		||||
//            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT);
 | 
			
		||||
//            intent.addFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
 | 
			
		||||
//            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
 | 
			
		||||
//            intent.putExtra(EXTRA_TAG, tag);
 | 
			
		||||
//            mContext.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) {
 | 
			
		||||
//        try {
 | 
			
		||||
//            // 如果窗口已存在就重启窗口
 | 
			
		||||
//            String tag = clazz.newInstance().getTag();
 | 
			
		||||
//            if (isActive(tag)) {
 | 
			
		||||
//                resumeActivity(context, tag);
 | 
			
		||||
//                return;
 | 
			
		||||
//            }
 | 
			
		||||
//
 | 
			
		||||
//            // 新建一个任务窗口
 | 
			
		||||
//            //Intent intent = new Intent(context, clazz);
 | 
			
		||||
//            //打开多任务窗口 flags
 | 
			
		||||
//            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT);
 | 
			
		||||
//            intent.addFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
 | 
			
		||||
//            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
 | 
			
		||||
//            intent.putExtra(EXTRA_TAG, tag);
 | 
			
		||||
//            mContext.startActivity(intent);
 | 
			
		||||
//        } catch (InstantiationException | IllegalAccessException e) {
 | 
			
		||||
//            LogUtils.d(TAG, e, Thread.currentThread().getStackTrace());
 | 
			
		||||
//        }
 | 
			
		||||
//    }
 | 
			
		||||
//
 | 
			
		||||
//    public boolean isFirstIWinBollActivity(IWinBollActivity iWinBollActivity) {
 | 
			
		||||
//        return firstIWinBollActivity != null && firstIWinBollActivity == iWinBollActivity;
 | 
			
		||||
//    }
 | 
			
		||||
//
 | 
			
		||||
//    //
 | 
			
		||||
//    // 判断 tag绑定的 MyActivity是否存在
 | 
			
		||||
//    //
 | 
			
		||||
//    public boolean isActive(String tag) {
 | 
			
		||||
//        //printAvtivityListInfo();
 | 
			
		||||
//        IWinBollActivity iWinBoll = getIWinBoll(tag);
 | 
			
		||||
//        if (iWinBoll != null) {
 | 
			
		||||
//            LogUtils.d(TAG, "isActive(...) activity != null tag " + tag);
 | 
			
		||||
//            //ToastUtils.show("activity != null tag " + tag);
 | 
			
		||||
//            //判断是否为 BaseActivity,如果已经销毁,则移除
 | 
			
		||||
//            if (iWinBoll.getActivity().isFinishing() || iWinBoll.getActivity().isDestroyed()) {
 | 
			
		||||
//                _mapIWinBollList.remove(iWinBoll.getTag());
 | 
			
		||||
//                //_mWinBollActivityList.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;
 | 
			
		||||
//            }
 | 
			
		||||
//        } else {
 | 
			
		||||
//            LogUtils.d(TAG, String.format("isActive(...) activity == null\ntag : %s", tag));
 | 
			
		||||
//            return false;
 | 
			
		||||
//        }
 | 
			
		||||
//    }
 | 
			
		||||
//
 | 
			
		||||
//    static IWinBollActivity getIWinBoll(String tag) {
 | 
			
		||||
//        return _mapIWinBollList.get(tag);
 | 
			
		||||
//    }
 | 
			
		||||
//
 | 
			
		||||
//    //
 | 
			
		||||
//    // 找到tag 绑定的 BaseActivity ,通过 getTaskId() 移动到前台
 | 
			
		||||
//    //
 | 
			
		||||
//    public <T extends IWinBollActivity> void resumeActivity(Context context, String tag) {
 | 
			
		||||
//        LogUtils.d(TAG, "resumeActivty");
 | 
			
		||||
//        T iWinBoll = (T)getIWinBoll(tag);
 | 
			
		||||
//        //LogUtils.d(TAG, "activity " + activity.getTag());
 | 
			
		||||
//        if (iWinBoll != null && !iWinBoll.getActivity().isFinishing() && !iWinBoll.getActivity().isDestroyed()) {
 | 
			
		||||
//            resumeActivity(context, iWinBoll);
 | 
			
		||||
//        }
 | 
			
		||||
//    }
 | 
			
		||||
//
 | 
			
		||||
//    //
 | 
			
		||||
//    // 找到tag 绑定的 BaseActivity ,通过 getTaskId() 移动到前台
 | 
			
		||||
//    //
 | 
			
		||||
//    public <T extends IWinBollActivity> void resumeActivity(Context context, T iWinBoll) {
 | 
			
		||||
//        ActivityManager am = (ActivityManager) iWinBoll.getActivity().getSystemService(Context.ACTIVITY_SERVICE);
 | 
			
		||||
//        //返回启动它的根任务(home 或者 MainActivity)
 | 
			
		||||
//        Intent intent = new Intent(context, iWinBoll.getClass());
 | 
			
		||||
//        TaskStackBuilder stackBuilder = TaskStackBuilder.create(context);
 | 
			
		||||
//        stackBuilder.addNextIntentWithParentStack(intent);
 | 
			
		||||
//        stackBuilder.startActivities();
 | 
			
		||||
//        //moveTaskToFront(YourTaskId, 0);
 | 
			
		||||
//        LogUtils.d(TAG, "am.moveTaskToFront");
 | 
			
		||||
//        //ToastUtils.show("resumeActivity am.moveTaskToFront");
 | 
			
		||||
//        am.moveTaskToFront(iWinBoll.getActivity().getTaskId(), ActivityManager.MOVE_TASK_NO_USER_ACTION);
 | 
			
		||||
//    }
 | 
			
		||||
//
 | 
			
		||||
//
 | 
			
		||||
//    //
 | 
			
		||||
//    // 结束所有 Activity
 | 
			
		||||
//    //
 | 
			
		||||
//    public void finishAll() {
 | 
			
		||||
//        try {
 | 
			
		||||
//            for (String key : _mapIWinBollList.keySet()) {
 | 
			
		||||
//                //System.out.println("Key: " + key + ", Value: " + _mapActivityList.get(key));
 | 
			
		||||
//                IWinBollActivity iWinBoll = _mapIWinBollList.get(key);
 | 
			
		||||
//                //ToastUtils.show("finishAll() activity");
 | 
			
		||||
//                if (iWinBoll != null && !iWinBoll.getActivity().isFinishing() && !iWinBoll.getActivity().isDestroyed()) {
 | 
			
		||||
//                    //ToastUtils.show("activity != null ...");
 | 
			
		||||
//                    if (getWinBollUI_TYPE() == WinBollUI_TYPE.Service) {
 | 
			
		||||
//                        // 结束窗口和最近任务栏, 建议前台服务类应用使用,可以方便用户再次调用 UI 操作。
 | 
			
		||||
//                        iWinBoll.getActivity().finishAndRemoveTask();
 | 
			
		||||
//                        //ToastUtils.show("finishAll() activity.finishAndRemoveTask();");
 | 
			
		||||
//                    } else if (getWinBollUI_TYPE() == WinBollUI_TYPE.Aplication) {
 | 
			
		||||
//                        // 结束窗口保留最近任务栏,建议前台服务类应用使用,可以保持应用的系统自觉性。
 | 
			
		||||
//                        iWinBoll.getActivity().finish();
 | 
			
		||||
//                        //ToastUtils.show("finishAll() activity.finish();");
 | 
			
		||||
//                    } else {
 | 
			
		||||
//                        LogUtils.d(TAG, "WinBollApplication.WinBollUI_TYPE error.");
 | 
			
		||||
//                        //ToastUtils.show("WinBollApplication.WinBollUI_TYPE error.");
 | 
			
		||||
//                    }
 | 
			
		||||
//                }
 | 
			
		||||
//            }
 | 
			
		||||
//        } catch (Exception e) {
 | 
			
		||||
//            LogUtils.d(TAG, e, Thread.currentThread().getStackTrace());
 | 
			
		||||
//        }
 | 
			
		||||
//    }
 | 
			
		||||
//
 | 
			
		||||
//    //
 | 
			
		||||
//    // 结束指定Activity
 | 
			
		||||
//    //
 | 
			
		||||
//    public <T extends IWinBollActivity> void finish(T iWinBoll) {
 | 
			
		||||
//        try {
 | 
			
		||||
//            if (iWinBoll != null && !iWinBoll.getActivity().isFinishing() && !iWinBoll.getActivity().isDestroyed()) {
 | 
			
		||||
//                //根据tag 移除 MyActivity
 | 
			
		||||
//                //String tag= activity.getTag();
 | 
			
		||||
//                //_mWinBollActivityList.remove(tag);
 | 
			
		||||
//                //ToastUtils.show("remove");
 | 
			
		||||
//                //ToastUtils.show("_mWinBollActivityArrayMap.size() " + Integer.toString(_mWinBollActivityArrayMap.size()));
 | 
			
		||||
//
 | 
			
		||||
//                // 窗口回调规则:
 | 
			
		||||
//                // [] 当前窗口位置 >> 调度出的窗口位置
 | 
			
		||||
//                // ★:[0] 1 2 3 4 >> 1
 | 
			
		||||
//                // ★:0 1 [2] 3 4 >> 1
 | 
			
		||||
//                // ★:0 1 2 [3] 4 >> 2
 | 
			
		||||
//                // ★:0 1 2 3 [4] >> 3
 | 
			
		||||
//                // ★:[0] >> 直接关闭当前窗口
 | 
			
		||||
//                LogUtils.d(TAG, "finish no yet.");
 | 
			
		||||
//                IWinBollActivity preIWinBoll = getPreIWinBoll(iWinBoll);
 | 
			
		||||
//                iWinBoll.getActivity().finish();
 | 
			
		||||
//                if (preIWinBoll != null) {
 | 
			
		||||
//                    resumeActivity(mContext, preIWinBoll);
 | 
			
		||||
//                }
 | 
			
		||||
//            }
 | 
			
		||||
//
 | 
			
		||||
//        } catch (Exception e) {
 | 
			
		||||
//            LogUtils.d(TAG, e, Thread.currentThread().getStackTrace());
 | 
			
		||||
//        }
 | 
			
		||||
//    }
 | 
			
		||||
//
 | 
			
		||||
//    //
 | 
			
		||||
//    // 获取窗口队列中的前一个窗口
 | 
			
		||||
//    //
 | 
			
		||||
//    IWinBollActivity getPreIWinBoll(IWinBollActivity iWinBoll) {
 | 
			
		||||
//        try {
 | 
			
		||||
//            boolean bingo = false;
 | 
			
		||||
//            IWinBollActivity preIWinBoll = null;
 | 
			
		||||
//            for (Map.Entry<String, IWinBollActivity> entity : _mapIWinBollList.entrySet()) {
 | 
			
		||||
//                if (entity.getKey().equals(iWinBoll.getTag())) {
 | 
			
		||||
//                    bingo = true;
 | 
			
		||||
//                    LogUtils.d(TAG, "bingo");
 | 
			
		||||
//                    break;
 | 
			
		||||
//                }
 | 
			
		||||
//                preIWinBoll = entity.getValue();
 | 
			
		||||
//            }
 | 
			
		||||
//
 | 
			
		||||
//            if (bingo) {
 | 
			
		||||
//                return preIWinBoll;
 | 
			
		||||
//            }
 | 
			
		||||
//        } catch (Exception e) {
 | 
			
		||||
//            LogUtils.d(TAG, e, Thread.currentThread().getStackTrace());
 | 
			
		||||
//        }
 | 
			
		||||
//
 | 
			
		||||
//        return null;
 | 
			
		||||
//    }
 | 
			
		||||
//
 | 
			
		||||
//    //
 | 
			
		||||
//    // 从管理列表中移除管理项
 | 
			
		||||
//    //
 | 
			
		||||
//    public <T extends IWinBollActivity> boolean registeRemove(T activity) {
 | 
			
		||||
//        IWinBollActivity iWinBollTest = _mapIWinBollList.get(activity.getTag());
 | 
			
		||||
//        if (iWinBollTest != null) {
 | 
			
		||||
//            _mapIWinBollList.remove(activity.getTag());
 | 
			
		||||
//            return true;
 | 
			
		||||
//        }
 | 
			
		||||
//        return false;
 | 
			
		||||
//    }
 | 
			
		||||
//
 | 
			
		||||
//    //
 | 
			
		||||
//    // 打印管理列表项列表里的信息
 | 
			
		||||
//    //
 | 
			
		||||
//    public static void printIWinBollListInfo() {
 | 
			
		||||
//        //LogUtils.d(TAG, "printAvtivityListInfo");
 | 
			
		||||
//        if (!_mapIWinBollList.isEmpty()) {
 | 
			
		||||
//            StringBuilder sb = new StringBuilder("Map entries : " + Integer.toString(_mapIWinBollList.size()));
 | 
			
		||||
//            Iterator<Map.Entry<String, IWinBollActivity>> iterator = _mapIWinBollList.entrySet().iterator();
 | 
			
		||||
//            while (iterator.hasNext()) {
 | 
			
		||||
//                Map.Entry<String, IWinBollActivity> entry = iterator.next();
 | 
			
		||||
//                sb.append("\nKey: " + entry.getKey() + ", \nValue: " + entry.getValue().getTag());
 | 
			
		||||
//                //ToastUtils.show("\nKey: " + entry.getKey() + ", Value: " + entry.getValue().getTag());
 | 
			
		||||
//            }
 | 
			
		||||
//            sb.append("\nMap entries end.");
 | 
			
		||||
//            LogUtils.d(TAG, sb.toString());
 | 
			
		||||
//        } else {
 | 
			
		||||
//            LogUtils.d(TAG, "The map is empty.");
 | 
			
		||||
//        }
 | 
			
		||||
//    }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user