Commit f5a9ad41 authored by shubhsherl's avatar shubhsherl

Change in layout and Fragment as requested

parent 464896d4
......@@ -426,13 +426,13 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
private val fabScrollListener = object : RecyclerView.OnScrollListener() {
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
if (!recyclerView.canScrollVertically(1)) {
text_count.visibility = View.INVISIBLE
text_count.isVisible = false
button_fab.hide()
newMessageCount = 0
} else {
if (dy < 0 && !button_fab.isVisible) {
button_fab.show()
if (newMessageCount !=0) text_count.visibility = View.VISIBLE
if (newMessageCount !=0) text_count.isVisible = true
}
}
}
......@@ -493,7 +493,7 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
override fun showNewMessage(message: List<BaseUiModel<*>>, isMessageReceived: Boolean) {
ui {
adapter.prependData(message)
if (isMessageReceived && button_fab.visibility == View.VISIBLE) {
if (isMessageReceived && button_fab.isVisible) {
newMessageCount++
if (newMessageCount <= 99)
......@@ -501,9 +501,9 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
else
text_count.text = "99+"
text_count.visibility = View.VISIBLE
text_count.isVisible = true
}
else if (button_fab.visibility == View.GONE)
else if (!button_fab.isVisible)
recycler_view.scrollToPosition(0)
verticalScrollOffset.set(0)
empty_chat_view.isVisible = adapter.itemCount == 0
......@@ -739,7 +739,7 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
button_fab.setOnClickListener {
recycler_view.scrollToPosition(0)
verticalScrollOffset.set(0)
text_count.visibility = View.INVISIBLE
text_count.isVisible = false
button_fab.hide()
newMessageCount = 0
}
......
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="#30a7fe" />
<solid android:color="@color/colorAccent" />
<size
android:height="20dp"
android:width="20dp" />
<size
android:width="20dp"
android:height="20dp" />
</shape>
\ No newline at end of file
</shape>
\ No newline at end of file
......@@ -4,14 +4,12 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical" />
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
......@@ -20,7 +18,6 @@
app:layout_anchor="@id/recycler_view"
app:layout_anchorGravity="bottom|end">
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/button_fab"
android:layout_alignParentEnd="true"
......@@ -34,7 +31,6 @@
app:backgroundTint="@color/colorWhite"
app:fabSize="mini" />
<TextView
android:id="@+id/text_count"
android:layout_width="wrap_content"
......@@ -45,10 +41,9 @@
android:layout_margin="10dp"
android:textColor="@color/colorWhite"
android:visibility="invisible"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:textSize="@dimen/message_time_text_size"
android:background="@drawable/round_textview" />
</RelativeLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
\ No newline at end of file
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