合并黑夜白天模式等需求

This commit is contained in:
wangcongtao
2020-09-10 16:27:01 +08:00
940 changed files with 19301 additions and 2446 deletions

View File

@@ -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();
}
}
}