Commit 0cdd58ee authored by Filipe de Lima Brito's avatar Filipe de Lima Brito

Brings the toolbar icons visible again.

parent 327aabf7
...@@ -148,7 +148,8 @@ class ChatRoomsFragment : Fragment(), ChatRoomsView { ...@@ -148,7 +148,8 @@ class ChatRoomsFragment : Fragment(), ChatRoomsView {
inflater.inflate(R.menu.chatrooms, menu) inflater.inflate(R.menu.chatrooms, menu)
val searchItem = menu.findItem(R.id.action_search) val searchItem = menu.findItem(R.id.action_search)
searchView = searchItem?.actionView as SearchView? searchView = searchItem?.actionView as? SearchView
searchView?.setIconifiedByDefault(false)
searchView?.maxWidth = Integer.MAX_VALUE searchView?.maxWidth = Integer.MAX_VALUE
searchView?.setOnQueryTextListener(object : SearchView.OnQueryTextListener { searchView?.setOnQueryTextListener(object : SearchView.OnQueryTextListener {
override fun onQueryTextSubmit(query: String?): Boolean { override fun onQueryTextSubmit(query: String?): Boolean {
...@@ -176,7 +177,7 @@ class ChatRoomsFragment : Fragment(), ChatRoomsView { ...@@ -176,7 +177,7 @@ class ChatRoomsFragment : Fragment(), ChatRoomsView {
0 -> R.id.radio_sort_alphabetical 0 -> R.id.radio_sort_alphabetical
else -> R.id.radio_sort_activity else -> R.id.radio_sort_activity
}) })
radioGroup.setOnCheckedChangeListener({ _, checkedId -> radioGroup.setOnCheckedChangeListener { _, checkedId ->
run { run {
SharedPreferenceHelper.putInt(Constants.CHATROOM_SORT_TYPE_KEY, when (checkedId) { SharedPreferenceHelper.putInt(Constants.CHATROOM_SORT_TYPE_KEY, when (checkedId) {
R.id.radio_sort_alphabetical -> 0 R.id.radio_sort_alphabetical -> 0
...@@ -184,23 +185,21 @@ class ChatRoomsFragment : Fragment(), ChatRoomsView { ...@@ -184,23 +185,21 @@ class ChatRoomsFragment : Fragment(), ChatRoomsView {
else -> 1 else -> 1
}) })
} }
}) }
groupByTypeCheckBox.isChecked = groupByType groupByTypeCheckBox.isChecked = groupByType
groupByTypeCheckBox.setOnCheckedChangeListener({ _, isChecked -> groupByTypeCheckBox.setOnCheckedChangeListener { _, isChecked ->
SharedPreferenceHelper.putBoolean(Constants.CHATROOM_GROUP_BY_TYPE_KEY, isChecked) SharedPreferenceHelper.putBoolean(Constants.CHATROOM_GROUP_BY_TYPE_KEY, isChecked)
}) }
val dialogSort = AlertDialog.Builder(context) AlertDialog.Builder(context)
.setTitle(R.string.dialog_sort_title) .setTitle(R.string.dialog_sort_title)
.setView(dialogLayout) .setView(dialogLayout)
.setPositiveButton("Done", { dialog, _ -> .setPositiveButton("Done") { dialog, _ ->
invalidateQueryOnSearch() invalidateQueryOnSearch()
updateSort() updateSort()
dialog.dismiss() dialog.dismiss()
}) }.show()
dialogSort.show()
} }
} }
return super.onOptionsItemSelected(item) return super.onOptionsItemSelected(item)
......
...@@ -6,13 +6,13 @@ ...@@ -6,13 +6,13 @@
android:id="@+id/action_search" android:id="@+id/action_search"
android:icon="@drawable/ic_search_white_24px" android:icon="@drawable/ic_search_white_24px"
android:title="@string/action_search" android:title="@string/action_search"
android:actionViewClass="androidx.appcompat.widget.SearchView" app:actionViewClass="androidx.appcompat.widget.SearchView"
android:showAsAction="ifRoom|collapseActionView" /> app:showAsAction="ifRoom|collapseActionView" />
<item <item
android:id="@+id/action_sort" android:id="@+id/action_sort"
android:icon="@drawable/ic_sort" android:icon="@drawable/ic_sort"
android:title="@string/menu_chatroom_sort" android:title="@string/menu_chatroom_sort"
android:showAsAction="always" /> app:showAsAction="ifRoom" />
</menu> </menu>
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