1:修改金币钻石收支接口
2:修改进入房间添加字段 3:修改所有的图片展示,使用url作为key
This commit is contained in:
@@ -4,7 +4,7 @@ import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class RevenueBean {
|
||||
private String id;
|
||||
private int id;
|
||||
private String user_id;
|
||||
private String change_type;
|
||||
private String change_type_name;
|
||||
|
||||
@@ -89,6 +89,7 @@ public class RoomBean implements Serializable {
|
||||
private int queue_number;//排麦队列人数
|
||||
private HeadlineBean head_line;
|
||||
|
||||
private String sexy_coin;//酒吧房撩的金币
|
||||
|
||||
private String room_code;
|
||||
private String popularity;
|
||||
|
||||
@@ -50,7 +50,6 @@ public class RoomPitBean implements Serializable ,Cloneable{
|
||||
private String dress;//麦位用户头像装扮
|
||||
private String charm;//麦位上用户在当前房间的魅力值
|
||||
|
||||
|
||||
private String room_id;
|
||||
private String voice;
|
||||
private String shutup;
|
||||
@@ -77,9 +76,10 @@ public class RoomPitBean implements Serializable ,Cloneable{
|
||||
private String nickname_color;//昵称颜色
|
||||
private String mic_cycle;//麦圈
|
||||
|
||||
|
||||
private boolean occupied;
|
||||
private boolean imageType;//是否是演唱者
|
||||
private String end_time;//倒计时结束时间 酒吧房
|
||||
private int had_custom_gift;//是否显示设置了自定义礼物 0:没有 1:有
|
||||
|
||||
public RoomPitBean clone(){
|
||||
try {
|
||||
|
||||
@@ -115,7 +115,7 @@ public interface ApiServer {
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(Constants.POST_LOG_LIST)
|
||||
Call<BaseModel<List<RevenueBean>>> getRevenueData(@Field("page") String page, @Field("page_limit") String page_limit, @Field("in_out_type") String in_out_type, @Field("start_time") String start_time, @Field("end_time") String end_time, @Field("gift_type") String gift_type);
|
||||
Call<BaseModel<List<RevenueBean>>> getRevenueData(@Field("last_id") int page, @Field("page_limit") String page_limit, @Field("in_out_type") String in_out_type, @Field("start_time") String start_time, @Field("end_time") String end_time, @Field("gift_type") String gift_type);
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(Constants.POST_WEALTH_RANKING)
|
||||
|
||||
@@ -1438,8 +1438,9 @@ public class RetrofitClient {
|
||||
|
||||
}
|
||||
|
||||
public void getRevenueData(String page, String page_limit, String in_out_type, String start_time, String end_time, String gift_type, BaseObserver<List<RevenueBean>> observer) {
|
||||
sApiServer.getRevenueData(page, page_limit, in_out_type, start_time, end_time, gift_type).enqueue(new Callback<BaseModel<List<RevenueBean>>>() {
|
||||
// TODO: 2026/1/7 修改当前接口,传递上一次的id
|
||||
public void getRevenueData(int id, String page_limit, String in_out_type, String start_time, String end_time, String gift_type, BaseObserver<List<RevenueBean>> observer) {
|
||||
sApiServer.getRevenueData(id, page_limit, in_out_type, start_time, end_time, gift_type).enqueue(new Callback<BaseModel<List<RevenueBean>>>() {
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<List<RevenueBean>>> call, Response<BaseModel<List<RevenueBean>>> response) {
|
||||
if (response.code() == 200) {
|
||||
@@ -4233,6 +4234,21 @@ public class RetrofitClient {
|
||||
});
|
||||
}
|
||||
|
||||
// TODO: 2026/1/7
|
||||
public void applyPubPit(String roomId, String pitNumber, BaseObserver<String> observer) {
|
||||
sApiServer.applyPit(roomId, pitNumber).enqueue(new Callback<BaseModel<String>>() {
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<String>> call, Response<BaseModel<String>> response) {
|
||||
onNextRetu(response, observer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
LogUtils.e("applyPit", t.fillInStackTrace());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void startFriend(String roomId, BaseObserver<String> observer) {
|
||||
sApiServer.startFriend(roomId).enqueue(new Callback<BaseModel<String>>() {
|
||||
@Override
|
||||
|
||||
@@ -18,8 +18,11 @@ import androidx.annotation.NonNull;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.load.engine.DiskCacheStrategy;
|
||||
import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
|
||||
import com.bumptech.glide.load.model.GlideUrl;
|
||||
import com.bumptech.glide.load.resource.bitmap.BitmapTransformation;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.bumptech.glide.request.target.Target;
|
||||
import com.bumptech.glide.signature.ObjectKey;
|
||||
import com.xscm.moduleutil.R;
|
||||
import com.xscm.moduleutil.widget.GrayscaleTransformation;
|
||||
|
||||
@@ -33,25 +36,32 @@ import java.security.MessageDigest;
|
||||
*/
|
||||
|
||||
public class ImageLoader {
|
||||
|
||||
private static RequestOptions createUrlOnlyOptions(String url) {
|
||||
String urls = String.valueOf(new GlideUrl(url));
|
||||
return new RequestOptions().signature(new ObjectKey(urls)).diskCacheStrategy(DiskCacheStrategy.ALL)
|
||||
.skipMemoryCache(false)
|
||||
// 禁止尺寸影响缓存
|
||||
.override(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL);
|
||||
}
|
||||
|
||||
public static void loadHead(Context context, ImageView view, String url) {
|
||||
RequestOptions options = RequestOptions.circleCropTransform();
|
||||
Glide.with(context).load(url).apply(options).error(com.xscm.moduleutil.R.mipmap.default_avatar).placeholder(R.mipmap.default_avatar).diskCacheStrategy(DiskCacheStrategy.RESOURCE).thumbnail(0.1f).into(view);
|
||||
Glide.with(context).load(url).apply(createUrlOnlyOptions(url)).error(com.xscm.moduleutil.R.mipmap.default_avatar).placeholder(R.mipmap.default_avatar).thumbnail(0.1f).into(view);
|
||||
}
|
||||
|
||||
public static void loadHead(ImageView view, String url) {
|
||||
RequestOptions options = RequestOptions.circleCropTransform();
|
||||
Glide.with(view).load(url).apply(options).error(R.mipmap.default_avatar).placeholder(R.mipmap.default_avatar).diskCacheStrategy(DiskCacheStrategy.RESOURCE).thumbnail(0.1f).into(view);
|
||||
Glide.with(view).load(url).apply(createUrlOnlyOptions(url)).error(R.mipmap.default_avatar).placeholder(R.mipmap.default_avatar).thumbnail(0.1f).into(view);
|
||||
}
|
||||
|
||||
public static void loadImage(ImageView view, String url) {
|
||||
Glide.with(view).load(url).error(R.mipmap.default_image).placeholder(R.mipmap.default_image).diskCacheStrategy(DiskCacheStrategy.RESOURCE).thumbnail(0.1f).into(view);
|
||||
RequestOptions options = RequestOptions.circleCropTransform();
|
||||
Glide.with(view).load(url).apply(createUrlOnlyOptions(url)).error(R.mipmap.default_image).placeholder(R.mipmap.default_image).thumbnail(0.1f).into(view);
|
||||
}
|
||||
|
||||
public static void loadImage(Context context, ImageView view, String url) {
|
||||
Glide.with(context).load(url).error(R.mipmap.default_image).placeholder(R.mipmap.default_image)
|
||||
.diskCacheStrategy(DiskCacheStrategy.RESOURCE).thumbnail(0.1f).into(view);
|
||||
Glide.with(context).load(url).apply(createUrlOnlyOptions(url)).error(R.mipmap.default_image).placeholder(R.mipmap.default_image)
|
||||
.thumbnail(0.1f).into(view);
|
||||
}
|
||||
/**
|
||||
* 加载图片并灰度
|
||||
|
||||
@@ -37,6 +37,7 @@ import com.bumptech.glide.load.DataSource;
|
||||
import com.bumptech.glide.load.Transformation;
|
||||
import com.bumptech.glide.load.engine.DiskCacheStrategy;
|
||||
import com.bumptech.glide.load.engine.GlideException;
|
||||
import com.bumptech.glide.load.model.GlideUrl;
|
||||
import com.bumptech.glide.load.resource.bitmap.CenterInside;
|
||||
import com.bumptech.glide.load.resource.gif.GifDrawable;
|
||||
import com.bumptech.glide.request.FutureTarget;
|
||||
@@ -75,11 +76,18 @@ public class ImageUtils {
|
||||
|
||||
public static final int ANIM = -1;
|
||||
|
||||
private static RequestOptions createUrlOnlyOptions(String url) {
|
||||
return new RequestOptions().signature(new ObjectKey(url!=null ? url :"")).diskCacheStrategy(DiskCacheStrategy.ALL)
|
||||
.skipMemoryCache(false)
|
||||
// 禁止尺寸影响缓存
|
||||
.override(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL);
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认加载
|
||||
*/
|
||||
public static void loadImageView(String path, ImageView mImageView) {
|
||||
Glide.with(mImageView).load(path).diskCacheStrategy(DiskCacheStrategy.RESOURCE).thumbnail(0.1f).into(mImageView);
|
||||
Glide.with(mImageView).load(path).apply(createUrlOnlyOptions(path)).thumbnail(0.1f).into(mImageView);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -87,7 +95,7 @@ public class ImageUtils {
|
||||
*/
|
||||
public static void loadIcon(String path, ImageView mImageView) {
|
||||
mImageView.setVisibility(TextUtils.isEmpty(path) ? GONE : View.VISIBLE);
|
||||
Glide.with(mImageView).load(path).diskCacheStrategy(DiskCacheStrategy.RESOURCE).thumbnail(0.1f).into(mImageView);
|
||||
Glide.with(mImageView).load(path).apply(createUrlOnlyOptions(path)).thumbnail(0.1f).into(mImageView);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -141,7 +149,9 @@ public class ImageUtils {
|
||||
Glide.with(mImageView).load(path).diskCacheStrategy(DiskCacheStrategy.ALL).into(mImageView);
|
||||
}
|
||||
}
|
||||
|
||||
private static Map<Integer, SVGAVideoEntity> svgaCache = new HashMap<>();
|
||||
|
||||
// TODO: 2025/8/22 播放svga
|
||||
public static void loadDecorationAvatar2(int resourceId, SVGAImageView mImageView) {
|
||||
// 从资源文件夹加载SVGA文件
|
||||
@@ -160,7 +170,7 @@ public class ImageUtils {
|
||||
// 没有缓存,正常加载
|
||||
SVGAParser parser = SVGAParser.Companion.shareParser();
|
||||
InputStream inputStream = mImageView.getContext().getResources().openRawResource(resourceId);
|
||||
parser.decodeFromAssets("heart_line_31.svga", new SVGAParser.ParseCompletion() {
|
||||
parser.decodeFromAssets("heart_line_31.svga", new SVGAParser.ParseCompletion() {
|
||||
@Override
|
||||
public void onComplete(@NotNull SVGAVideoEntity svgaVideoEntity) {
|
||||
if (mImageView != null) {
|
||||
@@ -184,7 +194,8 @@ public class ImageUtils {
|
||||
Logger.e("Resource ID is 0 or invalid");
|
||||
}
|
||||
}
|
||||
public static void loadSetErrorImg(String path, ImageView mImageView,int errorRes) {
|
||||
|
||||
public static void loadSetErrorImg(String path, ImageView mImageView, int errorRes) {
|
||||
if (mImageView == null) {
|
||||
return;
|
||||
}
|
||||
@@ -196,7 +207,8 @@ public class ImageUtils {
|
||||
return;
|
||||
}
|
||||
}
|
||||
Glide.with(mImageView).load(path).error(errorRes).placeholder(errorRes).centerCrop().diskCacheStrategy(DiskCacheStrategy.ALL).thumbnail(0.1f).into(mImageView);
|
||||
Glide.with(mImageView).load(path).apply(createUrlOnlyOptions(path)).error(errorRes).
|
||||
placeholder(errorRes).centerCrop().diskCacheStrategy(DiskCacheStrategy.ALL).thumbnail(0.1f).into(mImageView);
|
||||
|
||||
}
|
||||
|
||||
@@ -212,7 +224,8 @@ public class ImageUtils {
|
||||
return;
|
||||
}
|
||||
}
|
||||
Glide.with(mImageView).load(path).placeholder(R.mipmap.default_avatar).diskCacheStrategy(DiskCacheStrategy.RESOURCE).thumbnail(0.1f).into(mImageView);
|
||||
Glide.with(mImageView).load(path).apply(createUrlOnlyOptions(path))
|
||||
.placeholder(R.mipmap.default_avatar).diskCacheStrategy(DiskCacheStrategy.RESOURCE).thumbnail(0.1f).into(mImageView);
|
||||
}
|
||||
|
||||
public static void loadHeadCC(String path, ImageView mImageView) {
|
||||
@@ -226,7 +239,9 @@ public class ImageUtils {
|
||||
return;
|
||||
}
|
||||
}
|
||||
Glide.with(mImageView).asBitmap().load(path).error(R.mipmap.default_avatar).placeholder(R.mipmap.default_avatar).centerCrop().diskCacheStrategy(DiskCacheStrategy.RESOURCE).thumbnail(0.1f).into(mImageView);
|
||||
Glide.with(mImageView).asBitmap().load(path)
|
||||
.apply(createUrlOnlyOptions(path))
|
||||
.error(R.mipmap.default_avatar).placeholder(R.mipmap.default_avatar).centerCrop().thumbnail(0.1f).into(mImageView);
|
||||
}
|
||||
|
||||
public static void loadHead(String path, ImageView mImageView) {
|
||||
@@ -240,7 +255,8 @@ public class ImageUtils {
|
||||
return;
|
||||
}
|
||||
}
|
||||
Glide.with(mImageView).load(path).diskCacheStrategy(DiskCacheStrategy.RESOURCE).thumbnail(0.1f).into(mImageView);
|
||||
Glide.with(mImageView).load(path).apply(createUrlOnlyOptions(path))
|
||||
.thumbnail(0.1f).into(mImageView);
|
||||
}
|
||||
|
||||
public static void loadHeadCC(String path, ImageView mImageView, LinearLayout.LayoutParams params) {
|
||||
@@ -254,8 +270,9 @@ public class ImageUtils {
|
||||
return;
|
||||
}
|
||||
}
|
||||
Glide.with(mImageView).asBitmap().load(path).error(R.mipmap.default_avatar).placeholder(R.mipmap.default_avatar)
|
||||
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
|
||||
Glide.with(mImageView).asBitmap().load(path)
|
||||
.apply(createUrlOnlyOptions(path))
|
||||
.error(R.mipmap.default_avatar).placeholder(R.mipmap.default_avatar)
|
||||
// 添加加载监听
|
||||
.listener(new RequestListener<Bitmap>() {
|
||||
@Override
|
||||
@@ -270,7 +287,7 @@ public class ImageUtils {
|
||||
// 加载成功!resource 就是最终的 Bitmap 对象
|
||||
int imageWidth = resource.getWidth(); // 图片原始宽度
|
||||
int imageHeight = resource.getHeight(); // 图片原始高度
|
||||
params.width = (int)(imageWidth * 1.3);
|
||||
params.width = (int) (imageWidth * 1.3);
|
||||
// 这里可以使用宽高(如打印、适配布局等)
|
||||
Log.d("GlideImageSize", "宽度:" + imageWidth + ",高度:" + imageHeight);
|
||||
return false; // 返回 false,Glide 会继续执行默认的图片设置(显示到 mImageView)
|
||||
@@ -288,7 +305,7 @@ public class ImageUtils {
|
||||
}
|
||||
|
||||
public static void loadCenterCrop(String path, ImageView mImageView) {
|
||||
Glide.with(mImageView).load(path).centerCrop().diskCacheStrategy(DiskCacheStrategy.RESOURCE).into(mImageView);
|
||||
Glide.with(mImageView).load(path).apply(createUrlOnlyOptions(path)).centerCrop().into(mImageView);
|
||||
}
|
||||
|
||||
public static void loadRes(int path, ImageView mImageView) {
|
||||
@@ -299,8 +316,8 @@ public class ImageUtils {
|
||||
/**
|
||||
* 加载图片(优先使用本地缓存,无缓存则下载)
|
||||
*
|
||||
* @param context 上下文
|
||||
* @param url 图片 URL
|
||||
* @param context 上下文
|
||||
* @param url 图片 URL
|
||||
* @param imageView 目标 ImageView
|
||||
*/
|
||||
public static void loadImageWithCache(Context context, String url, ImageView imageView) {
|
||||
@@ -432,7 +449,7 @@ public class ImageUtils {
|
||||
* @param listener 回调
|
||||
*/
|
||||
public static void loadBitmap(String path, final onLoadBitmap listener) {
|
||||
Glide.with(Utils.getApp()).asBitmap().load(path).into(new SimpleTarget<Bitmap>() {
|
||||
Glide.with(Utils.getApp()).asBitmap().load(path).apply(createUrlOnlyOptions(path)).into(new SimpleTarget<Bitmap>() {
|
||||
|
||||
@Override
|
||||
public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
|
||||
@@ -471,7 +488,8 @@ public class ImageUtils {
|
||||
}
|
||||
});
|
||||
}
|
||||
public static void loadIconByHeight1(String path, ImageView mImageView,int height) {
|
||||
|
||||
public static void loadIconByHeight1(String path, ImageView mImageView, int height) {
|
||||
mImageView.setVisibility(TextUtils.isEmpty(path) ? GONE : View.VISIBLE);
|
||||
Glide.with(mImageView).load(path).diskCacheStrategy(DiskCacheStrategy.ALL).into(new SimpleTarget<Drawable>() {
|
||||
@Override
|
||||
@@ -495,6 +513,7 @@ public class ImageUtils {
|
||||
Glide.with(imageView.getContext())
|
||||
.asBitmap()
|
||||
.load(url)
|
||||
.apply(createUrlOnlyOptions(url))
|
||||
.error(defaultResId) // 加载失败时显示默认图片
|
||||
.into(new SimpleTarget<Bitmap>() {
|
||||
@Override
|
||||
@@ -524,8 +543,6 @@ public class ImageUtils {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 加载bitmap回调
|
||||
*/
|
||||
@@ -603,12 +620,13 @@ public class ImageUtils {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
* 将 assets 中的文件复制到指定路径
|
||||
*
|
||||
* @param assetName assets 中的文件名,例如:"my_file.txt"
|
||||
* @param savePath 要保存的目录路径,例如:"/data/data/your.package/files/"
|
||||
* @param saveName 保存后的文件名
|
||||
* @param assetName assets 中的文件名,例如:"my_file.txt"
|
||||
* @param savePath 要保存的目录路径,例如:"/data/data/your.package/files/"
|
||||
* @param saveName 保存后的文件名
|
||||
*/
|
||||
public static void copyAssetToFile(String assetName, String savePath, String saveName) {
|
||||
InputStream myInput = null;
|
||||
@@ -661,12 +679,12 @@ public class ImageUtils {
|
||||
}
|
||||
|
||||
|
||||
public static void loadWebpOneStart(int webp_anim, ImageView mAnimView){
|
||||
public static void loadWebpOneStart(int webp_anim, ImageView mAnimView) {
|
||||
|
||||
if (mAnimView == null) {
|
||||
return;
|
||||
}
|
||||
// 1. 本地资源专属优化配置
|
||||
// 1. 本地资源专属优化配置
|
||||
RequestOptions options = new RequestOptions()
|
||||
// 强制限制解码尺寸为ImageView显示尺寸(核心优化)
|
||||
.override(800, 800); // 本地图用原尺寸,或指定固定尺寸
|
||||
@@ -708,7 +726,7 @@ public class ImageUtils {
|
||||
.into(mAnimView);
|
||||
}
|
||||
|
||||
public static void clearDiskCache(Context context){
|
||||
public static void clearDiskCache(Context context) {
|
||||
Glide.get(context).clearDiskCache();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user