1:添加元旦主题,添加新的接口

This commit is contained in:
2025-12-30 14:16:03 +08:00
parent 4f48c55cf6
commit ab556d2519
100 changed files with 511 additions and 234 deletions

View File

@@ -103,7 +103,7 @@ public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends
// 注册背景更新监听器
BackgroundManager.getInstance().addListener(this);
// 尝试加载网络背景
loadNetworkBackground();
// loadNetworkBackground();
// 注册颜色变化监听器
ColorManager.getInstance().addColorChangeListener(this);
@@ -179,28 +179,37 @@ public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends
protected void loadNetworkBackground() {
// 只有当已经有背景URL时才加载
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);
}
int backgroundUrl = BackgroundManager.getInstance().getBackgroundUrl();
getWindow().getDecorView().setBackgroundResource(backgroundUrl);
@Override
public void onLoadFailed() {
// 加载失败时使用默认背景
getWindow().getDecorView().setBackgroundResource(R.mipmap.activity_bj);
}
});
}
}
// 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) {
//
// }
// });
// }
// }
}
@Override
@@ -213,7 +222,7 @@ public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends
// 提供一个方法供子类调用用于设置背景URL
protected void setNetworkBackgroundUrl(String url) {
BackgroundManager.getInstance().setBackgroundUrl(url);
// BackgroundManager.getInstance().setBackgroundUrl(url);
}
@Override

View File

