Merge remote-tracking branch 'origin/appbase' into aes
This commit is contained in:
		| @@ -1,8 +1,8 @@ | ||||
| #Created by .winboll/winboll_app_build.gradle | ||||
| #Tue May 20 03:28:00 GMT 2025 | ||||
| stageCount=2 | ||||
| #Sun Jun 01 15:41:55 HKT 2025 | ||||
| stageCount=3 | ||||
| libraryProject=libappbase | ||||
| baseVersion=15.8 | ||||
| publishVersion=15.8.1 | ||||
| buildCount=1 | ||||
| baseBetaVersion=15.8.2 | ||||
| publishVersion=15.8.2 | ||||
| buildCount=0 | ||||
| baseBetaVersion=15.8.3 | ||||
|   | ||||
| @@ -40,7 +40,6 @@ public class MainActivity extends WinBoLLActivity implements IWinBoLLActivity { | ||||
|     } | ||||
|  | ||||
|     Toolbar mToolbar; | ||||
|     LogView mLogView; | ||||
|  | ||||
|     @Override | ||||
|     protected void onCreate(Bundle savedInstanceState) { | ||||
| @@ -53,14 +52,11 @@ public class MainActivity extends WinBoLLActivity implements IWinBoLLActivity { | ||||
|  | ||||
|         CheckBox cbIsDebugMode = findViewById(R.id.activitymainCheckBox1); | ||||
|         cbIsDebugMode.setChecked(GlobalApplication.isDebuging()); | ||||
|         mLogView = findViewById(R.id.logview); | ||||
|         mLogView.start();  | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public boolean onCreateOptionsMenu(Menu menu) { | ||||
|         getMenuInflater().inflate(R.menu.toolbar_main, menu); | ||||
|         getMenuInflater().inflate(R.menu.toolbar_appbase, menu); | ||||
|         return super.onCreateOptionsMenu(menu); | ||||
|     } | ||||
|  | ||||
| @@ -176,8 +172,7 @@ public class MainActivity extends WinBoLLActivity implements IWinBoLLActivity { | ||||
|     @Override | ||||
|     protected void onResume() { | ||||
|         super.onResume(); | ||||
|         mLogView.start(); | ||||
|     } | ||||
|      | ||||
|      | ||||
|  | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -66,16 +66,11 @@ public class New2Activity extends WinBoLLActivity implements IWinBoLLActivity { | ||||
|     @Override | ||||
|     public boolean onCreateOptionsMenu(Menu menu) { | ||||
|         getMenuInflater().inflate(R.menu.toolbar_main, menu); | ||||
|         getMenuInflater().inflate(R.menu.toolbar_appbase, menu); | ||||
|         return super.onCreateOptionsMenu(menu); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     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。 | ||||
|         return super.onOptionsItemSelected(item); | ||||
|     } | ||||
|   | ||||
| @@ -64,16 +64,11 @@ public class NewActivity extends WinBoLLActivity implements IWinBoLLActivity { | ||||
|     @Override | ||||
|     public boolean onCreateOptionsMenu(Menu menu) { | ||||
|         getMenuInflater().inflate(R.menu.toolbar_main, menu); | ||||
|         getMenuInflater().inflate(R.menu.toolbar_appbase, menu); | ||||
|         return super.onCreateOptionsMenu(menu); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     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。 | ||||
|         return super.onOptionsItemSelected(item); | ||||
|     } | ||||
|   | ||||
| @@ -6,6 +6,12 @@ package cc.winboll.studio.appbase.activities; | ||||
|  * @Describe WinBoLL 窗口基础类 | ||||
|  */ | ||||
| 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; | ||||
|  | ||||
| public class WinBoLLActivity extends Activity implements IWinBoLLActivity { | ||||
| @@ -21,4 +27,35 @@ public class WinBoLLActivity extends Activity implements IWinBoLLActivity { | ||||
|     public String getTag() { | ||||
|         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 | ||||
| 					android:layout_width="wrap_content" | ||||
| 					android:layout_height="wrap_content" | ||||
| 					android:text="Hello, WinBoLL!"/> | ||||
|  | ||||
| 				<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,但可能需要注意兼容性和配置问题。"/> | ||||
| 					android:text="安卓R对应的是Android 11,其API级别是30。以下是Android 11中一些重要的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 | ||||
| 					android:layout_width="match_parent" | ||||
| 					android:layout_height="wrap_content"> | ||||
| @@ -211,11 +217,5 @@ | ||||
| 		</LinearLayout> | ||||
|  | ||||
| 	</ScrollView> | ||||
|  | ||||
| 	<cc.winboll.studio.libappbase.LogView | ||||
| 		android:layout_width="match_parent" | ||||
| 		android:layout_height="300dp" | ||||
| 		android:id="@+id/logview"/> | ||||
|  | ||||
| </LinearLayout> | ||||
|  | ||||
|   | ||||
| @@ -1,6 +1,12 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <menu xmlns:android="http://schemas.android.com/apk/res/android" | ||||
| 	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> | ||||
|   | ||||
| @@ -24,12 +24,12 @@ android { | ||||
|     defaultConfig { | ||||
|         applicationId "cc.winboll.studio.contacts" | ||||
|         minSdkVersion 24 | ||||
|         targetSdkVersion 29 | ||||
|         targetSdkVersion 30 | ||||
|         versionCode 1 | ||||
|         // versionName 更新后需要手动设置  | ||||
|         // 项目模块目录的 build.gradle 文件的 stageCount=0 | ||||
|         // Gradle编译环境下合起来的 versionName 就是 "${versionName}.0" | ||||
|         versionName "15.2"  | ||||
|         versionName "15.3"  | ||||
|         if(true) { | ||||
|             versionName = genVersionName("${versionName}") | ||||
|         } | ||||
| @@ -45,6 +45,9 @@ android { | ||||
|  | ||||
| dependencies { | ||||
|     api fileTree(dir: 'libs', include: ['*.jar']) | ||||
|     api 'cc.winboll.studio:libaes:15.8.0' | ||||
|     api 'cc.winboll.studio:libapputils:15.8.1' | ||||
|     api 'cc.winboll.studio:libappbase:15.8.1' | ||||
|      | ||||
|     // 权限请求框架:https://github.com/getActivity/XXPermissions | ||||
|     api 'com.github.getActivity:XXPermissions:18.63' | ||||
| @@ -81,8 +84,4 @@ dependencies { | ||||
|     //api 'androidx.vectordrawable:vectordrawable:1.1.0' | ||||
|     //api 'androidx.vectordrawable:vectordrawable-animated:1.1.0' | ||||
|     //api 'androidx.fragment:fragment:1.1.0' | ||||
|      | ||||
|     api 'cc.winboll.studio:libaes:15.2.4' | ||||
|     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 | ||||
| #Sun Apr 13 02:46:09 HKT 2025 | ||||
| stageCount=8 | ||||
| #Tue May 20 13:02:18 HKT 2025 | ||||
| stageCount=3 | ||||
| libraryProject= | ||||
| baseVersion=15.2 | ||||
| publishVersion=15.2.7 | ||||
| baseVersion=15.3 | ||||
| publishVersion=15.3.2 | ||||
| buildCount=0 | ||||
| baseBetaVersion=15.2.8 | ||||
| baseBetaVersion=15.3.3 | ||||
|   | ||||
| @@ -42,7 +42,8 @@ | ||||
|         android:icon="@drawable/ic_winboll" | ||||
|         android:label="@string/app_name" | ||||
|         android:theme="@style/MyAppTheme" | ||||
|         android:supportsRtl="true"> | ||||
|         android:supportsRtl="true" | ||||
|         android:networkSecurityConfig="@xml/network_security_config"> | ||||
|  | ||||
|         <activity | ||||
|             android:name=".MainActivity" | ||||
| @@ -192,4 +193,4 @@ | ||||
|  | ||||
|     </application> | ||||
|  | ||||
| </manifest> | ||||
| </manifest> | ||||
|   | ||||
| @@ -7,7 +7,7 @@ package cc.winboll.studio.contacts; | ||||
|  */ | ||||
| import android.view.Gravity; | ||||
| import cc.winboll.studio.libappbase.GlobalApplication; | ||||
| import cc.winboll.studio.libappbase.winboll.WinBollActivityManager; | ||||
| import cc.winboll.studio.libappbase.winboll.WinBoLLActivityManager; | ||||
| import com.hjq.toast.ToastUtils; | ||||
|  | ||||
| public class App extends GlobalApplication { | ||||
| @@ -20,8 +20,8 @@ public class App extends GlobalApplication { | ||||
|         // 这样可以预先设置日志与数据的存储根目录。 | ||||
|         //setIsDebuging(BuildConfig.DEBUG); | ||||
|         super.onCreate(); | ||||
|         // 设置 WinBoll 应用 UI 类型 | ||||
|         WinBollActivityManager.getInstance(this).setWinBollUI_TYPE(WinBollActivityManager.WinBollUI_TYPE.Aplication); | ||||
|         // 设置 WinBoLL 应用 UI 类型 | ||||
|         getWinBoLLActivityManager().setWinBoLLUI_TYPE(WinBoLLActivityManager.WinBoLLUI_TYPE.Aplication); | ||||
|          | ||||
|         //LogUtils.d(TAG, "onCreate"); | ||||
|          | ||||
|   | ||||
| @@ -32,22 +32,21 @@ import cc.winboll.studio.contacts.fragments.CallLogFragment; | ||||
| import cc.winboll.studio.contacts.fragments.ContactsFragment; | ||||
| import cc.winboll.studio.contacts.fragments.LogFragment; | ||||
| import cc.winboll.studio.contacts.services.MainService; | ||||
| import cc.winboll.studio.libaes.winboll.APPInfo; | ||||
| import cc.winboll.studio.libappbase.LogUtils; | ||||
| import cc.winboll.studio.libappbase.LogView; | ||||
| import cc.winboll.studio.libappbase.winboll.IWinBollActivity; | ||||
| import cc.winboll.studio.libappbase.winboll.IWinBoLLActivity; | ||||
| import com.google.android.material.tabs.TabLayout; | ||||
| import java.util.ArrayList; | ||||
| import java.util.List; | ||||
|  | ||||
| final public class MainActivity extends AppCompatActivity implements IWinBollActivity, ViewPager.OnPageChangeListener, View.OnClickListener { | ||||
| final public class MainActivity extends AppCompatActivity implements IWinBoLLActivity, ViewPager.OnPageChangeListener, View.OnClickListener { | ||||
|  | ||||
| 	public static final String TAG = "MainActivity"; | ||||
|  | ||||
|     public static final int REQUEST_HOME_ACTIVITY = 0; | ||||
|     public static final int REQUEST_ABOUT_ACTIVITY = 1; | ||||
|  | ||||
|     public static final String ACTION_SOS = "cc.winboll.studio.libappbase.WinBoll.ACTION_SOS"; | ||||
|     public static final String ACTION_SOS = "cc.winboll.studio.libappbase.WinBoLL.ACTION_SOS"; | ||||
|  | ||||
|     static MainActivity _MainActivity; | ||||
|     LogView mLogView; | ||||
| @@ -71,10 +70,10 @@ final public class MainActivity extends AppCompatActivity implements IWinBollAct | ||||
|  | ||||
|     private static final int DIALER_REQUEST_CODE = 1; | ||||
|  | ||||
|     @Override | ||||
|     public Activity getActivity() { | ||||
|         return this; | ||||
|     } | ||||
| //    @Override | ||||
| //    public Activity getActivity() { | ||||
| //        return this; | ||||
| //    } | ||||
|  | ||||
| //    @Override | ||||
| //    public APPInfo getAppInfo() { | ||||
| @@ -95,6 +94,17 @@ final public class MainActivity extends AppCompatActivity implements IWinBollAct | ||||
| //        return null; | ||||
| //    } | ||||
|  | ||||
|  | ||||
|     @Override | ||||
|     public Activity getActivity() { | ||||
|         return this; | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public String getTag() { | ||||
|         return TAG; | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     protected void onCreate(Bundle savedInstanceState) { | ||||
|         // 接收并处理 Intent 数据,函数 Intent 处理接收就直接返回 | ||||
| @@ -111,7 +121,7 @@ final public class MainActivity extends AppCompatActivity implements IWinBollAct | ||||
| //            // 显示后退按钮 | ||||
| //            getSupportActionBar().setDisplayHomeAsUpEnabled(true); | ||||
| //        } | ||||
|         getSupportActionBar().setSubtitle(getTag()); | ||||
|         getSupportActionBar().setSubtitle(TAG); | ||||
|  | ||||
|         tabLayout = findViewById(R.id.tabLayout); | ||||
|         viewPager = findViewById(R.id.viewPager); | ||||
| @@ -339,7 +349,7 @@ final public class MainActivity extends AppCompatActivity implements IWinBollAct | ||||
| // | ||||
| //        if (intent.getAction().equals(StringToQrCodeView.ACTION_UNITTEST_QRCODE)) { | ||||
| //            try { | ||||
| //                WinBollActivity clazzActivity = UnitTestActivity.class.newInstance(); | ||||
| //                WinBoLLActivity clazzActivity = UnitTestActivity.class.newInstance(); | ||||
| //                String tag = clazzActivity.getTag(); | ||||
| //                LogUtils.d(TAG, "String tag = clazzActivity.getTag(); tag " + tag); | ||||
| //                Intent subIntent = new Intent(this, UnitTestActivity.class); | ||||
| @@ -357,8 +367,8 @@ final public class MainActivity extends AppCompatActivity implements IWinBollAct | ||||
| //                } | ||||
| // | ||||
| //                Files.copy(Paths.get(szSrcPath), Paths.get(file.getPath())); | ||||
| //                //startWinBollActivity(subIntent, tag); | ||||
| //                WinBollActivityManager.getInstance(this).startWinBollActivity(this, subIntent, UnitTestActivity.class); | ||||
| //                //startWinBoLLActivity(subIntent, tag); | ||||
| //                WinBoLLActivityManager.getInstance(this).startWinBoLLActivity(this, subIntent, UnitTestActivity.class); | ||||
| //            } catch (IllegalAccessException | InstantiationException | IOException e) { | ||||
| //                LogUtils.d(TAG, e, Thread.currentThread().getStackTrace()); | ||||
| //                // 函数处理异常返回失败 | ||||
| @@ -371,10 +381,10 @@ final public class MainActivity extends AppCompatActivity implements IWinBollAct | ||||
| //        return true; | ||||
| //    } | ||||
|  | ||||
|     @Override | ||||
|     public String getTag() { | ||||
|         return TAG; | ||||
|     } | ||||
| //    @Override | ||||
| //    public String getTag() { | ||||
| //        return TAG; | ||||
| //    } | ||||
|  | ||||
| //    @Override | ||||
| //    public void onBackPressed() { | ||||
| @@ -386,7 +396,7 @@ final public class MainActivity extends AppCompatActivity implements IWinBollAct | ||||
| // | ||||
| //            @Override | ||||
| //            public void onYes() { | ||||
| //                WinBollActivityManager.getInstance(getApplicationContext()).finishAll(); | ||||
| //                WinBoLLActivityManager.getInstance(getApplicationContext()).finishAll(); | ||||
| //            } | ||||
| // | ||||
| //            @Override | ||||
| @@ -408,7 +418,7 @@ final public class MainActivity extends AppCompatActivity implements IWinBollAct | ||||
|         if (item.getItemId() == R.id.item_settings) { | ||||
|             Intent intent = new Intent(this, SettingsActivity.class); | ||||
|             startActivity(intent); | ||||
|             //WinBollActivityManager.getInstance(this).startWinBollActivity(this, CallActivity.class); | ||||
|             //WinBoLLActivityManager.getInstance(this).startWinBoLLActivity(this, CallActivity.class); | ||||
|         } | ||||
| //        } else  | ||||
| //        if (item.getItemId() == R.id.item_exit) { | ||||
|   | ||||
| @@ -10,14 +10,15 @@ import android.content.Context; | ||||
| import android.os.Bundle; | ||||
| import android.view.ViewGroup; | ||||
| import android.widget.LinearLayout; | ||||
| import androidx.appcompat.app.AppCompatActivity; | ||||
| import androidx.appcompat.widget.Toolbar; | ||||
| import cc.winboll.studio.contacts.R; | ||||
| import cc.winboll.studio.libaes.winboll.APPInfo; | ||||
| import cc.winboll.studio.libaes.winboll.AboutView; | ||||
| import cc.winboll.studio.libappbase.GlobalApplication; | ||||
| import cc.winboll.studio.libappbase.winboll.IWinBollActivity; | ||||
| import cc.winboll.studio.libappbase.winboll.IWinBoLLActivity; | ||||
|  | ||||
| public class AboutActivity extends WinBollActivity implements IWinBollActivity { | ||||
| public class AboutActivity extends AppCompatActivity implements IWinBoLLActivity { | ||||
|  | ||||
|     public static final String TAG = "AboutActivity"; | ||||
|  | ||||
| @@ -64,13 +65,13 @@ public class AboutActivity extends WinBollActivity implements IWinBollActivity { | ||||
|         ); | ||||
|         layout.addView(aboutView, params); | ||||
|  | ||||
|         GlobalApplication.getWinBollActivityManager().add(this); | ||||
|         GlobalApplication.getWinBoLLActivityManager().add(this); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     protected void onDestroy() { | ||||
|         super.onDestroy(); | ||||
|         GlobalApplication.getWinBollActivityManager().registeRemove(this); | ||||
|         GlobalApplication.getWinBoLLActivityManager().registeRemove(this); | ||||
|     } | ||||
|  | ||||
|     public AboutView CreateAboutView() { | ||||
|   | ||||
| @@ -24,6 +24,7 @@ import androidx.appcompat.app.AppCompatActivity; | ||||
| import androidx.appcompat.widget.Toolbar; | ||||
| import androidx.recyclerview.widget.LinearLayoutManager; | ||||
| import androidx.recyclerview.widget.RecyclerView; | ||||
| import cc.winboll.studio.contacts.App; | ||||
| import cc.winboll.studio.contacts.R; | ||||
| import cc.winboll.studio.contacts.adapters.PhoneConnectRuleAdapter; | ||||
| import cc.winboll.studio.contacts.beans.MainServiceBean; | ||||
| @@ -34,15 +35,13 @@ import cc.winboll.studio.contacts.bobulltoon.TomCat; | ||||
| import cc.winboll.studio.contacts.dun.Rules; | ||||
| import cc.winboll.studio.contacts.services.MainService; | ||||
| import cc.winboll.studio.contacts.views.DuInfoTextView; | ||||
| import cc.winboll.studio.libaes.winboll.APPInfo; | ||||
| import cc.winboll.studio.libappbase.LogUtils; | ||||
| import cc.winboll.studio.libappbase.winboll.IWinBollActivity; | ||||
| import cc.winboll.studio.libappbase.winboll.IWinBoLLActivity; | ||||
| import com.hjq.toast.ToastUtils; | ||||
| import java.lang.reflect.Field; | ||||
| import java.util.List; | ||||
| import cc.winboll.studio.contacts.App; | ||||
|  | ||||
| public class SettingsActivity extends AppCompatActivity implements IWinBollActivity { | ||||
| public class SettingsActivity extends AppCompatActivity implements IWinBoLLActivity { | ||||
|  | ||||
|     public static final String TAG = "SettingsActivity"; | ||||
|  | ||||
| @@ -177,6 +176,8 @@ public class SettingsActivity extends AppCompatActivity implements IWinBollActiv | ||||
|         etDunResumeSecondCount.setEnabled(!isEnableDun); | ||||
|         etDunResumeCount.setEnabled(!isEnableDun); | ||||
|  | ||||
|         EditText etBoBullToonURL = findViewById(R.id.bobulltoonurl_et); | ||||
|         etBoBullToonURL.setText(Rules.getInstance(this).getBoBullToonURL()); | ||||
|     } | ||||
|  | ||||
|     public static void notifyDunInfoUpdate() { | ||||
| @@ -201,6 +202,11 @@ public class SettingsActivity extends AppCompatActivity implements IWinBollActiv | ||||
|         settingsModel.setIsEnableDun(isEnableDun); | ||||
|         Rules.getInstance(this).saveDun(); | ||||
|         Rules.getInstance(this).reload(); | ||||
|          | ||||
|         // 重新加载盾牌参数 | ||||
|         etDunTotalCount.setText(Integer.toString(settingsModel.getDunTotalCount())); | ||||
|         etDunResumeSecondCount.setText(Integer.toString(settingsModel.getDunResumeSecondCount())); | ||||
|         etDunResumeCount.setText(Integer.toString(settingsModel.getDunResumeCount())); | ||||
|     } | ||||
|  | ||||
|     void updateStreamVolumeTextView() { | ||||
| @@ -233,7 +239,18 @@ public class SettingsActivity extends AppCompatActivity implements IWinBollActiv | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public void onResetBoBullToonURL(View view) { | ||||
|         Rules.getInstance(this).resetDefaultBoBullToonURL(); | ||||
|         EditText etBoBullToonURL = findViewById(R.id.bobulltoonurl_et); | ||||
|         etBoBullToonURL.setText(Rules.getInstance(this).getBoBullToonURL()); | ||||
|     } | ||||
|  | ||||
|     public void onDownloadBoBullToon(View view) { | ||||
|         EditText etBoBullToonURL = findViewById(R.id.bobulltoonurl_et); | ||||
|         if (!etBoBullToonURL.getText().toString().trim().equals(Rules.getInstance(this).getBoBullToonURL())) { | ||||
|             Rules.getInstance(this).setBoBullToonURL(etBoBullToonURL.getText().toString().trim()); | ||||
|         } | ||||
|  | ||||
|         final TomCat tomCat = TomCat.getInstance(this); | ||||
|         new Thread(new Runnable() { | ||||
|                 @Override | ||||
| @@ -247,8 +264,6 @@ public class SettingsActivity extends AppCompatActivity implements IWinBollActiv | ||||
|             }).start(); | ||||
|     } | ||||
|  | ||||
|  | ||||
|  | ||||
|     public void onSearchBoBullToonPhone(View view) { | ||||
|         TomCat tomCat = TomCat.getInstance(this); | ||||
|         EditText etPhone = findViewById(R.id.activitysettingsEditText1); | ||||
| @@ -311,8 +326,8 @@ public class SettingsActivity extends AppCompatActivity implements IWinBollActiv | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|      | ||||
|  | ||||
|     public void onAbout(View view) { | ||||
|         App.getWinBollActivityManager().startWinBollActivity(this, AboutActivity.class); | ||||
|         App.getWinBoLLActivityManager().startWinBoLLActivity(this, AboutActivity.class); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -11,9 +11,9 @@ import android.view.MenuItem; | ||||
| import androidx.appcompat.app.AppCompatActivity; | ||||
| import cc.winboll.studio.libaes.beans.AESThemeBean; | ||||
| import cc.winboll.studio.libaes.utils.AESThemeUtil; | ||||
| import cc.winboll.studio.libappbase.winboll.IWinBollActivity; | ||||
| import cc.winboll.studio.libappbase.winboll.IWinBoLLActivity; | ||||
|  | ||||
| public class WinBollActivity extends AppCompatActivity implements IWinBollActivity { | ||||
| public class WinBollActivity extends AppCompatActivity implements IWinBoLLActivity { | ||||
|  | ||||
|     public static final String TAG = "WinBollActivity"; | ||||
|  | ||||
|   | ||||
| @@ -14,6 +14,7 @@ import cc.winboll.studio.contacts.utils.IntUtils; | ||||
| public class SettingsModel extends BaseBean { | ||||
|  | ||||
|     public static final String TAG = "SettingsModel"; | ||||
|      | ||||
|     public static final int MAX_INTRANGE = 666666; | ||||
|     public static final int MIN_INTRANGE = 1; | ||||
|      | ||||
| @@ -27,6 +28,8 @@ public class SettingsModel extends BaseBean { | ||||
|     int dunResumeCount; | ||||
|     // 是否启用云盾 | ||||
|     boolean isEnableDun; | ||||
|     // BoBullToon 应用模块数据请求地址 | ||||
|     String szBoBullToon_URL; | ||||
|  | ||||
|     public SettingsModel() { | ||||
|         this.dunTotalCount = 6; | ||||
| @@ -34,14 +37,24 @@ public class SettingsModel extends BaseBean { | ||||
|         this.dunResumeSecondCount = 60; | ||||
|         this.dunResumeCount = 1; | ||||
|         this.isEnableDun = false; | ||||
|         this.szBoBullToon_URL = ""; | ||||
|     } | ||||
|  | ||||
|     public SettingsModel(int dunTotalCount, int dunCurrentCount, int dunResumeSecondCount, int dunResumeCount, boolean isEnableDun) { | ||||
|     public SettingsModel(int dunTotalCount, int dunCurrentCount, int dunResumeSecondCount, int dunResumeCount, boolean isEnableDun, String szBoBullToon_URL) { | ||||
|         this.dunTotalCount = getSettingsModelRangeInt(dunTotalCount); | ||||
|         this.dunCurrentCount = getSettingsModelRangeInt(dunCurrentCount); | ||||
|         this.dunResumeSecondCount = getSettingsModelRangeInt(dunResumeSecondCount); | ||||
|         this.dunResumeCount = getSettingsModelRangeInt(dunResumeCount); | ||||
|         this.isEnableDun = isEnableDun; | ||||
|         this.szBoBullToon_URL = szBoBullToon_URL; | ||||
|     } | ||||
|  | ||||
|     public void setBoBullToon_URL(String boBullToon_URL) { | ||||
|         this.szBoBullToon_URL = boBullToon_URL; | ||||
|     } | ||||
|  | ||||
|     public String getBoBullToon_URL() { | ||||
|         return szBoBullToon_URL; | ||||
|     } | ||||
|  | ||||
|     public void setDunTotalCount(int dunTotalCount) { | ||||
| @@ -102,7 +115,8 @@ public class SettingsModel extends BaseBean { | ||||
|         jsonWriter.name("dunResumeSecondCount").value(getDunResumeSecondCount()); | ||||
|         jsonWriter.name("dunResumeCount").value(getDunResumeCount()); | ||||
|         jsonWriter.name("isEnableDun").value(isEnableDun()); | ||||
|  | ||||
|         jsonWriter.name("szBoBullToon_URL").value(getBoBullToon_URL()); | ||||
|          | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
| @@ -118,6 +132,8 @@ public class SettingsModel extends BaseBean { | ||||
|                 setDunResumeCount(getSettingsModelRangeInt(jsonReader.nextInt())); | ||||
|             } else if (name.equals("isEnableDun")) { | ||||
|                 setIsEnableDun(jsonReader.nextBoolean()); | ||||
|             } else if (name.equals("szBoBullToon_URL")) { | ||||
|                 setBoBullToon_URL(jsonReader.nextString()); | ||||
|             } else { | ||||
|                 return false; | ||||
|             } | ||||
|   | ||||
| @@ -6,6 +6,8 @@ package cc.winboll.studio.contacts.bobulltoon; | ||||
|  * @Describe 汤姆猫管家 :使用 BoBullToon 项目,对通讯地址进行筛选判断的好朋友。 | ||||
|  */ | ||||
| import android.content.Context; | ||||
| import cc.winboll.studio.contacts.R; | ||||
| import cc.winboll.studio.contacts.dun.Rules; | ||||
| import cc.winboll.studio.libappbase.LogUtils; | ||||
| import com.hjq.toast.ToastUtils; | ||||
| import java.io.File; | ||||
| @@ -28,6 +30,7 @@ public class TomCat { | ||||
|     public static final String TAG = "TomCat"; | ||||
|  | ||||
|     List<String> listPhoneBoBullToon = new ArrayList<String>(); | ||||
|     String mszBoBullToon_URL; | ||||
|  | ||||
|     static volatile TomCat _TomCat; | ||||
|     Context mContext; | ||||
| @@ -41,8 +44,12 @@ public class TomCat { | ||||
|         } | ||||
|         return _TomCat; | ||||
|     } | ||||
|      | ||||
|     public String getDefaultBobulltoonUrl() { | ||||
|         return mContext.getString(R.string.default_bobulltoon_url); | ||||
|     } | ||||
|  | ||||
|     void downloadAndExtractZip(String zipUrl, String destinationFolder) throws IOException { | ||||
|     boolean downloadAndExtractZip(String zipUrl, String destinationFolder) throws IOException { | ||||
|         OkHttpClient client = new OkHttpClient(); | ||||
|         Request request = new Request.Builder() | ||||
|             .url(zipUrl) | ||||
| @@ -95,13 +102,16 @@ public class TomCat { | ||||
|             // 删除临时 ZIP 文件 | ||||
|             tempZipFile.delete(); | ||||
|             LogUtils.d(TAG, "已更新 BoBullToon 数据"); | ||||
|             return true; | ||||
|         } catch (Exception e) { | ||||
|             ToastUtils.show(e.getMessage()); | ||||
|             LogUtils.d(TAG, e, Thread.currentThread().getStackTrace()); | ||||
|             return false; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public boolean downloadBoBullToon() { | ||||
|         String zipUrl = "http://10.8.0.12:3000/Studio/BoBullToon/archive/main.zip"; // 替换为实际的 ZIP 文件 URL | ||||
|         String zipUrl = Rules.getInstance(mContext).getBoBullToonURL(); // 替换为实际的 ZIP 文件 URL | ||||
|         String destinationFolder = getWorkingFolder().getPath(); // 替换为实际的目标文件夹路径 | ||||
|         try { | ||||
|             // 删除旧文件 | ||||
| @@ -113,9 +123,11 @@ public class TomCat { | ||||
|             } | ||||
|  | ||||
|             // 更新新文件 | ||||
|             downloadAndExtractZip(zipUrl, destinationFolder); | ||||
|             LogUtils.d(TAG, "ZIP 文件下载并解压成功。"); | ||||
|             return true; | ||||
|             if(downloadAndExtractZip(zipUrl, destinationFolder)) { | ||||
|                 LogUtils.d(TAG, "ZIP 文件下载并解压成功。"); | ||||
|                 return true; | ||||
|             } | ||||
|             return false; | ||||
|         } catch (IOException e) { | ||||
|             LogUtils.d(TAG, e, Thread.currentThread().getStackTrace()); | ||||
|         } | ||||
|   | ||||
| @@ -18,6 +18,7 @@ import java.util.ArrayList; | ||||
| import java.util.Timer; | ||||
| import java.util.TimerTask; | ||||
| import java.util.regex.Pattern; | ||||
| import cc.winboll.studio.contacts.bobulltoon.TomCat; | ||||
|  | ||||
| public class Rules { | ||||
|  | ||||
| @@ -84,6 +85,20 @@ public class Rules { | ||||
|         PhoneConnectRuleModel.saveBeanList(mContext, _PhoneConnectRuleModelList, PhoneConnectRuleModel.class); | ||||
|     } | ||||
|  | ||||
|     public void resetDefaultBoBullToonURL() { | ||||
|         mSettingsModel.setBoBullToon_URL(TomCat.getInstance(mContext).getDefaultBobulltoonUrl()); | ||||
|         saveDun(); | ||||
|     } | ||||
|  | ||||
|     public void setBoBullToonURL(String szUrl) { | ||||
|         mSettingsModel.setBoBullToon_URL(szUrl); | ||||
|         saveDun(); | ||||
|     } | ||||
|  | ||||
|     public String getBoBullToonURL() { | ||||
|         return mSettingsModel.getBoBullToon_URL(); | ||||
|     } | ||||
|  | ||||
|     public void loadDun() { | ||||
|         mSettingsModel = SettingsModel.loadBean(mContext, SettingsModel.class); | ||||
|         if (mSettingsModel == null) { | ||||
| @@ -109,8 +124,12 @@ public class Rules { | ||||
|         boolean isDefend = false; // 盾牌是否生效 | ||||
|         boolean isConnect = true; // 防御结果是否连接 | ||||
|  | ||||
|         // 进行盾牌层数预计缩减计算 | ||||
|         int nDunCurrentCount = mSettingsModel.getDunCurrentCount() - 1; | ||||
|         LogUtils.d(TAG, String.format("nDunCurrentCount : %d", nDunCurrentCount)); | ||||
|  | ||||
|         // 如果盾值小于1,则解除防御 | ||||
|         if (!isDefend && mSettingsModel.getDunCurrentCount() < 1) { | ||||
|         if (!isDefend && nDunCurrentCount < 1) { | ||||
|             // 盾层为1以下,防御解除 | ||||
|             LogUtils.d(TAG, "盾层为1以下,防御解除"); | ||||
|             isDefend = true; | ||||
| @@ -174,17 +193,17 @@ public class Rules { | ||||
|             // 就减少防御盾牌层数。 | ||||
|             // 每校验一次规则,云盾防御层数减1 | ||||
|             // 当云盾防御层数为0时,再次进行以下程序段则恢复满值防御。 | ||||
|             int newDunCount = mSettingsModel.getDunCurrentCount() - 1; | ||||
|             int newDunCount = nDunCurrentCount; | ||||
|             LogUtils.d(TAG, String.format("新的防御层数预计为 %d", newDunCount)); | ||||
|  | ||||
|             // 保证盾值在[0,DunTotalCount]之内其他值一律重置为 DunTotalCount。 | ||||
|             if (newDunCount < 0 || newDunCount > mSettingsModel.getDunTotalCount()) { | ||||
|                 mSettingsModel.setDunCurrentCount(mSettingsModel.getDunTotalCount()); | ||||
|                 LogUtils.d(TAG, String.format("盾值不在[0,%d]区间,恢复防御最大值%d", mSettingsModel.getDunTotalCount(), mSettingsModel.getDunTotalCount())); | ||||
|             } else { | ||||
|             // 保证盾值在[1,DunTotalCount]之内其他值一律重置为 DunTotalCount。 | ||||
|             if (newDunCount > 0 && newDunCount < mSettingsModel.getDunTotalCount()) { | ||||
|                 mSettingsModel.setDunCurrentCount(newDunCount); | ||||
|                 LogUtils.d(TAG, String.format("设置防御层数为 %d", newDunCount)); | ||||
|             } | ||||
|             } else { | ||||
|                 mSettingsModel.setDunCurrentCount(mSettingsModel.getDunTotalCount()); | ||||
|                 LogUtils.d(TAG, String.format("盾值不在[0,%d]区间,恢复防御最大值%d", mSettingsModel.getDunTotalCount(), mSettingsModel.getDunTotalCount())); | ||||
|             }  | ||||
|  | ||||
|             saveDun(); | ||||
|             SettingsActivity.notifyDunInfoUpdate(); | ||||
|   | ||||
| @@ -18,6 +18,7 @@ import android.content.ServiceConnection; | ||||
| import android.media.AudioManager; | ||||
| import android.os.Binder; | ||||
| import android.os.IBinder; | ||||
| import cc.winboll.studio.contacts.App; | ||||
| import cc.winboll.studio.contacts.beans.MainServiceBean; | ||||
| import cc.winboll.studio.contacts.beans.RingTongBean; | ||||
| import cc.winboll.studio.contacts.bobulltoon.TomCat; | ||||
| @@ -29,11 +30,9 @@ import cc.winboll.studio.contacts.services.MainService; | ||||
| import cc.winboll.studio.contacts.threads.MainServiceThread; | ||||
| import cc.winboll.studio.libappbase.LogUtils; | ||||
| import cc.winboll.studio.libappbase.sos.SOS; | ||||
| import cc.winboll.studio.libappbase.winboll.WinBoLL; | ||||
| import java.util.Timer; | ||||
| import java.util.TimerTask; | ||||
| import cc.winboll.studio.libappbase.sos.WinBoll; | ||||
| import cc.winboll.studio.contacts.App; | ||||
| import cc.winboll.studio.libappbase.sos.APPModel; | ||||
|  | ||||
| public class MainService extends Service { | ||||
|  | ||||
| @@ -129,11 +128,11 @@ public class MainService extends Service { | ||||
|             isServiceRunning = true; | ||||
|             // 唤醒守护进程 | ||||
|             wakeupAndBindAssistant(); | ||||
|             // 召唤 WinBoll APP 绑定本服务 | ||||
|             // 召唤 WinBoLL APP 绑定本服务 | ||||
|             if (App.isDebuging()) { | ||||
|                 WinBoll.bindToAPPBaseBeta(this, MainService.class.getName()); | ||||
|                 WinBoLL.bindToAPPBaseBeta(this, MainService.class.getName()); | ||||
|             } else { | ||||
|                 WinBoll.bindToAPPBase(this, MainService.class.getName()); | ||||
|                 WinBoLL.bindToAPPBase(this, MainService.class.getName()); | ||||
|             } | ||||
|  | ||||
|             // 初始化服务运行参数 | ||||
|   | ||||
| @@ -195,16 +195,29 @@ | ||||
| 				android:text="拨不通电话记录查询:"/> | ||||
|  | ||||
| 			<LinearLayout | ||||
| 				android:orientation="vertical" | ||||
| 				android:orientation="horizontal" | ||||
| 				android:layout_width="match_parent" | ||||
| 				android:layout_height="wrap_content" | ||||
| 				android:gravity="right" | ||||
| 				android:layout_margin="10dp"> | ||||
|  | ||||
| 				<EditText | ||||
| 					android:layout_width="0dp" | ||||
| 					android:ems="10" | ||||
| 					android:layout_height="wrap_content" | ||||
| 					android:layout_weight="1.0" | ||||
| 					android:id="@+id/bobulltoonurl_et"/> | ||||
|  | ||||
| 				<Button | ||||
| 					android:layout_width="wrap_content" | ||||
| 					android:layout_height="wrap_content" | ||||
| 					android:text="下载 BoBullToon" | ||||
| 					android:text="重置地址" | ||||
| 					android:onClick="onResetBoBullToonURL"/> | ||||
|  | ||||
| 				<Button | ||||
| 					android:layout_width="wrap_content" | ||||
| 					android:layout_height="wrap_content" | ||||
| 					android:text="下载数据" | ||||
| 					android:onClick="onDownloadBoBullToon"/> | ||||
|  | ||||
| 			</LinearLayout> | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <resources> | ||||
|     <!-- WinBoll 默认方案 --> | ||||
|     <!-- WinBoLL 默认方案 --> | ||||
|     <color name="colorPrimary">#FF196ABC</color> | ||||
|     <color name="colorPrimaryDark">#FF002B57</color> | ||||
|     <color name="colorAccent">#FF80BFFF</color> | ||||
|   | ||||
| @@ -2,5 +2,6 @@ | ||||
| <resources> | ||||
|  | ||||
|     <string name="app_name">Contacts</string> | ||||
|     <string name="default_bobulltoon_url">http://10.8.0.12:3000/Studio/BoBullToon/archive/main.zip</string> | ||||
|  | ||||
| </resources> | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <resources> | ||||
|     <style name="MyAppTheme" parent="APPBaseTheme"> | ||||
|     <style name="MyAppTheme" parent="AESTheme"> | ||||
|         <item name="colorPrimary">@color/colorPrimary</item> | ||||
|         <item name="colorPrimaryDark">@color/colorPrimaryDark</item> | ||||
|         <item name="colorAccent">@color/colorAccent</item> | ||||
| @@ -8,7 +8,7 @@ | ||||
|         <item name="android:windowContentOverlay">@null</item> | ||||
|     </style> | ||||
|  | ||||
|     <style name="GlobalCrashActivityTheme" parent="@android:style/Theme.DeviceDefault.Light.NoActionBar"> | ||||
|     <style name="GlobalCrashActivityTheme" parent="AESTheme"> | ||||
|         <item name="colorTittle">@color/colorAccent</item> | ||||
|         <item name="colorTittleBackgound">@color/colorPrimary</item> | ||||
|         <item name="colorText">@color/colorAccent</item> | ||||
|   | ||||
							
								
								
									
										9
									
								
								contacts/src/main/res/xml/network_security_config.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								contacts/src/main/res/xml/network_security_config.xml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <network-security-config> | ||||
|     <domain-config cleartextTrafficPermitted="true"> | ||||
|         <domain includeSubdomains="true">winboll.cc</domain> | ||||
|     </domain-config> | ||||
|     <domain-config cleartextTrafficPermitted="true"> | ||||
|         <domain includeSubdomains="false">10.8.0.12</domain> | ||||
|     </domain-config> | ||||
| </network-security-config> | ||||
| @@ -1,8 +1,8 @@ | ||||
| #Created by .winboll/winboll_app_build.gradle | ||||
| #Tue May 20 03:28:00 GMT 2025 | ||||
| stageCount=2 | ||||
| #Sun Jun 01 15:41:38 HKT 2025 | ||||
| stageCount=3 | ||||
| libraryProject=libappbase | ||||
| baseVersion=15.8 | ||||
| publishVersion=15.8.1 | ||||
| buildCount=1 | ||||
| baseBetaVersion=15.8.2 | ||||
| publishVersion=15.8.2 | ||||
| buildCount=0 | ||||
| baseBetaVersion=15.8.3 | ||||
|   | ||||
| @@ -47,7 +47,7 @@ public class GlobalApplication extends Application { | ||||
|     } | ||||
|  | ||||
|     public static WinBoLLActivityManager getWinBoLLActivityManager() { | ||||
|         return WinBoLLActivityManager.getInstance(_GlobalApplication); | ||||
|         return WinBoLLActivityManager.getInstance(); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|   | ||||
| @@ -22,7 +22,9 @@ import java.util.Map; | ||||
|  | ||||
| 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 } | ||||
| @@ -39,14 +41,14 @@ public class WinBoLLActivityManager { | ||||
|     public static WinBoLLUI_TYPE getWinBoLLUI_TYPE() { | ||||
|         return _WinBoLLUI_TYPE; | ||||
|     } | ||||
|     WinBoLLActivityManager(Context context) { | ||||
|         mContext = context; | ||||
|     WinBoLLActivityManager() { | ||||
|         mContext = GlobalApplication.getInstance(); | ||||
|         mActivityListMap = new HashMap<String, IWinBoLLActivity>(); | ||||
|     } | ||||
|  | ||||
|     public static synchronized WinBoLLActivityManager getInstance(Context context) { | ||||
|     public static synchronized WinBoLLActivityManager getInstance() { | ||||
|         if (_mIWinBoLLActivityManager == null) { | ||||
|             _mIWinBoLLActivityManager = new WinBoLLActivityManager(context); | ||||
|             _mIWinBoLLActivityManager = new WinBoLLActivityManager(); | ||||
|         } | ||||
|         return _mIWinBoLLActivityManager; | ||||
|     } | ||||
| @@ -55,7 +57,7 @@ public class WinBoLLActivityManager { | ||||
|      * 把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())); | ||||
|         } else { | ||||
|             mActivityListMap.put(activity.getTag(), activity); | ||||
| @@ -70,106 +72,107 @@ public class WinBoLLActivityManager { | ||||
|     // 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; | ||||
|             } | ||||
|  | ||||
|         // 如果窗口已存在就重启窗口 | ||||
|         if (!resumeActivity(clazz)) { | ||||
|             // 新建一个任务窗口 | ||||
|             Intent intent = new Intent(context, clazz); | ||||
|             //打开多任务窗口 flags | ||||
|             intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | ||||
|             intent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT); | ||||
|             intent.addFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK); | ||||
|             intent.putExtra("tag", tag); | ||||
|             mContext.startActivity(intent); | ||||
|         } catch (InstantiationException | IllegalAccessException e) { | ||||
|             LogUtils.d(TAG, e, Thread.currentThread().getStackTrace()); | ||||
|             //intent.putExtra("tag", tag); | ||||
|             context.startActivity(intent); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     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; | ||||
|             } | ||||
|  | ||||
|         // 如果窗口已存在就重启窗口 | ||||
|         if (!resumeActivity(clazz)) { | ||||
|             // 新建一个任务窗口 | ||||
|             //Intent intent = new Intent(context, clazz); | ||||
|             //打开多任务窗口 flags | ||||
|             intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | ||||
|             intent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT); | ||||
|             intent.addFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK); | ||||
|             intent.putExtra("tag", tag); | ||||
|             mContext.startActivity(intent); | ||||
|             //intent.putExtra("tag", tag); | ||||
|             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) { | ||||
|             LogUtils.d(TAG, e, Thread.currentThread().getStackTrace()); | ||||
|         } | ||||
|         return false; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 判断 tag绑定的 MyActivity是否存在 | ||||
|      */ | ||||
|     public boolean isActive(String tag) { | ||||
|         //printAvtivityListInfo(); | ||||
|         IWinBoLLActivity iWinBoLLActivity = getIWinBoLLActivity(tag); | ||||
|         if (iWinBoLLActivity != null) { | ||||
|             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; | ||||
|                 } | ||||
|             } | ||||
|     // | ||||
|     // 找到tag 绑定的 BaseActivity ,通过 getTaskId() 移动到前台 | ||||
|     // | ||||
|     public <T extends IWinBoLLActivity> boolean resumeActivity(String tag) { | ||||
|         Activity activity = getActivityByTag(tag); | ||||
|         if (activity != null) { | ||||
|             return resumeActivity(activity); | ||||
|         } | ||||
|         return false; | ||||
|  | ||||
|     } | ||||
|  | ||||
|     IWinBoLLActivity getIWinBoLLActivity(String tag) { | ||||
|         return mActivityListMap.get(tag); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 找到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); | ||||
|     // | ||||
|     // 找到tag 绑定的 BaseActivity ,通过 getTaskId() 移动到前台 | ||||
|     // | ||||
|     public <T extends IWinBoLLActivity> boolean resumeActivity(Activity activity) { | ||||
|         ActivityManager am = (ActivityManager) activity.getSystemService(Context.ACTIVITY_SERVICE); | ||||
|         //返回启动它的根任务(home 或者 MainActivity) | ||||
|         Intent intent = new Intent(context, activity.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(activity.getActivity().getTaskId(), ActivityManager.MOVE_TASK_NO_USER_ACTION); | ||||
|         //Intent intent = new Intent(mContext, activity.getClass()); | ||||
|         //TaskStackBuilder stackBuilder = TaskStackBuilder.create(mContext); | ||||
|         //stackBuilder.addNextIntentWithParentStack(intent); | ||||
|         //stackBuilder.startActivities(); | ||||
|         am.moveTaskToFront(activity.getTaskId(), ActivityManager.MOVE_TASK_NO_USER_ACTION); | ||||
|         //ToastUtils.show("resumeActivity"); | ||||
|         return true; | ||||
|     } | ||||
|  | ||||
|  | ||||
| @@ -221,10 +224,10 @@ public class WinBoLLActivityManager { | ||||
|                 // ★:0 1 2 [3] 4 >> 2 | ||||
|                 // ★:0 1 2 3 [4] >> 3 | ||||
|                 // ★:[0] >> 直接关闭当前窗口 | ||||
|                 IWinBoLLActivity preActivity = getPreActivity(iWinBoLLActivity); | ||||
|                 Activity preActivity = getPreActivity(iWinBoLLActivity); | ||||
|                 iWinBoLLActivity.getActivity().finish(); | ||||
|                 if (preActivity != null) { | ||||
|                     resumeActivity(mContext, preActivity); | ||||
|                     resumeActivity(preActivity); | ||||
|                 } | ||||
|             } | ||||
|  | ||||
| @@ -233,7 +236,7 @@ public class WinBoLLActivityManager { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     IWinBoLLActivity getPreActivity(IWinBoLLActivity iWinBoLLActivity) { | ||||
|     Activity getPreActivity(IWinBoLLActivity iWinBoLLActivity) { | ||||
|         try { | ||||
|             boolean bingo = false; | ||||
|             IWinBoLLActivity preIWinBoLLActivity = null; | ||||
| @@ -247,7 +250,7 @@ public class WinBoLLActivityManager { | ||||
|             } | ||||
|  | ||||
|             if (bingo) { | ||||
|                 return preIWinBoLLActivity; | ||||
|                 return preIWinBoLLActivity.getActivity(); | ||||
|             } | ||||
|         } catch (Exception e) { | ||||
|             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> | ||||
| @@ -24,7 +24,7 @@ android { | ||||
|     defaultConfig { | ||||
|         applicationId "cc.winboll.studio.mymessagemanager" | ||||
|         minSdkVersion 24 | ||||
|         targetSdkVersion 29 | ||||
|         targetSdkVersion 30 | ||||
|         versionCode 8 | ||||
|         // versionName 更新后需要手动设置  | ||||
|         // .winboll/winbollBuildProps.properties 文件的 stageCount=0 | ||||
| @@ -45,9 +45,9 @@ android { | ||||
|  | ||||
| dependencies { | ||||
|     api fileTree(dir: 'libs', include: ['*.jar']) | ||||
|     api 'cc.winboll.studio:libaes:15.6.0' | ||||
|     api 'cc.winboll.studio:libapputils:15.3.4' | ||||
|     api 'cc.winboll.studio:libappbase:15.7.6' | ||||
|     api 'cc.winboll.studio:libaes:15.8.0' | ||||
|     api 'cc.winboll.studio:libapputils:15.8.1' | ||||
|     api 'cc.winboll.studio:libappbase:15.8.1' | ||||
|      | ||||
| 	api 'io.github.medyo:android-about-page:2.0.0' | ||||
|     api 'com.github.getActivity:ToastUtils:10.5' | ||||
|   | ||||
| @@ -1,8 +1,8 @@ | ||||
| #Created by .winboll/winboll_app_build.gradle | ||||
| #Sat May 03 12:49:28 GMT 2025 | ||||
| stageCount=5 | ||||
| #Tue May 20 20:39:06 HKT 2025 | ||||
| stageCount=6 | ||||
| libraryProject= | ||||
| baseVersion=15.2 | ||||
| publishVersion=15.2.4 | ||||
| buildCount=14 | ||||
| baseBetaVersion=15.2.5 | ||||
| publishVersion=15.2.5 | ||||
| buildCount=0 | ||||
| baseBetaVersion=15.2.6 | ||||
|   | ||||
| @@ -1,52 +0,0 @@ | ||||
| package cc.winboll.studio.mymessagemanager; | ||||
|  | ||||
| /** | ||||
|  * @Author ZhanGSKen<zhangsken@188.com> | ||||
|  * @Date 2023/07/24 01:46:59 | ||||
|  * @Describe 全局应用类 | ||||
|  */ | ||||
| import android.view.Gravity; | ||||
| import cc.winboll.studio.mymessagemanager.R; | ||||
| import cc.winboll.studio.shared.app.WinBollApplication; | ||||
| import cc.winboll.studio.shared.log.LogUtils; | ||||
| import com.hjq.toast.ToastUtils; | ||||
| import java.io.File; | ||||
|  | ||||
| public class GlobalApplication extends WinBollApplication { | ||||
|  | ||||
|     public static final String TAG = "GlobalApplication"; | ||||
|  | ||||
|     static String _mszAppExternalFilesDir; | ||||
|     static String _mszConfigUtilFileName = "ConfigUtil.json"; | ||||
|     static String _mszConfigUtilPath; | ||||
|     static String _mszSMSReceiveRuleUtilFileName = "SMSReceiveRuleUtil.json"; | ||||
|     static String _mszSMSReceiveRuleUtilPath; | ||||
|  | ||||
|     public static final int USER_ID = -1; | ||||
|     Long mszVersionName = 1L; | ||||
|     Long mszDataVersionName = 1L; | ||||
|  | ||||
|  | ||||
|     @Override | ||||
|     public void onCreate() { | ||||
|         super.onCreate(); | ||||
|         //setIsDebug(cc.winboll.studio.mymessagemanager.BuildConfig.DEBUG); | ||||
|  | ||||
|         // 初始化 Toast 框架 | ||||
|         ToastUtils.init(this); | ||||
|         // 设置 Toast 布局样式 | ||||
|         ToastUtils.setView(R.layout.toast_custom_view); | ||||
|         //ToastUtils.setStyle(new WhiteToastStyle()); | ||||
|         ToastUtils.setGravity(Gravity.BOTTOM, 0, 200); | ||||
|  | ||||
|         //LogUtils.d(TAG, "BuildConfig.DEBUG " + Boolean.toString(BuildConfig.DEBUG)); | ||||
|  | ||||
|         _mszAppExternalFilesDir = getExternalFilesDir(TAG).toString(); | ||||
|         _mszConfigUtilPath = _mszAppExternalFilesDir + File.separator + _mszConfigUtilFileName; | ||||
|         _mszSMSReceiveRuleUtilPath = _mszAppExternalFilesDir + File.separator + _mszSMSReceiveRuleUtilFileName; | ||||
|     } | ||||
|  | ||||
|     public static void showApplicationMessage(String szMessage) { | ||||
|         LogUtils.i(TAG, szMessage); | ||||
|     } | ||||
| } | ||||
| @@ -306,7 +306,7 @@ public class MainActivity extends BaseActivity { | ||||
|             i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | ||||
|             startActivity(i); | ||||
| 		} else if (nItemId ==  R.id.app_log) { | ||||
|             App.getWinBoLLActivityManager().startLogActivity(this); | ||||
|             //App.getWinBoLLActivityManager().startLogActivity(this); | ||||
|         } else if (nItemId ==  R.id.app_unittest) { | ||||
|             Intent i = new Intent(MainActivity.this, UnitTestActivity.class); | ||||
|             i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | ||||
|   | ||||
| @@ -15,12 +15,12 @@ import android.graphics.BitmapFactory; | ||||
| import android.graphics.Color; | ||||
| import android.media.RingtoneManager; | ||||
| import android.widget.RemoteViews; | ||||
| import cc.winboll.studio.libappbase.LogUtils; | ||||
| import cc.winboll.studio.mymessagemanager.R; | ||||
| import cc.winboll.studio.mymessagemanager.activitys.MainActivity; | ||||
| import cc.winboll.studio.mymessagemanager.activitys.SMSActivity; | ||||
| import cc.winboll.studio.mymessagemanager.beans.MessageNotificationBean; | ||||
| import cc.winboll.studio.mymessagemanager.services.MainService; | ||||
| import cc.winboll.studio.shared.log.LogUtils; | ||||
|  | ||||
| public class NotificationUtil { | ||||
|  | ||||
|   | ||||
| @@ -18,6 +18,7 @@ | ||||
| 1.自启动权限允许。 | ||||
| 2.省电策略-无限制权限允许。 | ||||
| 3.设置背景图片需要读写手机存储权限。 | ||||
| 4.要在锁屏充电的时候提醒,还需要设置允许锁屏通知权限。 | ||||
|  | ||||
| #### 参与贡献 | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 ZhanGSKen
					ZhanGSKen