Commit 93c5172b authored by divyanshu's avatar divyanshu

code optimisation for empty file view

parent f515a781
......@@ -265,7 +265,7 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
verticalScrollOffset.set(0)
}
presenter.loadActiveMembers(chatRoomId, chatRoomType, filterSelfOut = true)
toggleNoChatView(adapter.itemCount)
empty_chat_view.isVisible = adapter.itemCount == 0
}
}
......@@ -287,18 +287,6 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
}
private fun toggleNoChatView(size: Int) {
if (size == 0) {
image_chat_icon.setVisible(true)
text_chat_title.setVisible(true)
text_chat_description.setVisible(true)
} else {
image_chat_icon.setVisible(false)
text_chat_title.setVisible(false)
text_chat_description.setVisible(false)
}
}
private val layoutChangeListener =
View.OnLayoutChangeListener { _, _, _, _, bottom, _, _, _, oldBottom ->
val y = oldBottom - bottom
......@@ -412,7 +400,7 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
adapter.prependData(message)
recycler_view.scrollToPosition(0)
verticalScrollOffset.set(0)
toggleNoChatView(adapter.itemCount)
empty_chat_view.isVisible = adapter.itemCount == 0
}
}
......
......@@ -30,13 +30,11 @@
android:layout_height="100dp"
android:src="@drawable/ic_chat_black_24dp"
android:tint="@color/icon_grey"
android:visibility="gone"
app:layout_constraintBottom_toTopOf="@id/text_chat_title"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_chainStyle="packed"
tools:visibility="visible" />
app:layout_constraintVertical_chainStyle="packed" />
<TextView
android:id="@+id/text_chat_title"
......@@ -47,12 +45,10 @@
android:textColor="@color/colorSecondaryText"
android:textSize="20sp"
android:textStyle="bold"
android:visibility="gone"
app:layout_constraintBottom_toTopOf="@id/text_chat_description"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/image_chat_icon"
tools:visibility="visible" />
app:layout_constraintTop_toBottomOf="@id/image_chat_icon" />
<TextView
android:id="@+id/text_chat_description"
......@@ -63,11 +59,17 @@
android:textAlignment="center"
android:textColor="@color/colorSecondaryTextLight"
android:textSize="16sp"
android:visibility="gone"
app:layout_constraintBottom_toTopOf="@id/layout_message_composer"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/text_chat_title"
app:layout_constraintTop_toBottomOf="@id/text_chat_title" />
<android.support.constraint.Group
android:id="@+id/empty_chat_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:constraint_referenced_ids="image_chat_icon, text_chat_title, text_chat_description"
android:visibility="gone"
tools:visibility="visible" />
<chat.rocket.android.widget.autocompletion.ui.SuggestionsView
......
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