diff --git a/res/drawable/prominent_outline_button_medium_background.xml b/res/drawable/prominent_outline_button_medium_background.xml
index 183ed83282..f595e4f38b 100644
--- a/res/drawable/prominent_outline_button_medium_background.xml
+++ b/res/drawable/prominent_outline_button_medium_background.xml
@@ -7,5 +7,5 @@
-
+
\ No newline at end of file
diff --git a/res/layout/activity_home.xml b/res/layout/activity_home.xml
index 13eb8bda5e..53e3a9138d 100644
--- a/res/layout/activity_home.xml
+++ b/res/layout/activity_home.xml
@@ -76,7 +76,8 @@
+ android:layout_height="match_parent"
+ android:clipChildren="false">
#141414
#99FFFFFF
#1F1F1F
+ #077C44
#1B1B1B
#212121
#FFCE3A
diff --git a/src/org/thoughtcrime/securesms/loki/views/GlowView.kt b/src/org/thoughtcrime/securesms/loki/views/GlowView.kt
index e534cc6279..5ecb77a5e2 100644
--- a/src/org/thoughtcrime/securesms/loki/views/GlowView.kt
+++ b/src/org/thoughtcrime/securesms/loki/views/GlowView.kt
@@ -90,3 +90,36 @@ class PNModeView : LinearLayout, GlowView {
}
// endregion
}
+
+class NewConversationButtonImageView : androidx.appcompat.widget.AppCompatImageView, GlowView {
+ @ColorInt override var mainColor: Int = 0
+ set(newValue) { field = newValue; paint.color = newValue }
+ @ColorInt override var sessionShadowColor: Int = 0
+ set(newValue) { field = newValue; paint.setShadowLayer(toPx(6, resources).toFloat(), 0.0f, 0.0f, newValue) }
+
+ private val paint: Paint by lazy {
+ val result = Paint()
+ result.style = Paint.Style.FILL
+ result.isAntiAlias = true
+ result
+ }
+
+ // region Lifecycle
+ constructor(context: Context) : super(context) { }
+ constructor(context: Context, attrs: AttributeSet) : super(context, attrs) { }
+ constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr) { }
+
+ init {
+ setWillNotDraw(false)
+ }
+ // endregion
+
+ // region Updating
+ override fun onDraw(c: Canvas) {
+ val w = width.toFloat()
+ val h = height.toFloat()
+ c.drawCircle(w / 2, h / 2, w / 2, paint)
+ super.onDraw(c)
+ }
+ // endregion
+}
\ No newline at end of file
diff --git a/src/org/thoughtcrime/securesms/loki/views/LabeledSeparatorView.kt b/src/org/thoughtcrime/securesms/loki/views/LabeledSeparatorView.kt
index 028dd34a49..4cbc83dc7b 100644
--- a/src/org/thoughtcrime/securesms/loki/views/LabeledSeparatorView.kt
+++ b/src/org/thoughtcrime/securesms/loki/views/LabeledSeparatorView.kt
@@ -16,7 +16,7 @@ class LabeledSeparatorView : RelativeLayout {
private val path = Path()
- private val paint: Paint by lazy{
+ private val paint: Paint by lazy {
val result = Paint()
result.style = Paint.Style.STROKE
result.color = ThemeUtil.getThemedColor(context, R.attr.dividerHorizontal)
diff --git a/src/org/thoughtcrime/securesms/loki/views/NewConversationButtonSetView.kt b/src/org/thoughtcrime/securesms/loki/views/NewConversationButtonSetView.kt
index e46f82e376..793ae44dea 100644
--- a/src/org/thoughtcrime/securesms/loki/views/NewConversationButtonSetView.kt
+++ b/src/org/thoughtcrime/securesms/loki/views/NewConversationButtonSetView.kt
@@ -7,9 +7,7 @@ import android.animation.ValueAnimator
import android.content.Context
import android.content.Context.VIBRATOR_SERVICE
import android.content.res.ColorStateList
-import android.graphics.Color
import android.graphics.PointF
-import android.graphics.drawable.GradientDrawable
import android.os.Build
import android.os.VibrationEffect
import android.os.VibrationEffect.DEFAULT_AMPLITUDE
@@ -66,24 +64,25 @@ class NewConversationButtonSetView : RelativeLayout {
private val collapsedImageViewPosition by lazy { PointF((expandedSize - collapsedSize) / 2, (expandedSize - collapsedSize) / 2) }
private val imageView by lazy {
- val result = ImageView(context)
+ val result = NewConversationButtonImageView(context)
val size = collapsedSize.toInt()
result.layoutParams = LayoutParams(size, size)
result.setBackgroundResource(R.drawable.new_conversation_button_background)
- val background = result.background as GradientDrawable
- @ColorRes val backgroundColorID = if (isMain)
- R.color.accent else
- R.color.new_conversation_button_collapsed_background
- background.color = ColorStateList.valueOf(resources.getColorWithID(backgroundColorID, context.theme))
+ @ColorRes val backgroundColorID = if (isMain) R.color.accent else R.color.new_conversation_button_collapsed_background
+ @ColorRes val shadowColorID = if (isMain) {
+ R.color.new_conversation_button_shadow
+ } else {
+ if (UiModeUtilities.isDayUiMode(context)) R.color.transparent_black_30 else R.color.black
+ }
+ result.mainColor = resources.getColorWithID(backgroundColorID, context.theme)
+ result.sessionShadowColor = resources.getColorWithID(shadowColorID, context.theme)
result.scaleType = ImageView.ScaleType.CENTER
result.setImageResource(iconID)
-
- result.imageTintList = if (isMain)
- // Always use white icon for the main button.
+ result.imageTintList = if (isMain) {
ColorStateList.valueOf(resources.getColorWithID(android.R.color.white, context.theme))
- else
+ } else {
ColorStateList.valueOf(resources.getColorWithID(R.color.text, context.theme))
-
+ }
result
}
@@ -106,30 +105,21 @@ class NewConversationButtonSetView : RelativeLayout {
}
fun expand() {
- animateImageViewColorChange(R.color.new_conversation_button_collapsed_background, R.color.accent)
+ GlowViewUtilities.animateColorChange(context, imageView, R.color.new_conversation_button_collapsed_background, R.color.accent)
+ @ColorRes val startShadowColorID = if (UiModeUtilities.isDayUiMode(context)) R.color.transparent_black_30 else R.color.black
+ GlowViewUtilities.animateShadowColorChange(context, imageView, startShadowColorID, R.color.new_conversation_button_shadow)
imageView.animateSizeChange(R.dimen.new_conversation_button_collapsed_size, R.dimen.new_conversation_button_expanded_size, animationDuration)
animateImageViewPositionChange(collapsedImageViewPosition, expandedImageViewPosition)
}
fun collapse() {
- animateImageViewColorChange(R.color.accent, R.color.new_conversation_button_collapsed_background)
+ GlowViewUtilities.animateColorChange(context, imageView, R.color.accent, R.color.new_conversation_button_collapsed_background)
+ @ColorRes val endShadowColorID = if (UiModeUtilities.isDayUiMode(context)) R.color.transparent_black_30 else R.color.black
+ GlowViewUtilities.animateShadowColorChange(context, imageView, R.color.new_conversation_button_shadow, endShadowColorID)
imageView.animateSizeChange(R.dimen.new_conversation_button_expanded_size, R.dimen.new_conversation_button_collapsed_size, animationDuration)
animateImageViewPositionChange(expandedImageViewPosition, collapsedImageViewPosition)
}
- private fun animateImageViewColorChange(@ColorRes startColorID: Int, @ColorRes endColorID: Int) {
- val drawable = imageView.background as GradientDrawable
- val startColor = resources.getColorWithID(startColorID, context.theme)
- val endColor = resources.getColorWithID(endColorID, context.theme)
- val animation = ValueAnimator.ofObject(ArgbEvaluator(), startColor, endColor)
- animation.duration = animationDuration
- animation.addUpdateListener { animator ->
- val color = animator.animatedValue as Int
- drawable.color = ColorStateList.valueOf(color)
- }
- animation.start()
- }
-
private fun animateImageViewPositionChange(startPosition: PointF, endPosition: PointF) {
val animation = ValueAnimator.ofObject(PointFEvaluator(), startPosition, endPosition)
animation.duration = animationDuration
@@ -170,6 +160,7 @@ class NewConversationButtonSetView : RelativeLayout {
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int, defStyleRes: Int) : super(context, attrs, defStyleAttr, defStyleRes) { setUpViewHierarchy() }
private fun setUpViewHierarchy() {
+ disableClipping()
// Set up session button
addView(sessionButton)
sessionButton.alpha = 0.0f