fix:全局处理 Color.parseColor() 方法异常 https://git.shanqu.cc/halo/android/assistant-android/-/issues/99
This commit is contained in:
@ -12,6 +12,7 @@ import android.widget.TextView;
|
||||
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.gh.gamecenter.common.utils.ExtensionsKt;
|
||||
import com.gh.gamecenter.core.AppExecutor;
|
||||
import com.gh.gamecenter.common.view.DrawableView;
|
||||
import com.gh.gamecenter.R;
|
||||
@ -125,8 +126,8 @@ public class GameViewUtils {
|
||||
DisplayUtils.dip2px(context, 4),
|
||||
DisplayUtils.dip2px(context, 1));
|
||||
|
||||
textView.setTextColor(Color.parseColor("#" + tagEntity.getColor()));
|
||||
textView.setBackground(DrawableView.getServerDrawable(Color.parseColor("#" + tagEntity.getBackground())));
|
||||
textView.setTextColor(ExtensionsKt.hexStringToIntColor("#" + tagEntity.getColor(), Color.WHITE));
|
||||
textView.setBackground(DrawableView.getServerDrawable(ExtensionsKt.hexStringToIntColor("#" + tagEntity.getBackground(), Color.WHITE)));
|
||||
}
|
||||
|
||||
private static TextView getGameTagView(Context context, String tagStr, int rightMargin, String tagType, TagStyleEntity tagEntity) {
|
||||
@ -149,10 +150,10 @@ public class GameViewUtils {
|
||||
|
||||
if ("border".equals(tagEntity.getStyle())) {
|
||||
gradientDrawable.setColor(Color.TRANSPARENT);
|
||||
gradientDrawable.setStroke(DisplayUtils.dip2px(context, 1f), Color.parseColor(colorStr));
|
||||
tag.setTextColor(Color.parseColor(colorStr));
|
||||
gradientDrawable.setStroke(DisplayUtils.dip2px(context, 1f), ExtensionsKt.hexStringToIntColor(colorStr, Color.WHITE));
|
||||
tag.setTextColor(ExtensionsKt.hexStringToIntColor(colorStr, Color.WHITE));
|
||||
} else {
|
||||
gradientDrawable.setColor(Color.parseColor(colorStr));
|
||||
gradientDrawable.setColor(ExtensionsKt.hexStringToIntColor(colorStr, Color.WHITE));
|
||||
gradientDrawable.setShape(GradientDrawable.RECTANGLE);
|
||||
tag.setTextColor(Color.WHITE);
|
||||
}
|
||||
@ -163,7 +164,7 @@ public class GameViewUtils {
|
||||
if (colorStr == null) {
|
||||
return null;
|
||||
}
|
||||
int color = Color.parseColor(colorStr);
|
||||
int color = ExtensionsKt.hexStringToIntColor(colorStr, Color.WHITE);
|
||||
GradientDrawable gradientDrawable = new GradientDrawable();
|
||||
gradientDrawable.setColor(Color.TRANSPARENT);
|
||||
gradientDrawable.setStroke(DisplayUtils.dip2px(context, 1f), color);
|
||||
|
||||
Reference in New Issue
Block a user