mirror of
https://gitea.winboll.cc/ZhanGSKen/MyWinBoLL.git
synced 2026-08-14 13:37:11 +08:00
适配远程 AAR 15.20.x API 并移除广告组件
- 升级 libaes 15.15.2 -> 15.20.16, libappbase 15.15.11 -> 15.20.33 - 提升 minSdkVersion 21 -> 26 - 移除米盟广告 SDK (mimo-ad-sdk) 及其 packagingOptions/proguard 规则 - 移除 ADsBannerView 及 ADsControlView 相关代码与布局 - 删除 view_ads_banner.xml - 修复 BaseBean 导入路径: cc.winboll.studio.libappbase.BaseBean -> cc.winboll.studio.libappbase.models.libs1520000.BaseBean (5 model类) - 修复 AESThemeUtil 方法名: inflateMenu -> inflateThemeMenu, onAppThemeItemSelected -> onThemeItemSelected - 修复 AESThemeUtil.getThemeStyleID 崩溃(IndexOutOfBoundsException), 在 WinBoLLActivity.onCreate 中提前调用 initAESThemeStyles() - 移除 App.onCreate 中的 setIsDebugging(BuildConfig.DEBUG)
This commit is contained in:
@@ -24,7 +24,7 @@ android {
|
||||
|
||||
defaultConfig {
|
||||
applicationId "cc.winboll.studio.powerbell"
|
||||
minSdkVersion 21
|
||||
minSdkVersion 26
|
||||
targetSdkVersion 30
|
||||
versionCode 7
|
||||
// versionName 更新后需要手动设置
|
||||
@@ -36,16 +36,11 @@ android {
|
||||
}
|
||||
}
|
||||
|
||||
// 米盟 SDK
|
||||
packagingOptions {
|
||||
doNotStrip "*/*/libmimo_1011.so"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
// 米盟
|
||||
api 'com.miui.zeus:mimo-ad-sdk:5.3.+'//请使用最新版sdk
|
||||
//注意:以下5个库必须要引入
|
||||
//api 'androidx.appcompat:appcompat:1.4.1'
|
||||
api 'androidx.recyclerview:recyclerview:1.0.0'
|
||||
@@ -80,8 +75,8 @@ dependencies {
|
||||
//api 'androidx.fragment:fragment:1.1.0'
|
||||
|
||||
// WinBoLL库 nexus.winboll.cc 地址
|
||||
api 'cc.winboll.studio:libaes:15.15.2'
|
||||
api 'cc.winboll.studio:libappbase:15.15.11'
|
||||
api 'cc.winboll.studio:libaes:15.20.16'
|
||||
api 'cc.winboll.studio:libappbase:15.20.33'
|
||||
|
||||
// WinBoLL备用库 jitpack.io 地址
|
||||
//api 'com.github.ZhanGSKen:AES:aes-v15.15.2'
|
||||
|
||||
Vendored
+1
-9
@@ -93,15 +93,7 @@
|
||||
@com.google.gson.annotations.SerializedName <fields>;
|
||||
}
|
||||
|
||||
# 米盟 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(米盟广告布局渲染依赖)
|
||||
# RecyclerView 1.0.0
|
||||
-keep class androidx.recyclerview.** { *; }
|
||||
-keep interface androidx.recyclerview.** { *; }
|
||||
-keepclassmembers class androidx.recyclerview.widget.RecyclerView$Adapter {
|
||||
|
||||
@@ -175,10 +175,9 @@ public class App extends GlobalApplication {
|
||||
super.onCreate();
|
||||
LogUtils.d(TAG, "【onCreate】应用启动生命周期方法调用 | 开始初始化应用...");
|
||||
|
||||
// 初始化应用单例与调试模式
|
||||
// 初始化应用单例
|
||||
sApp = this;
|
||||
setIsDebugging(BuildConfig.DEBUG);
|
||||
LogUtils.d(TAG, "【onCreate】应用单例已初始化 | 调试模式:" + BuildConfig.DEBUG);
|
||||
LogUtils.d(TAG, "【onCreate】应用单例已初始化");
|
||||
|
||||
// 初始化核心组件
|
||||
initBaseTools();
|
||||
|
||||
@@ -11,13 +11,13 @@ import android.view.KeyEvent;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewStub;
|
||||
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import cc.winboll.studio.libaes.models.APPInfo;
|
||||
import cc.winboll.studio.libaes.utils.AESThemeUtil;
|
||||
import cc.winboll.studio.libaes.utils.DevelopUtils;
|
||||
import cc.winboll.studio.libaes.utils.WinBoLLActivityManager;
|
||||
import cc.winboll.studio.libaes.views.ADsBannerView;
|
||||
|
||||
import cc.winboll.studio.libappbase.LogUtils;
|
||||
import cc.winboll.studio.powerbell.activities.AboutActivity;
|
||||
import cc.winboll.studio.powerbell.activities.BackgroundSettingsActivity;
|
||||
@@ -52,8 +52,6 @@ public class MainActivity extends WinBoLLActivity implements MainContentView.OnV
|
||||
private static final int REQUEST_BACKGROUND_SETTINGS_ACTIVITY = 1001;
|
||||
public static final String EXTRA_ISRELOAD_BACKGROUNDVIEW = "EXTRA_ISRELOAD_BACKGROUNDVIEW";
|
||||
public static final String EXTRA_ISRELOAD_ACCENTCOLOR = "EXTRA_ISRELOAD_ACCENTCOLOR";
|
||||
private static final long DELAY_LOAD_NON_CRITICAL = 500L;
|
||||
|
||||
// Handler 消息常量
|
||||
public static final int MSG_RELOAD_APPCONFIG = 0;
|
||||
public static final int MSG_CURRENTVALUEBATTERY = 1;
|
||||
@@ -77,8 +75,6 @@ public class MainActivity extends WinBoLLActivity implements MainContentView.OnV
|
||||
|
||||
// ======================== 基础视图组件区 =========================
|
||||
private Toolbar mToolbar;
|
||||
private ViewStub mAdsViewStub;
|
||||
private ADsBannerView mADsBannerView;
|
||||
private Drawable mFrameDrawable;
|
||||
private Menu mMenu;
|
||||
|
||||
@@ -104,7 +100,6 @@ public class MainActivity extends WinBoLLActivity implements MainContentView.OnV
|
||||
initMainContentView();
|
||||
initCriticalView();
|
||||
initCoreUtilsAsync();
|
||||
loadNonCriticalViewDelayed();
|
||||
|
||||
// 处理首次启动参数
|
||||
handleReloadBackgroundParam(getIntent());
|
||||
@@ -131,11 +126,6 @@ public class MainActivity extends WinBoLLActivity implements MainContentView.OnV
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
LogUtils.d(TAG, "onResume() 调用");
|
||||
|
||||
if (mADsBannerView != null) {
|
||||
mADsBannerView.resumeADs(this);
|
||||
LogUtils.d(TAG, "onResume: 广告视图已恢复");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -149,12 +139,6 @@ public class MainActivity extends WinBoLLActivity implements MainContentView.OnV
|
||||
super.onDestroy();
|
||||
LogUtils.d(TAG, "onDestroy() 调用");
|
||||
|
||||
// 释放广告资源
|
||||
if (mADsBannerView != null) {
|
||||
mADsBannerView.releaseAdResources();
|
||||
mADsBannerView = null;
|
||||
LogUtils.d(TAG, "onDestroy: 广告资源已释放");
|
||||
}
|
||||
// 释放核心视图
|
||||
if (mMainContentView != null) {
|
||||
mMainContentView.releaseResources();
|
||||
@@ -182,7 +166,6 @@ public class MainActivity extends WinBoLLActivity implements MainContentView.OnV
|
||||
mMenu = null;
|
||||
mApplication = null;
|
||||
mToolbar = null;
|
||||
mAdsViewStub = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -202,7 +185,7 @@ public class MainActivity extends WinBoLLActivity implements MainContentView.OnV
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
LogUtils.d(TAG, "onCreateOptionsMenu() 调用 | menu: " + menu);
|
||||
mMenu = menu;
|
||||
AESThemeUtil.inflateMenu(this, menu);
|
||||
AESThemeUtil.inflateThemeMenu(this, menu);
|
||||
|
||||
// 调试模式加载测试菜单
|
||||
if (App.isDebugging()) {
|
||||
@@ -218,7 +201,7 @@ public class MainActivity extends WinBoLLActivity implements MainContentView.OnV
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
LogUtils.d(TAG, "onOptionsItemSelected() 调用 | itemId: " + item.getItemId());
|
||||
// 主题切换处理
|
||||
if (AESThemeUtil.onAppThemeItemSelected(this, item)) {
|
||||
if (AESThemeUtil.onThemeItemSelected(this, item)) {
|
||||
recreate();
|
||||
Intent mainIntent = new Intent(MainActivity.this, MainActivity.class);
|
||||
mainIntent.putExtra(MainActivity.EXTRA_ISRELOAD_BACKGROUNDVIEW, true);
|
||||
@@ -346,8 +329,7 @@ public class MainActivity extends WinBoLLActivity implements MainContentView.OnV
|
||||
mToolbar.setTitleTextAppearance(this, R.style.Toolbar_TitleText);
|
||||
LogUtils.d(TAG, "initCriticalView: 工具栏已设置标题样式");
|
||||
}
|
||||
mAdsViewStub = findViewById(R.id.stub_ads_banner);
|
||||
LogUtils.d(TAG, "initCriticalView: 广告ViewStub已获取");
|
||||
LogUtils.d(TAG, "initCriticalView: 工具栏已设置标题样式");
|
||||
}
|
||||
|
||||
private void initCoreUtilsAsync() {
|
||||
@@ -415,20 +397,6 @@ public class MainActivity extends WinBoLLActivity implements MainContentView.OnV
|
||||
}).start();
|
||||
}
|
||||
|
||||
private void loadNonCriticalViewDelayed() {
|
||||
LogUtils.d(TAG, "loadNonCriticalViewDelayed() 调用 | 延迟时长: " + DELAY_LOAD_NON_CRITICAL + "ms");
|
||||
new Handler().postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (isFinishing() || isDestroyed()) {
|
||||
LogUtils.w(TAG, "loadNonCriticalViewDelayed: Activity已销毁,跳过广告加载");
|
||||
return;
|
||||
}
|
||||
loadAdsView();
|
||||
}
|
||||
}, DELAY_LOAD_NON_CRITICAL);
|
||||
}
|
||||
|
||||
// ======================== 视图操作方法区 ========================
|
||||
private void handleReloadBackgroundParam(Intent intent) {
|
||||
LogUtils.d(TAG, "handleReloadBackgroundParam() 调用 | intent: " + intent);
|
||||
@@ -455,21 +423,6 @@ public class MainActivity extends WinBoLLActivity implements MainContentView.OnV
|
||||
mMainContentView.reloadBackgroundView();
|
||||
}
|
||||
|
||||
private void loadAdsView() {
|
||||
LogUtils.d(TAG, "loadAdsView() 调用");
|
||||
if (mAdsViewStub == null) {
|
||||
LogUtils.e(TAG, "loadAdsView: 广告ViewStub为空,加载失败");
|
||||
return;
|
||||
}
|
||||
if (mADsBannerView == null) {
|
||||
View adsView = mAdsViewStub.inflate();
|
||||
mADsBannerView = adsView.findViewById(R.id.adsbanner);
|
||||
LogUtils.d(TAG, "loadAdsView: 广告视图已加载");
|
||||
} else {
|
||||
LogUtils.d(TAG, "loadAdsView: 广告视图已存在,无需重复加载");
|
||||
}
|
||||
}
|
||||
|
||||
private void updateViewData() {
|
||||
LogUtils.d(TAG, "updateViewData() 调用");
|
||||
if (mMainContentView == null || mFrameDrawable == null) {
|
||||
|
||||
@@ -22,6 +22,7 @@ import cc.winboll.studio.libaes.utils.WinBoLLActivityManager;
|
||||
import cc.winboll.studio.libappbase.LogUtils;
|
||||
import cc.winboll.studio.powerbell.BuildConfig;
|
||||
import cc.winboll.studio.powerbell.R;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* @Author ZhanGSKen<zhangsken@qq.com>
|
||||
@@ -50,6 +51,8 @@ public abstract class WinBoLLActivity extends AppCompatActivity implements IWinB
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
LogUtils.d(TAG, String.format("【%s-onCreate】窗口基类初始化开始", getTag()));
|
||||
// 初始化主题样式ID列表(远程AAR要求init先于getThemeTypeID调用)
|
||||
initAESThemeStyles();
|
||||
// 初始化主题
|
||||
mThemeType = getThemeType();
|
||||
setThemeStyle();
|
||||
@@ -82,6 +85,17 @@ public abstract class WinBoLLActivity extends AppCompatActivity implements IWinB
|
||||
}
|
||||
|
||||
// ======================== 主题相关方法 =========================
|
||||
/**
|
||||
* 初始化 AESThemeUtil 内部主题样式ID列表
|
||||
* 远程 AAR 15.20.x 的 AESThemeUtil.getThemeStyleID 依赖此列表进行 ordinal 查找,
|
||||
* 未初始化将导致 IndexOutOfBoundsException
|
||||
*/
|
||||
private void initAESThemeStyles() {
|
||||
ArrayList<Integer> themeStyleIDs = new ArrayList<Integer>();
|
||||
AESThemeBean.fillThemeStyleIDList(themeStyleIDs);
|
||||
AESThemeUtil.init(themeStyleIDs);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前主题类型
|
||||
* @return 主题类型枚举
|
||||
|
||||
@@ -4,7 +4,7 @@ import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.util.JsonReader;
|
||||
import android.util.JsonWriter;
|
||||
import cc.winboll.studio.libappbase.BaseBean;
|
||||
import cc.winboll.studio.libappbase.models.libs1520000.BaseBean;
|
||||
import cc.winboll.studio.libappbase.LogUtils;
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
|
||||
@@ -2,7 +2,7 @@ package cc.winboll.studio.powerbell.models;
|
||||
|
||||
import android.util.JsonReader;
|
||||
import android.util.JsonWriter;
|
||||
import cc.winboll.studio.libappbase.BaseBean;
|
||||
import cc.winboll.studio.libappbase.models.libs1520000.BaseBean;
|
||||
import cc.winboll.studio.libappbase.LogUtils;
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
|
||||
@@ -2,7 +2,7 @@ package cc.winboll.studio.powerbell.models;
|
||||
|
||||
import android.util.JsonReader;
|
||||
import android.util.JsonWriter;
|
||||
import cc.winboll.studio.libappbase.BaseBean;
|
||||
import cc.winboll.studio.libappbase.models.libs1520000.BaseBean;
|
||||
import cc.winboll.studio.libappbase.LogUtils;
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ import android.util.JsonReader;
|
||||
import android.util.JsonWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import cc.winboll.studio.libappbase.BaseBean;
|
||||
import cc.winboll.studio.libappbase.models.libs1520000.BaseBean;
|
||||
import cc.winboll.studio.libappbase.LogUtils;
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ import android.util.JsonWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
|
||||
import cc.winboll.studio.libappbase.BaseBean;
|
||||
import cc.winboll.studio.libappbase.models.libs1520000.BaseBean;
|
||||
import cc.winboll.studio.libappbase.LogUtils;
|
||||
|
||||
/**
|
||||
|
||||
@@ -234,13 +234,6 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ViewStub
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/stub_ads_banner"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout="@layout/view_ads_banner"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
@@ -183,19 +183,6 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/bg_frame">
|
||||
|
||||
<cc.winboll.studio.libaes.views.ADsControlView
|
||||
android:id="@+id/ads_control_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- 广告视图独立布局(供ViewStub延迟加载) -->
|
||||
<cc.winboll.studio.libaes.views.ADsBannerView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/adsbanner"/>
|
||||
Reference in New Issue
Block a user