
工具类
陈福旭
这个作者很懒,什么都没留下…
展开
-
JsonCacheUtil-缓存工具类
/** * Project_name:TaobaoUnion * Created by:ChenFuXu. * Date: 2022/3/20 20:07 * * 缓存工具类 */public class JsonCacheUtil { public static final String JSON_CACHE_SP_NAME = "json_cache_sp_name"; private static volatile JsonCacheUtil sJsonCacheUti.原创 2022-03-20 21:04:33 · 160 阅读 · 0 评论 -
ToastUtils-Toast工具类
背景:正常情况下,使用原生的Toast时,当多次调用时,容易发生Toast错乱的问题,即多个Toast的时长叠加在一起,造成状态错乱,可以使用如下工具类来解决public class ToastUtils { private static Toast sToast = null; public static void showToast(String tips) { if (sToast == null) { sToast = Toast.ma原创 2022-03-04 23:02:09 · 579 阅读 · 0 评论 -
CalculateInSampleSize-计算大图降采样率的方法
/** * 计算降采样率的算法 * @param options * @param maxWidth * @param maxHeight * @return */ public static int calculateInSampleSize(BitmapFactory.Options options, int maxWidth, int maxHeight) { //这里其实是获取到默认的高度和宽度,也就是图片的实际高.原创 2022-02-08 23:19:49 · 752 阅读 · 0 评论 -
SizeUtils-单位转换工具类
public class SizeUtils { public static int dip2px(Context context, float dpValue) { float scale = context.getResources().getDisplayMetrics().density; return (int) (dpValue * scale + 0.5f); }}原创 2021-12-13 22:28:17 · 404 阅读 · 0 评论 -
UILoader-工具类
/** * 该类用来帮助对不同的UI界面进行加载 */public abstract class UILoader extends FrameLayout { private View mLoadingView; private View mNetworkErrorView; private View mDataEmptyView; private View mSuccessView; private OnRetryLoadDataListener mOnR.原创 2021-12-06 23:51:51 · 212 阅读 · 0 评论 -
RoundRectImageView-裁剪圆角图片工具类
/** * Created by TrillGates on 18/10/7. * God bless my code! */public class RoundRectImageView extends AppCompatImageView { // 可以定义裁剪圆角比例roundRatio private float roundRatio = 0.1f; private Path path; public RoundRectImageView(Context .原创 2021-12-06 23:32:15 · 141 阅读 · 0 评论 -
LoadingView-旋转图片工具类
public class LoadingView extends ImageView { //旋转角度 private int rotateDegree = 0; private boolean mNeedRotate = false; public LoadingView(Context context) { this(context, null); } public LoadingView(Context context, @N.原创 2021-12-06 23:29:44 · 106 阅读 · 0 评论 -
LogUtil-Log打印工具类
public class LogUtil { public static String sTAG = "LogUtil"; // 控制是否要输出log public static boolean sIsRelease = false; /** * 如果是要发布了,可以在application里面把这里release一下,这样子就没有log输出了 */ public static void init(String baseTag, boolea.原创 2021-12-06 23:15:02 · 146 阅读 · 0 评论 -
ImageTools-图片格式转换工具类
/** * 图片转换工具类 */public final class ImageTools { /** * Transfer drawable to bitmap 把drawable转换为bitmap * * @param drawable * @return */ public static Bitmap drawableToBitmap(Drawable drawable) { int w = drawable.g.原创 2021-12-06 23:03:11 · 3646 阅读 · 0 评论 -
ImageBlur-高斯模糊工具类
/** * 高斯模糊工具类 */public class ImageBlur { public static void makeBlur(ImageView imageview, Context context) { BitmapDrawable drawable = (BitmapDrawable) imageview.getDrawable(); Bitmap bitmap = drawable.getBitmap(); Bitmap b.原创 2021-12-06 22:53:00 · 158 阅读 · 0 评论