Commit f2ec3bdc authored by Leonardo Aramaki's avatar Leonardo Aramaki

Fill all section area on landscape and set first selected tab to recents if we have any

parent 1ee16334
......@@ -15,7 +15,7 @@ import android.widget.TextView
import chat.rocket.android.R
class EmojiBottomPicker : DialogFragment() {
open class EmojiBottomPicker : DialogFragment() {
private lateinit var viewPager: ViewPager
private lateinit var tabLayout: TabLayout
......@@ -81,7 +81,9 @@ class EmojiBottomPicker : DialogFragment() {
textView.text = category.icon()
}
viewPager.setCurrentItem(EmojiCategory.PEOPLE.ordinal)
val currentTab = if (EmojiLoader.getRecents().isEmpty()) EmojiCategory.PEOPLE.ordinal else
EmojiCategory.RECENTS.ordinal
viewPager.setCurrentItem(currentTab)
}
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
......@@ -89,6 +91,11 @@ class EmojiBottomPicker : DialogFragment() {
}
interface OnEmojiClickCallback {
/**
* Callback triggered after an emoji is selected on the picker.
*
* @param emoji The selected emoji
*/
fun onEmojiAdded(emoji: Emoji)
}
}
\ No newline at end of file
......@@ -4,5 +4,6 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/whitesmoke"
android:layout_gravity="center"
android:gravity="center"
android:textSize="14sp" />
......@@ -12,8 +12,7 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:tabGravity="center"
app:tabMaxWidth="48dp"
app:tabGravity="fill"
app:tabBackground="@color/whitesmoke"
app:tabMode="scrollable" />
......@@ -23,6 +22,7 @@
android:layout_height="200dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:background="@color/white"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
......
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