|
|
@@ -134,26 +134,7 @@ public class GlideImageLoader {
|
|
|
* @param w
|
|
|
*/
|
|
|
public static void saveAndSetRqImage(final ImageView imageView, String link, int w) {
|
|
|
- String fileName = String.format(Locale.CHINA, "%d.png", link.hashCode());
|
|
|
- File file = new File(ClassFileHelper.DIR, fileName);
|
|
|
- if(!file.exists()){
|
|
|
- Bitmap mBitmap = CodeUtils.createImage(link, w, w, null);
|
|
|
- if(mBitmap != null) {
|
|
|
- ViewUtil.saveImage(mBitmap, ClassFileHelper.DIR, fileName);
|
|
|
- if(imageView != null)
|
|
|
- Glide.with(SheepApp.getInstance())
|
|
|
- .load(file)
|
|
|
- .apply(new RequestOptions().override(w, w))
|
|
|
- .into(imageView);
|
|
|
- }
|
|
|
- }
|
|
|
- if(file.exists()){
|
|
|
- if(imageView != null)
|
|
|
- Glide.with(SheepApp.getInstance())
|
|
|
- .load(file)
|
|
|
- .apply(new RequestOptions().override(w, w))
|
|
|
- .into(imageView);
|
|
|
- }
|
|
|
+ saveAndSetRqImage(imageView, link, w, new RequestOptions().override(w, w));
|
|
|
}
|
|
|
/**
|
|
|
* 设置二维码图片
|
|
|
@@ -162,7 +143,16 @@ public class GlideImageLoader {
|
|
|
* @param w
|
|
|
*/
|
|
|
public static void saveAndSetRqImageDisHardConfig(final ImageView imageView, String link, int w) {
|
|
|
- String fileName = String.format(Locale.CHINA, "%d.png", link.hashCode());
|
|
|
+ saveAndSetRqImage(imageView, link, w, new RequestOptions().disallowHardwareConfig().override(w, w));
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 设置二维码图片
|
|
|
+ * @param imageView
|
|
|
+ * @param link
|
|
|
+ * @param w
|
|
|
+ */
|
|
|
+ public static void saveAndSetRqImage(final ImageView imageView, String link, int w, RequestOptions requestOptions) {
|
|
|
+ String fileName = String.format(Locale.CHINA, "%d_%d_%d.png", link.hashCode(), w, w);
|
|
|
File file = new File(ClassFileHelper.DIR, fileName);
|
|
|
if(!file.exists()){
|
|
|
Bitmap mBitmap = CodeUtils.createImage(link, w, w, null);
|
|
|
@@ -171,7 +161,7 @@ public class GlideImageLoader {
|
|
|
if(imageView != null)
|
|
|
Glide.with(SheepApp.getInstance())
|
|
|
.load(file)
|
|
|
- .apply(new RequestOptions().disallowHardwareConfig().override(w, w))
|
|
|
+ .apply(requestOptions)
|
|
|
.into(imageView);
|
|
|
}
|
|
|
}
|
|
|
@@ -179,7 +169,7 @@ public class GlideImageLoader {
|
|
|
if(imageView != null)
|
|
|
Glide.with(SheepApp.getInstance())
|
|
|
.load(file)
|
|
|
- .apply(new RequestOptions().disallowHardwareConfig().override(w, w))
|
|
|
+ .apply(requestOptions)
|
|
|
.into(imageView);
|
|
|
}
|
|
|
}
|