合并黑夜白天模式等需求
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,6 @@
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners android:radius="@dimen/dp_30" />
|
||||
<solid android:color="#3F4057" />
|
||||
<gradient android:startColor="#3F4057" android:endColor="#2A2B38"/>
|
||||
</shape>
|
||||
|
||||
@@ -4,14 +4,14 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#7f000000"
|
||||
android:background="@color/module_commons_dlg_bkg"
|
||||
android:layout_gravity="center">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="@dimen/dp_790"
|
||||
android:layout_height="@dimen/dp_440"
|
||||
android:layout_gravity="center"
|
||||
android:background="@drawable/module_commons_shape_round_gray">
|
||||
android:background="@drawable/module_commons_shape_dlg_round_bkg">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_commons_wm_dialog_content"
|
||||
@@ -19,7 +19,7 @@
|
||||
android:layout_height="@dimen/dp_56"
|
||||
android:layout_marginTop="@dimen/dp_134"
|
||||
android:maxLines="1"
|
||||
android:textColor="@android:color/white"
|
||||
android:textColor="@color/module_commons_wm_dialog_text_textColor"
|
||||
android:textSize="@dimen/sp_40"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
@@ -31,9 +31,9 @@
|
||||
android:id="@+id/module_commons_wm_dialog_button_ok"
|
||||
android:layout_width="@dimen/dp_395"
|
||||
android:layout_height="@dimen/dp_128"
|
||||
android:background="@drawable/moddule_commons_shape_react_blue_grident"
|
||||
android:background="@drawable/module_commons_shape_left_btn_bkg"
|
||||
android:gravity="center"
|
||||
android:textColor="@android:color/white"
|
||||
android:textColor="@color/module_commons_wm_dialog_text_textColor"
|
||||
android:textSize="@dimen/dp_40"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
@@ -43,9 +43,9 @@
|
||||
android:id="@+id/module_commons_wm_dialog_button_cancel"
|
||||
android:layout_width="@dimen/dp_395"
|
||||
android:layout_height="@dimen/dp_128"
|
||||
android:background="@drawable/module_commons_shape_react_gray_grident"
|
||||
android:background="@drawable/module_commons_shape_right_btn_bkg"
|
||||
android:gravity="center"
|
||||
android:textColor="@android:color/white"
|
||||
android:textColor="@color/module_commons_wm_dialog_text_textColor"
|
||||
android:textSize="@dimen/dp_40"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
|
||||
@@ -1052,5 +1052,6 @@
|
||||
<dimen name="sp_40">40px</dimen>
|
||||
<dimen name="sp_42">42px</dimen>
|
||||
<dimen name="sp_48">48px</dimen>
|
||||
<dimen name="module_common_shadow_width">-10px</dimen>
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="module_commons_dlg_bkg">#7f000000</color>
|
||||
<color name="module_commons_wm_dialog_text_textColor">#FFFFFF</color>
|
||||
</resources>
|
||||
@@ -1043,4 +1043,5 @@
|
||||
<dimen name="sp_40">21.8750px</dimen>
|
||||
<dimen name="sp_42">22.9688px</dimen>
|
||||
<dimen name="sp_48">26.2500px</dimen>
|
||||
<dimen name="module_common_shadow_width">-8px</dimen>
|
||||
</resources>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<item name="android:windowFrame">@null</item>
|
||||
<item name="android:windowNoTitle">true</item>
|
||||
<item name="android:windowBackground">@android:color/transparent</item>
|
||||
<item name="android:backgroundDimAmount">0.85</item>
|
||||
<item name="android:backgroundDimAmount">0.4</item>
|
||||
<item name="android:backgroundDimEnabled">true</item>
|
||||
<item name="android:windowContentOverlay">@null</item>
|
||||
<item name="android:fullBright">@android:color/transparent</item>
|
||||
|
||||
Reference in New Issue
Block a user