mirror of
https://github.com/nextcloud/talk-android
synced 2025-03-06 14:27:24 +00:00
theme toolbar icons including overflow icon and search field
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
parent
365a7502b4
commit
fa82641f31
@ -2486,6 +2486,16 @@ class ChatController(args: Bundle) :
|
|||||||
super.onCreateOptionsMenu(menu, inflater)
|
super.onCreateOptionsMenu(menu, inflater)
|
||||||
inflater.inflate(R.menu.menu_conversation, menu)
|
inflater.inflate(R.menu.menu_conversation, menu)
|
||||||
|
|
||||||
|
viewThemeUtils.colorToolbarMenuIcon(
|
||||||
|
binding.messageInputView.context,
|
||||||
|
menu.findItem(R.id.conversation_voice_call)
|
||||||
|
)
|
||||||
|
|
||||||
|
viewThemeUtils.colorToolbarMenuIcon(
|
||||||
|
binding.messageInputView.context,
|
||||||
|
menu.findItem(R.id.conversation_video_call)
|
||||||
|
)
|
||||||
|
|
||||||
if (conversationUser?.userId == "?") {
|
if (conversationUser?.userId == "?") {
|
||||||
menu.removeItem(R.id.conversation_info)
|
menu.removeItem(R.id.conversation_info)
|
||||||
} else {
|
} else {
|
||||||
|
@ -334,6 +334,7 @@ class ContactsController(args: Bundle) :
|
|||||||
val searchManager: SearchManager? = activity?.getSystemService(Context.SEARCH_SERVICE) as SearchManager?
|
val searchManager: SearchManager? = activity?.getSystemService(Context.SEARCH_SERVICE) as SearchManager?
|
||||||
if (searchItem != null) {
|
if (searchItem != null) {
|
||||||
searchView = MenuItemCompat.getActionView(searchItem) as SearchView
|
searchView = MenuItemCompat.getActionView(searchItem) as SearchView
|
||||||
|
viewThemeUtils.themeSearchView(searchView!!)
|
||||||
searchView!!.maxWidth = Int.MAX_VALUE
|
searchView!!.maxWidth = Int.MAX_VALUE
|
||||||
searchView!!.inputType = InputType.TYPE_TEXT_VARIATION_FILTER
|
searchView!!.inputType = InputType.TYPE_TEXT_VARIATION_FILTER
|
||||||
var imeOptions: Int = EditorInfo.IME_ACTION_DONE or EditorInfo.IME_FLAG_NO_FULLSCREEN
|
var imeOptions: Int = EditorInfo.IME_ACTION_DONE or EditorInfo.IME_FLAG_NO_FULLSCREEN
|
||||||
@ -377,6 +378,14 @@ class ContactsController(args: Bundle) :
|
|||||||
|
|
||||||
override fun onPrepareOptionsMenu(menu: Menu) {
|
override fun onPrepareOptionsMenu(menu: Menu) {
|
||||||
super.onPrepareOptionsMenu(menu)
|
super.onPrepareOptionsMenu(menu)
|
||||||
|
|
||||||
|
if (searchItem != null) {
|
||||||
|
viewThemeUtils.colorToolbarMenuIcon(
|
||||||
|
binding.titleTextView.context,
|
||||||
|
searchItem!!
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
checkAndHandleDoneMenuItem()
|
checkAndHandleDoneMenuItem()
|
||||||
if (adapter?.hasFilter() == true) {
|
if (adapter?.hasFilter() == true) {
|
||||||
searchItem!!.expandActionView()
|
searchItem!!.expandActionView()
|
||||||
|
@ -188,6 +188,7 @@ abstract class NewBaseController(@LayoutRes var layoutRes: Int, args: Bundle? =
|
|||||||
val layoutParams = binding.searchToolbar.layoutParams as AppBarLayout.LayoutParams
|
val layoutParams = binding.searchToolbar.layoutParams as AppBarLayout.LayoutParams
|
||||||
binding.searchToolbar.visibility = View.GONE
|
binding.searchToolbar.visibility = View.GONE
|
||||||
binding.toolbar.visibility = View.VISIBLE
|
binding.toolbar.visibility = View.VISIBLE
|
||||||
|
viewThemeUtils.colorToolbarOverflowIcon(binding.toolbar)
|
||||||
layoutParams.scrollFlags = 0
|
layoutParams.scrollFlags = 0
|
||||||
binding.appBar.stateListAnimator = AnimatorInflater.loadStateListAnimator(
|
binding.appBar.stateListAnimator = AnimatorInflater.loadStateListAnimator(
|
||||||
binding.appBar.context,
|
binding.appBar.context,
|
||||||
|
@ -30,6 +30,7 @@ import android.graphics.PorterDuff
|
|||||||
import android.graphics.drawable.Drawable
|
import android.graphics.drawable.Drawable
|
||||||
import android.graphics.drawable.LayerDrawable
|
import android.graphics.drawable.LayerDrawable
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
|
import android.view.MenuItem
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.CheckBox
|
import android.widget.CheckBox
|
||||||
@ -120,6 +121,18 @@ class ViewThemeUtils @Inject constructor(private val theme: ServerTheme, private
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun colorToolbarMenuIcon(context: Context, item: MenuItem) {
|
||||||
|
withScheme(context) { scheme ->
|
||||||
|
item.icon.setColorFilter(scheme.onSurface, PorterDuff.Mode.SRC_ATOP)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun colorToolbarOverflowIcon(toolbar: MaterialToolbar) {
|
||||||
|
withScheme(toolbar) { scheme ->
|
||||||
|
toolbar.overflowIcon?.setColorFilter(scheme.onSurface, PorterDuff.Mode.SRC_ATOP)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun themeSearchView(searchView: SearchView) {
|
fun themeSearchView(searchView: SearchView) {
|
||||||
withScheme(searchView) { scheme ->
|
withScheme(searchView) { scheme ->
|
||||||
// hacky as no default way is provided
|
// hacky as no default way is provided
|
||||||
@ -690,7 +703,8 @@ class ViewThemeUtils @Inject constructor(private val theme: ServerTheme, private
|
|||||||
.mutate()
|
.mutate()
|
||||||
DrawableCompat.setTintList(
|
DrawableCompat.setTintList(
|
||||||
drawable,
|
drawable,
|
||||||
ColorStateList.valueOf(scheme.primary))
|
ColorStateList.valueOf(scheme.primary)
|
||||||
|
)
|
||||||
emoji.background = drawable
|
emoji.background = drawable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user