Merge remote-tracking branch 'origin/master'
@@ -2,7 +2,9 @@ package com.yunbao.common.glide;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.media.ThumbnailUtils;
|
||||
import android.net.Uri;
|
||||
import android.text.TextUtils;
|
||||
import android.widget.ImageView;
|
||||
@@ -13,6 +15,7 @@ import androidx.annotation.Nullable;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.bumptech.glide.request.target.CustomTarget;
|
||||
import com.bumptech.glide.request.target.SimpleTarget;
|
||||
import com.bumptech.glide.request.transition.Transition;
|
||||
import com.yunbao.common.R;
|
||||
|
||||
@@ -33,36 +36,120 @@ public class ImgLoader {
|
||||
sBlurTransformation = new BlurTransformation(25);
|
||||
}
|
||||
|
||||
|
||||
public static void display(Context context, String url, ImageView imageView) {
|
||||
display(context, url, imageView, -1, -1);
|
||||
}
|
||||
|
||||
public static void display(Context context, String url, ImageView imageView, int width, int height) {
|
||||
if (!contextIsExist(context)) {
|
||||
return;
|
||||
}
|
||||
Glide.with(context).asDrawable().load(url).skipMemoryCache(SKIP_MEMORY_CACHE).into(imageView);
|
||||
Glide.with(context)
|
||||
.asBitmap()
|
||||
.load(url)
|
||||
.skipMemoryCache(SKIP_MEMORY_CACHE)
|
||||
.into(new CustomTarget<Bitmap>() {
|
||||
@Override
|
||||
public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
|
||||
if (width == -1 || height == -1) {
|
||||
imageView.setImageBitmap(resource);
|
||||
} else {
|
||||
Bitmap bitmap = ThumbnailUtils.extractThumbnail(resource, width, height);
|
||||
imageView.setImageBitmap(bitmap);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadCleared(@Nullable Drawable placeholder) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void display2(Context context, String url, ImageView imageView) {
|
||||
display2(context, url, imageView, -1, -1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 手动清空内存
|
||||
*/
|
||||
public static void clearMemory(Context context){
|
||||
Glide.get(context)
|
||||
.clearMemory();
|
||||
}
|
||||
public static void display2(Context context, String url, ImageView imageView, int width, int height) {
|
||||
if (!contextIsExist(context)) {
|
||||
return;
|
||||
}
|
||||
Glide.with(context).asDrawable().load(url).placeholder(imageView.getDrawable()).dontAnimate().skipMemoryCache(SKIP_MEMORY_CACHE).into(imageView);
|
||||
Glide.with(context)
|
||||
.asBitmap()
|
||||
.load(url)
|
||||
.placeholder(imageView.getDrawable())
|
||||
.dontAnimate()
|
||||
.skipMemoryCache(SKIP_MEMORY_CACHE)
|
||||
.into(new CustomTarget<Bitmap>() {
|
||||
@Override
|
||||
public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
|
||||
if (width == -1 || height == -1) {
|
||||
imageView.setImageBitmap(resource);
|
||||
} else {
|
||||
Bitmap bitmap = ThumbnailUtils.extractThumbnail(resource, width, height);
|
||||
imageView.setImageBitmap(bitmap);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadCleared(@Nullable Drawable placeholder) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void display2(Context context, int url, ImageView imageView) {
|
||||
if (!contextIsExist(context)) {
|
||||
return;
|
||||
}
|
||||
Glide.with(context).asDrawable().load(url).placeholder(imageView.getDrawable()).dontAnimate().skipMemoryCache(SKIP_MEMORY_CACHE).into(imageView);
|
||||
Glide.with(context)
|
||||
.asDrawable()
|
||||
.load(url)
|
||||
.placeholder(imageView.getDrawable())
|
||||
.dontAnimate()
|
||||
.skipMemoryCache(SKIP_MEMORY_CACHE)
|
||||
.into(imageView);
|
||||
}
|
||||
|
||||
public static void displayWithError(Context context, String url, ImageView imageView, int errorRes) {
|
||||
displayWithError(context, url, imageView, errorRes, -1, -1);
|
||||
}
|
||||
|
||||
public static void displayWithError(Context context, String url, ImageView imageView, int errorRes, int width, int height) {
|
||||
if (!contextIsExist(context)) {
|
||||
return;
|
||||
}
|
||||
if (imageView == null) {
|
||||
return;
|
||||
}
|
||||
Glide.with(context).asDrawable().load(url).error(errorRes).skipMemoryCache(SKIP_MEMORY_CACHE).into(imageView);
|
||||
Glide.with(context)
|
||||
.asBitmap()
|
||||
.load(url)
|
||||
.error(errorRes)
|
||||
.skipMemoryCache(SKIP_MEMORY_CACHE)
|
||||
.into(new CustomTarget<Bitmap>() {
|
||||
@Override
|
||||
public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
|
||||
if (width == -1 || height == -1) {
|
||||
imageView.setImageBitmap(resource);
|
||||
} else {
|
||||
Bitmap bitmap = ThumbnailUtils.extractThumbnail(resource, width, height);
|
||||
imageView.setImageBitmap(bitmap);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadCleared(@Nullable Drawable placeholder) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void displayWithError(Context context, int url, ImageView imageView, int errorRes) {
|
||||
@@ -79,8 +166,34 @@ public class ImgLoader {
|
||||
if (!contextIsExist(context)) {
|
||||
return;
|
||||
}
|
||||
displayWithError(context, url, imageView, R.mipmap.icon_avatar_placeholder);
|
||||
displayAvatar(context, url, imageView, -1, -1);
|
||||
}
|
||||
|
||||
public static void displayAvatar(Context context, String url, ImageView imageView, int width, int height) {
|
||||
if (!contextIsExist(context)) {
|
||||
return;
|
||||
}
|
||||
Glide.with(context)
|
||||
.asBitmap()
|
||||
.load(url)
|
||||
.error(R.mipmap.icon_avatar_placeholder)
|
||||
.skipMemoryCache(SKIP_MEMORY_CACHE)
|
||||
.into(new CustomTarget<Bitmap>() {
|
||||
@Override
|
||||
public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
|
||||
if (width == -1 || height == -1) {
|
||||
imageView.setImageBitmap(resource);
|
||||
} else {
|
||||
Bitmap bitmap = ThumbnailUtils.extractThumbnail(resource, width, height);
|
||||
imageView.setImageBitmap(bitmap);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadCleared(@Nullable Drawable placeholder) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void displayAvatar(Context context, int url, ImageView imageView) {
|
||||
@@ -95,14 +208,22 @@ public class ImgLoader {
|
||||
if (!contextIsExist(context)) {
|
||||
return;
|
||||
}
|
||||
Glide.with(context).asDrawable().load(file).skipMemoryCache(SKIP_MEMORY_CACHE).into(imageView);
|
||||
Glide.with(context)
|
||||
.asDrawable()
|
||||
.load(file)
|
||||
.skipMemoryCache(SKIP_MEMORY_CACHE)
|
||||
.into(imageView);
|
||||
}
|
||||
|
||||
public static void display(Context context, int res, ImageView imageView) {
|
||||
if (!contextIsExist(context)) {
|
||||
return;
|
||||
}
|
||||
Glide.with(context).asDrawable().load(res).skipMemoryCache(SKIP_MEMORY_CACHE).into(imageView);
|
||||
Glide.with(context)
|
||||
.asDrawable()
|
||||
.load(res)
|
||||
.skipMemoryCache(SKIP_MEMORY_CACHE)
|
||||
.into(imageView);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -112,7 +233,11 @@ public class ImgLoader {
|
||||
if (!contextIsExist(context)) {
|
||||
return;
|
||||
}
|
||||
Glide.with(context).asDrawable().load(Uri.fromFile(new File(videoPath))).skipMemoryCache(SKIP_MEMORY_CACHE).into(imageView);
|
||||
Glide.with(context)
|
||||
.asDrawable()
|
||||
.load(Uri.fromFile(new File(videoPath)))
|
||||
.skipMemoryCache(SKIP_MEMORY_CACHE)
|
||||
.into(imageView);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -122,7 +247,11 @@ public class ImgLoader {
|
||||
if (!contextIsExist(context)) {
|
||||
return;
|
||||
}
|
||||
Glide.with(context).asGif().load(videoPath).skipMemoryCache(SKIP_MEMORY_CACHE).into(imageView);
|
||||
Glide.with(context)
|
||||
.asGif()
|
||||
.load(videoPath)
|
||||
.skipMemoryCache(SKIP_MEMORY_CACHE)
|
||||
.into(imageView);
|
||||
}
|
||||
|
||||
public static void displayDrawable(Context context, String url, final DrawableCallback callback) {
|
||||
@@ -143,8 +272,9 @@ public class ImgLoader {
|
||||
@Override
|
||||
public void onLoadFailed(@Nullable Drawable errorDrawable) {
|
||||
super.onLoadFailed(errorDrawable);
|
||||
if (callback != null)
|
||||
if (callback != null) {
|
||||
callback.onLoadFailed();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -173,7 +303,9 @@ public class ImgLoader {
|
||||
|
||||
@Override
|
||||
public void onLoadCleared(@Nullable Drawable placeholder) {
|
||||
|
||||
if (callback != null) {
|
||||
callback.onLoadFailed();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -190,27 +322,67 @@ public class ImgLoader {
|
||||
* 显示模糊的毛玻璃图片
|
||||
*/
|
||||
public static void displayBlur(Context context, String url, ImageView imageView) {
|
||||
displayBlur(context, url, imageView, -1, -1);
|
||||
}
|
||||
|
||||
public static void displayBlur(Context context, String url, ImageView imageView, int width, int height) {
|
||||
if (!contextIsExist(context)) {
|
||||
return;
|
||||
}
|
||||
Glide.with(context).asDrawable().load(url)
|
||||
Glide.with(context)
|
||||
.asBitmap()
|
||||
.load(url)
|
||||
.skipMemoryCache(SKIP_MEMORY_CACHE)
|
||||
.apply(RequestOptions.bitmapTransform(sBlurTransformation))
|
||||
.into(imageView);
|
||||
.into(new CustomTarget<Bitmap>() {
|
||||
@Override
|
||||
public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
|
||||
if (width == -1 || height == -1) {
|
||||
imageView.setImageBitmap(resource);
|
||||
} else {
|
||||
Bitmap bitmap = ThumbnailUtils.extractThumbnail(resource, width, height);
|
||||
imageView.setImageBitmap(bitmap);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadCleared(@Nullable Drawable placeholder) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示模糊的毛玻璃图片
|
||||
*/
|
||||
public static void displayBlurLive(Context context, String url, ImageView imageView) {
|
||||
displayBlurLive(context, url, imageView, -1, -1);
|
||||
}
|
||||
|
||||
public static void displayBlurLive(Context context, String url, ImageView imageView, int width, int height) {
|
||||
if (!contextIsExist(context)) {
|
||||
return;
|
||||
}
|
||||
Glide.with(context).asDrawable().load(url)
|
||||
Glide.with(context).asBitmap().load(url)
|
||||
.skipMemoryCache(SKIP_MEMORY_CACHE)
|
||||
.apply(RequestOptions.bitmapTransform(new BlurTransformation(100)))
|
||||
.apply(RequestOptions.bitmapTransform(new BlurTransformation(20)))
|
||||
.placeholder(R.mipmap.live_bg)
|
||||
.into(imageView);
|
||||
.into(new CustomTarget<Bitmap>() {
|
||||
@Override
|
||||
public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
|
||||
if (width == -1 || height == -1) {
|
||||
imageView.setImageBitmap(resource);
|
||||
} else {
|
||||
Bitmap bitmap = ThumbnailUtils.extractThumbnail(resource, width, height);
|
||||
imageView.setImageBitmap(bitmap);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadCleared(@Nullable Drawable placeholder) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static boolean contextIsExist(Context context) {
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.yunbao.common.utils;
|
||||
|
||||
import com.opensource.svgaplayer.SVGACallback;
|
||||
import com.opensource.svgaplayer.SVGAImageView;
|
||||
|
||||
public class SVGAViewUtils {
|
||||
public static void playEndClear(SVGAImageView svga){
|
||||
svga.setCallback(new SVGACallback() {
|
||||
@Override
|
||||
public void onPause() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinished() {
|
||||
//动画结束后调用clear释放资源
|
||||
svga.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRepeat() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStep(int i, double v) {
|
||||
|
||||
}
|
||||
});
|
||||
svga.startAnimation();
|
||||
}
|
||||
}
|
||||
@@ -81,7 +81,7 @@ public class VersionUtil {
|
||||
|
||||
//谷歌更新
|
||||
} else if (CommonAppConfig.IS_GOOGLE_PLAY == true) {
|
||||
if (configBean.getGoogle_isup().equals("0")) {
|
||||
if ("0".equals(configBean.getGoogle_isup())) {
|
||||
DialogUitl.Builder builder = new DialogUitl.Builder(context);
|
||||
builder.setTitle(WordUtil.getString(R.string.version_update))
|
||||
.setContent(configBean.getUpdateDes())
|
||||
@@ -158,8 +158,8 @@ public class VersionUtil {
|
||||
} else {
|
||||
ToastUtil.show(R.string.version_download_url_error);
|
||||
}
|
||||
} else if (CommonAppConfig.IS_GOOGLE_PLAY == true) {
|
||||
if (configBean.getGoogle_isup().equals("0")) {
|
||||
} else if (CommonAppConfig.IS_GOOGLE_PLAY) {
|
||||
if ( "0".equals(configBean.getGoogle_isup())) {
|
||||
Log.e("tagg", "111111");
|
||||
DialogUitl.Builder builder = new DialogUitl.Builder(context);
|
||||
builder.setTitle(WordUtil.getString(R.string.version_update))
|
||||
|
||||
@@ -8,6 +8,7 @@ import android.widget.ImageView;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.ms.banner.holder.BannerViewHolder;
|
||||
import com.yunbao.common.bean.BannerBean;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
|
||||
public class CustomViewHolder implements BannerViewHolder<BannerBean> {
|
||||
|
||||
@@ -20,7 +21,8 @@ public class CustomViewHolder implements BannerViewHolder<BannerBean> {
|
||||
);
|
||||
imageView.setLayoutParams(params);
|
||||
imageView.setScaleType(ImageView.ScaleType.FIT_XY);
|
||||
Glide.with(context).load(data.getImageUrl()).into(imageView);
|
||||
//Glide.with(context).load(data.getImageUrl()).into(imageView);
|
||||
ImgLoader.display(context,data.getImageUrl(),imageView,600,170);
|
||||
|
||||
return imageView;
|
||||
}
|
||||
|
||||
@@ -263,7 +263,8 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="23dp"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="40dp"
|
||||
|
||||
|
Before Width: | Height: | Size: 217 KiB After Width: | Height: | Size: 53 KiB |
|
Before Width: | Height: | Size: 1.2 MiB After Width: | Height: | Size: 350 KiB |
|
Before Width: | Height: | Size: 104 KiB After Width: | Height: | Size: 32 KiB |
|
Before Width: | Height: | Size: 288 KiB After Width: | Height: | Size: 74 KiB |
@@ -282,9 +282,9 @@
|
||||
<string name="gxzb">Personalized Dress Up</string>
|
||||
<string name="live_camera">Flip</string>
|
||||
<string name="live_camera_s">Mirroring</string>
|
||||
<string name="live_zg">Tricky</string>
|
||||
<string name="live_zg">Trickster</string>
|
||||
<string name="live_dr">MultiplayerPK</string>
|
||||
<string name="live_mic">LianmaiVoice</string>
|
||||
<string name="live_mic">Voice Link</string>
|
||||
<string name="live_wks">Start</string>
|
||||
<string name="live_zslk">LeaveTemporarily</string>
|
||||
<string name="live_zslk1">ResumeLive</string>
|
||||
@@ -647,7 +647,7 @@
|
||||
<string name="near">nearby</string>
|
||||
<string name="num_wan">ten thousand</string>
|
||||
<string name="please_wait">One moment please</string>
|
||||
<string name="pri_msg">Private letter</string>
|
||||
<string name="pri_msg">News</string>
|
||||
<string name="report">Report</string>
|
||||
<string name="reload">retry</string>
|
||||
<string name="refuse">refuse</string>
|
||||
@@ -874,7 +874,10 @@ Limited ride And limited avatar frame</string>
|
||||
<string name="bonus_message">has sent you a reward, come and get it!</string>
|
||||
<string name="live_class_tip_title">Pay attention to the channel that suits you.</string>
|
||||
<string name="live_anchor_send">What do you say to everyone</string>
|
||||
<string name="live_config">LiveConfig</string>
|
||||
<string name="live_config">Settings</string>
|
||||
<string name="can_not_go">No access to the mystery man\'s personal home page。</string>
|
||||
<string name="mystery_man">The Mystery Man</string>
|
||||
<string name="system_notice">Notice</string>
|
||||
<string name="online_service">Online Service</string>
|
||||
<string name="popular_tickets">Hot Ticket</string>
|
||||
</resources>
|
||||
|
||||
@@ -712,9 +712,9 @@
|
||||
<string name="live_send_buy_liang_name_1">購買了靚號</string>
|
||||
<string name="live_send_buy_vip_1">VIP</string>
|
||||
<string name="live_wishlist">心願單</string>
|
||||
<string name="live_zg">整蠱</string>
|
||||
<string name="live_zg">娛樂整蠱</string>
|
||||
<string name="live_dr">多人PK</string>
|
||||
<string name="live_mic">連麥語音</string>
|
||||
<string name="live_mic">語音連麥</string>
|
||||
<string name="live_wks">周星榜</string>
|
||||
<string name="live_zslk">暫時離開</string>
|
||||
<string name="live_zslk1">恢復直播</string>
|
||||
|
||||