use the apps color on the focus rect

This commit is contained in:
tibbi
2017-03-21 22:39:25 +01:00
parent e309221b76
commit 5a04995b77
3 changed files with 13 additions and 10 deletions

View File

@ -6,7 +6,7 @@ import android.graphics.Paint
import android.graphics.Rect
import android.os.Handler
import android.view.ViewGroup
import com.simplemobiletools.camera.R
import com.simplemobiletools.camera.extensions.config
class FocusRectView(context: Context) : ViewGroup(context) {
companion object {
@ -14,7 +14,6 @@ class FocusRectView(context: Context) : ViewGroup(context) {
private val RECT_DURATION = 500
private var mDrawRect = false
private var mPrimaryColor = 0
lateinit var mPaint: Paint
lateinit var mHandler: Handler
@ -24,18 +23,21 @@ class FocusRectView(context: Context) : ViewGroup(context) {
init {
setWillNotDraw(false)
mHandler = Handler()
mPrimaryColor = resources.getColor(R.color.color_primary)
setupPaint()
}
private fun setupPaint() {
mPaint = Paint().apply {
style = Paint.Style.STROKE
color = mPrimaryColor
color = context.config.primaryColor
strokeWidth = 2f
}
}
fun setStrokeColor(color: Int) {
mPaint.color = color
}
fun drawFocusRect(x: Int, y: Int) {
mRect = Rect(x - RECT_SIZE, y - RECT_SIZE, x + RECT_SIZE, y + RECT_SIZE)
toggleRect(true)