From 5a2baae15dea2dba07c04ce2fb917b99accd444f Mon Sep 17 00:00:00 2001 From: Niels Andriesse Date: Thu, 17 Jun 2021 14:57:47 +1000 Subject: [PATCH] Clean --- .../v2/input_bar/InputBarButton.kt | 3 +++ .../securesms/loki/views/GlowView.kt | 24 ++++++++++++++----- .../main/res/values-notnight-v21/colors.xml | 1 + app/src/main/res/values/colors.xml | 1 + 4 files changed, 23 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/input_bar/InputBarButton.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/input_bar/InputBarButton.kt index cf95a7c4eb..bcb753b416 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/input_bar/InputBarButton.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/input_bar/InputBarButton.kt @@ -63,6 +63,9 @@ class InputBarButton : RelativeLayout { result.layoutParams = LayoutParams(size, size) result.setBackgroundResource(R.drawable.input_bar_button_background) result.mainColor = resources.getColorWithID(colorID, context.theme) + if (hasOpaqueBackground) { + result.strokeColor = resources.getColorWithID(R.color.input_bar_button_background_opaque_border, context.theme) + } result } diff --git a/app/src/main/java/org/thoughtcrime/securesms/loki/views/GlowView.kt b/app/src/main/java/org/thoughtcrime/securesms/loki/views/GlowView.kt index e99e6f601a..c2619a6044 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/loki/views/GlowView.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/loki/views/GlowView.kt @@ -6,16 +6,14 @@ import android.content.Context import android.graphics.* import android.util.AttributeSet import android.view.View -import android.view.ViewOutlineProvider -import android.widget.ImageView import android.widget.LinearLayout import android.widget.RelativeLayout import androidx.annotation.ColorInt import androidx.annotation.ColorRes -import androidx.appcompat.widget.AppCompatImageView import network.loki.messenger.R import org.thoughtcrime.securesms.loki.utilities.getColorWithID import org.thoughtcrime.securesms.loki.utilities.toPx +import kotlin.math.roundToInt interface GlowView { var mainColor: Int @@ -162,16 +160,27 @@ class PathDotView : View, GlowView { class InputBarButtonImageViewContainer : RelativeLayout, GlowView { @ColorInt override var mainColor: Int = 0 - set(newValue) { field = newValue; paint.color = newValue } + set(newValue) { field = newValue; fillPaint.color = newValue } + @ColorInt var strokeColor: Int = 0 + set(newValue) { field = newValue; strokePaint.color = newValue } @ColorInt override var sessionShadowColor: Int = 0 // Unused - private val paint: Paint by lazy { + private val fillPaint: Paint by lazy { val result = Paint() result.style = Paint.Style.FILL result.isAntiAlias = true result } + private val strokePaint: Paint by lazy { + val result = Paint() + result.style = Paint.Style.STROKE + result.isAntiAlias = true + result.strokeWidth = 1.0f + result.alpha = (255 * 0.2f).roundToInt() + result + } + // region Lifecycle constructor(context: Context) : super(context) { } constructor(context: Context, attrs: AttributeSet) : super(context, attrs) { } @@ -186,7 +195,10 @@ class InputBarButtonImageViewContainer : RelativeLayout, GlowView { override fun onDraw(c: Canvas) { val w = width.toFloat() val h = height.toFloat() - c.drawCircle(w / 2, h / 2, w / 2, paint) + c.drawCircle(w / 2, h / 2, w / 2, fillPaint) + if (strokeColor != 0) { + c.drawCircle(w / 2, h / 2, w / 2, strokePaint) + } super.onDraw(c) } // endregion diff --git a/app/src/main/res/values-notnight-v21/colors.xml b/app/src/main/res/values-notnight-v21/colors.xml index 235a24ae0a..29ccfd2318 100644 --- a/app/src/main/res/values-notnight-v21/colors.xml +++ b/app/src/main/res/values-notnight-v21/colors.xml @@ -23,6 +23,7 @@ #FCFCFC #0D000000 #EFEFEF + #33000000 #FCFCFC #66000000 diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 45d1eb8454..57d076c8ea 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -30,6 +30,7 @@ #171717 #0DFFFFFF #232323 + #33FFFFFF #171717 #66FFFFFF