diff --git a/aes/build.properties b/aes/build.properties index bc15417..13a8f96 100644 --- a/aes/build.properties +++ b/aes/build.properties @@ -1,8 +1,8 @@ #Created by .winboll/winboll_app_build.gradle -#Sun May 24 10:48:48 HKT 2026 -stageCount=10 +#Wed Jun 03 07:07:27 HKT 2026 +stageCount=15 libraryProject=libaes baseVersion=15.20 -publishVersion=15.20.9 +publishVersion=15.20.14 buildCount=0 -baseBetaVersion=15.20.10 +baseBetaVersion=15.20.15 diff --git a/aes/src/main/java/cc/winboll/studio/aes/App.java b/aes/src/main/java/cc/winboll/studio/aes/App.java index 0a99369..ece7ea0 100644 --- a/aes/src/main/java/cc/winboll/studio/aes/App.java +++ b/aes/src/main/java/cc/winboll/studio/aes/App.java @@ -5,10 +5,14 @@ package cc.winboll.studio.aes; * @Date 2024/06/13 19:03:58 * @Describe AES应用类 */ -import android.view.Gravity; +import cc.winboll.studio.libaes.utils.AESThemeUtil; import cc.winboll.studio.libaes.utils.WinBoLLActivityManager; +import cc.winboll.studio.libappbase.CrashHandler; import cc.winboll.studio.libappbase.GlobalApplication; import cc.winboll.studio.libappbase.ToastUtils; +import cc.winboll.studio.libappbase.utils.CrashHandleNotifyUtils; +import java.io.PrintWriter; +import java.io.StringWriter; public class App extends GlobalApplication { @@ -17,11 +21,25 @@ public class App extends GlobalApplication { @Override public void onCreate() { - super.onCreate(); - WinBoLLActivityManager.init(this); + try { + super.onCreate(); + ToastUtils.init(this); + WinBoLLActivityManager.init(this); + AESThemeUtil.init(null); + } catch (Throwable e) { + StringWriter sw = new StringWriter(); + PrintWriter pw = new PrintWriter(sw); + e.printStackTrace(pw); + pw.close(); + String stackTraceStr = sw.toString(); + CrashHandleNotifyUtils.handleUncaughtException( + this, + getPackageName(), + stackTraceStr, + CrashHandler.CrashActivity.class + ); + } - // 初始化 Toast 框架 - ToastUtils.init(this); } @Override diff --git a/aes/src/main/java/cc/winboll/studio/aes/MainActivity.java b/aes/src/main/java/cc/winboll/studio/aes/MainActivity.java index 927c852..30be2c0 100644 --- a/aes/src/main/java/cc/winboll/studio/aes/MainActivity.java +++ b/aes/src/main/java/cc/winboll/studio/aes/MainActivity.java @@ -84,11 +84,12 @@ public class MainActivity extends DrawerFragmentActivity { @Override public boolean onCreateOptionsMenu(Menu menu) { + super.onCreateOptionsMenu(menu); getMenuInflater().inflate(R.menu.toolbar_main, menu); // if(App.isDebugging()) { // getMenuInflater().inflate(cc.winboll.studio.libaes.R.menu.toolbar_studio_debug, menu); // } - return super.onCreateOptionsMenu(menu); + return true; } @Override diff --git a/appbase/build.properties b/appbase/build.properties index f2d536c..a3eae15 100644 --- a/appbase/build.properties +++ b/appbase/build.properties @@ -1,8 +1,8 @@ #Created by .winboll/winboll_app_build.gradle -#Sun May 24 09:53:05 HKT 2026 -stageCount=22 +#Wed Jun 03 06:52:38 HKT 2026 +stageCount=26 libraryProject=libappbase baseVersion=15.20 -publishVersion=15.20.21 +publishVersion=15.20.25 buildCount=0 -baseBetaVersion=15.20.22 +baseBetaVersion=15.20.26 diff --git a/appbase/src/main/java/cc/winboll/studio/appbase/App.java b/appbase/src/main/java/cc/winboll/studio/appbase/App.java index 9a19876..4666ea9 100644 --- a/appbase/src/main/java/cc/winboll/studio/appbase/App.java +++ b/appbase/src/main/java/cc/winboll/studio/appbase/App.java @@ -1,8 +1,11 @@ package cc.winboll.studio.appbase; +import cc.winboll.studio.libappbase.CrashHandler; import cc.winboll.studio.libappbase.GlobalApplication; import cc.winboll.studio.libappbase.ToastUtils; -import cc.winboll.studio.libappbase.BuildConfig; +import cc.winboll.studio.libappbase.utils.CrashHandleNotifyUtils; +import java.io.PrintWriter; +import java.io.StringWriter; /** * @Author ZhanGSKen @@ -21,10 +24,24 @@ public class App extends GlobalApplication { */ @Override public void onCreate() { - super.onCreate(); - - // 初始化 Toast 工具类(传入应用全局上下文,确保 Toast 可在任意地方调用) - ToastUtils.init(getApplicationContext()); + try { + super.onCreate(); + + // 初始化 Toast 工具类(传入应用全局上下文,确保 Toast 可在任意地方调用) + ToastUtils.init(getApplicationContext()); + } catch (Throwable e) { + StringWriter sw = new StringWriter(); + PrintWriter pw = new PrintWriter(sw); + e.printStackTrace(pw); + pw.close(); + String stackTraceStr = sw.toString(); + CrashHandleNotifyUtils.handleUncaughtException( + this, + getPackageName(), + stackTraceStr, + CrashHandler.CrashActivity.class + ); + } } /** diff --git a/libaes/build.gradle b/libaes/build.gradle index 73ac7bc..397e4ab 100644 --- a/libaes/build.gradle +++ b/libaes/build.gradle @@ -66,9 +66,9 @@ dependencies { //annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0' // WinBoLL库 nexus.winboll.cc 地址 - api 'cc.winboll.studio:libappbase:15.20.21' + api 'cc.winboll.studio:libappbase:15.20.25' // 备用库 jitpack.io 地址 - //api 'com.github.ZhanGSKen:libappbase:appbase-v15.15.21' + //api 'com.github.ZhanGSKen:libappbase:appbase-v15.20.25' api fileTree(dir: 'libs', include: ['*.jar']) } diff --git a/libaes/build.properties b/libaes/build.properties index bc15417..13a8f96 100644 --- a/libaes/build.properties +++ b/libaes/build.properties @@ -1,8 +1,8 @@ #Created by .winboll/winboll_app_build.gradle -#Sun May 24 10:48:48 HKT 2026 -stageCount=10 +#Wed Jun 03 07:07:27 HKT 2026 +stageCount=15 libraryProject=libaes baseVersion=15.20 -publishVersion=15.20.9 +publishVersion=15.20.14 buildCount=0 -baseBetaVersion=15.20.10 +baseBetaVersion=15.20.15 diff --git a/libaes/src/main/java/cc/winboll/studio/libaes/activitys/DrawerFragmentActivity.java b/libaes/src/main/java/cc/winboll/studio/libaes/activitys/DrawerFragmentActivity.java index 97610a3..7d0a47a 100644 --- a/libaes/src/main/java/cc/winboll/studio/libaes/activitys/DrawerFragmentActivity.java +++ b/libaes/src/main/java/cc/winboll/studio/libaes/activitys/DrawerFragmentActivity.java @@ -15,6 +15,7 @@ import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.widget.AdapterView; + import androidx.appcompat.app.ActionBarDrawerToggle; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.widget.Toolbar; @@ -22,8 +23,10 @@ import androidx.drawerlayout.widget.DrawerLayout; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentTransaction; + import cc.winboll.studio.libaes.DrawerMenuDataAdapter; import cc.winboll.studio.libaes.R; +import cc.winboll.studio.libaes.interfaces.IWinBoLLActivity; import cc.winboll.studio.libaes.models.AESThemeBean; import cc.winboll.studio.libaes.models.DrawerMenuBean; import cc.winboll.studio.libaes.utils.AESThemeUtil; @@ -34,8 +37,8 @@ import cc.winboll.studio.libaes.views.ADsBannerView; import cc.winboll.studio.libappbase.GlobalApplication; import cc.winboll.studio.libappbase.LogUtils; import com.baoyz.widget.PullRefreshLayout; + import java.util.ArrayList; -import cc.winboll.studio.libaes.interfaces.IWinBoLLActivity; public abstract class DrawerFragmentActivity extends AppCompatActivity implements IWinBoLLActivity, AdapterView.OnItemClickListener { @@ -44,7 +47,6 @@ public abstract class DrawerFragmentActivity extends AppCompatActivity implement static final String SHAREDPREFERENCES_NAME = "SHAREDPREFERENCES_NAME"; static final String DRAWER_THEME_TYPE = "DRAWER_THEME_TYPE"; - //protected Context mContext; ActivityType mActivityType; ActionBarDrawerToggle mActionBarDrawerToggle; DrawerLayout mDrawerLayout; @@ -59,13 +61,14 @@ public abstract class DrawerFragmentActivity extends AppCompatActivity implement public enum ActivityType { Main, Secondary } protected volatile AESThemeBean.ThemeType mThemeType; protected ArrayList malDrawerMenuItem; + abstract protected ActivityType initActivityType(); - //abstract protected View initContentView(LayoutInflater inflater, ViewGroup rootView); @Override protected void onCreate(Bundle savedInstanceState) { + // 替换:使用工具类统一应用主题 + AESThemeUtil.applyAppCompatTheme(this); mThemeType = AESThemeBean.getThemeStyleType(AESThemeUtil.getThemeTypeID(getApplicationContext())); - setTheme(AESThemeUtil.getThemeTypeID(getApplicationContext())); super.onCreate(savedInstanceState); WinBoLLActivityManager.getInstance().add(this); mActivityType = initActivityType(); @@ -78,53 +81,32 @@ public abstract class DrawerFragmentActivity extends AppCompatActivity implement return this; } - @Override - public String getTag() { - return TAG; - } + @Override + public String getTag() { + return TAG; + } @Override protected void onDestroy() { - WinBoLLActivityManager.getInstance().registeRemove(this); + WinBoLLActivityManager.getInstance().registeRemove(this); super.onDestroy(); - // 修复:释放广告资源,避免内存泄漏 - ADsBannerView adsBannerView = findViewById(R.id.adsbanner); - if (adsBannerView != null) { - adsBannerView.releaseAdResources(); - } + // 修复:释放广告资源,避免内存泄漏 + ADsBannerView adsBannerView = findViewById(R.id.adsbanner); + if (adsBannerView != null) { + adsBannerView.releaseAdResources(); + } } - /*@Override - public Intent getIntent() { - // TODO: Implement this method - return super.getIntent(); - } - - public Context getContext() { - return this.mContext; - }*/ - @Override public MenuInflater getMenuInflater() { - // TODO: Implement this method return super.getMenuInflater(); } - /*public void setSubtitle(CharSequence context) { - // TODO: Implement this method - getSupportActionBar().setSubtitle(context); - }*/ - @Override public void recreate() { super.recreate(); } - /*@Override - public boolean moveTaskToBack(boolean nonRoot) { - return super.moveTaskToBack(nonRoot); - }*/ - @Override public void startActivity(Intent intent) { super.startActivity(intent); @@ -135,26 +117,6 @@ public abstract class DrawerFragmentActivity extends AppCompatActivity implement super.startActivityForResult(intent, requestCode, options); } - /*@Override - public FragmentManager getSupportFragmentManager() { - return super.getSupportFragmentManager(); - } - - public void setSubtitle(int resId) { - // TODO: Implement this method - getSupportActionBar().setSubtitle(resId); - } - - public void setTitle(CharSequence context) { - // TODO: Implement this method - getSupportActionBar().setTitle(context); - } - - public void setTitle(int resId) { - // TODO: Implement this method - getSupportActionBar().setTitle(resId); - }*/ - @Override public SharedPreferences getSharedPreferences(String name, int mode) { return super.getSharedPreferences(name, mode); @@ -162,7 +124,6 @@ public abstract class DrawerFragmentActivity extends AppCompatActivity implement @Override public Context getApplicationContext() { - // TODO: Implement this method return super.getApplicationContext(); } @@ -173,25 +134,27 @@ public abstract class DrawerFragmentActivity extends AppCompatActivity implement @Override public boolean onOptionsItemSelected(MenuItem item) { - if (AESThemeUtil.onAppThemeItemSelected(this, item)) { + // 替换为 DrawerFragmentActivity 专属点击处理方法 + if (AESThemeUtil.onWinBoLLThemeItemSelected(this, item)) { recreate(); - } if (DevelopUtils.onDevelopItemSelected(this, item)) { - LogUtils.d(TAG, String.format("onOptionsItemSelected item.getItemId() %d ", item.getItemId())); - } else { - return super.onOptionsItemSelected(item); - } + } + if (DevelopUtils.onDevelopItemSelected(this, item)) { + LogUtils.d(TAG, String.format("onOptionsItemSelected item.getItemId() %d ", item.getItemId())); + } else { + return super.onOptionsItemSelected(item); + } - return true; + return true; } @Override protected void onResume() { super.onResume(); - ADsBannerView adsBannerView = findViewById(R.id.adsbanner); - if (adsBannerView != null) { - adsBannerView.resumeADs(DrawerFragmentActivity.this); - } + ADsBannerView adsBannerView = findViewById(R.id.adsbanner); + if (adsBannerView != null) { + adsBannerView.resumeADs(DrawerFragmentActivity.this); + } } void initRootView() { @@ -213,14 +176,13 @@ public abstract class DrawerFragmentActivity extends AppCompatActivity implement mPullRefreshLayout = findViewById(R.id.activitydrawerfragmentPullRefreshLayout1); mPullRefreshLayout.setOnRefreshListener(new PullRefreshLayout.OnRefreshListener() { - @Override - public void onRefresh() { - //LogUtils.d(TAG, "onRefresh"); - reinitDrawerMenuItemList(malDrawerMenuItem); - mDrawerMenuDataAdapter.notifyDataSetChanged(); - mPullRefreshLayout.setRefreshing(false); - } - }); + @Override + public void onRefresh() { + reinitDrawerMenuItemList(malDrawerMenuItem); + mDrawerMenuDataAdapter.notifyDataSetChanged(); + mPullRefreshLayout.setRefreshing(false); + } + }); malDrawerMenuItem = new ArrayList(); @@ -236,68 +198,51 @@ public abstract class DrawerFragmentActivity extends AppCompatActivity implement mActionBarDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, mToolbar, R.string.lib_name, R.string.lib_name) { @Override - public void onDrawerOpened(View drawerView) {//完全打开时触发 + public void onDrawerOpened(View drawerView) { super.onDrawerOpened(drawerView); mIsDrawerOpened = true; mIsDrawerOpening = false; - //Toast.makeText(MainActivity.this,"onDrawerOpened",Toast.LENGTH_SHORT).show(); } @Override - public void onDrawerClosed(View drawerView) {//完全关闭时触发 + public void onDrawerClosed(View drawerView) { super.onDrawerClosed(drawerView); mIsDrawerOpened = false; mIsDrawerClosing = false; - //Toast.makeText(MainActivity.this,"onDrawerClosed",Toast.LENGTH_SHORT).show(); } - /** - * 当抽屉被滑动的时候调用此方法 - * slideOffset表示 滑动的幅度(0-1) - */ @Override public void onDrawerSlide(View drawerView, float slideOffset) { super.onDrawerSlide(drawerView, slideOffset); } - /** - * 当抽屉滑动状态改变的时候被调用 - * 状态值是STATE_IDLE(闲置--0), STATE_DRAGGING(拖拽的--1), STATE_SETTLING(固定--2)中之一。 - *具体状态可以慢慢调试 - */ @Override public void onDrawerStateChanged(int newState) { super.onDrawerStateChanged(newState); } }; - //设置显示旋转菜单 getSupportActionBar().setDisplayHomeAsUpEnabled(true); - //通过下面这句实现toolbar和Drawer的联动:如果没有这行代码,箭头是不会随着侧滑菜单的开关而变换的(或者没有箭头), - // 可以尝试一下,不影响正常侧滑 mActionBarDrawerToggle.syncState(); mDrawerLayout.setDrawerListener(mActionBarDrawerToggle); - //去掉侧滑的默认图标(动画箭头图标),也可以选择不去, - //不去的话把这一行注释掉或者改成true,然后把toolbar.setNavigationIcon注释掉就行了 - //mActionBarDrawerToggle.setDrawerIndicatorEnabled(false); mToolbar.setNavigationOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - if (mIsDrawerOpened || mIsDrawerOpening) { - mIsDrawerClosing = true; - mIsDrawerOpening = false; - mDrawerLayout.closeDrawer(mPullRefreshLayout); - return; - } - if (!mIsDrawerOpened || mIsDrawerClosing) { - mIsDrawerOpening = true; - mIsDrawerClosing = false; - mDrawerLayout.openDrawer(mPullRefreshLayout); - return; - } - } - }); + @Override + public void onClick(View v) { + if (mIsDrawerOpened || mIsDrawerOpening) { + mIsDrawerClosing = true; + mIsDrawerOpening = false; + mDrawerLayout.closeDrawer(mPullRefreshLayout); + return; + } + if (!mIsDrawerOpened || mIsDrawerClosing) { + mIsDrawerOpening = true; + mIsDrawerClosing = false; + mDrawerLayout.openDrawer(mPullRefreshLayout); + return; + } + } + }); initDrawerMenuItemList(malDrawerMenuItem); } @@ -305,12 +250,11 @@ public abstract class DrawerFragmentActivity extends AppCompatActivity implement void initSecondaryRootView() { getSupportActionBar().setDisplayHomeAsUpEnabled(true); mToolbar.setNavigationOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - //LogUtils.d(TAG, "onClick " + Integer.toString(v.getId())); - finish(); - } - }); + @Override + public void onClick(View v) { + finish(); + } + }); } public int removeFragment(T fragment) { @@ -375,13 +319,13 @@ public abstract class DrawerFragmentActivity extends AppCompatActivity implement @Override public boolean onCreateOptionsMenu(Menu menu) { if (mActivityType == ActivityType.Main) { - // 主题菜单 - AESThemeUtil.inflateMenu(this, menu); - // 调试工具菜单 - if (GlobalApplication.isDebugging()) { - DevelopUtils.inflateMenu(this, menu); - } - // 应用信息菜单 + // 替换为兼容版菜单加载方法 + AESThemeUtil.inflateCompatThemeMenu(this, menu); + // 调试工具菜单 + if (GlobalApplication.isDebugging()) { + DevelopUtils.inflateMenu(this, menu); + } + // 应用信息菜单 getMenuInflater().inflate(R.menu.toolbar_drawerbase, menu); } return super.onCreateOptionsMenu(menu); @@ -392,3 +336,4 @@ public abstract class DrawerFragmentActivity extends AppCompatActivity implement super.onActivityResult(who, targetFragment, requestCode); } } + diff --git a/libaes/src/main/java/cc/winboll/studio/libaes/models/AESThemeBean.java b/libaes/src/main/java/cc/winboll/studio/libaes/models/AESThemeBean.java index cc1517c..0a835ef 100644 --- a/libaes/src/main/java/cc/winboll/studio/libaes/models/AESThemeBean.java +++ b/libaes/src/main/java/cc/winboll/studio/libaes/models/AESThemeBean.java @@ -10,6 +10,7 @@ import android.util.JsonWriter; import cc.winboll.studio.libaes.R; import cc.winboll.studio.libappbase.models.libs1520000.BaseBean; import java.io.IOException; +import java.util.ArrayList; public class AESThemeBean extends BaseBean { @@ -41,13 +42,28 @@ public class AESThemeBean extends BaseBean { return name; } } - + + public static void fillThemeStyleIDList(ArrayList themeStyleIDList) { + if (themeStyleIDList == null) { + themeStyleIDList = new ArrayList(); + + } + themeStyleIDList.clear(); + themeStyleIDList.add(cc.winboll.studio.libaes.R.style.AESTheme); + themeStyleIDList.add(cc.winboll.studio.libaes.R.style.DepthAESTheme); + themeStyleIDList.add(cc.winboll.studio.libaes.R.style.SkyAESTheme); + themeStyleIDList.add(cc.winboll.studio.libaes.R.style.GoldenAESTheme); + themeStyleIDList.add(cc.winboll.studio.libaes.R.style.BearingAESTheme); + themeStyleIDList.add(cc.winboll.studio.libaes.R.style.MemorAESTheme); + themeStyleIDList.add(cc.winboll.studio.libaes.R.style.TaoAESTheme); + } + // 保存当前主题 int currentThemeStyleID = getThemeStyleID(ThemeType.AES); - + public AESThemeBean() { } - + public AESThemeBean(int currentThemeStyleID) { this.currentThemeStyleID = currentThemeStyleID; } @@ -59,7 +75,7 @@ public class AESThemeBean extends BaseBean { public int getCurrentThemeTypeID() { return this.currentThemeStyleID; } - + @Override public String getName() { return AESThemeBean.class.getName(); @@ -74,8 +90,7 @@ public class AESThemeBean extends BaseBean { @Override public boolean initObjectsFromJsonReader(JsonReader jsonReader, String name) throws IOException { - if(super.initObjectsFromJsonReader(jsonReader, name)) { return true; } - else{ + if (super.initObjectsFromJsonReader(jsonReader, name)) { return true; } else { if (name.equals("currentThemeTypeID")) { setCurrentThemeTypeID(jsonReader.nextInt()); } else { @@ -90,7 +105,7 @@ public class AESThemeBean extends BaseBean { jsonReader.beginObject(); while (jsonReader.hasNext()) { String name = jsonReader.nextName(); - if(!initObjectsFromJsonReader(jsonReader, name)) { + if (!initObjectsFromJsonReader(jsonReader, name)) { jsonReader.skipValue(); } } diff --git a/libaes/src/main/java/cc/winboll/studio/libaes/unittests/TestASupportToolbarActivity.java b/libaes/src/main/java/cc/winboll/studio/libaes/unittests/TestASupportToolbarActivity.java index d014654..8021b3e 100644 --- a/libaes/src/main/java/cc/winboll/studio/libaes/unittests/TestASupportToolbarActivity.java +++ b/libaes/src/main/java/cc/winboll/studio/libaes/unittests/TestASupportToolbarActivity.java @@ -12,7 +12,6 @@ import androidx.appcompat.widget.Toolbar; import cc.winboll.studio.libaes.R; import cc.winboll.studio.libaes.interfaces.IWinBoLLActivity; import cc.winboll.studio.libaes.utils.AESThemeUtil; -import cc.winboll.studio.libaes.views.ASupportToolbar; import cc.winboll.studio.libappbase.LogUtils; public class TestASupportToolbarActivity extends AppCompatActivity implements IWinBoLLActivity { @@ -28,11 +27,12 @@ public class TestASupportToolbarActivity extends AppCompatActivity implements IW public String getTag() { return TAG; } - + @Override protected void onCreate(Bundle savedInstanceState) { LogUtils.d(TAG, "onCreate() start"); - AESThemeUtil.applyAppTheme(this); + // 替换此处:原 applyAppTheme -> 新方法 applyAppCompatTheme + AESThemeUtil.applyAppCompatTheme(this); super.onCreate(savedInstanceState); setContentView(R.layout.activity_testasupporttoolbar); LogUtils.d(TAG, "setContentView() done"); @@ -45,3 +45,4 @@ public class TestASupportToolbarActivity extends AppCompatActivity implements IW LogUtils.d(TAG, "onCreate() end"); } } + diff --git a/libaes/src/main/java/cc/winboll/studio/libaes/unittests/TestAToolbarActivity.java b/libaes/src/main/java/cc/winboll/studio/libaes/unittests/TestAToolbarActivity.java index bba25fc..2239d33 100644 --- a/libaes/src/main/java/cc/winboll/studio/libaes/unittests/TestAToolbarActivity.java +++ b/libaes/src/main/java/cc/winboll/studio/libaes/unittests/TestAToolbarActivity.java @@ -14,10 +14,11 @@ import cc.winboll.studio.libaes.utils.AESThemeUtil; public class TestAToolbarActivity extends Activity { public static final String TAG = "TestAToolbarActivity"; - + @Override protected void onCreate(Bundle savedInstanceState) { - AESThemeUtil.applyAppTheme(this); + // 原生Activity 使用 applyTheme + AESThemeUtil.applyTheme(this); super.onCreate(savedInstanceState); setContentView(R.layout.activity_testatoolbar); Toolbar toolbar = findViewById(R.id.activitytestatoolbarAToolbar1); @@ -26,3 +27,4 @@ public class TestAToolbarActivity extends Activity { } } + diff --git a/libaes/src/main/java/cc/winboll/studio/libaes/utils/AESThemeUtil.java b/libaes/src/main/java/cc/winboll/studio/libaes/utils/AESThemeUtil.java index b4e7548..1987dc9 100644 --- a/libaes/src/main/java/cc/winboll/studio/libaes/utils/AESThemeUtil.java +++ b/libaes/src/main/java/cc/winboll/studio/libaes/utils/AESThemeUtil.java @@ -13,199 +13,159 @@ import androidx.appcompat.app.AppCompatActivity; import cc.winboll.studio.libaes.R; import cc.winboll.studio.libaes.activitys.DrawerFragmentActivity; import cc.winboll.studio.libaes.models.AESThemeBean; +import java.util.ArrayList; public class AESThemeUtil { public static final String TAG = "AESThemeUtil"; + private static final String SHAREDPREFERENCES_NAME = "SHAREDPREFERENCES_NAME"; + private static final String DRAWER_THEME_TYPE = "DRAWER_THEME_TYPE"; - static final String SHAREDPREFERENCES_NAME = "SHAREDPREFERENCES_NAME"; - static final String DRAWER_THEME_TYPE = "DRAWER_THEME_TYPE"; + // 私有静态集合,外部不可直接修改 + private static ArrayList themeStyleIDList = new ArrayList<>(); - protected volatile AESThemeBean.ThemeType mThemeType; + // 移除无用实例成员 mThemeType,工具类不保留实例字段 - public static int getThemeTypeID(T context) { - AESThemeBean bean = AESThemeBean.loadBean(context, AESThemeBean.class); - return bean == null ? AESThemeBean.getThemeStyleID(AESThemeBean.ThemeType.AES): bean.getCurrentThemeTypeID(); + /** + * 初始化主题样式ID集合 + */ + public static void init(ArrayList themeStyleIDList) { + + if (themeStyleIDList == null) { + themeStyleIDList = new ArrayList(); + AESThemeBean.fillThemeStyleIDList(themeStyleIDList); + } + AESThemeUtil.themeStyleIDList.clear(); + AESThemeUtil.themeStyleIDList.addAll(themeStyleIDList); } - public static void saveThemeStyleID(T context, int nThemeTypeID) { - AESThemeBean bean = new AESThemeBean(nThemeTypeID); + /** + * 获取当前主题样式ID + */ + public static int getThemeTypeID(Context context) { + AESThemeBean bean = AESThemeBean.loadBean(context, AESThemeBean.class); + return bean == null ? getThemeStyleID(AESThemeBean.ThemeType.AES) : bean.getCurrentThemeTypeID(); + } + + /** + * 保存主题样式ID + */ + public static void saveThemeStyleID(Context context, int themeTypeID) { + AESThemeBean bean = new AESThemeBean(themeTypeID); AESThemeBean.saveBean(context, bean); } - public static void applyAppTheme(T activity) { + // ====================== 应用主题 - 规范重载 ====================== + /** + * 应用当前持久化主题(通用 Activity) + */ + public static void applyTheme(Activity activity) { activity.setTheme(getThemeTypeID(activity)); } - public static void applyAppCompatTheme(T activity) { + /** + * 应用指定主题(通用 Activity) + */ + public static void applyTheme(Activity activity, AESThemeBean.ThemeType themeType) { + activity.setTheme(getThemeStyleID(themeType)); + } + + /** + * 应用当前持久化主题(AppCompat 兼容 Activity) + */ + public static void applyAppCompatTheme(AppCompatActivity activity) { activity.setTheme(getThemeTypeID(activity)); } - /*public static void applyWinBoLLTheme(T activity) { - activity.setTheme(getThemeTypeID(activity.getApplicationContext())); - }*/ - - public static void applyAppTheme(Activity activity, AESThemeBean.ThemeType themeType) { - activity.setTheme(AESThemeBean.getThemeStyleID(themeType)); + /** + * 应用指定主题(AppCompat 兼容 Activity) + */ + public static void applyAppCompatTheme(AppCompatActivity activity, AESThemeBean.ThemeType themeType) { + activity.setTheme(getThemeStyleID(themeType)); } - public static void applyAppCompatTheme(Activity activity, AESThemeBean.ThemeType themeType) { - activity.setTheme(AESThemeBean.getThemeStyleID(themeType)); - } - - /*public static void applyWinBoLLTheme(Activity activity, AESThemeBean.ThemeType themeType) { - activity.setTheme(AESThemeBean.getThemeStyleID(themeType)); - }*/ - - public static void inflateMenu(T activity, Menu menu) { + // ====================== 加载菜单 ====================== + /** + * 加载主题菜单(通用 Activity) + */ + public static void inflateThemeMenu(Activity activity, Menu menu) { activity.getMenuInflater().inflate(R.menu.toolbar_apptheme, menu); } - public static void inflateCompatMenu(T activity, Menu menu) { + /** + * 加载主题菜单(AppCompat Activity) + */ + public static void inflateCompatThemeMenu(AppCompatActivity activity, Menu menu) { activity.getMenuInflater().inflate(R.menu.toolbar_apptheme, menu); } - /*public static void inflateWinBoLLMenu(T activity, Menu menu) { - activity.getMenuInflater().inflate(R.menu.toolbar_apptheme, menu); - }*/ - - public static boolean onAppThemeItemSelected(T activity, MenuItem item) { - int nThemeStyleID; - if (R.id.item_depththeme == item.getItemId()) { - nThemeStyleID = AESThemeBean.getThemeStyleID(AESThemeBean.ThemeType.DEPTH); - saveThemeStyleID(activity, nThemeStyleID); - return true; - } else if (R.id.item_skytheme == item.getItemId()) { - nThemeStyleID = AESThemeBean.getThemeStyleID(AESThemeBean.ThemeType.SKY); - saveThemeStyleID(activity, nThemeStyleID); - return true; - } else if (R.id.item_goldentheme == item.getItemId()) { - nThemeStyleID = AESThemeBean.getThemeStyleID(AESThemeBean.ThemeType.GOLDEN); - saveThemeStyleID(activity, nThemeStyleID); - return true; - } else if (R.id.item_bearingtheme == item.getItemId()) { - nThemeStyleID = AESThemeBean.getThemeStyleID(AESThemeBean.ThemeType.BEARING); - saveThemeStyleID(activity, nThemeStyleID); - return true; - } else if (R.id.item_memortheme == item.getItemId()) { - nThemeStyleID = AESThemeBean.getThemeStyleID(AESThemeBean.ThemeType.MEMOR); - saveThemeStyleID(activity, nThemeStyleID); - return true; - } else if (R.id.item_taotheme == item.getItemId()) { - nThemeStyleID = AESThemeBean.getThemeStyleID(AESThemeBean.ThemeType.TAO); - saveThemeStyleID(activity, nThemeStyleID); - return true; - } else if (R.id.item_defaulttheme == item.getItemId()) { - nThemeStyleID = AESThemeBean.getThemeStyleID(AESThemeBean.ThemeType.AES); - saveThemeStyleID(activity, nThemeStyleID); - return true; + // ====================== 菜单点击统一核心逻辑(消除重复代码) ====================== + /** + * 主题菜单项点击统一处理 + * @param context 上下文(用于持久化) + * @param item 点击的菜单项 + * @return 是否消费点击事件 + */ + public static boolean handleThemeMenuClick(Context context, MenuItem item) { + int themeStyleId; + int itemId = item.getItemId(); + if (R.id.item_depththeme == itemId) { + themeStyleId = getThemeStyleID(AESThemeBean.ThemeType.DEPTH); + } else if (R.id.item_skytheme == itemId) { + themeStyleId = getThemeStyleID(AESThemeBean.ThemeType.SKY); + } else if (R.id.item_goldentheme == itemId) { + themeStyleId = getThemeStyleID(AESThemeBean.ThemeType.GOLDEN); + } else if (R.id.item_bearingtheme == itemId) { + themeStyleId = getThemeStyleID(AESThemeBean.ThemeType.BEARING); + } else if (R.id.item_memortheme == itemId) { + themeStyleId = getThemeStyleID(AESThemeBean.ThemeType.MEMOR); + } else if (R.id.item_taotheme == itemId) { + themeStyleId = getThemeStyleID(AESThemeBean.ThemeType.TAO); + } else if (R.id.item_defaulttheme == itemId) { + themeStyleId = getThemeStyleID(AESThemeBean.ThemeType.AES); + } else { + return false; } - - return false; + saveThemeStyleID(context, themeStyleId); + return true; } - public static boolean onAppCompatThemeItemSelected(T activity, MenuItem item) { - int nThemeStyleID; - if (R.id.item_depththeme == item.getItemId()) { - nThemeStyleID = AESThemeBean.getThemeStyleID(AESThemeBean.ThemeType.DEPTH); - saveThemeStyleID(activity, nThemeStyleID); - return true; - } else if (R.id.item_skytheme == item.getItemId()) { - nThemeStyleID = AESThemeBean.getThemeStyleID(AESThemeBean.ThemeType.SKY); - saveThemeStyleID(activity, nThemeStyleID); - return true; - } else if (R.id.item_goldentheme == item.getItemId()) { - nThemeStyleID = AESThemeBean.getThemeStyleID(AESThemeBean.ThemeType.GOLDEN); - saveThemeStyleID(activity, nThemeStyleID); - return true; - } else if (R.id.item_bearingtheme == item.getItemId()) { - nThemeStyleID = AESThemeBean.getThemeStyleID(AESThemeBean.ThemeType.BEARING); - saveThemeStyleID(activity, nThemeStyleID); - return true; - } else if (R.id.item_memortheme == item.getItemId()) { - nThemeStyleID = AESThemeBean.getThemeStyleID(AESThemeBean.ThemeType.MEMOR); - saveThemeStyleID(activity, nThemeStyleID); - return true; - } else if (R.id.item_taotheme == item.getItemId()) { - nThemeStyleID = AESThemeBean.getThemeStyleID(AESThemeBean.ThemeType.TAO); - saveThemeStyleID(activity, nThemeStyleID); - return true; - } else if (R.id.item_defaulttheme == item.getItemId()) { - nThemeStyleID = AESThemeBean.getThemeStyleID(AESThemeBean.ThemeType.AES); - saveThemeStyleID(activity, nThemeStyleID); - return true; - } - - return false; + // 对外暴露不同 Activity 类型的入口,内部调用统一核心方法 + public static boolean onThemeItemSelected(Activity activity, MenuItem item) { + return handleThemeMenuClick(activity, item); } - public static boolean onWinBoLLThemeItemSelected(T activity, MenuItem item) { - int nThemeStyleID; - if (R.id.item_depththeme == item.getItemId()) { - nThemeStyleID = AESThemeBean.getThemeStyleID(AESThemeBean.ThemeType.DEPTH); - saveThemeStyleID(activity.getApplicationContext(), nThemeStyleID); - return true; - } else if (R.id.item_skytheme == item.getItemId()) { - nThemeStyleID = AESThemeBean.getThemeStyleID(AESThemeBean.ThemeType.SKY); - saveThemeStyleID(activity.getApplicationContext(), nThemeStyleID); - return true; - } else if (R.id.item_goldentheme == item.getItemId()) { - nThemeStyleID = AESThemeBean.getThemeStyleID(AESThemeBean.ThemeType.GOLDEN); - saveThemeStyleID(activity.getApplicationContext(), nThemeStyleID); - return true; - } else if (R.id.item_bearingtheme == item.getItemId()) { - nThemeStyleID = AESThemeBean.getThemeStyleID(AESThemeBean.ThemeType.BEARING); - saveThemeStyleID(activity.getApplicationContext(), nThemeStyleID); - return true; - } else if (R.id.item_memortheme == item.getItemId()) { - nThemeStyleID = AESThemeBean.getThemeStyleID(AESThemeBean.ThemeType.MEMOR); - saveThemeStyleID(activity.getApplicationContext(), nThemeStyleID); - return true; - } else if (R.id.item_taotheme == item.getItemId()) { - nThemeStyleID = AESThemeBean.getThemeStyleID(AESThemeBean.ThemeType.TAO); - saveThemeStyleID(activity.getApplicationContext(), nThemeStyleID); - return true; - } else if (R.id.item_defaulttheme == item.getItemId()) { - nThemeStyleID = AESThemeBean.getThemeStyleID(AESThemeBean.ThemeType.AES); - saveThemeStyleID(activity.getApplicationContext(), nThemeStyleID); - return true; - } - - return false; + public static boolean onAppCompatThemeItemSelected(AppCompatActivity activity, MenuItem item) { + return handleThemeMenuClick(activity, item); } - public static boolean onWinBoLLThemeItemSelected(T activity, MenuItem item) { - int nThemeStyleID; - if (R.id.item_depththeme == item.getItemId()) { - nThemeStyleID = AESThemeBean.getThemeStyleID(AESThemeBean.ThemeType.DEPTH); - saveThemeStyleID(activity.getApplicationContext(), nThemeStyleID); - return true; - } else if (R.id.item_skytheme == item.getItemId()) { - nThemeStyleID = AESThemeBean.getThemeStyleID(AESThemeBean.ThemeType.SKY); - saveThemeStyleID(activity.getApplicationContext(), nThemeStyleID); - return true; - } else if (R.id.item_goldentheme == item.getItemId()) { - nThemeStyleID = AESThemeBean.getThemeStyleID(AESThemeBean.ThemeType.GOLDEN); - saveThemeStyleID(activity.getApplicationContext(), nThemeStyleID); - return true; - } else if (R.id.item_bearingtheme == item.getItemId()) { - nThemeStyleID = AESThemeBean.getThemeStyleID(AESThemeBean.ThemeType.BEARING); - saveThemeStyleID(activity.getApplicationContext(), nThemeStyleID); - return true; - } else if (R.id.item_memortheme == item.getItemId()) { - nThemeStyleID = AESThemeBean.getThemeStyleID(AESThemeBean.ThemeType.MEMOR); - saveThemeStyleID(activity.getApplicationContext(), nThemeStyleID); - return true; - } else if (R.id.item_taotheme == item.getItemId()) { - nThemeStyleID = AESThemeBean.getThemeStyleID(AESThemeBean.ThemeType.TAO); - saveThemeStyleID(activity.getApplicationContext(), nThemeStyleID); - return true; - } else if (R.id.item_defaulttheme == item.getItemId()) { - nThemeStyleID = AESThemeBean.getThemeStyleID(AESThemeBean.ThemeType.AES); - saveThemeStyleID(activity.getApplicationContext(), nThemeStyleID); - return true; - } + public static boolean onWinBoLLThemeItemSelected(AppCompatActivity activity, MenuItem item) { + // 使用 Application 上下文保存,避免 Activity 泄漏 + return handleThemeMenuClick(activity.getApplicationContext(), item); + } - return false; + public static boolean onWinBoLLThemeItemSelected(DrawerFragmentActivity activity, MenuItem item) { + return handleThemeMenuClick(activity.getApplicationContext(), item); + } + + // ====================== 主题类型转换工具 ====================== + /** + * 根据枚举获取对应样式ID + */ + public static int getThemeStyleID(AESThemeBean.ThemeType themeType) { + return themeStyleIDList.get(themeType.ordinal()); + } + + /** + * 根据样式ID反向获取主题枚举 + */ + public static AESThemeBean.ThemeType getThemeStyleType(int themeStyleID) { + for (int i = 0; i < themeStyleIDList.size(); i++) { + if (themeStyleIDList.get(i) == themeStyleID) { + return AESThemeBean.ThemeType.values()[i]; + } + } + return AESThemeBean.ThemeType.values()[0]; } } + diff --git a/libaes/src/main/res/values-night/colors.xml b/libaes/src/main/res/values-night/colors.xml index 06857dc..77b7b0a 100644 --- a/libaes/src/main/res/values-night/colors.xml +++ b/libaes/src/main/res/values-night/colors.xml @@ -3,15 +3,15 @@ #FFFFFFFF #FF03AB4E - #FF027C39 - #FF3DDC84 + #FF3DDC84 + #FF027C39 #FFFFFB8D - #FFA9A9A9 + #FF555555 #FF000000 - #FFFFFFFF - #FF7D3F12 - #FFCC6E2B - #FFF4B98F + #FF3A3A3A + #FF5A3A1A + #FFA05A2A + #FFD4A07A @color/colorPrimaryDark @color/colorPrimary @@ -24,7 +24,7 @@ @color/colorPrimary @color/colorPrimaryDark - #FF03AB4E + #FF3DDC84 #FFFFFFFF #FF2C2C2C #FFFFFFFF diff --git a/libaes/src/main/res/values-night/styles.xml b/libaes/src/main/res/values-night/styles.xml index 020baff..c660e53 100644 --- a/libaes/src/main/res/values-night/styles.xml +++ b/libaes/src/main/res/values-night/styles.xml @@ -2,6 +2,9 @@ - \ No newline at end of file + diff --git a/libappbase/build.properties b/libappbase/build.properties index f2d536c..a3eae15 100644 --- a/libappbase/build.properties +++ b/libappbase/build.properties @@ -1,8 +1,8 @@ #Created by .winboll/winboll_app_build.gradle -#Sun May 24 09:53:05 HKT 2026 -stageCount=22 +#Wed Jun 03 06:52:38 HKT 2026 +stageCount=26 libraryProject=libappbase baseVersion=15.20 -publishVersion=15.20.21 +publishVersion=15.20.25 buildCount=0 -baseBetaVersion=15.20.22 +baseBetaVersion=15.20.26 diff --git a/libappbase/src/main/java/cc/winboll/studio/libappbase/CrashHandler.java b/libappbase/src/main/java/cc/winboll/studio/libappbase/CrashHandler.java index bfdcf5f..dcd0aa9 100644 --- a/libappbase/src/main/java/cc/winboll/studio/libappbase/CrashHandler.java +++ b/libappbase/src/main/java/cc/winboll/studio/libappbase/CrashHandler.java @@ -263,7 +263,7 @@ public final class CrashHandler { setContentView(contentView); getActionBar().setTitle(TITTLE); - getActionBar().setSubtitle(GlobalApplication.class.getSimpleName() + " Error"); + getActionBar().setSubtitle(GlobalApplication.getAppName(getApplicationContext()) + " Error"); } @Override diff --git a/libappbase/src/main/java/cc/winboll/studio/libappbase/GlobalApplication.java b/libappbase/src/main/java/cc/winboll/studio/libappbase/GlobalApplication.java index e03ac72..05df241 100644 --- a/libappbase/src/main/java/cc/winboll/studio/libappbase/GlobalApplication.java +++ b/libappbase/src/main/java/cc/winboll/studio/libappbase/GlobalApplication.java @@ -6,6 +6,10 @@ import android.content.SharedPreferences; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; +import android.util.Log; +import cc.winboll.studio.libappbase.utils.CrashHandleNotifyUtils; +import java.io.PrintWriter; +import java.io.StringWriter; /** * @Author ZhanGSKen&豆包大模型 @@ -125,17 +129,32 @@ public class GlobalApplication extends Application { */ @Override public void onCreate() { - super.onCreate(); - // 初始化单例实例(确保在所有初始化操作前完成) - sInstance = this; + try { + super.onCreate(); + + // 初始化单例实例(确保在所有初始化操作前完成) + sInstance = this; - restoreDebugStatus(); - // 初始化基础组件(日志、崩溃处理、Toast) - initCoreComponents(); - // 初始化服务器地址(从 SP 读取到内存,提高后续访问效率) - initWinbollHost(); + restoreDebugStatus(); + // 初始化基础组件(日志、崩溃处理、Toast) + initCoreComponents(); + // 初始化服务器地址(从 SP 读取到内存,提高后续访问效率) + initWinbollHost(); - LogUtils.d(TAG, "GlobalApplication 初始化完成,单例实例已创建"); + LogUtils.d(TAG, "GlobalApplication 初始化完成,单例实例已创建"); + } catch (Throwable e) { + StringWriter sw = new StringWriter(); + PrintWriter pw = new PrintWriter(sw); + e.printStackTrace(pw); + pw.close(); + String stackTraceStr = sw.toString(); + CrashHandleNotifyUtils.handleUncaughtException( + this, + getPackageName(), + stackTraceStr, + CrashHandler.CrashActivity.class + ); + } } /** @@ -190,7 +209,7 @@ public class GlobalApplication extends Application { */ public static String getAppName(Context context) { if (context == null) { - LogUtils.w(TAG, "getAppName: 上下文为空,返回 null"); + Log.w(TAG, "getAppName: 上下文为空,返回 null"); return null; } PackageManager packageManager = context.getPackageManager(); @@ -206,8 +225,7 @@ public class GlobalApplication extends Application { return appName; } catch (NameNotFoundException e) { // 包名不存在(理论上不会发生,捕获异常避免崩溃) - LogUtils.d(TAG, e, Thread.currentThread().getStackTrace()); - //LogUtils.e(TAG, "获取应用名称失败:包名不存在", e); + Log.e(TAG, "获取应用名称失败:包名不存在", e); e.printStackTrace(); } return null; diff --git a/libappbase/src/main/java/cc/winboll/studio/libappbase/views/DebugSwitchInfoImageView.java b/libappbase/src/main/java/cc/winboll/studio/libappbase/views/DebugSwitchInfoImageView.java index 72679ed..6c03ff2 100644 --- a/libappbase/src/main/java/cc/winboll/studio/libappbase/views/DebugSwitchInfoImageView.java +++ b/libappbase/src/main/java/cc/winboll/studio/libappbase/views/DebugSwitchInfoImageView.java @@ -59,7 +59,7 @@ public class DebugSwitchInfoImageView extends ImageView { final AlertDialog dialog = new AlertDialog.Builder(getContext()).create(); dialog.setTitle("调试Token"); dialog.setMessage(getDebugToken()); - dialog.setCanceledOnTouchOutside(true); + dialog.setCanceledOnTouchOutside(false); dialog.setButton(DialogInterface.BUTTON_POSITIVE, "复制到剪贴板", (DialogInterface.OnClickListener) null); dialog.setButton(DialogInterface.BUTTON_NEUTRAL, "重置", (DialogInterface.OnClickListener) null); dialog.setButton(DialogInterface.BUTTON_NEGATIVE, "关闭", (DialogInterface.OnClickListener) null); diff --git a/libwinboll/.gitignore b/libwinboll/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/libwinboll/.gitignore @@ -0,0 +1 @@ +/build diff --git a/libwinboll/build.gradle b/libwinboll/build.gradle new file mode 100644 index 0000000..a2eece2 --- /dev/null +++ b/libwinboll/build.gradle @@ -0,0 +1,55 @@ +apply plugin: 'com.android.library' +apply plugin: 'maven-publish' +apply from: '../.winboll/winboll_lib_build.gradle' +apply from: '../.winboll/winboll_lint_build.gradle' + +android { + // 适配MIUI12 + compileSdkVersion 30 + buildToolsVersion "30.0.3" + + defaultConfig { + minSdkVersion 26 + targetSdkVersion 30 + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_7 + targetCompatibility JavaVersion.VERSION_1_7 + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + // 网络连接类库 + api 'com.squareup.okhttp3:okhttp:4.4.1' + // Gson + api 'com.google.code.gson:gson:2.8.9' + // Html 解析 + api 'org.jsoup:jsoup:1.13.1' + // 添加JSch依赖(SFTP核心,com.jcraft:jsch:0.1.54) + api 'com.jcraft:jsch:0.1.54' + + // 米盟 + api 'com.miui.zeus:mimo-ad-sdk:5.3.+'//请使用最新版sdk + //注意:以下5个库必须要引入 + //implementation 'androidx.appcompat:appcompat:1.4.1' + api 'androidx.recyclerview:recyclerview:1.0.0' + api 'com.google.code.gson:gson:2.8.5' + api 'com.github.bumptech.glide:glide:4.9.0' + //annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0' + + // WinBoLL库 nexus.winboll.cc 地址 + api 'cc.winboll.studio:libappbase:15.20.25' + api 'cc.winboll.studio:libaes:15.20.14' + + // 备用库 jitpack.io 地址 + //api 'com.github.ZhanGSKen:libappbase:appbase-v15.20.25' + //api 'com.github.ZhanGSKen:libaes:aes-v15.20.14' + + api fileTree(dir: 'libs', include: ['*.jar']) +} diff --git a/libwinboll/build.properties b/libwinboll/build.properties new file mode 100644 index 0000000..0c9fce3 --- /dev/null +++ b/libwinboll/build.properties @@ -0,0 +1,8 @@ +#Created by .winboll/winboll_app_build.gradle +#Wed Jun 03 07:32:48 HKT 2026 +stageCount=8 +libraryProject=libwinboll +baseVersion=15.20 +publishVersion=15.20.7 +buildCount=0 +baseBetaVersion=15.20.8 diff --git a/libwinboll/proguard-rules.pro b/libwinboll/proguard-rules.pro new file mode 100644 index 0000000..536058a --- /dev/null +++ b/libwinboll/proguard-rules.pro @@ -0,0 +1,17 @@ +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in C:/tools/adt-bundle-windows-x86_64-20131030/sdk/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the proguardFiles +# directive in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} diff --git a/libwinboll/src/main/AndroidManifest.xml b/libwinboll/src/main/AndroidManifest.xml new file mode 100644 index 0000000..2323080 --- /dev/null +++ b/libwinboll/src/main/AndroidManifest.xml @@ -0,0 +1,12 @@ + + + + + + + + + + diff --git a/libwinboll/src/main/java/cc/winboll/studio/libwinboll/WinBoLLLibraryActivity.java b/libwinboll/src/main/java/cc/winboll/studio/libwinboll/WinBoLLLibraryActivity.java new file mode 100644 index 0000000..bb86ae9 --- /dev/null +++ b/libwinboll/src/main/java/cc/winboll/studio/libwinboll/WinBoLLLibraryActivity.java @@ -0,0 +1,17 @@ +package cc.winboll.studio.libwinboll; + +import android.app.Activity; +import android.os.Bundle; +import cc.winboll.studio.libappbase.ToastUtils; + +public class WinBoLLLibraryActivity extends Activity +{ + @Override + protected void onCreate(Bundle savedInstanceState) + { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_winbolllibrary); + + ToastUtils.show("WinBoLLLibraryActivity onCreate"); + } +} diff --git a/libwinboll/src/main/res/drawable-hdpi/ic_launcher.png b/libwinboll/src/main/res/drawable-hdpi/ic_launcher.png new file mode 100644 index 0000000..96a442e Binary files /dev/null and b/libwinboll/src/main/res/drawable-hdpi/ic_launcher.png differ diff --git a/libwinboll/src/main/res/drawable-mdpi/ic_launcher.png b/libwinboll/src/main/res/drawable-mdpi/ic_launcher.png new file mode 100644 index 0000000..359047d Binary files /dev/null and b/libwinboll/src/main/res/drawable-mdpi/ic_launcher.png differ diff --git a/libwinboll/src/main/res/drawable-xhdpi/ic_launcher.png b/libwinboll/src/main/res/drawable-xhdpi/ic_launcher.png new file mode 100644 index 0000000..71c6d76 Binary files /dev/null and b/libwinboll/src/main/res/drawable-xhdpi/ic_launcher.png differ diff --git a/libwinboll/src/main/res/drawable-xxhdpi/ic_launcher.png b/libwinboll/src/main/res/drawable-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..4df1894 Binary files /dev/null and b/libwinboll/src/main/res/drawable-xxhdpi/ic_launcher.png differ diff --git a/libwinboll/src/main/res/layout/activity_winbolllibrary.xml b/libwinboll/src/main/res/layout/activity_winbolllibrary.xml new file mode 100644 index 0000000..97dc11a --- /dev/null +++ b/libwinboll/src/main/res/layout/activity_winbolllibrary.xml @@ -0,0 +1,11 @@ + + + + + diff --git a/libwinboll/src/main/res/values-v21/styles.xml b/libwinboll/src/main/res/values-v21/styles.xml new file mode 100644 index 0000000..0948fdc --- /dev/null +++ b/libwinboll/src/main/res/values-v21/styles.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/libwinboll/src/main/res/values/strings.xml b/libwinboll/src/main/res/values/strings.xml new file mode 100644 index 0000000..b677aa6 --- /dev/null +++ b/libwinboll/src/main/res/values/strings.xml @@ -0,0 +1,7 @@ + + + + libwinboll + Hello world! + + diff --git a/libwinboll/src/main/res/values/styles.xml b/libwinboll/src/main/res/values/styles.xml new file mode 100644 index 0000000..8d78246 --- /dev/null +++ b/libwinboll/src/main/res/values/styles.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/winboll/README.md b/winboll/README.md new file mode 100644 index 0000000..afbaba5 --- /dev/null +++ b/winboll/README.md @@ -0,0 +1,37 @@ +# WinBoLL + +#### 介绍 +WinBoLL 网站浏览器。 + +#### 软件架构 +适配安卓应用 [AIDE Pro] 的 Gradle 编译结构。 +也适配安卓应用 [AndroidIDE] 的 Gradle 编译结构。 + + +#### Gradle 编译说明 +调试版编译命令 :gradle assembleBetaDebug +阶段版编译命令 :bash .winboll/bashPublishAPKAddTag.sh winboll + +#### 使用说明 +3. Termux应用配置: +- 已安装Termux(包名 com.termux ); +- 执行  echo "allow-external-apps = true" > ~/.termux/termux.properties + +#### 参与贡献 + +1. Fork 本仓库 +2. 新建 Feat_xxx 分支 +3. 提交代码 : ZhanGSKen(ZhanGSKen) +4. 新建 Pull Request + + +#### 特技 + +1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md +2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com) +3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目 +4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目 +5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) +6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) + +#### 参考文档 diff --git a/winboll/app_update_description.txt b/winboll/app_update_description.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/winboll/app_update_description.txt @@ -0,0 +1 @@ + diff --git a/winboll/build.gradle b/winboll/build.gradle new file mode 100644 index 0000000..15cc45d --- /dev/null +++ b/winboll/build.gradle @@ -0,0 +1,119 @@ +apply plugin: 'com.android.application' +apply from: '../.winboll/winboll_app_build.gradle' +apply from: '../.winboll/winboll_lint_build.gradle' + +def genVersionName(def versionName){ + // 检查编译标志位配置 + assert (winbollBuildProps['stageCount'] != null) + assert (winbollBuildProps['baseVersion'] != null) + // 保存基础版本号 + winbollBuildProps.setProperty("baseVersion", "${versionName}"); + //保存编译标志配置 + FileOutputStream fos = new FileOutputStream(winbollBuildPropsFile) + winbollBuildProps.store(fos, "${winbollBuildPropsDesc}"); + fos.close(); + + // 返回编译版本号 + return "${versionName}." + winbollBuildProps['stageCount'] +} + +android { + // 适配MIUI12 + compileSdkVersion 30 + buildToolsVersion "30.0.3" + + defaultConfig { + applicationId "cc.winboll.studio.winboll" + minSdkVersion 26 + // 适配MIUI12 + targetSdkVersion 30 + versionCode 1 + // versionName 更新后需要手动设置 + // .winboll/winbollBuildProps.properties 文件的 stageCount=0 + // Gradle编译环境下合起来的 versionName 就是 "${versionName}.0" + versionName "15.20" + if(true) { + versionName = genVersionName("${versionName}") + } + } + + // 米盟 SDK + packagingOptions { + doNotStrip "*/*/libmimo_1011.so" + } + + sourceSets { + main { + jniLibs.srcDirs = ['libs'] // 若SO库放在libs目录下 + } + } +} + +dependencies { + api project(':libwinboll') + api 'com.google.code.gson:gson:2.10.1' + + // 下拉控件 + api 'com.baoyz.pullrefreshlayout:library:1.2.0' + + // SSH + api 'com.jcraft:jsch:0.1.55' + // Html 解析 + api 'org.jsoup:jsoup:1.13.1' + // 二维码类库 + api 'com.google.zxing:core:3.4.1' + api 'com.journeyapps:zxing-android-embedded:3.6.0' + // 应用介绍页类库 + api 'io.github.medyo:android-about-page:2.0.0' + // 网络连接类库 + api 'com.squareup.okhttp3:okhttp:4.4.1' + // FastJSON解析 + implementation 'com.alibaba:fastjson:1.2.76' + + // AndroidX 类库 + /*api 'androidx.appcompat:appcompat:1.1.0' + //api 'com.google.android.material:material:1.4.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.miui.zeus:mimo-ad-sdk:5.3.+'//请使用最新版sdk + //注意:以下5个库必须要引入 + //implementation 'androidx.appcompat:appcompat:1.4.1' + api 'androidx.recyclerview:recyclerview:1.0.0' + api 'com.github.bumptech.glide:glide:4.9.0' + //annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0' + + implementation "androidx.annotation:annotation:1.3.0" + implementation "androidx.core:core:1.6.0" + implementation "androidx.drawerlayout:drawerlayout:1.1.1" + implementation "androidx.preference:preference:1.1.1" + implementation "androidx.viewpager:viewpager:1.0.0" + implementation "com.google.android.material:material:1.4.0" + implementation "com.google.guava:guava:24.1-jre" + /* + implementation "io.noties.markwon:core:$markwonVersion" + implementation "io.noties.markwon:ext-strikethrough:$markwonVersion" + implementation "io.noties.markwon:linkify:$markwonVersion" + implementation "io.noties.markwon:recycler:$markwonVersion" + */ + implementation 'com.termux:terminal-emulator:0.118.0' + implementation 'com.termux:terminal-view:0.118.0' + implementation 'com.termux:termux-shared:0.118.0' + + // Biometric (指纹识别) + implementation 'androidx.biometric:biometric:1.1.0' + + // WinBoLL库 nexus.winboll.cc 地址 + api 'cc.winboll.studio:libappbase:15.20.25' + api 'cc.winboll.studio:libaes:15.20.14' + + // 备用库 jitpack.io 地址 + //api 'com.github.ZhanGSKen:libappbase:appbase-v15.20.25' + //api 'com.github.ZhanGSKen:libaes:aes-v15.20.14' + + api fileTree(dir: 'libs', include: ['*.jar']) +} diff --git a/winboll/build.properties b/winboll/build.properties new file mode 100644 index 0000000..0c9fce3 --- /dev/null +++ b/winboll/build.properties @@ -0,0 +1,8 @@ +#Created by .winboll/winboll_app_build.gradle +#Wed Jun 03 07:32:48 HKT 2026 +stageCount=8 +libraryProject=libwinboll +baseVersion=15.20 +publishVersion=15.20.7 +buildCount=0 +baseBetaVersion=15.20.8 diff --git a/winboll/libs/libWeWorkSpecSDK.so b/winboll/libs/libWeWorkSpecSDK.so new file mode 100644 index 0000000..d9f592b Binary files /dev/null and b/winboll/libs/libWeWorkSpecSDK.so differ diff --git a/winboll/proguard-rules.pro b/winboll/proguard-rules.pro new file mode 100644 index 0000000..a18de74 --- /dev/null +++ b/winboll/proguard-rules.pro @@ -0,0 +1,137 @@ +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in C:\tools\adt-bundle-windows-x86_64-20131030\sdk/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the proguardFiles +# directive in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# ============================== 基础通用规则 ============================== +# 保留系统组件 +-keep public class * extends android.app.Activity +-keep public class * extends android.app.Service +-keep public class * extends android.content.BroadcastReceiver +-keep public class * extends android.content.ContentProvider +-keep public class * extends android.app.backup.BackupAgentHelper +-keep public class * extends android.preference.Preference + +# 保留 WinBoLL 核心包及子类(合并简化规则) +-keep class cc.winboll.studio.** { *; } +-keepclassmembers class cc.winboll.studio.** { *; } + +# 保留所有类中的 public static final String TAG 字段(便于日志定位) +-keepclassmembers class * { + public static final java.lang.String TAG; +} + +# 保留序列化类(避免Parcelable/Gson解析异常) +-keep class * implements android.os.Parcelable { + public static final android.os.Parcelable$Creator *; +} +-keepclassmembers class * implements java.io.Serializable { + static final long serialVersionUID; + private static final java.io.ObjectStreamField[] serialPersistentFields; + private void writeObject(java.io.ObjectOutputStream); + private void readObject(java.io.ObjectInputStream); + java.lang.Object writeReplace(); + java.lang.Object readResolve(); +} + +# 保留 R 文件(避免资源ID混淆) +-keepclassmembers class **.R$* { + public static ; +} + +# 保留 native 方法(避免JNI调用失败) +-keepclasseswithmembernames class * { + native ; +} + +# 保留注解和泛型(避免反射/序列化异常) +-keepattributes *Annotation* +-keepattributes Signature + +# 屏蔽 Java 8+ 警告(适配 Java 7 语法) +-dontwarn java.lang.invoke.* +-dontwarn android.support.v8.renderscript.* +-dontwarn java.util.function.** + +# ============================== 第三方框架专项规则 ============================== +# OkHttp 4.4.1(米盟广告请求依赖,完善Lambda兼容) +-keep class okhttp3.** { *; } +-keep interface okhttp3.** { *; } +-keep class okhttp3.internal.** { *; } +-keep class okio.** { *; } +-dontwarn okhttp3.internal.platform.** +-dontwarn okio.** + +# Glide 4.9.0(米盟广告图片加载依赖) +-keep public class * implements com.bumptech.glide.module.GlideModule +-keep public class * extends com.bumptech.glide.module.AppGlideModule +-keep public enum com.bumptech.glide.load.ImageHeaderParser$ImageType { + **[] $VALUES; + public *; +} +-keepclassmembers class * implements com.bumptech.glide.module.AppGlideModule { + (); +} +-dontwarn com.bumptech.glide.** + +# Gson 2.8.5(米盟广告数据序列化依赖) +-keep class com.google.gson.** { *; } +-keep interface com.google.gson.** { *; } +-keepclassmembers class * { + @com.google.gson.annotations.SerializedName ; +} + +# 米盟 SDK(核心广告组件,完整保留避免加载失败) +-keep class com.miui.zeus.** { *; } +-keep interface com.miui.zeus.** { *; } +# 保留米盟日志字段(便于广告加载失败排查) +-keepclassmembers class com.miui.zeus.mimo.sdk.** { + public static final java.lang.String TAG; +} + +# RecyclerView 1.0.0(米盟广告布局渲染依赖) +-keep class androidx.recyclerview.** { *; } +-keep interface androidx.recyclerview.** { *; } +-keepclassmembers class androidx.recyclerview.widget.RecyclerView$Adapter { + public *; +} + +# 其他第三方框架(按引入依赖保留,无则可删除) +# XXPermissions 18.63 +-keep class com.hjq.permissions.** { *; } +-keep interface com.hjq.permissions.** { *; } + +# ZXing 二维码(核心解析组件) +-keep class com.google.zxing.** { *; } +-keep class com.journeyapps.zxing.** { *; } + +# Jsoup HTML解析 +-keep class org.jsoup.** { *; } + +# Pinyin4j 拼音搜索 +-keep class net.sourceforge.pinyin4j.** { *; } + +# JSch SSH组件 +-keep class com.jcraft.jsch.** { *; } + +# AndroidX 基础组件 +-keep class androidx.appcompat.** { *; } +-keep interface androidx.appcompat.** { *; } + +# ============================== 优化与调试配置 ============================== +# 优化级别(平衡混淆效果与性能) +-optimizationpasses 5 +-optimizations !code/simplification/arithmetic,!code/simplification/cast,!field/*,!class/merging/* + +# 调试辅助(保留行号便于崩溃定位) +-verbose +-dontpreverify +-dontusemixedcaseclassnames +-keepattributes SourceFile,LineNumberTable + diff --git a/winboll/src/beta/AndroidManifest.xml b/winboll/src/beta/AndroidManifest.xml new file mode 100644 index 0000000..be35225 --- /dev/null +++ b/winboll/src/beta/AndroidManifest.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + diff --git a/winboll/src/beta/java/cc/winboll/studio/winboll/activities/OllamaWindowActivity.java b/winboll/src/beta/java/cc/winboll/studio/winboll/activities/OllamaWindowActivity.java new file mode 100644 index 0000000..07b804d --- /dev/null +++ b/winboll/src/beta/java/cc/winboll/studio/winboll/activities/OllamaWindowActivity.java @@ -0,0 +1,32 @@ +package cc.winboll.studio.winboll.activities; + +import android.os.Bundle; +import android.view.Menu; +import android.view.MenuItem; + +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.Toolbar; + +import cc.winboll.studio.winboll.R; + +/** + * Ollama 模型对话窗口 + */ +public class OllamaWindowActivity extends AppCompatActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_ollama_window); + + Toolbar toolbar = findViewById(R.id.toolbar); + setSupportActionBar(toolbar); + getSupportActionBar().setTitle("Ollama 窗口"); + } + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + getMenuInflater().inflate(R.menu.menu_ollama_window, menu); + return true; + } +} diff --git a/winboll/src/beta/res/layout/activity_ollama_window.xml b/winboll/src/beta/res/layout/activity_ollama_window.xml new file mode 100644 index 0000000..86f97cd --- /dev/null +++ b/winboll/src/beta/res/layout/activity_ollama_window.xml @@ -0,0 +1,140 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +