mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-24 10:35:19 +00:00
Add fake chat view elevation
This commit is contained in:
parent
7209686322
commit
be04246ba2
@ -5,6 +5,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:paddingLeft="@dimen/very_large_spacing"
|
android:paddingLeft="@dimen/very_large_spacing"
|
||||||
android:paddingRight="@dimen/very_large_spacing"
|
android:paddingRight="@dimen/very_large_spacing"
|
||||||
|
android:paddingBottom="@dimen/medium_spacing"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
@ -11,4 +11,14 @@
|
|||||||
<item name="android:textColor">@android:color/white</item>
|
<item name="android:textColor">@android:color/white</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<style name="FakeChatViewMessageBubble.Incoming">
|
||||||
|
<item name="android:background">@drawable/fake_chat_view_incoming_message_background</item>
|
||||||
|
<item name="android:elevation">4dp</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="FakeChatViewMessageBubble.Outgoing">
|
||||||
|
<item name="android:background">@drawable/fake_chat_view_outgoing_message_background</item>
|
||||||
|
<item name="android:elevation">4dp</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
@ -29,7 +29,7 @@
|
|||||||
<dimen name="text_view_corner_radius">8dp</dimen>
|
<dimen name="text_view_corner_radius">8dp</dimen>
|
||||||
<dimen name="fake_chat_view_bubble_width">224dp</dimen>
|
<dimen name="fake_chat_view_bubble_width">224dp</dimen>
|
||||||
<dimen name="fake_chat_view_bubble_corner_radius">10dp</dimen>
|
<dimen name="fake_chat_view_bubble_corner_radius">10dp</dimen>
|
||||||
<dimen name="fake_chat_view_height">234dp</dimen>
|
<dimen name="fake_chat_view_height">250dp</dimen>
|
||||||
<dimen name="setting_button_height">56dp</dimen>
|
<dimen name="setting_button_height">56dp</dimen>
|
||||||
<dimen name="dialog_corner_radius">12dp</dimen>
|
<dimen name="dialog_corner_radius">12dp</dimen>
|
||||||
<dimen name="dialog_button_corner_radius">4dp</dimen>
|
<dimen name="dialog_button_corner_radius">4dp</dimen>
|
||||||
|
@ -184,10 +184,12 @@
|
|||||||
|
|
||||||
<style name="FakeChatViewMessageBubble.Incoming">
|
<style name="FakeChatViewMessageBubble.Incoming">
|
||||||
<item name="android:background">@drawable/fake_chat_view_incoming_message_background</item>
|
<item name="android:background">@drawable/fake_chat_view_incoming_message_background</item>
|
||||||
|
<item name="android:elevation">10dp</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="FakeChatViewMessageBubble.Outgoing">
|
<style name="FakeChatViewMessageBubble.Outgoing">
|
||||||
<item name="android:background">@drawable/fake_chat_view_outgoing_message_background</item>
|
<item name="android:background">@drawable/fake_chat_view_outgoing_message_background</item>
|
||||||
|
<item name="android:elevation">10dp</item>
|
||||||
</style>
|
</style>
|
||||||
<!-- Session -->
|
<!-- Session -->
|
||||||
|
|
||||||
|
@ -1,14 +1,18 @@
|
|||||||
package org.thoughtcrime.securesms.loki.views
|
package org.thoughtcrime.securesms.loki.views
|
||||||
|
|
||||||
|
import android.animation.FloatEvaluator
|
||||||
|
import android.animation.ValueAnimator
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Context.LAYOUT_INFLATER_SERVICE
|
import android.content.Context.LAYOUT_INFLATER_SERVICE
|
||||||
import android.os.Handler
|
import android.os.Handler
|
||||||
import android.util.AttributeSet
|
import android.util.AttributeSet
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
import android.widget.LinearLayout
|
||||||
import android.widget.ScrollView
|
import android.widget.ScrollView
|
||||||
import kotlinx.android.synthetic.main.view_fake_chat.view.*
|
import kotlinx.android.synthetic.main.view_fake_chat.view.*
|
||||||
import network.loki.messenger.R
|
import network.loki.messenger.R
|
||||||
|
import org.thoughtcrime.securesms.loki.utilities.disableClipping
|
||||||
|
|
||||||
class FakeChatView : ScrollView {
|
class FakeChatView : ScrollView {
|
||||||
|
|
||||||
@ -38,7 +42,8 @@ class FakeChatView : ScrollView {
|
|||||||
|
|
||||||
private fun setUpViewHierarchy() {
|
private fun setUpViewHierarchy() {
|
||||||
val inflater = context.getSystemService(LAYOUT_INFLATER_SERVICE) as LayoutInflater
|
val inflater = context.getSystemService(LAYOUT_INFLATER_SERVICE) as LayoutInflater
|
||||||
val contentView = inflater.inflate(R.layout.view_fake_chat, null)
|
val contentView = inflater.inflate(R.layout.view_fake_chat, null) as LinearLayout
|
||||||
|
contentView.disableClipping()
|
||||||
addView(contentView)
|
addView(contentView)
|
||||||
isVerticalScrollBarEnabled = false
|
isVerticalScrollBarEnabled = false
|
||||||
}
|
}
|
||||||
@ -47,8 +52,13 @@ class FakeChatView : ScrollView {
|
|||||||
// region Animation
|
// region Animation
|
||||||
fun startAnimating() {
|
fun startAnimating() {
|
||||||
listOf( bubble1, bubble2, bubble3, bubble4, bubble5 ).forEach { it.alpha = 0.0f }
|
listOf( bubble1, bubble2, bubble3, bubble4, bubble5 ).forEach { it.alpha = 0.0f }
|
||||||
fun show(view: View) {
|
fun show(bubble: View) {
|
||||||
view.animate().alpha(1.0f).setDuration(animationDuration).start()
|
val animation = ValueAnimator.ofObject(FloatEvaluator(), 0.0f, 1.0f)
|
||||||
|
animation.duration = animationDuration
|
||||||
|
animation.addUpdateListener { animator ->
|
||||||
|
bubble.alpha = animator.animatedValue as Float
|
||||||
|
}
|
||||||
|
animation.start()
|
||||||
}
|
}
|
||||||
Handler().postDelayed({
|
Handler().postDelayed({
|
||||||
show(bubble1)
|
show(bubble1)
|
||||||
|
Loading…
Reference in New Issue
Block a user