|
|
@ -5,6 +5,7 @@ import android.content.Context |
|
|
|
import android.graphics.Canvas |
|
|
|
import android.graphics.Canvas |
|
|
|
import android.graphics.Paint |
|
|
|
import android.graphics.Paint |
|
|
|
import android.graphics.Rect |
|
|
|
import android.graphics.Rect |
|
|
|
|
|
|
|
import android.graphics.Typeface |
|
|
|
import android.util.AttributeSet |
|
|
|
import android.util.AttributeSet |
|
|
|
import androidx.annotation.ColorInt |
|
|
|
import androidx.annotation.ColorInt |
|
|
|
import androidx.appcompat.widget.AppCompatTextView |
|
|
|
import androidx.appcompat.widget.AppCompatTextView |
|
|
@ -21,6 +22,7 @@ class BatteryView(context: Context, attrs: AttributeSet?) : AppCompatTextView(co |
|
|
|
batteryPaint.strokeWidth = 1.dp.toFloat() |
|
|
|
batteryPaint.strokeWidth = 1.dp.toFloat() |
|
|
|
batteryPaint.isAntiAlias = true |
|
|
|
batteryPaint.isAntiAlias = true |
|
|
|
batteryPaint.color = paint.color |
|
|
|
batteryPaint.color = paint.color |
|
|
|
|
|
|
|
typeface = Typeface.createFromAsset(context.assets, "number.ttf") |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun setColor(@ColorInt color: Int) { |
|
|
|
fun setColor(@ColorInt color: Int) { |
|
|
|