Skip to content
This repository was archived by the owner on Jun 7, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
if (newMessageCount <= 99) {
text_count.text = newMessageCount.toString()
} else {
text_count.text = "99+"
text_count.text = getString(R.string.msg_more_than_ninety_nine_unread_messages)
}
text_count.isVisible = true
} else if (!button_fab.isVisible) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package chat.rocket.android.directory.ui

import DrawableHelper
import android.content.DialogInterface
import android.graphics.drawable.Drawable
import android.os.Bundle
import android.view.LayoutInflater
Expand All @@ -10,6 +9,8 @@ import android.view.ViewGroup
import android.widget.TextView
import androidx.fragment.app.FragmentManager
import chat.rocket.android.R
import com.google.android.material.bottomsheet.BottomSheetBehavior
import com.google.android.material.bottomsheet.BottomSheetDialog
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import kotlinx.android.synthetic.main.bottom_sheet_fragment_directory_sorting.*

Expand Down Expand Up @@ -67,10 +68,6 @@ class DirectorySortingBottomSheetFragment : BottomSheetDialogFragment() {
setupListeners()
}

override fun onCancel(dialog: DialogInterface?) {
super.onCancel(dialog)
}

private fun setupView() {
if (isSortByChannels) {
checkSelection(text_channels, hashtagDrawable)
Expand All @@ -82,6 +79,15 @@ class DirectorySortingBottomSheetFragment : BottomSheetDialogFragment() {
}

private fun setupListeners() {
dialog.setOnShowListener { dialog ->
val bottomSheet = (dialog as BottomSheetDialog).findViewById<View>(
com.google.android.material.R.id.design_bottom_sheet
)
bottomSheet?.let {
BottomSheetBehavior.from(bottomSheet).peekHeight = bottomSheet.height
}
}

text_channels.setOnClickListener {
checkSelection(text_channels, hashtagDrawable)
uncheckSelection(text_users, userDrawable)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import chat.rocket.android.servers.adapter.ServersAdapter
import chat.rocket.android.servers.presentation.ServersPresenter
import chat.rocket.android.servers.presentation.ServersView
import chat.rocket.android.util.extensions.showToast
import com.google.android.material.bottomsheet.BottomSheetBehavior
import com.google.android.material.bottomsheet.BottomSheetDialog
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import dagger.android.support.AndroidSupportInjection
import kotlinx.android.synthetic.main.bottom_sheet_fragment_servers.*
Expand All @@ -38,6 +40,18 @@ class ServersBottomSheetFragment : BottomSheetDialogFragment(), ServersView {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
presenter.getAllServers()
setupListeners()
}

private fun setupListeners() {
dialog.setOnShowListener { dialog ->
val bottomSheet = (dialog as BottomSheetDialog).findViewById<View>(
com.google.android.material.R.id.design_bottom_sheet
)
bottomSheet?.let {
BottomSheetBehavior.from(bottomSheet).peekHeight = bottomSheet.height
}
}
}

override fun showServerList(serverList: List<Account>, currentServerUrl: String) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import chat.rocket.android.chatrooms.ui.ChatRoomsFragment
import chat.rocket.android.chatrooms.ui.TAG_CHAT_ROOMS_FRAGMENT
import chat.rocket.android.sortingandgrouping.presentation.SortingAndGroupingPresenter
import chat.rocket.android.sortingandgrouping.presentation.SortingAndGroupingView
import com.google.android.material.bottomsheet.BottomSheetBehavior
import com.google.android.material.bottomsheet.BottomSheetDialog
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import dagger.android.support.AndroidSupportInjection
import kotlinx.android.synthetic.main.bottom_sheet_fragment_sort_by.*
Expand Down Expand Up @@ -89,6 +91,15 @@ class SortingAndGroupingBottomSheetFragment : BottomSheetDialogFragment(), Sorti
}

private fun setupListeners() {
dialog.setOnShowListener { dialog ->
val bottomSheet = (dialog as BottomSheetDialog).findViewById<View>(
com.google.android.material.R.id.design_bottom_sheet
)
bottomSheet?.let {
BottomSheetBehavior.from(bottomSheet).peekHeight = bottomSheet.height
}
}

text_name.setOnClickListener {
changeSortByTitle(getString(R.string.msg_sort_by_name))
checkSelection(text_name, filterDrawable)
Expand Down
173 changes: 92 additions & 81 deletions app/src/main/res/layout/bottom_sheet_fragment_directory_sorting.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
tools:context=".directory.ui.DirectorySortingBottomSheetFragment">

<TextView
Expand All @@ -16,96 +17,106 @@
android:text="@string/msg_sort_by"
android:textColor="#9EA2A8"
android:textSize="17sp"
android:textStyle="normal"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
android:textStyle="normal" />

<View
android:id="@+id/view_divider_one"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="16dp"
android:background="#1F000000"
app:layout_constraintTop_toBottomOf="@+id/text_sort_by" />
android:background="#1F000000" />

<TextView
android:id="@+id/text_channels"
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableStart="@drawable/ic_hashtag_16dp"
android:drawablePadding="16dp"
android:paddingStart="16dp"
android:paddingTop="16dp"
android:paddingEnd="16dp"
android:paddingBottom="16dp"
android:text="@string/msg_channels"
android:textColor="#2F343D"
android:textSize="16sp"
android:textStyle="normal"
app:layout_constraintTop_toBottomOf="@+id/view_divider_one" />
android:layout_height="wrap_content">

<TextView
android:id="@+id/text_users"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableStart="@drawable/ic_user_16dp"
android:drawablePadding="16dp"
android:paddingStart="16dp"
android:paddingTop="16dp"
android:paddingEnd="16dp"
android:paddingBottom="16dp"
android:text="@string/msg_users"
android:textColor="#2F343D"
android:textSize="16sp"
android:textStyle="normal"
app:layout_constraintTop_toBottomOf="@+id/text_channels" />
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">

<View
android:id="@+id/view_divider_two"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:background="#1F000000"
app:layout_constraintTop_toBottomOf="@+id/text_users" />
<TextView
android:id="@+id/text_channels"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableStart="@drawable/ic_hashtag_16dp"
android:drawablePadding="16dp"
android:paddingStart="16dp"
android:paddingTop="16dp"
android:paddingEnd="16dp"
android:paddingBottom="16dp"
android:text="@string/msg_channels"
android:textColor="#2F343D"
android:textSize="16sp"
android:textStyle="normal"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/text_search_for_global_users"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="16dp"
android:paddingTop="16dp"
android:paddingEnd="16dp"
android:text="@string/msg_search_for_global_users"
android:textColor="#2F343D"
android:textSize="16sp"
android:textStyle="normal"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/view_divider_two" />
<TextView
android:id="@+id/text_users"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableStart="@drawable/ic_user_16dp"
android:drawablePadding="16dp"
android:paddingStart="16dp"
android:paddingTop="16dp"
android:paddingEnd="16dp"
android:paddingBottom="16dp"
android:text="@string/msg_users"
android:textColor="#2F343D"
android:textSize="16sp"
android:textStyle="normal"
app:layout_constraintTop_toBottomOf="@+id/text_channels" />

<Switch
android:id="@+id/switch_global_users"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:checked="false"
app:layout_constraintBottom_toBottomOf="@+id/text_search_for_global_users"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/text_search_for_global_users" />
<View
android:id="@+id/view_divider_two"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:background="#1F000000"
app:layout_constraintTop_toBottomOf="@+id/text_users" />

<TextView
android:id="@+id/text_search_for_global_users_description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:paddingBottom="16dp"
android:text="@string/msg_search_for_global_users_description"
android:textColor="#9EA2A8"
android:textSize="14sp"
android:textStyle="normal"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/text_search_for_global_users" />
<TextView
android:id="@+id/text_search_for_global_users"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="16dp"
android:paddingTop="16dp"
android:paddingEnd="16dp"
android:text="@string/msg_search_for_global_users"
android:textColor="#2F343D"
android:textSize="16sp"
android:textStyle="normal"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/view_divider_two" />

<Switch
android:id="@+id/switch_global_users"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:checked="false"
app:layout_constraintBottom_toBottomOf="@+id/text_search_for_global_users"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/text_search_for_global_users" />

<TextView
android:id="@+id/text_search_for_global_users_description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:paddingBottom="16dp"
android:text="@string/msg_search_for_global_users_description"
android:textColor="#9EA2A8"
android:textSize="14sp"
android:textStyle="normal"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/text_search_for_global_users" />

</androidx.constraintlayout.widget.ConstraintLayout>

</androidx.core.widget.NestedScrollView>

</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
Loading