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