春节主题:登录、主页面。
This commit is contained in:
@@ -84,9 +84,10 @@ public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends
|
||||
@SuppressLint("UnspecifiedRegisterReceiverFlag")
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
initFestivalTheme(2);
|
||||
super.onCreate(savedInstanceState);
|
||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||
getWindow().getDecorView().setBackgroundResource(R.mipmap.log_bj);
|
||||
// getWindow().getDecorView().setBackgroundResource(R.attr.app_bg_img);
|
||||
setContentView(getLayoutId());
|
||||
doDone();
|
||||
// 隐藏标题栏
|
||||
@@ -116,6 +117,25 @@ public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends
|
||||
EventBus.getDefault().register(this);
|
||||
}
|
||||
|
||||
// 节日判断+主题切换核心方法
|
||||
private void initFestivalTheme(int currentFestival) {
|
||||
switch (currentFestival) {
|
||||
case 0:
|
||||
setTheme(R.style.AppTheme_CustomAttrs);
|
||||
break;
|
||||
case 1:
|
||||
setTheme(R.style.AppTheme_newYear_CustomAttrs);
|
||||
break;
|
||||
case 2:
|
||||
setTheme(R.style.AppTheme_Spring_CustomAttrs);
|
||||
break;
|
||||
default:
|
||||
// 默认皮肤
|
||||
setTheme(R.style.AppTheme_CustomAttrs);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 在Activity中
|
||||
private static final int REQUEST_OVERLAY_PERMISSION = 1001;
|
||||
|
||||
@@ -181,37 +201,8 @@ public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends
|
||||
|
||||
protected void loadNetworkBackground() {
|
||||
// 只有当已经有背景URL时才加载
|
||||
int backgroundUrl = BackgroundManager.getInstance().getBackgroundUrl();
|
||||
getWindow().getDecorView().setBackgroundResource(backgroundUrl);
|
||||
|
||||
|
||||
// String backgroundUrl = BackgroundManager.getInstance().getBackgroundUrl();
|
||||
// if (backgroundUrl != null && !backgroundUrl.isEmpty()) {
|
||||
// // 检查是否有已加载的drawable
|
||||
// Drawable cachedDrawable = BackgroundManager.getInstance().getBackgroundDrawable();
|
||||
// if (cachedDrawable != null) {
|
||||
// getWindow().getDecorView().setBackground(cachedDrawable);
|
||||
// } else {
|
||||
// // 加载网络背景
|
||||
// BackgroundManager.getInstance().loadBackgroundDrawable(this, new BackgroundManager.BackgroundLoadCallback() {
|
||||
// @Override
|
||||
// public void onLoadSuccess(Drawable drawable) {
|
||||
// getWindow().getDecorView().setBackground(drawable);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onLoadFailed() {
|
||||
// // 加载失败时使用默认背景
|
||||
// getWindow().getDecorView().setBackgroundResource(R.mipmap.activity_bj);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onLoadComplete(int resultId) {
|
||||
//
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
// int backgroundUrl = BackgroundManager.getInstance().getBackgroundUrl();
|
||||
// getWindow().getDecorView().setBackgroundResource(backgroundUrl);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -137,7 +137,7 @@ public class CommonAppContext extends MultiDexApplication implements Application
|
||||
@Getter
|
||||
public UnreadCountEvent unreadCountEvent;
|
||||
|
||||
public static int selectRelease = -1;
|
||||
public static int selectRelease = 1;
|
||||
|
||||
public int is_open = 0;//主题的开关
|
||||
|
||||
|
||||
Reference in New Issue
Block a user