fix bugs. add 字体流光 自定义view,cos上传报错信息。
This commit is contained in:
@@ -1,19 +1,35 @@
|
||||
package com.xscm.moduleutil.utils;
|
||||
|
||||
import android.os.SystemClock;
|
||||
import android.util.SparseArray;
|
||||
import android.view.View;
|
||||
|
||||
/**
|
||||
*@author qx
|
||||
*@data 2025/9/10
|
||||
*@description: 防止重复点击的工具类
|
||||
*/
|
||||
public class ClickUtils {
|
||||
private static final long CLICK_INTERVAL = 1000; // 1000ms内不允许重复点击
|
||||
private static long lastClickTime = 0;
|
||||
private static final long DEFAULT_CLICK_INTERVAL = 500;
|
||||
private static final SparseArray<Long> lastClickTimes = new SparseArray<>();
|
||||
|
||||
public static boolean isFastDoubleClick() {
|
||||
long currentTime = System.currentTimeMillis();
|
||||
if (currentTime - lastClickTime < CLICK_INTERVAL) {
|
||||
public static boolean isFastDoubleClick(View view) {
|
||||
return isFastDoubleClick(view, DEFAULT_CLICK_INTERVAL);
|
||||
}
|
||||
|
||||
public static boolean isFastDoubleClick(View view, long interval) {
|
||||
long currentTime = SystemClock.elapsedRealtime();
|
||||
int viewId = view.getId();
|
||||
Long lastClickTime = lastClickTimes.get(viewId);
|
||||
if (lastClickTime != null && currentTime - lastClickTime < interval) {
|
||||
return true;
|
||||
}
|
||||
lastClickTime = currentTime;
|
||||
lastClickTimes.put(viewId, currentTime);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// 新增:清理所有点击记录
|
||||
public static void clearAllClickRecords() {
|
||||
lastClickTimes.clear();
|
||||
}
|
||||
}
|
||||
@@ -196,7 +196,19 @@ public class ImageUtils {
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static void loadRoomItem(String path, ImageView mImageView) {
|
||||
if (mImageView == null) {
|
||||
return;
|
||||
}
|
||||
Context context = mImageView.getContext();
|
||||
if (context instanceof android.app.Activity) {
|
||||
android.app.Activity activity = (android.app.Activity) context;
|
||||
if (activity.isFinishing() || (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 && activity.isDestroyed())) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
Glide.with(mImageView).load(path).diskCacheStrategy(DiskCacheStrategy.ALL).into(mImageView);
|
||||
}
|
||||
|
||||
public static void loadHeadCC(String path, ImageView mImageView) {
|
||||
if (mImageView == null) {
|
||||
|
||||
@@ -8,6 +8,7 @@ import android.widget.ImageView;
|
||||
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
|
||||
import com.blankj.utilcode.util.LogUtils;
|
||||
import com.xscm.moduleutil.R;
|
||||
import com.xscm.moduleutil.utils.logger.Logger;
|
||||
import com.xscm.moduleutil.widget.AvatarFrameView;
|
||||
@@ -47,7 +48,7 @@ public class MeHeadView extends ConstraintLayout {
|
||||
}
|
||||
|
||||
public void setData(String headPicture, String framePicture, String nobilityImage) {
|
||||
Logger.e(headPicture, framePicture, nobilityImage);
|
||||
LogUtils.e(headPicture, framePicture, nobilityImage);
|
||||
if (!TextUtils.isEmpty(headPicture)) {
|
||||
ImageUtils.loadHead(headPicture, mRiv);
|
||||
}
|
||||
|
||||
@@ -207,7 +207,7 @@ public class TimeUtils {
|
||||
//获取当前日期
|
||||
public static String getCurrentDate2() {
|
||||
Date d = new Date();
|
||||
SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss SSS");
|
||||
SimpleDateFormat sf = new SimpleDateFormat("yyyy_MM_dd_hh_mm_ss_SSS");
|
||||
return sf.format(d);
|
||||
}
|
||||
/**
|
||||
|
||||
@@ -80,7 +80,7 @@ public class CosUploadManager {
|
||||
String tmpSecretKey = tempKeyBean.getCredentials().getTmpSecretKey(); // 临时密钥 SecretKey
|
||||
String sessionToken = tempKeyBean.getCredentials().getSessionToken(); // 临时密钥 Token
|
||||
long expiredTime = tempKeyBean.getExpiredTime();//临时密钥有效截止时间戳,单位是秒
|
||||
// 建议返回服务器时间作为签名的开始时间,避免由于用户手机本地时间偏差过大导致请求过期
|
||||
// 建议返回服务器时间作为签名的开始时间,避免由于用户手机本地时间偏差过大导致请求过期
|
||||
long startTime = tempKeyBean.getStartTime(); //临时密钥有效起始时间,单位是秒
|
||||
// 存储桶所在地域简称,例如广州地区是 ap-guangzhou
|
||||
String region = tempKeyBean.getRegion();
|
||||
@@ -95,13 +95,13 @@ public class CosUploadManager {
|
||||
CosXmlService cosXmlService = new CosXmlService(mContext, serviceConfig);
|
||||
|
||||
// 任何 CosXmlRequest 都支持这种方式,例如上传 PutObjectRequest、下载 GetObjectRequest、删除 DeleteObjectRequest 等
|
||||
// 以下用上传进行示例
|
||||
// 以下用上传进行示例
|
||||
PutObjectRequest putRequest = new PutObjectRequest(bucketName, objectKey, localFilePath);
|
||||
// sessionQCloudCredentials 为第一步“初始化密钥”中获取到的单次临时密钥
|
||||
// sessionQCloudCredentials 为第一步“初始化密钥”中获取到的单次临时密钥
|
||||
putRequest.setCredential(sessionQCloudCredentials);
|
||||
// 初始化 TransferConfig,这里使用默认配置,如果需要定制,请参考 SDK 接口文档
|
||||
// 初始化 TransferConfig,这里使用默认配置,如果需要定制,请参考 SDK 接口文档
|
||||
TransferConfig transferConfig = new TransferConfig.Builder().build();
|
||||
// 初始化 TransferManager
|
||||
// 初始化 TransferManager
|
||||
TransferManager transferManager = new TransferManager(cosXmlService, transferConfig);
|
||||
COSXMLUploadTask uploadTask = transferManager.upload(putRequest, null);
|
||||
uploadTask.setCosXmlResultListener(new CosXmlResultListener() {
|
||||
|
||||
@@ -63,7 +63,7 @@ public final class DataLogger implements DataLoggingInterceptor.Logger {
|
||||
}
|
||||
// 响应结束,打印整条日志
|
||||
if (message.startsWith(DataLoggingInterceptor.sLogEndFlag)) {
|
||||
if (mMessage.toString().contains("https://test.vespa.xscmmidi.site/api/Xintiao/keep_xintiao"))
|
||||
if (mMessage.toString().contains("Xintiao/keep_xintiao"))
|
||||
return;
|
||||
LogUtils.d(mMessage.toString());
|
||||
return;
|
||||
|
||||
@@ -17,6 +17,7 @@ import com.blankj.utilcode.util.FileUtils;
|
||||
import com.blankj.utilcode.util.ThreadUtils;
|
||||
import com.xscm.moduleutil.base.CommonAppContext;
|
||||
import com.xscm.moduleutil.utils.Md5Utils;
|
||||
import com.xscm.moduleutil.utils.TimeUtils;
|
||||
import com.xscm.moduleutil.utils.logger.Logger;
|
||||
|
||||
import java.io.File;
|
||||
@@ -53,6 +54,7 @@ public class OSSOperUtils {
|
||||
public static final String img = "images/android_images/";
|
||||
public static final String video = "video/";
|
||||
public static final String audio = "audio/";
|
||||
public static final String AppLog = "applog/";
|
||||
|
||||
|
||||
/**
|
||||
@@ -77,6 +79,15 @@ public class OSSOperUtils {
|
||||
// }
|
||||
}
|
||||
|
||||
public static String getAppLogPath(File file) {
|
||||
String fileMD5 = Md5Utils.getFileMD5(file);
|
||||
String suffix = "";
|
||||
if (file.getName().contains(".")) {
|
||||
suffix = file.getName().substring(file.getName().lastIndexOf("."));
|
||||
}
|
||||
return AppLog + fileMD5 + TimeUtils.getCurrentDate2() + suffix;
|
||||
}
|
||||
|
||||
public static OSSOperUtils newInstance() {
|
||||
if (null == utils) {
|
||||
utils = new OSSOperUtils();
|
||||
|
||||
Reference in New Issue
Block a user