@@ -136,7 +136,9 @@ 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;//主题的开关
@Override
public void onCreate() {

View File

@@ -0,0 +1,11 @@
package com.xscm.moduleutil.bean
/**
* 项目名称:羽声语音
* 时间2025/12/30 9:44
* 用途:节日主题接口
*/
class FestivalThemeBean {
var is_open : Int = 0 //主题开关
var theme_name : String = "" //主题名称
}

View File

@@ -1,5 +1,8 @@
package com.xscm.moduleutil.bean;
import com.xscm.moduleutil.R;
import com.xscm.moduleutil.base.CommonAppContext;
import lombok.Data;
/**
@@ -9,17 +12,115 @@ import lombok.Data;
*/
@Data
public class ThemeBean {
private String theme_color;//主题颜色
private int is_open;
private String theme_name;
private String theme_color="#22BB79";//主题颜色
private String file_url;//
private String auxiliary_color;//
private String btn_text_color;//按钮文字颜色
private String app_bg;//app背景图
private String home_sel;//首页选中
private String home_nor;//首页未选中
private String find_sel;//广场选中
private String find_nor;//广场未选中
private String msg_sel;//消息选中
private String msg_nor;//消息未选中
private String mine_sel;//我的选中
private String mine_nor;//我的未选中
private String btn_text_color="#3ABC6D";//按钮文字颜色
private int app_bg;//app背景图
private int home_sel;//首页选中
private int home_nor;//首页未选中
private int find_sel;//广场选中
private int find_nor;//广场未选中
private int msg_sel;//消息选中
private int msg_nor;//消息未选中
private int mine_sel;//我的选中
private int mine_nor;//我的未选中
public int getIs_open() {
CommonAppContext.getInstance().is_open = is_open;
return is_open;
}
public void setIs_open(int is_open) {
this.is_open = is_open;
CommonAppContext.getInstance().is_open = is_open;
}
public String getTheme_color() {
return "#22BB79";
}
public String getFile_url() {
return file_url;
}
public String getAuxiliary_color() {
return auxiliary_color;
}
public String getBtn_text_color() {
// if (CommonAppContext.getInstance().is_open == 1){
// return "#FF663B";
// }
return "#FFFFFF";
}
public int getApp_bg() {
if (CommonAppContext.getInstance().is_open == 1){
return R.mipmap.bg_dark;
}else {
return R.mipmap.activity_bj;
}
}
public int getHome_sel() {
if (CommonAppContext.getInstance().is_open == 1){
return R.mipmap.icon_sy_select;
}
return R.mipmap.tab_main_media_selected;
}
public int getHome_nor() {
if (CommonAppContext.getInstance().is_open == 1){
return R.mipmap.icon_sy_notselect;
}
return R.mipmap.tab_main_media_unselected;
}
public int getFind_sel() {
if (CommonAppContext.getInstance().is_open == 1){
return R.mipmap.icon_dt_select;
}
return R.mipmap.icon_me_trend_select;
}
public int getFind_nor() {
if (CommonAppContext.getInstance().is_open == 1){
return R.mipmap.icon_dt_notselect;
}
return R.mipmap.icon_me_trend_unselect;
}
public int getMsg_sel() {
if (CommonAppContext.getInstance().is_open == 1){
return R.mipmap.icon_xx_select;
}
return R.mipmap.icon_news_select;
}
public int getMsg_nor() {
if (CommonAppContext.getInstance().is_open == 1){
return R.mipmap.icon_xx_notselect;
}
return R.mipmap.icon_news_un_select;
}
public int getMine_sel() {
if (CommonAppContext.getInstance().is_open == 1){
return R.mipmap.icon_wd_select;
}
return R.mipmap.icon_my_select;
}
public int getMine_nor() {
if (CommonAppContext.getInstance().is_open == 1){
return R.mipmap.icon_wd_notselect;
}
return R.mipmap.icon_my_un_select;
}
}

View File

@@ -41,6 +41,8 @@ public interface ApiServer {
@POST(Constants.MODIFY_MOBILE)
Call<BaseModel<String>> mobileView(@Field("mobile") String mobile, @Field("new_mobile") String new_mobile, @Field("sms_code") String sms_code,@Field("new_sms_code") String new_sms_code);
@GET(Constants.GET_FESTIVAL_THEME)
Call<BaseModel<FestivalThemeBean>> getFestivalThemeBean();
@GET(Constants.GET_EMOTION)
Call<BaseModel<List<Emotion>>> upEmotion();
@@ -255,7 +257,8 @@ public interface ApiServer {
@POST(Constants.URL_LOGIN)
Call<BaseModel<List<UserBean>>> oauthLogin(@Field("login_token") String login_token);
@GET(Constants.GET_THEME_DATA)
// @GET(Constants.GET_THEME_DATA)
@GET(Constants.GET_FESTIVAL_THEME)
Call<BaseModel<ThemeBean>> getThemeData();
@FormUrlEncoded

View File

@@ -251,6 +251,34 @@ public class RetrofitClient {
});
}
public void getFestivalTheme(BaseObserver<FestivalThemeBean> observer) {
sApiServer.getFestivalThemeBean().enqueue(new Callback<BaseModel<FestivalThemeBean>>() {
@Override
public void onResponse(Call<BaseModel<FestivalThemeBean>> call, Response<BaseModel<FestivalThemeBean>> response) {
if (response.code() == 200) {
BaseModel<FestivalThemeBean> body = response.body();
if (body.getCode() == 1) {
observer.onNext(body.getData());
} else if (body.getCode() == 0) {
observer.onNext(new FestivalThemeBean());
} else if (body.getCode() == 301) {
setCode301(body.getMsg());
}
} else {
ToastUtils.showLong("主题请求错误", response.code());
LogUtils.e("getFestivalTheme", response.message());
}
}
@Override
public void onFailure(Call<BaseModel<FestivalThemeBean>> call, Throwable t) {
LogUtils.e("getFestivalTheme", t.toString());
}
});
}
public void mobileView(String mobile, String new_mobile, String sms_code, String new_sms_code, BaseObserver<String> observer) {
sApiServer.mobileView(mobile, new_mobile, sms_code, new_sms_code).enqueue(new Callback<BaseModel<String>>() {
@Override

View File

@@ -16,7 +16,7 @@ import java.util.List;
*/
public class BackgroundManager {
private static BackgroundManager instance;
private String backgroundUrl;
private int backgroundUrl;
private Drawable backgroundDrawable;
private List<BackgroundUpdateListener> listeners = new ArrayList<>();
@@ -31,12 +31,16 @@ public class BackgroundManager {
return instance;
}
public void setBackgroundUrl(String url) {
public void setBackgroundUrl(int url) {
this.backgroundUrl = url;
loadBackground();
// loadBackground();
}
// public void setBackgroundUrl(String url) {
// this.backgroundUrl = url;
// loadBackground();
// }
public String getBackgroundUrl() {
public int getBackgroundUrl() {
return backgroundUrl;
}
@@ -44,43 +48,42 @@ public class BackgroundManager {
return backgroundDrawable;
}
private void loadBackground() {
if (backgroundUrl == null || backgroundUrl.isEmpty()) {
return;
}
// 这里使用一个临时的 ImageView 来加载图片
// 实际项目中可能需要使用 Application Context
// 为简化,这里直接加载到 drawable
}
// private void loadBackground() {
// if (backgroundUrl == null || backgroundUrl.isEmpty()) {
// return;
// }
// }
public void loadBackgroundDrawable(android.content.Context context, BackgroundLoadCallback callback) {
if (backgroundUrl == null || backgroundUrl.isEmpty()) {
if (backgroundUrl == 0 ) {
callback.onLoadFailed();
return;
}
Glide.with(context)
.asDrawable()
.load(backgroundUrl)
.into(new CustomTarget<Drawable>() {
@Override
public void onResourceReady(Drawable resource, Transition<? super Drawable> transition) {
backgroundDrawable = resource;
callback.onLoadSuccess(resource);
notifyBackgroundUpdated(resource);
}
callback.onLoadComplete(backgroundUrl);
@Override
public void onLoadCleared(Drawable placeholder) {
callback.onLoadFailed();
}
@Override
public void onLoadFailed(Drawable errorDrawable) {
super.onLoadFailed(errorDrawable);
callback.onLoadFailed();
}
});
// Glide.with(context)
// .asDrawable()
// .load(backgroundUrl)
// .into(new CustomTarget<Drawable>() {
// @Override
// public void onResourceReady(Drawable resource, Transition<? super Drawable> transition) {
// backgroundDrawable = resource;
// callback.onLoadSuccess(resource);
// notifyBackgroundUpdated(resource);
// }
//
// @Override
// public void onLoadCleared(Drawable placeholder) {
// callback.onLoadFailed();
// }
//
// @Override
// public void onLoadFailed(Drawable errorDrawable) {
// super.onLoadFailed(errorDrawable);
// callback.onLoadFailed();
// }
// });
}
public void addListener(BackgroundUpdateListener listener) {
@@ -102,6 +105,8 @@ public class BackgroundManager {
public interface BackgroundLoadCallback {
void onLoadSuccess(Drawable drawable);
void onLoadFailed();
void onLoadComplete(int resultId);
}
public interface BackgroundUpdateListener {

View File

@@ -449,6 +449,7 @@ public class Constants {
// public static final String MODIFY_MOBILE = "/api/UserData/modify_mobile";//手机换绑
public static final String MODIFY_MOBILE = "/api/UserData/modify_mobiles";//手机换绑
public static final String BIND_MOBILE = "/api/UserData/bind_mobile";//手机绑定
public static final String GET_FESTIVAL_THEME = "/api/Theme/get_festival_theme";//节日主题接口
public static final String POST_SIGN_START = "/api/Sign/start_sign";//签约开始

Binary file not shown.

After

Width:  |  Height:  |  Size: 759 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 262 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 466 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 171 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 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: 6.5 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: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 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: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB