春节主题:登录、主页面。

This commit is contained in:
2026-01-28 09:29:03 +08:00
parent 3d0fb12565
commit 88ce0205fb
68 changed files with 221 additions and 254 deletions

View File

@@ -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

View File

@@ -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;//主题的开关

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#F0EEF7" />
<solid android:color="#FFF0EEF7" />
<corners android:radius="@dimen/dp_22" />
</shape>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true" android:drawable="@mipmap/icon_shouye_s"/>
<item android:state_selected="false" android:drawable="@mipmap/icon_shouye_ns"/>
</selector>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true" android:drawable="@mipmap/icon_dongtai_s"/>
<item android:state_selected="false" android:drawable="@mipmap/icon_dongtai_ns"/>
</selector>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true" android:drawable="@mipmap/icon_xiaoxi_s"/>
<item android:state_selected="false" android:drawable="@mipmap/icon_xiaoxi_ns"/>
</selector>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true" android:drawable="@mipmap/icon_wode_s"/>
<item android:state_selected="false" android:drawable="@mipmap/icon_wode_ns"/>
</selector>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true" android:drawable="@mipmap/icon_sy_notselect"/>
<item android:state_selected="false" android:drawable="@mipmap/icon_sy_select"/>
</selector>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true" android:drawable="@mipmap/icon_dt_notselect"/>
<item android:state_selected="false" android:drawable="@mipmap/icon_dt_select"/>
</selector>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true" android:drawable="@mipmap/icon_xx_notselect"/>
<item android:state_selected="false" android:drawable="@mipmap/icon_xx_select"/>
</selector>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true" android:drawable="@mipmap/icon_wd_notselect"/>
<item android:state_selected="false" android:drawable="@mipmap/icon_wd_select"/>
</selector>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@mipmap/ic_agreement_spring_selected" android:state_checked="true" />
<item android:drawable="@drawable/ic_agreement_unselect" android:state_checked="false" />
<item android:drawable="@drawable/ic_agreement_unselect" />
</selector>

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="#6D6D6D"
android:state_selected="false" />
<item android:color="@color/colorPrimary_spring"
android:state_selected="true"/>
</selector>

View File

@@ -2,7 +2,7 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#ff22BB79 " />
<solid android:color="?attr/app_color_colorPrimary" />
<corners
android:bottomLeftRadius="22dp"
android:bottomRightRadius="22dp"

View File

@@ -73,6 +73,7 @@
android:text="确认"
android:textSize="@dimen/sp_14"
android:gravity="center"
android:backgroundTint="?attr/app_color_colorPrimary"
android:background="@drawable/cs"/>
</RelativeLayout>
</LinearLayout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1004 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 765 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1014 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 286 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 650 KiB

View File

@@ -3,6 +3,22 @@
<attr name="ev_title" format="string" />
<!-- 自定义图片属性:应用节日背景图 -->
<attr name="app_bg_img" format="reference" />
<attr name="app_color_colorPrimary" format="reference" />
<attr name="app_login_check_select" format="reference"/>
<attr name="app_main_bg" format="reference"/>
<attr name="app_main_tab_1" format="reference"/>
<attr name="app_main_tab_2" format="reference"/>
<attr name="app_main_tab_3" format="reference"/>
<attr name="app_main_tab_4" format="reference"/>
<attr name="app_main_tab_text_color" format="reference"/>
<attr name="app_main_tab_bg" format="reference"/>
<attr name="app_user_bg_color" format="color"/>
<attr name="app_user_edit_me" format="reference"/>
<declare-styleable name="ExplainView">
<attr name="ev_title" />
<attr name="ev_hint" format="string" />

View File

@@ -305,6 +305,7 @@
<!-- 主题色 -->
<color name="colorPrimary">#22BB79</color>
<color name="colorPrimary_spring">#FFFF3700</color>
<!-- 辅助色 -->
<color name="colorSecondary1">#F0EEF7</color>

View File

