mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-28 04:25:18 +00:00
Clean
This commit is contained in:
parent
092dad03b7
commit
5a2baae15d
@ -63,6 +63,9 @@ class InputBarButton : RelativeLayout {
|
|||||||
result.layoutParams = LayoutParams(size, size)
|
result.layoutParams = LayoutParams(size, size)
|
||||||
result.setBackgroundResource(R.drawable.input_bar_button_background)
|
result.setBackgroundResource(R.drawable.input_bar_button_background)
|
||||||
result.mainColor = resources.getColorWithID(colorID, context.theme)
|
result.mainColor = resources.getColorWithID(colorID, context.theme)
|
||||||
|
if (hasOpaqueBackground) {
|
||||||
|
result.strokeColor = resources.getColorWithID(R.color.input_bar_button_background_opaque_border, context.theme)
|
||||||
|
}
|
||||||
result
|
result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,16 +6,14 @@ import android.content.Context
|
|||||||
import android.graphics.*
|
import android.graphics.*
|
||||||
import android.util.AttributeSet
|
import android.util.AttributeSet
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewOutlineProvider
|
|
||||||
import android.widget.ImageView
|
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
import android.widget.RelativeLayout
|
import android.widget.RelativeLayout
|
||||||
import androidx.annotation.ColorInt
|
import androidx.annotation.ColorInt
|
||||||
import androidx.annotation.ColorRes
|
import androidx.annotation.ColorRes
|
||||||
import androidx.appcompat.widget.AppCompatImageView
|
|
||||||
import network.loki.messenger.R
|
import network.loki.messenger.R
|
||||||
import org.thoughtcrime.securesms.loki.utilities.getColorWithID
|
import org.thoughtcrime.securesms.loki.utilities.getColorWithID
|
||||||
import org.thoughtcrime.securesms.loki.utilities.toPx
|
import org.thoughtcrime.securesms.loki.utilities.toPx
|
||||||
|
import kotlin.math.roundToInt
|
||||||
|
|
||||||
interface GlowView {
|
interface GlowView {
|
||||||
var mainColor: Int
|
var mainColor: Int
|
||||||
@ -162,16 +160,27 @@ class PathDotView : View, GlowView {
|
|||||||
|
|
||||||
class InputBarButtonImageViewContainer : RelativeLayout, GlowView {
|
class InputBarButtonImageViewContainer : RelativeLayout, GlowView {
|
||||||
@ColorInt override var mainColor: Int = 0
|
@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
|
@ColorInt override var sessionShadowColor: Int = 0 // Unused
|
||||||
|
|
||||||
private val paint: Paint by lazy {
|
private val fillPaint: Paint by lazy {
|
||||||
val result = Paint()
|
val result = Paint()
|
||||||
result.style = Paint.Style.FILL
|
result.style = Paint.Style.FILL
|
||||||
result.isAntiAlias = true
|
result.isAntiAlias = true
|
||||||
result
|
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
|
// region Lifecycle
|
||||||
constructor(context: Context) : super(context) { }
|
constructor(context: Context) : super(context) { }
|
||||||
constructor(context: Context, attrs: AttributeSet) : super(context, attrs) { }
|
constructor(context: Context, attrs: AttributeSet) : super(context, attrs) { }
|
||||||
@ -186,7 +195,10 @@ class InputBarButtonImageViewContainer : RelativeLayout, GlowView {
|
|||||||
override fun onDraw(c: Canvas) {
|
override fun onDraw(c: Canvas) {
|
||||||
val w = width.toFloat()
|
val w = width.toFloat()
|
||||||
val h = height.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)
|
super.onDraw(c)
|
||||||
}
|
}
|
||||||
// endregion
|
// endregion
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
<color name="input_bar_background">#FCFCFC</color>
|
<color name="input_bar_background">#FCFCFC</color>
|
||||||
<color name="input_bar_button_background">#0D000000</color>
|
<color name="input_bar_button_background">#0D000000</color>
|
||||||
<color name="input_bar_button_background_opaque">#EFEFEF</color>
|
<color name="input_bar_button_background_opaque">#EFEFEF</color>
|
||||||
|
<color name="input_bar_button_background_opaque_border">#33000000</color>
|
||||||
<color name="input_bar_lock_view_background">#FCFCFC</color>
|
<color name="input_bar_lock_view_background">#FCFCFC</color>
|
||||||
<color name="input_bar_lock_view_border">#66000000</color>
|
<color name="input_bar_lock_view_border">#66000000</color>
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
<color name="input_bar_background">#171717</color>
|
<color name="input_bar_background">#171717</color>
|
||||||
<color name="input_bar_button_background">#0DFFFFFF</color>
|
<color name="input_bar_button_background">#0DFFFFFF</color>
|
||||||
<color name="input_bar_button_background_opaque">#232323</color>
|
<color name="input_bar_button_background_opaque">#232323</color>
|
||||||
|
<color name="input_bar_button_background_opaque_border">#33FFFFFF</color>
|
||||||
<color name="input_bar_lock_view_background">#171717</color>
|
<color name="input_bar_lock_view_background">#171717</color>
|
||||||
<color name="input_bar_lock_view_border">#66FFFFFF</color>
|
<color name="input_bar_lock_view_border">#66FFFFFF</color>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user