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
override fun showConnectionState(state: State) {
ui {
connection_status_text.fadeIn()
text_connection_status.fadeIn()
handler.removeCallbacks(dismissStatus)
when (state) {
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)
}
is State.Disconnected -> connection_status_text.text =
is State.Disconnected -> text_connection_status.text =
getString(R.string.status_disconnected)
is State.Connecting -> connection_status_text.text =
is State.Connecting -> text_connection_status.text =
getString(R.string.status_connecting)
is State.Authenticating -> connection_status_text.text =
is State.Authenticating -> text_connection_status.text =
getString(R.string.status_authenticating)
is State.Disconnecting -> connection_status_text.text =
is State.Disconnecting -> text_connection_status.text =
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)
}
}
......@@ -737,7 +737,7 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
}
private val dismissStatus = {
connection_status_text.fadeOut()
text_connection_status.fadeOut()
}
private fun setupRecyclerView() {
......
......@@ -297,25 +297,25 @@ class ChatRoomsFragment : Fragment(), ChatRoomsView {
private fun showConnectionState(state: State) {
Timber.d("Got new state: $state")
ui {
connection_status_text.fadeIn()
text_connection_status.fadeIn()
handler.removeCallbacks(dismissStatus)
when (state) {
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)
}
is State.Disconnected -> connection_status_text.text = getString(R.string.status_disconnected)
is State.Connecting -> connection_status_text.text = getString(R.string.status_connecting)
is State.Authenticating -> connection_status_text.text = getString(R.string.status_authenticating)
is State.Disconnecting -> connection_status_text.text = getString(R.string.status_disconnecting)
is State.Waiting -> connection_status_text.text = getString(R.string.status_waiting, state.seconds)
is State.Disconnected -> text_connection_status.text = getString(R.string.status_disconnected)
is State.Connecting -> text_connection_status.text = getString(R.string.status_connecting)
is State.Authenticating -> text_connection_status.text = getString(R.string.status_authenticating)
is State.Disconnecting -> text_connection_status.text = getString(R.string.status_disconnecting)
is State.Waiting -> text_connection_status.text = getString(R.string.status_waiting, state.seconds)
}
}
}
private val dismissStatus = {
if (connection_status_text != null) {
connection_status_text.fadeOut()
if (text_connection_status != null) {
text_connection_status.fadeOut()
}
}
......@@ -331,4 +331,4 @@ class ChatRoomsFragment : Fragment(), ChatRoomsView {
}
return true
}
}
\ No newline at end of file
}
......@@ -12,9 +12,9 @@
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toTopOf="@id/text_typing_status"
app:layout_constraintTop_toBottomOf="@+id/text_connection_status"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
app:layout_constraintStart_toStartOf="parent">
<include
android:id="@+id/layout_message_list"
......@@ -117,7 +117,7 @@
app:layout_constraintBottom_toTopOf="@id/layout_message_composer" />
<TextView
android:id="@+id/connection_status_text"
android:id="@+id/text_connection_status"
android:layout_width="match_parent"
android:layout_height="32dp"
android:alpha="0"
......@@ -127,6 +127,7 @@
android:textAppearance="@style/TextAppearance.AppCompat.Body2"
android:textColor="@color/colorWhite"
android:visibility="gone"
app:layout_constraintTop_toTopOf="parent"
tools:alpha="1"
tools:text="connected"
tools:visibility="visible" />
......@@ -144,4 +145,4 @@
app:layout_constraintTop_toTopOf="parent"
tools:visibility="visible" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
</androidx.constraintlayout.widget.ConstraintLayout>
......@@ -8,6 +8,7 @@
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_below="@+id/text_connection_status"
android:layout_width="match_parent"
android:layout_height="match_parent" />
......@@ -31,7 +32,7 @@
tools:visibility="visible" />
<TextView
android:id="@+id/connection_status_text"
android:id="@+id/text_connection_status"
android:layout_width="match_parent"
android:layout_height="32dp"
android:alpha="0"
......@@ -55,4 +56,4 @@
android:textSize="20sp"
android:visibility="gone"
tools:visibility="visible" />
</RelativeLayout>
\ No newline at end of file
</RelativeLayout>
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