@@ -5,20 +5,93 @@
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:colorBackground">@color/background</item>
<item name="android:colorBackground">@color/transparent</item>
<item name="android:textColor">@color/color_1F1C1F</item>
<item name="android:textColorHint">@color/color_FF999999</item>
<item name="android:windowBackground">@color/color_F9FAFA</item>
<item name="android:windowTranslucentStatus">false</item>
<item name="android:windowLightStatusBar">true</item>
<item name="android:windowDisablePreview">true</item>
<!-- 新增:全局禁用跳转动画 -->
<item name="android:windowAnimationStyle">@style/NoAnimationStyle</item>
</style>
<!-- 你的基础主题(保持不变) -->
<style name="AppTheme_Spring" parent="@style/Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:colorBackground">@color/transparent</item>
<item name="android:textColor">@color/color_1F1C1F</item>
<item name="android:textColorHint">@color/color_FF999999</item>
<item name="android:windowBackground">@mipmap/icon_spring_bg</item>
<item name="android:windowTranslucentStatus">false</item>
<item name="android:windowLightStatusBar">true</item>
<item name="android:windowDisablePreview">true</item>
<!-- 新增:全局禁用跳转动画 -->
<item name="android:windowAnimationStyle">@style/NoAnimationStyle</item>
</style>
<!-- 子主题:默认主题 -->
<style name="AppTheme.CustomAttrs" parent="AppTheme">
<item name="app_bg_img">@mipmap/log_bj</item>
<item name="app_color_colorPrimary">@color/colorPrimary</item>
<item name="app_login_check_select">@drawable/selector_login_agreement</item>
<item name="app_main_bg">@mipmap/activity_bj</item>
<item name="app_main_tab_1">@drawable/main_bottom_bar_icon_me</item>
<item name="app_main_tab_2">@drawable/main_bottom_bar_icon_media</item>
<item name="app_main_tab_3">@drawable/main_bottom_bar_icon_news</item>
<item name="app_main_tab_4">@drawable/main_bottom_bar_icon_tend</item>
<item name="app_main_tab_text_color">@drawable/text_color_two</item>
<item name="app_user_edit_me">@mipmap/me_edit</item>
</style>
<!-- 子主题:元旦主题 -->
<style name="AppTheme_newYear.CustomAttrs" parent="AppTheme_Spring">
<item name="app_bg_img">@mipmap/log_bj</item>
<item name="app_color_colorPrimary">@color/colorPrimary</item>
<item name="app_login_check_select">@drawable/selector_login_agreement</item>
<item name="app_main_bg">@mipmap/bg_dark</item>
<item name="app_main_tab_1">@drawable/main_tab_new_1</item>
<item name="app_main_tab_2">@drawable/main_tab_new_2</item>
<item name="app_main_tab_3">@drawable/main_tab_new_3</item>
<item name="app_main_tab_4">@drawable/main_tab_new_4</item>
<item name="app_main_tab_text_color">@drawable/text_color_two</item>
<item name="app_main_tab_bg">@drawable/home_bbar_xz</item>
<item name="app_user_bg_color">#231F2C</item>
<item name="app_user_edit_me">@mipmap/me_edit</item>
</style>
<!-- 子主题:春节主题 -->
<style name="AppTheme_Spring.CustomAttrs" parent="AppTheme_Spring">
<item name="app_bg_img">@mipmap/icon_spring_bg</item>
<item name="app_color_colorPrimary">@color/colorPrimary_spring</item>
<item name="app_login_check_select">@drawable/selector_login_spring_agreement</item>
<item name="app_main_bg">@mipmap/icon_main_bg</item>
<item name="app_main_tab_1">@drawable/main_tab_1</item>
<item name="app_main_tab_2">@drawable/main_tab_2</item>
<item name="app_main_tab_3">@drawable/main_tab_3</item>
<item name="app_main_tab_4">@drawable/main_tab_4</item>
<item name="app_main_tab_text_color">@drawable/text_color_spring</item>
<item name="app_main_tab_bg">@mipmap/icon_main_tab_bg</item>
<item name="app_user_bg_color">#FF600D00</item>
<item name="app_user_edit_me">@mipmap/icon_spring_edit_me</item>
</style>
<!-- 定义具体的无动画属性 -->
<style name="NoAnimationStyle" parent="@android:style/Animation.Activity">

View File

@@ -315,9 +315,10 @@ open class Application : CommonAppContext() {
private fun initLogUtils() {
LogUtils.getConfig()
.setLogSwitch(true) // 全局开关
.setLogHeadSwitch(false)
.setLog2FileSwitch(true) // 必须设为 true
.setDir(LOGUTILS_SAVE_PATH) // 设置有效路径
.setFileFilter(LogUtils.V); // 允许所有级别
.setDir(LOGUTILS_SAVE_PATH) // 设置有效路径
.setFileFilter(LogUtils.V) // 允许所有级别
}

View File

@@ -9,6 +9,7 @@ import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.res.TypedArray;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
@@ -111,37 +112,6 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
private Fragment[] fragments;
private AppUpdateDialog appUpdateDialog;
private boolean isMediaSelected = false;
private int unselectedMediaUrl; // 从服务器获取
private int selectedMediaUrl; // 从服务器获取
// 添加其他 tab 的图标 URL
private int unselectedTrendUrl;
private int selectedTrendUrl;
private int unselectedNewsUrl;
private int selectedNewsUrl;
private int unselectedMeUrl;
private int selectedMeUrl;
// 添加文字颜色变量
private int selectedTextColor = 0; // 选中文字颜色 (从服务器获取)
private int unselectedTextColor = 0; // 未选中文字颜色 (从服务器获取)
// private String unselectedMediaUrl = ""; // 从服务器获取
// private String selectedMediaUrl = ""; // 从服务器获取
//
// // 添加其他 tab 的图标 URL
// private String unselectedTrendUrl = "";
// private String selectedTrendUrl = "";
// private String unselectedNewsUrl = "";
// private String selectedNewsUrl = "";
// private String unselectedMeUrl = "";
// private String selectedMeUrl = "";
//
// // 添加文字颜色变量
// private int selectedTextColor = 0; // 选中文字颜色 (从服务器获取)
// private int unselectedTextColor = 0; // 未选中文字颜色 (从服务器获取)
private InviteDialog inviteDialog;
@Override
protected int getLayoutId() {
@@ -173,6 +143,20 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
LogUtils.e("MainActivity", "onWindowFocusChanged:" + hasFocus);
}
private int getTabBg(){
// 1. 定义需要获取的自定义属性数组
int[] attrs = new int[]{com.xscm.moduleutil.R.attr.app_main_tab_bg};
// 2. 从Context的Theme中获取TypedArray核心绑定当前主题的属性值
TypedArray ta = obtainStyledAttributes(attrs);
// 3. 获取attr对应的资源ID默认值0无有效资源时返回0
int bgResId = ta.getResourceId(0, 0);
// 4. 关键手动回收TypedArray释放系统资源避免内存泄漏
ta.recycle();
// 5. 有有效资源ID时设置背景
return bgResId;
}
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -356,13 +340,8 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
// 初始化显示派对Tab
reset();
mBinding.rlMedia.setSelected(true);
mBinding.llBottomBar.setBackgroundResource(com.xscm.moduleutil.R.drawable.home_bbar_xz);
mBinding.llBottomBar.setBackgroundResource(getTabBg());
FragmentUtils.showHide(0, fragments);
index = 0;
isMediaSelected = true; // 确保设置为选中状态
selectedTextColor = ColorManager.getInstance().getPrimaryColorInt();
unselectedTextColor = Color.parseColor("#6D6D6D");
updateAllTabUI(); // 这会同时更新图标和文字颜色
}
@Override
@@ -384,7 +363,7 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
public void onClick(View view) {
int id = view.getId();
if (id == R.id.rl_media) {
mBinding.llBottomBar.setBackgroundResource(com.xscm.moduleutil.R.drawable.home_bbar_xz);
mBinding.llBottomBar.setBackgroundResource(getTabBg());
selectShow(0);
} else if (id == R.id.rl_trend) {
mBinding.llBottomBar.setBackgroundResource(com.xscm.moduleutil.R.drawable.home_bbar_yuan);
@@ -395,7 +374,7 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
selectShow(2);
} else if (id == R.id.rl_me) {
mBinding.llBottomBar.setBackgroundResource(com.xscm.moduleutil.R.drawable.home_bbar_xz);
mBinding.llBottomBar.setBackgroundResource(getTabBg());
selectShow(3);
//C0101我的界面
@@ -452,7 +431,6 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
switch (postion) {
case 0:
mBinding.rlMedia.setSelected(true);
isMediaSelected = true;
break;
case 1:
mBinding.rlTrend.setSelected(true);
@@ -465,35 +443,9 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
mBinding.rlMe.setSelected(true);
break;
}
// 更新所有图标状态
updateMediaIcon();
updateTrendIcon();
updateNewsIcon();
updateMeIcon();
// 更新文字颜色
updateTabTextColors();
FragmentUtils.showHide(postion, fragments);
}
private void updateMediaIcon() {
int imageUrl = (index == 0) ? selectedMediaUrl : unselectedMediaUrl;
mBinding.imSy.setImageResource(imageUrl);
// if (!TextUtils.isEmpty(imageUrl)) {
// Glide.with(this)
// .load(imageUrl)
// .placeholder(com.xscm.moduleutil.R.mipmap.tab_main_media_unselected) // 默认图标
// .into(mBinding.imSy);
// } else {
// // 如果没有网络图标,使用默认的选中/未选中状态
// int resId = (index == 0) ?
// com.xscm.moduleutil.R.mipmap.tab_main_media_selected :
// com.xscm.moduleutil.R.mipmap.tab_main_media_unselected;
// mBinding.imTrend.setImageResource(resId);
// }
}
private boolean shouldRestoreRoom() {
// 检查是否应该恢复房间:
@@ -869,43 +821,9 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
@Override
public void getThemeData(ThemeBean themeBean) {
if (themeBean != null) {
// 首页 tab 图标
selectedMediaUrl = themeBean.getHome_sel();
unselectedMediaUrl = themeBean.getHome_nor();
// 语圈 tab 图标
selectedTrendUrl = themeBean.getFind_sel();
unselectedTrendUrl = themeBean.getFind_nor();
// 消息 tab 图标
selectedNewsUrl = themeBean.getMsg_sel();
unselectedNewsUrl = themeBean.getMsg_nor();
// 我的 tab 图标
selectedMeUrl = themeBean.getMine_sel();
unselectedMeUrl = themeBean.getMine_nor();
// 获取文字颜色
try {
if (themeBean.getBtn_text_color() != null && !themeBean.getBtn_text_color().isEmpty()) {
if (CommonAppContext.getInstance().is_open == 1){
selectedTextColor = Color.parseColor("#FF663B");
}else {
selectedTextColor = Color.parseColor(themeBean.getTheme_color());
}
}
unselectedTextColor = Color.parseColor("#898989");
} catch (Exception e) {
// 使用默认颜色
selectedTextColor = ColorManager.getInstance().getPrimaryColorInt();
unselectedTextColor = Color.parseColor("#898989");
}
Map<String, String> colorMap = new HashMap<>();
colorMap.put("theme_color", themeBean.getTheme_color());
colorMap.put("btn_text_color", themeBean.getBtn_text_color());
// 更新 UI
updateAllTabUI();
// if (themeBean.getApp_bg() != null) {
BackgroundManager.getInstance().setBackgroundUrl(themeBean.getApp_bg());
// BackgroundManager.getInstance().setBackgroundUrl(themeBean.getApp_bg());
loadNetworkBackground();
// }
@@ -1136,96 +1054,6 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
});
}
private void updateAllTabUI() {
index = 0;
// 更新图标
updateMediaIcon();
updateTrendIcon();
updateNewsIcon();
updateMeIcon();
// 更新文字
updateTabTextColors();
}
private void updateTrendIcon() {
int imageUrl = (index == 1) ? selectedTrendUrl : unselectedTrendUrl;
mBinding.imTrend.setImageResource(imageUrl);
// if (!TextUtils.isEmpty(imageUrl)) {
// Glide.with(this)
// .load(imageUrl)
// .placeholder(com.xscm.moduleutil.R.mipmap.icon_me_trend_unselect)
// .into(mBinding.imTrend);
// } else {
// // 如果没有网络图标,使用默认的选中/未选中状态
// int resId = (index == 1) ?
// com.xscm.moduleutil.R.mipmap.icon_me_trend_select :
// com.xscm.moduleutil.R.mipmap.icon_me_trend_unselect;
// mBinding.imTrend.setImageResource(resId);
// }
}
private void updateNewsIcon() {
int imageUrl = (index == 2) ? selectedNewsUrl : unselectedNewsUrl;
mBinding.ivNews.setImageResource(imageUrl);
// if (!TextUtils.isEmpty(imageUrl)) {
// Glide.with(this)
// .load(imageUrl)
// .placeholder(com.xscm.moduleutil.R.mipmap.icon_news_un_select)
// .into(mBinding.ivNews);
// } else {
// // 如果没有网络图标,使用默认的选中/未选中状态
// int resId = (index == 2) ?
// com.xscm.moduleutil.R.mipmap.icon_news_select :
// com.xscm.moduleutil.R.mipmap.icon_news_un_select;
// mBinding.ivNews.setImageResource(resId);
// }
}
private void updateMeIcon() {
int imageUrl = (index == 3) ? selectedMeUrl : unselectedMeUrl;
mBinding.imMe.setImageResource(imageUrl);
// if (!TextUtils.isEmpty(imageUrl)) {
// Glide.with(this)
// .load(imageUrl)
// .placeholder(com.xscm.moduleutil.R.mipmap.icon_my_un_select)
// .into(mBinding.imMe);
// } else {
// // 如果没有网络图标,使用默认的选中/未选中状态
// int resId = (index == 3) ?
// com.xscm.moduleutil.R.mipmap.icon_my_select :
// com.xscm.moduleutil.R.mipmap.icon_my_un_select;
// mBinding.imMe.setImageResource(resId);
// }
}
private void updateTabTextColors() {
// 更新声播 tab 文字颜色
if (selectedTextColor != 0 && unselectedTextColor != 0) {
int mediaTextColor = (index == 0) ? selectedTextColor : unselectedTextColor;
mBinding.tvMedia.setTextColor(mediaTextColor);
}
// 更新语圈 tab 文字颜色
if (selectedTextColor != 0 && unselectedTextColor != 0) {
int trendTextColor = (index == 1) ? selectedTextColor : unselectedTextColor;
mBinding.tvTrend.setTextColor(trendTextColor);
}
// 更新消息 tab 文字颜色
if (selectedTextColor != 0 && unselectedTextColor != 0) {
int newsTextColor = (index == 2) ? selectedTextColor : unselectedTextColor;
mBinding.tvNews.setTextColor(newsTextColor);
}
// 更新我的 tab 文字颜色
if (selectedTextColor != 0 && unselectedTextColor != 0) {
int meTextColor = (index == 3) ? selectedTextColor : unselectedTextColor;
mBinding.tvMe.setTextColor(meTextColor);
}
}
@SuppressLint("CheckResult")
public void isShowLoading(boolean isShow) {
if (isShow) {

View File

@@ -120,9 +120,10 @@
android:layout_height="@dimen/dp_30"
android:layout_marginEnd="@dimen/dp_12"
android:background="@drawable/cs"
android:backgroundTint="?attr/app_color_colorPrimary"
android:gravity="center"
android:text="发送"
android:textColor="@color/color_FF333333"
android:textColor="@color/white"
android:textSize="@dimen/sp_12"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"

View File

@@ -10,8 +10,7 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_root"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@mipmap/log_bj">
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
@@ -146,7 +145,6 @@
android:layout_marginStart="@dimen/dp_40"
android:layout_marginTop="12dp"
android:layout_marginEnd="@dimen/dp_40"
android:background="@drawable/selector_sex_mm"
android:orientation="horizontal">
<RelativeLayout

View File

@@ -9,6 +9,7 @@
</data>
<RelativeLayout
android:background="?attr/app_main_bg"
android:layout_width="match_parent"
android:layout_height="match_parent">
@@ -49,7 +50,7 @@
android:layout_height="@dimen/dp_24"
android:gravity="center_horizontal"
android:scaleType="fitXY"
android:src="@drawable/main_bottom_bar_icon_media" />
android:src="?attr/app_main_tab_1" />
<TextView
android:id="@+id/tv_media"
@@ -57,7 +58,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_2"
android:text="@string/main_tab1"
android:textColor="@drawable/text_color_two"
android:textColor="?attr/app_main_tab_text_color"
android:textSize="@dimen/sp_10" />
</LinearLayout>
@@ -77,7 +78,7 @@
android:layout_height="@dimen/dp_24"
android:gravity="center_horizontal"
android:scaleType="fitXY"
android:src="@drawable/main_bottom_bar_icon_tend" />
android:src="?attr/app_main_tab_2" />
<TextView
android:id="@+id/tv_trend"
@@ -85,7 +86,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_2"
android:text="@string/main_tab2"
android:textColor="@drawable/text_color_two"
android:textColor="?attr/app_main_tab_text_color"
android:textSize="@dimen/sp_10" />
</LinearLayout>
@@ -113,7 +114,7 @@
android:layout_marginTop="3dp"
android:gravity="center_horizontal"
android:scaleType="fitXY"
android:src="@drawable/main_bottom_bar_icon_news" />
android:src="?attr/app_main_tab_3" />
<TextView
android:id="@+id/tv_message"
@@ -144,7 +145,7 @@
android:layout_centerHorizontal="true"
android:layout_marginTop="@dimen/dp_2"
android:text="@string/main_tab3"
android:textColor="@drawable/text_color_two"
android:textColor="?attr/app_main_tab_text_color"
android:textSize="@dimen/sp_10" />
</LinearLayout>
@@ -165,7 +166,7 @@
android:layout_centerInParent="true"
android:gravity="center_horizontal"
android:scaleType="fitXY"
android:src="@drawable/main_bottom_bar_icon_me" />
android:src="?attr/app_main_tab_4" />
<TextView
android:id="@+id/tv_me"
@@ -173,7 +174,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_2"
android:text="@string/main_tab4"
android:textColor="@drawable/text_color_two"
android:textColor="?attr/app_main_tab_text_color"
android:textSize="@dimen/sp_10" />
</LinearLayout>
</LinearLayout>

View File

@@ -119,6 +119,7 @@
android:layout_marginTop="@dimen/dp_20"
android:layout_marginEnd="@dimen/dp_38"
android:background="@drawable/cs"
android:backgroundTint="?attr/app_color_colorPrimary"
android:gravity="center"
android:text="立即发布"
android:textColor="@color/color_FF333333"

View File

@@ -273,6 +273,7 @@
android:layout_height="@dimen/dp_40"
android:text="确认"
android:background="@drawable/cs"
android:backgroundTint="?attr/app_color_colorPrimary"
android:gravity="center"
android:textColor="@color/white"
android:textSize="@dimen/sp_14"

View File

@@ -205,7 +205,7 @@
android:layout_height="@dimen/dp_33"
android:layout_marginEnd="@dimen/dp_16"
android:scaleType="fitCenter"
android:src="@mipmap/me_edit"
android:src="?attr/app_user_edit_me"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
@@ -403,7 +403,7 @@
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_16"
android:layout_marginEnd="@dimen/dp_16"
app:cardBackgroundColor="#231F2C"
app:cardBackgroundColor="?attr/app_user_bg_color"
app:cardCornerRadius="@dimen/dp_8">
<LinearLayout
@@ -559,7 +559,7 @@
android:layout_marginStart="@dimen/dp_16"
android:layout_marginTop="@dimen/dp_12"
android:layout_marginEnd="@dimen/dp_16"
app:cardBackgroundColor="#231F2C"
app:cardBackgroundColor="?attr/app_user_bg_color"
app:cardCornerRadius="@dimen/dp_8">
<LinearLayout
@@ -678,7 +678,7 @@
android:layout_marginStart="@dimen/dp_16"
android:layout_marginTop="@dimen/dp_12"
android:layout_marginEnd="@dimen/dp_16"
app:cardBackgroundColor="#231F2C"
app:cardBackgroundColor="?attr/app_user_bg_color"
app:cardCornerRadius="@dimen/dp_8">
<LinearLayout
@@ -818,7 +818,7 @@
android:layout_marginStart="@dimen/dp_16"
android:layout_marginTop="@dimen/dp_12"
android:layout_marginEnd="@dimen/dp_16"
app:cardBackgroundColor="#231F2C"
app:cardBackgroundColor="?attr/app_user_bg_color"
app:cardCornerRadius="@dimen/dp_8">

View File

@@ -9,7 +9,7 @@
android:id="@+id/root"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/transparent">
android:background="?attr/app_bg_img">
<FrameLayout

View File

@@ -11,10 +11,11 @@
android:layout_height="match_parent">
<ImageView
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:src="@mipmap/log_bj" />
android:src="?attr/app_bg_img" />
<LinearLayout
android:layout_width="match_parent"
@@ -161,7 +162,7 @@
android:layout_marginRight="@dimen/dp_13"
android:gravity="right"
android:text="@string/login_send_code"
android:textColor="#22BB79"
android:textColor="?attr/app_color_colorPrimary"
android:textSize="@dimen/sp_16"
tools:visibility="visible" />
@@ -340,7 +341,7 @@
android:layout_height="@dimen/dp_15"
android:layout_marginEnd="@dimen/dp_5"
android:checked="false"
android:background="@drawable/selector_login_agreement"
android:background="?attr/app_login_check_select"
android:button="@null" />
<TextView
@@ -356,7 +357,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="《用户协议》"
android:textColor="#22BB79"
android:textColor="?attr/app_color_colorPrimary"
android:textSize="@dimen/sp_11"
android:textStyle="bold" />
@@ -373,7 +374,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="《隐私协议》"
android:textColor="#22BB79"
android:textColor="?attr/app_color_colorPrimary"
android:textSize="@dimen/sp_11"
android:textStyle="bold" />
</LinearLayout>