Unverified Commit 49a3f43a authored by Filipe de Lima Brito's avatar Filipe de Lima Brito Committed by GitHub

Merge pull request #1481 from shubhsherl/f1463

[IMPROVEMENT] Connecting view at top of the chat list
parents 8c7899c3 9240c531
...@@ -706,22 +706,22 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR ...@@ -706,22 +706,22 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
override fun showConnectionState(state: State) { override fun showConnectionState(state: State) {
ui { ui {
connection_status_text.fadeIn() text_connection_status.fadeIn()
handler.removeCallbacks(dismissStatus) handler.removeCallbacks(dismissStatus)
when (state) { when (state) {
is State.Connected -> { is State.Connected -> {
connection_status_text.text = getString(R.string.status_connected) text_connection_status.text = getString(R.string.status_connected)
handler.postDelayed(dismissStatus, 2000) handler.postDelayed(dismissStatus, 2000)
} }
is State.Disconnected -> connection_status_text.text = is State.Disconnected -> text_connection_status.text =
getString(R.string.status_disconnected) getString(R.string.status_disconnected)
is State.Connecting -> connection_status_text.text = is State.Connecting -> text_connection_status.text =
getString(R.string.status_connecting) getString(R.string.status_connecting)
is State.Authenticating -> connection_status_text.text = is State.Authenticating -> text_connection_status.text =
getString(R.string.status_authenticating) getString(R.string.status_authenticating)
is State.Disconnecting -> connection_status_text.text = is State.Disconnecting -> text_connection_status.text =
getString(R.string.status_disconnecting) getString(R.string.status_disconnecting)
is State.Waiting -> connection_status_text.text = is State.Waiting -> text_connection_status.text =
getString(R.string.status_waiting, state.seconds) getString(R.string.status_waiting, state.seconds)
} }
} }
...@@ -737,7 +737,7 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR ...@@ -737,7 +737,7 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
} }
private val dismissStatus = { private val dismissStatus = {
connection_status_text.fadeOut() text_connection_status.fadeOut()
} }
private fun setupRecyclerView() { private fun setupRecyclerView() {
......
...@@ -297,25 +297,25 @@ class ChatRoomsFragment : Fragment(), ChatRoomsView { ...@@ -297,25 +297,25 @@ class ChatRoomsFragment : Fragment(), ChatRoomsView {
private fun showConnectionState(state: State) { private fun showConnectionState(state: State) {
Timber.d("Got new state: $state") Timber.d("Got new state: $state")
ui { ui {
connection_status_text.fadeIn() text_connection_status.fadeIn()
handler.removeCallbacks(dismissStatus) handler.removeCallbacks(dismissStatus)
when (state) { when (state) {
is State.Connected -> { is State.Connected -> {
connection_status_text.text = getString(R.string.status_connected) text_connection_status.text = getString(R.string.status_connected)
handler.postDelayed(dismissStatus, 2000) handler.postDelayed(dismissStatus, 2000)
} }
is State.Disconnected -> connection_status_text.text = getString(R.string.status_disconnected) is State.Disconnected -> text_connection_status.text = getString(R.string.status_disconnected)
is State.Connecting -> connection_status_text.text = getString(R.string.status_connecting) is State.Connecting -> text_connection_status.text = getString(R.string.status_connecting)
is State.Authenticating -> connection_status_text.text = getString(R.string.status_authenticating) is State.Authenticating -> text_connection_status.text = getString(R.string.status_authenticating)
is State.Disconnecting -> connection_status_text.text = getString(R.string.status_disconnecting) is State.Disconnecting -> text_connection_status.text = getString(R.string.status_disconnecting)
is State.Waiting -> connection_status_text.text = getString(R.string.status_waiting, state.seconds) is State.Waiting -> text_connection_status.text = getString(R.string.status_waiting, state.seconds)
} }
} }
} }
private val dismissStatus = { private val dismissStatus = {
if (connection_status_text != null) { if (text_connection_status != null) {
connection_status_text.fadeOut() text_connection_status.fadeOut()
} }
} }
......
...@@ -12,9 +12,9 @@ ...@@ -12,9 +12,9 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="0dp" android:layout_height="0dp"
app:layout_constraintBottom_toTopOf="@id/text_typing_status" app:layout_constraintBottom_toTopOf="@id/text_typing_status"
app:layout_constraintTop_toBottomOf="@+id/text_connection_status"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent">
app:layout_constraintTop_toTopOf="parent">
<include <include
android:id="@+id/layout_message_list" android:id="@+id/layout_message_list"
...@@ -117,7 +117,7 @@ ...@@ -117,7 +117,7 @@
app:layout_constraintBottom_toTopOf="@id/layout_message_composer" /> app:layout_constraintBottom_toTopOf="@id/layout_message_composer" />
<TextView <TextView
android:id="@+id/connection_status_text" android:id="@+id/text_connection_status"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="32dp" android:layout_height="32dp"
android:alpha="0" android:alpha="0"
...@@ -127,6 +127,7 @@ ...@@ -127,6 +127,7 @@
android:textAppearance="@style/TextAppearance.AppCompat.Body2" android:textAppearance="@style/TextAppearance.AppCompat.Body2"
android:textColor="@color/colorWhite" android:textColor="@color/colorWhite"
android:visibility="gone" android:visibility="gone"
app:layout_constraintTop_toTopOf="parent"
tools:alpha="1" tools:alpha="1"
tools:text="connected" tools:text="connected"
tools:visibility="visible" /> tools:visibility="visible" />
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view" android:id="@+id/recycler_view"
android:layout_below="@+id/text_connection_status"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" /> android:layout_height="match_parent" />
...@@ -31,7 +32,7 @@ ...@@ -31,7 +32,7 @@
tools:visibility="visible" /> tools:visibility="visible" />
<TextView <TextView
android:id="@+id/connection_status_text" android:id="@+id/text_connection_status"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="32dp" android:layout_height="32dp"
android:alpha="0" android:alpha="0"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment