[sonar] fix sonar plm
This commit is contained in:
@@ -30,7 +30,6 @@ import okhttp3.RequestBody;
|
||||
* @since: 10/28/21
|
||||
*/
|
||||
public class NoticeNetWorkManager {
|
||||
private static volatile NoticeNetWorkManager requestNoticeManager;
|
||||
private final INoticeApiService mNoticeApiService;
|
||||
|
||||
private NoticeNetWorkManager() {
|
||||
@@ -39,14 +38,11 @@ public class NoticeNetWorkManager {
|
||||
}
|
||||
|
||||
public static NoticeNetWorkManager getInstance() {
|
||||
if (requestNoticeManager == null) {
|
||||
synchronized (NoticeNetWorkManager.class) {
|
||||
if (requestNoticeManager == null) {
|
||||
requestNoticeManager = new NoticeNetWorkManager();
|
||||
}
|
||||
}
|
||||
}
|
||||
return requestNoticeManager;
|
||||
return Holder.requestNoticeManager;
|
||||
}
|
||||
|
||||
private static final class Holder{
|
||||
private static final NoticeNetWorkManager requestNoticeManager = new NoticeNetWorkManager();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -88,7 +84,7 @@ public class NoticeNetWorkManager {
|
||||
* 反馈交警是否接受事故任务
|
||||
*
|
||||
* @param infoId 事故id
|
||||
* @param sn
|
||||
* @param sn sn
|
||||
* @param status 是否接受 0否 1是
|
||||
*/
|
||||
public void sendAccidentAcceptStatus(String infoId, String sn, int status) {
|
||||
|
||||
@@ -6,14 +6,12 @@ import android.text.TextUtils;
|
||||
|
||||
//播放试听
|
||||
public class Audition implements MediaPlayer.OnPreparedListener, MediaPlayer.OnCompletionListener{
|
||||
private static volatile Audition INSTANCE;
|
||||
public MediaPlayer mediaPlayer;
|
||||
private String oldPath;
|
||||
private OnAuditionListener listener;
|
||||
|
||||
public interface OnAuditionListener {
|
||||
void onAuditionCompletion();
|
||||
|
||||
}
|
||||
|
||||
public void registerOnAuditionListener(OnAuditionListener listener) {
|
||||
@@ -28,16 +26,12 @@ public class Audition implements MediaPlayer.OnPreparedListener, MediaPlayer.OnC
|
||||
}
|
||||
|
||||
public static Audition getInstance() {
|
||||
if (INSTANCE == null) {
|
||||
synchronized (Audition.class) {
|
||||
if (INSTANCE == null) {
|
||||
INSTANCE = new Audition();
|
||||
}
|
||||
}
|
||||
}
|
||||
return INSTANCE;
|
||||
return Holder.INSTANCE;
|
||||
}
|
||||
|
||||
private static final class Holder{
|
||||
private static final Audition INSTANCE = new Audition();
|
||||
}
|
||||
|
||||
public boolean isPlaying() {
|
||||
return mediaPlayer != null && mediaPlayer.isPlaying();
|
||||
|
||||
@@ -7,9 +7,7 @@ import com.zhjt.mogo_core_function_devatools.badcase.record.listener.RecordListe
|
||||
|
||||
|
||||
public class RecordManager {
|
||||
private static final String TAG = RecordManager.class.getSimpleName();
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
private volatile static RecordManager instance;
|
||||
private final RecordHelper recordHelper;
|
||||
/**
|
||||
* 录音配置
|
||||
@@ -21,14 +19,11 @@ public class RecordManager {
|
||||
}
|
||||
|
||||
public static RecordManager getInstance() {
|
||||
if (instance == null) {
|
||||
synchronized (RecordManager.class) {
|
||||
if (instance == null) {
|
||||
instance = new RecordManager();
|
||||
}
|
||||
}
|
||||
}
|
||||
return instance;
|
||||
return Holder.instance;
|
||||
}
|
||||
|
||||
private static final class Holder{
|
||||
private static final RecordManager instance = new RecordManager();
|
||||
}
|
||||
|
||||
// /**
|
||||
|
||||
@@ -12,19 +12,18 @@ import androidx.annotation.Nullable;
|
||||
|
||||
public class SharpView extends View {
|
||||
|
||||
private int mWidth =0; //三角形的宽度
|
||||
private int mHeight =0; //三角形的高度
|
||||
private Context mContext;
|
||||
private int mWidth = 0; //三角形的宽度
|
||||
private int mHeight = 0; //三角形的高度
|
||||
private final Paint paint = new Paint();
|
||||
private final Path path = new Path();
|
||||
|
||||
public SharpView(Context context) {
|
||||
super(context);
|
||||
this.mContext=context;
|
||||
initView();
|
||||
}
|
||||
|
||||
public SharpView(Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
this.mContext=context;
|
||||
initView();
|
||||
}
|
||||
|
||||
@@ -32,28 +31,27 @@ public class SharpView extends View {
|
||||
mWidth = 25;
|
||||
mHeight = 25;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||
setMeasuredDimension(mWidth,mHeight);
|
||||
setMeasuredDimension(mWidth, mHeight);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
super.onDraw(canvas);
|
||||
//创建画笔
|
||||
Paint paint = new Paint();
|
||||
paint.setColor(Color.parseColor("#FFFFFFFF"));
|
||||
paint.setAntiAlias(true); //抗锯齿
|
||||
paint.setStyle(Paint.Style.FILL);//实线
|
||||
//创建路径
|
||||
Path path = new Path();
|
||||
path.moveTo(0,mHeight);
|
||||
path.lineTo(mWidth,mHeight);
|
||||
path.lineTo(mWidth/2,0);
|
||||
path.moveTo(0, mHeight);
|
||||
path.lineTo(mWidth, mHeight);
|
||||
path.lineTo(mWidth / 2.0f, 0);
|
||||
path.close();//闭合路径
|
||||
//画在画布上
|
||||
canvas.drawPath(path,paint);
|
||||
canvas.drawPath(path, paint);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import static com.mogo.eagle.core.data.biz.dispatch.DispatchAdasAutoPilotLocRece
|
||||
import static com.mogo.eagle.core.data.biz.dispatch.DispatchAdasAutoPilotLocReceiverBean.DISPATCH_TYPE_START;
|
||||
import static com.mogo.eagle.core.data.biz.dispatch.DispatchAdasAutoPilotLocReceiverBean.DISPATCH_TYPE_STOP;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
@@ -12,6 +13,7 @@ import com.mogo.eagle.core.data.biz.dispatch.DispatchAdasAutoPilotLocReceiverBea
|
||||
|
||||
public class DispatchDialogManager {
|
||||
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
private static volatile DispatchDialogManager manager;
|
||||
private static final byte[] obj = new byte[0];
|
||||
private final Context mContext;
|
||||
|
||||
@@ -22,13 +22,13 @@ import com.mogo.eagle.core.function.hmi.R;
|
||||
public class SpeedChartView extends View {
|
||||
|
||||
//中心的文字描述
|
||||
private String mDes = "KM/H";
|
||||
private final String mDes = "KM/H";
|
||||
//根据数据显示的圆弧Paint
|
||||
private Paint mArcPaint;
|
||||
//圆弧颜色
|
||||
private int mArcColor;
|
||||
//圆弧的画笔的宽度
|
||||
private float mStrokeWith = getResources().getDimension(R.dimen.module_ext_arcView_stroke_with);
|
||||
private final float mStrokeWith = getResources().getDimension(R.dimen.module_ext_arcView_stroke_with);
|
||||
//文字描述的paint
|
||||
private Paint mTextPaint;
|
||||
|
||||
@@ -37,9 +37,9 @@ public class SpeedChartView extends View {
|
||||
//当前数据
|
||||
private int currentValue;
|
||||
//最大数据
|
||||
private int maxValue = 240;
|
||||
private final int maxValue = 240;
|
||||
//圆弧背景的开始和结束间的夹角大小
|
||||
private float mAngle = 270;
|
||||
private final float mAngle = 270;
|
||||
//上次绘制圆弧夹角
|
||||
private float lastAngle = 0;
|
||||
|
||||
@@ -73,13 +73,13 @@ public class SpeedChartView extends View {
|
||||
mTextPaint.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));
|
||||
//绘制中心的数值
|
||||
mTextPaint.getTextBounds(mValue, 0, mValue.length(), mRect);
|
||||
canvas.drawText(mValue, getWidth() / 2, getHeight() / 2 + mRect.height() / 2 - 10, mTextPaint);
|
||||
canvas.drawText(mValue, getWidth() / 2.0f, getHeight() / 2.0f + mRect.height() / 2.0f - 10, mTextPaint);
|
||||
|
||||
mTextPaint.setTypeface(Typeface.defaultFromStyle(Typeface.NORMAL));
|
||||
//绘制中心文字描述
|
||||
mTextPaint.setTextSize(getResources().getDimension(R.dimen.module_ext_arcView_des_text_size));
|
||||
mTextPaint.getTextBounds(mDes, 0, mDes.length(), mRect);
|
||||
canvas.drawText(mDes, getWidth() / 2, getHeight() * 17 / 20 + mRect.height() / 2, mTextPaint);
|
||||
canvas.drawText(mDes, getWidth() / 2.0f, getHeight() * 17.0f / 20.0f + mRect.height() / 2.0f, mTextPaint);
|
||||
}
|
||||
|
||||
private void drawArc(Canvas canvas) {
|
||||
|
||||
@@ -27,6 +27,7 @@ public class RouteOverlayDrawer {
|
||||
private Handler mRenderHandler;
|
||||
private final IMoGoOverlayManager mogoOverlayManager;
|
||||
private static volatile RouteOverlayDrawer sInstance;
|
||||
private static final byte[] obj = new byte[0];
|
||||
private Polyline.Options mPolylineOptions;
|
||||
private static final int COLOR_LIGHT = Color.parseColor("#BAEBF5");
|
||||
|
||||
@@ -55,7 +56,7 @@ public class RouteOverlayDrawer {
|
||||
|
||||
public static RouteOverlayDrawer getInstance() {
|
||||
if (sInstance == null) {
|
||||
synchronized (RouteOverlayDrawer.class) {
|
||||
synchronized (obj) {
|
||||
if (sInstance == null) {
|
||||
sInstance = new RouteOverlayDrawer();
|
||||
}
|
||||
|
||||
@@ -142,11 +142,7 @@ public class CarOverlay {
|
||||
|
||||
if (directionMarker == null) {
|
||||
directionMarker = aMap.addMarker(new MarkerOptions().anchor(0.5f, 0.5f).setFlat(true).icon(fourCornersDescriptor).position(mLatLng));
|
||||
if (isDirectionVisible) {
|
||||
directionMarker.setVisible(true);
|
||||
} else {
|
||||
directionMarker.setVisible(false);
|
||||
}
|
||||
directionMarker.setVisible(isDirectionVisible);
|
||||
}
|
||||
carMarker.setVisible(true);
|
||||
newAngle = bearing;
|
||||
@@ -269,7 +265,7 @@ public class CarOverlay {
|
||||
}
|
||||
try {
|
||||
IPoint p = carMarker.getGeoPoint();
|
||||
double newX = 0, newY = 0;
|
||||
double newX, newY;
|
||||
if (currentFrameIndex++ < carMoveAnimationFrameNum) {
|
||||
newX = mapAnchorBackup.x + dXOffStep * currentFrameIndex;
|
||||
newY = mapAnchorBackup.y + dYOffStep * currentFrameIndex;
|
||||
|
||||
@@ -31,8 +31,6 @@ public final class NetConfig {
|
||||
private final Set< Interceptor > interceptors = new ArraySet<>();
|
||||
private final Set< Interceptor > networkInterceptors = new ArraySet<>();
|
||||
|
||||
private final HostnameVerifier allowAllHostnameVerifier = (hostname, session) -> true;
|
||||
|
||||
private String signaturePrefix = "com.foundation.network";
|
||||
private final HostnameVerifier hostnameVerifier = OkHostnameVerifier.INSTANCE;
|
||||
private Map< String, Object > publicParams;
|
||||
|
||||
@@ -60,7 +60,7 @@ public class S2FractalBuilder {
|
||||
*/
|
||||
private double offsetFraction = 0;
|
||||
|
||||
private Random rand;
|
||||
private final Random rand;
|
||||
|
||||
/** You must call setMaxLevel() or setLevelForApproxMaxMedges() before calling makeLoop(). */
|
||||
public S2FractalBuilder(Random rand) {
|
||||
@@ -124,7 +124,7 @@ public class S2FractalBuilder {
|
||||
|
||||
/** Returns level from values in the range [1.5 * (4 ^ n), 6 * (4 ^ n)]. */
|
||||
private static int levelFromEdges(int edges) {
|
||||
return (int) Math.ceil(0.5 * Math.log(edges / 3) / Math.log(2));
|
||||
return (int) Math.ceil(0.5 * Math.log(edges / 3.0f) / Math.log(2));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -49,12 +49,12 @@ public class GlideCircleBitmapTransform extends BitmapTransformation {
|
||||
borderPaint.setStrokeWidth( mBorderWidth );
|
||||
borderPaint.setColor( mBorderColor );
|
||||
borderPaint.setAntiAlias( true );
|
||||
canvas.drawCircle( radius, radius, radius - mBorderWidth / 2, borderPaint );
|
||||
canvas.drawCircle( radius, radius, radius - mBorderWidth / 2.0f, borderPaint );
|
||||
}
|
||||
Paint paint = new Paint();
|
||||
paint.setShader( new BitmapShader( bitmap, BitmapShader.TileMode.CLAMP, BitmapShader.TileMode.CLAMP ) );
|
||||
paint.setAntiAlias( true );
|
||||
canvas.drawCircle( radius, radius, radius - mBorderWidth, paint );
|
||||
canvas.drawCircle( radius, radius, (float) (radius - mBorderWidth), paint );
|
||||
|
||||
DiskLruCacheManager.getInstance( mContext ).put( mKey, result );
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ public class GlideRoundBitmapTransform extends BitmapTransformation {
|
||||
}
|
||||
int width = toTransform.getWidth();
|
||||
int height = toTransform.getHeight();
|
||||
RectF rectF = new RectF( mBorderWidth, mBorderWidth, width - mBorderWidth, height - mBorderWidth );
|
||||
RectF rectF = new RectF( mBorderWidth, mBorderWidth, (float) (width - mBorderWidth), (float) (height - mBorderWidth) );
|
||||
Bitmap result = pool.get( width, height, toTransform.getConfig() );
|
||||
// if ( result == null ) { //get() func always return not null
|
||||
// result = toTransform.copy( toTransform.getConfig(), true );
|
||||
|
||||
@@ -307,12 +307,12 @@ public final class ColorUtils {
|
||||
int[] cColor = hexToArgb(centerColor);
|
||||
int[] eColor = hexToArgb(endColor);
|
||||
if (step >= 3) {
|
||||
int colorStep = (int) Math.floor(step/2);
|
||||
int colorStep = (int) Math.floor(step/2.0f);
|
||||
// 计算每一步的差值
|
||||
float aStep = (cColor[0] - sColor[0]) / colorStep;
|
||||
float rStep = (cColor[1] - sColor[1]) / colorStep;
|
||||
float gStep = (cColor[2] - sColor[2]) / colorStep;
|
||||
float bStep = (cColor[3] - sColor[3]) / colorStep;
|
||||
float aStep = (float) (cColor[0] - sColor[0]) / colorStep;
|
||||
float rStep = (float) (cColor[1] - sColor[1]) / colorStep;
|
||||
float gStep = (float) (cColor[2] - sColor[2]) / colorStep;
|
||||
float bStep = (float) (cColor[3] - sColor[3]) / colorStep;
|
||||
|
||||
|
||||
for (int i = 0; i < colorStep; i++) {
|
||||
@@ -322,10 +322,10 @@ public final class ColorUtils {
|
||||
(int)(gStep * i + sColor[2]),
|
||||
(int)(bStep * i + sColor[3])));
|
||||
}
|
||||
float aStep_ = (eColor[0] - cColor[0]) / colorStep;
|
||||
float rStep_ = (eColor[1] - cColor[1]) / colorStep;
|
||||
float gStep_ = (eColor[2] - cColor[2]) / colorStep;
|
||||
float bStep_ = (eColor[3] - cColor[3]) / colorStep;
|
||||
float aStep_ = (float) (eColor[0] - cColor[0]) / colorStep;
|
||||
float rStep_ = (float) (eColor[1] - cColor[1]) / colorStep;
|
||||
float gStep_ = (float) (eColor[2] - cColor[2]) / colorStep;
|
||||
float bStep_ = (float) (eColor[3] - cColor[3]) / colorStep;
|
||||
|
||||
for (int i = 0; i < colorStep; i++) {
|
||||
gradientColorArr.add(
|
||||
|
||||
@@ -777,14 +777,14 @@ public final class ConvertUtils {
|
||||
SpannableStringBuilder spannable = new SpannableStringBuilder();
|
||||
int length = value.length();
|
||||
if (length > 1) {
|
||||
/**
|
||||
/*
|
||||
* 对于长度大于1的数,对首位进行赋值;
|
||||
* 对于两位数: 如果首位为“1”,则拼接的字符串为“”;
|
||||
*/
|
||||
spannable.append(getChinese(number / (int) Math.pow(10, length - 1), length))
|
||||
spannable.append(getChinese(number / (int) Math.pow(10.0f, length - 1.0f), length))
|
||||
.append(getUnitChinese(length));
|
||||
// 如果该数值取余数为0,则直接返回已有字符(例如:100,直接返回一百)
|
||||
if (number % (int) Math.pow(10, length - 1) == 0) {
|
||||
if (number % (int) Math.pow(10.0f, length - 1.0f) == 0) {
|
||||
return spannable.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,10 +182,10 @@ public class ShadowUtils {
|
||||
private float mShadowHorizScale = 1f;
|
||||
private float mShadowBottomScale = 1f;
|
||||
|
||||
private Paint mCornerShadowPaint;
|
||||
private Paint mEdgeShadowPaint;
|
||||
private final Paint mCornerShadowPaint;
|
||||
private final Paint mEdgeShadowPaint;
|
||||
|
||||
private RectF mContentBounds;
|
||||
private final RectF mContentBounds;
|
||||
|
||||
private float mCornerRadius;
|
||||
|
||||
@@ -210,7 +210,7 @@ public class ShadowUtils {
|
||||
|
||||
private float mRotation;
|
||||
|
||||
private boolean isCircle;
|
||||
private final boolean isCircle;
|
||||
|
||||
public ShadowDrawable(Drawable content, float radius,
|
||||
float shadowSize, float maxShadowSize, int shadowColor, boolean isCircle) {
|
||||
@@ -494,7 +494,7 @@ public class ShadowUtils {
|
||||
// We could have different top-bottom offsets to avoid extra gap above but in that case
|
||||
// center aligning Views inside the CardView would be problematic.
|
||||
if (isCircle) {
|
||||
mCornerRadius = bounds.width() / 2;
|
||||
mCornerRadius = bounds.width() / 2.0f;
|
||||
}
|
||||
final float verticalOffset = mRawMaxShadowSize * mShadowMultiplier;
|
||||
mContentBounds.set(bounds.left + mRawMaxShadowSize, bounds.top + verticalOffset,
|
||||
@@ -679,7 +679,7 @@ public class ShadowUtils {
|
||||
|
||||
public void setWrappedDrawable(Drawable drawable) {
|
||||
if (this.mDrawable != null) {
|
||||
this.mDrawable.setCallback((Callback) null);
|
||||
this.mDrawable.setCallback(null);
|
||||
}
|
||||
|
||||
this.mDrawable = drawable;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.mogo.eagle.core.utilcode.util;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.media.*;
|
||||
import android.content.*;
|
||||
import android.os.*;
|
||||
@@ -21,20 +22,15 @@ public class SoundPoolUtils {
|
||||
private int resId;
|
||||
private Context mContext;
|
||||
|
||||
private volatile static SoundPoolUtils INSTANCE;
|
||||
|
||||
private SoundPoolUtils(){}
|
||||
public static SoundPoolUtils getSoundPool(){
|
||||
if (INSTANCE == null){
|
||||
synchronized (SoundPoolUtils.class){
|
||||
if (INSTANCE == null){
|
||||
INSTANCE = new SoundPoolUtils();
|
||||
}
|
||||
}
|
||||
}
|
||||
return INSTANCE;
|
||||
return Holder.INSTANCE;
|
||||
}
|
||||
|
||||
private static final class Holder{
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
private static final SoundPoolUtils INSTANCE = new SoundPoolUtils();
|
||||
}
|
||||
|
||||
public SoundPoolUtils(){}
|
||||
|
||||
//播放资源文件
|
||||
public void playSoundWithRedId(Context context,int resId){
|
||||
@@ -63,30 +59,20 @@ public class SoundPoolUtils {
|
||||
|
||||
if (mSoundPool == null){
|
||||
// For Android SDK >= 21
|
||||
if (Build.VERSION.SDK_INT >= 21 ) {
|
||||
|
||||
AudioAttributes audioAttrib = new AudioAttributes.Builder()
|
||||
.setUsage(AudioAttributes.USAGE_GAME)
|
||||
.setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
|
||||
.build();
|
||||
AudioAttributes audioAttrib = new AudioAttributes.Builder()
|
||||
.setUsage(AudioAttributes.USAGE_GAME)
|
||||
.setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
|
||||
.build();
|
||||
|
||||
SoundPool.Builder builder= new SoundPool.Builder();
|
||||
builder.setAudioAttributes(audioAttrib).setMaxStreams(MAX_STREAMS);
|
||||
SoundPool.Builder builder= new SoundPool.Builder();
|
||||
builder.setAudioAttributes(audioAttrib).setMaxStreams(MAX_STREAMS);
|
||||
|
||||
this.mSoundPool = builder.build();
|
||||
} else {// for Android SDK < 21
|
||||
// SoundPool(int maxStreams, int streamType, int srcQuality)
|
||||
this.mSoundPool = new SoundPool(MAX_STREAMS, AudioManager.STREAM_MUSIC, 0);
|
||||
}
|
||||
this.mSoundPool = builder.build();
|
||||
}
|
||||
|
||||
// When Sound Pool load complete.
|
||||
this.mSoundPool.setOnLoadCompleteListener(new SoundPool.OnLoadCompleteListener() {
|
||||
@Override
|
||||
public void onLoadComplete(SoundPool soundPool, int sampleId, int status) {
|
||||
playSound();
|
||||
}
|
||||
});
|
||||
this.mSoundPool.setOnLoadCompleteListener((soundPool, sampleId, status) -> playSound());
|
||||
|
||||
//load res
|
||||
this.mSoundId =this.mSoundPool.load(this.mContext,this.resId,1);
|
||||
@@ -108,10 +94,10 @@ public class SoundPoolUtils {
|
||||
|
||||
//play the sound res
|
||||
private void playSound(){
|
||||
float leftVolumn = volume;
|
||||
float rightVolumn = volume;
|
||||
float leftVolume = volume;
|
||||
float rightVolume = volume;
|
||||
// Play sound of gunfire. Returns the ID of the new stream.
|
||||
int streamId = this.mSoundPool.play(this.mSoundId,leftVolumn, rightVolumn, 1, 0, 1f);
|
||||
int streamId = this.mSoundPool.play(this.mSoundId,leftVolume, rightVolume, 1, 0, 1f);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1031,7 +1031,7 @@ public final class SpanUtils {
|
||||
// }
|
||||
// }
|
||||
|
||||
canvas.drawText(text.toString(), x, y - ((y + fm.descent + y + fm.ascent) / 2 - (bottom + top) / 2), paint);
|
||||
canvas.drawText(text.toString(), x, y - ((y + fm.descent + y + fm.ascent) / 2.0f - (bottom + top) / 2.0f), paint);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1200,11 +1200,11 @@ public final class SpanUtils {
|
||||
sBulletPath.addCircle(0.0f, 0.0f, radius, Path.Direction.CW);
|
||||
}
|
||||
c.save();
|
||||
c.translate(x + dir * radius, (top + bottom) / 2.0f);
|
||||
c.translate((float)(x + dir * radius), (top + bottom) / 2.0f);
|
||||
c.drawPath(sBulletPath, p);
|
||||
c.restore();
|
||||
} else {
|
||||
c.drawCircle(x + dir * radius, (top + bottom) / 2.0f, radius, p);
|
||||
c.drawCircle((float)(x + dir * radius), (top + bottom) / 2.0f, radius, p);
|
||||
}
|
||||
p.setColor(oldColor);
|
||||
p.setStyle(style);
|
||||
@@ -1386,7 +1386,7 @@ public final class SpanUtils {
|
||||
if (mVerticalAlignment == ALIGN_TOP) {
|
||||
transY = top;
|
||||
} else if (mVerticalAlignment == ALIGN_CENTER) {
|
||||
transY = (bottom + top - rect.height()) / 2;
|
||||
transY = (bottom + top - rect.height()) / 2.0f;
|
||||
} else if (mVerticalAlignment == ALIGN_BASELINE) {
|
||||
transY = y - rect.height();
|
||||
} else {
|
||||
@@ -1417,7 +1417,7 @@ public final class SpanUtils {
|
||||
}
|
||||
|
||||
static class ShaderSpan extends CharacterStyle implements UpdateAppearance {
|
||||
private Shader mShader;
|
||||
private final Shader mShader;
|
||||
|
||||
private ShaderSpan(final Shader shader) {
|
||||
this.mShader = shader;
|
||||
|
||||
Reference in New Issue
Block a user