mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-27 17:08:34 +03: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
4 changed files with 35 additions and 1 deletions
|
@ -2486,6 +2486,16 @@ class ChatController(args: Bundle) :
|
|||
super.onCreateOptionsMenu(menu, inflater)
|
||||
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 == "?") {
|
||||
menu.removeItem(R.id.conversation_info)
|
||||
} else {
|
||||
|
|
|
@ -334,6 +334,7 @@ class ContactsController(args: Bundle) :
|
|||
val searchManager: SearchManager? = activity?.getSystemService(Context.SEARCH_SERVICE) as SearchManager?
|
||||
if (searchItem != null) {
|
||||
searchView = MenuItemCompat.getActionView(searchItem) as SearchView
|
||||
viewThemeUtils.themeSearchView(searchView!!)
|
||||
searchView!!.maxWidth = Int.MAX_VALUE
|
||||
searchView!!.inputType = InputType.TYPE_TEXT_VARIATION_FILTER
|
||||
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) {
|
||||
super.onPrepareOptionsMenu(menu)
|
||||
|
||||
if (searchItem != null) {
|
||||
viewThemeUtils.colorToolbarMenuIcon(
|
||||
binding.titleTextView.context,
|
||||
searchItem!!
|
||||
)
|
||||
}
|
||||
|
||||
checkAndHandleDoneMenuItem()
|
||||
if (adapter?.hasFilter() == true) {
|
||||
searchItem!!.expandActionView()
|
||||
|
|
|
@ -188,6 +188,7 @@ abstract class NewBaseController(@LayoutRes var layoutRes: Int, args: Bundle? =
|
|||
val layoutParams = binding.searchToolbar.layoutParams as AppBarLayout.LayoutParams
|
||||
binding.searchToolbar.visibility = View.GONE
|
||||
binding.toolbar.visibility = View.VISIBLE
|
||||
viewThemeUtils.colorToolbarOverflowIcon(binding.toolbar)
|
||||
layoutParams.scrollFlags = 0
|
||||
binding.appBar.stateListAnimator = AnimatorInflater.loadStateListAnimator(
|
||||
binding.appBar.context,
|
||||
|
|
|
@ -30,6 +30,7 @@ import android.graphics.PorterDuff
|
|||
import android.graphics.drawable.Drawable
|
||||
import android.graphics.drawable.LayerDrawable
|
||||
import android.os.Build
|
||||
import android.view.MenuItem
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
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) {
|
||||
withScheme(searchView) { scheme ->
|
||||
// hacky as no default way is provided
|
||||
|
@ -690,7 +703,8 @@ class ViewThemeUtils @Inject constructor(private val theme: ServerTheme, private
|
|||
.mutate()
|
||||
DrawableCompat.setTintList(
|
||||
drawable,
|
||||
ColorStateList.valueOf(scheme.primary))
|
||||
ColorStateList.valueOf(scheme.primary)
|
||||
)
|
||||
emoji.background = drawable
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue