Merge branch 'skin_custom_view' into dev
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
package com.mogo.module.common.glide;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.bumptech.glide.request.target.SimpleTarget;
|
||||
import com.bumptech.glide.request.transition.Transition;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/9/2
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
class SkinAbleBitmapTarget extends SimpleTarget< Bitmap > {
|
||||
|
||||
private ImageView mTarget;
|
||||
private RequestOptions mOptions;
|
||||
|
||||
public SkinAbleBitmapTarget( ImageView mTarget, RequestOptions mOptions ) {
|
||||
super();
|
||||
this.mTarget = mTarget;
|
||||
this.mOptions = mOptions;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResourceReady( @NonNull Bitmap resource, @Nullable Transition< ? super Bitmap > transition ) {
|
||||
try {
|
||||
mTarget.setImageResource( 0 );
|
||||
mTarget.setImageBitmap( resource );
|
||||
} catch( Exception e ){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadCleared( @Nullable Drawable placeholder ) {
|
||||
super.onLoadCleared( placeholder );
|
||||
try {
|
||||
mTarget.setImageResource( mOptions.getPlaceholderId() );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadStarted( @Nullable Drawable placeholder ) {
|
||||
super.onLoadStarted( placeholder );
|
||||
try {
|
||||
mTarget.setImageResource( mOptions.getPlaceholderId() );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadFailed( @Nullable Drawable errorDrawable ) {
|
||||
super.onLoadFailed( errorDrawable );
|
||||
try {
|
||||
mTarget.setImageResource( mOptions.getErrorId() );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -19,13 +19,13 @@ import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.module.common.entity.MarkerExploreWay;
|
||||
import com.mogo.module.common.glide.SkinAbleBitmapTarget;
|
||||
import com.mogo.module.tanlu.R;
|
||||
import com.mogo.module.tanlu.callback.IThumbsUpCallback;
|
||||
import com.mogo.module.tanlu.constant.TanluConstants;
|
||||
import com.mogo.module.tanlu.model.TanluModelData;
|
||||
import com.mogo.module.tanlu.model.event.CloseWindowInfo;
|
||||
import com.mogo.module.tanlu.model.event.ControlClickUpInfo;
|
||||
import com.mogo.module.tanlu.model.event.DataErrorInfo;
|
||||
import com.mogo.module.tanlu.model.event.StartPlayInfo;
|
||||
import com.mogo.module.tanlu.model.event.VoiceControlUpInfo;
|
||||
import com.mogo.module.tanlu.util.ChartUtil;
|
||||
@@ -372,9 +372,10 @@ public class TanluSlideAdapterNew extends RecyclerView.Adapter<TanluSlideViewHol
|
||||
.error(R.drawable.tanlu_normal_image)
|
||||
.fallback(R.drawable.tanlu_normal_image);
|
||||
Glide.with(mContext)
|
||||
.asBitmap()
|
||||
.load(imageUrl)
|
||||
.apply(requestOptions)
|
||||
.into(autoZoomInImageView);
|
||||
.into(new SkinAbleBitmapTarget(autoZoomInImageView, requestOptions));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/tanlu_module_card_height"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:background="@drawable/tanlu_gradual_change_bg">
|
||||
|
||||
<!--视频播放器和图片播放器-->
|
||||
@@ -37,7 +38,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_centerVertical="true"
|
||||
android:src="@drawable/tanlu_normal_image"
|
||||
tools:src="@drawable/tanlu_normal_image"
|
||||
android:scaleType="fitXY" />
|
||||
</com.mogo.module.tanlu.view.RoundLayout>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user