2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-03 23:15:31 +00:00

fixes #4435 - changed title of menuitem for delete and added content description

setting menu title should also set content description. I added the setContentDescription programmatically in order to ensure that the content description is being set. If content description matches title it won't be read twice
This commit is contained in:
mihai-adrian 2019-08-02 10:42:06 +03:00 committed by Emily Kager
parent 3a262a429b
commit bac2e40eb2
2 changed files with 7 additions and 3 deletions

View File

@ -20,6 +20,7 @@ import androidx.fragment.app.Fragment
import androidx.fragment.app.activityViewModels
import androidx.lifecycle.lifecycleScope
import androidx.navigation.Navigation
import androidx.core.view.MenuItemCompat.setContentDescription
import com.jakewharton.rxbinding3.widget.textChanges
import com.uber.autodispose.AutoDispose
import com.uber.autodispose.android.lifecycle.AndroidLifecycleScopeProvider
@ -146,8 +147,11 @@ class EditBookmarkFragment : Fragment() {
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
inflater.inflate(R.menu.bookmarks_edit, menu)
menu.findItem(R.id.delete_bookmark_button).icon.colorFilter =
PorterDuffColorFilter(context!!.getColorFromAttr(R.attr.primaryText), SRC_IN)
menu.findItem(R.id.delete_bookmark_button).apply {
icon.colorFilter =
PorterDuffColorFilter(context!!.getColorFromAttr(R.attr.primaryText), SRC_IN)
setContentDescription(this, getString(R.string.bookmark_menu_delete_button))
}
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {

View File

@ -9,7 +9,7 @@
android:id="@+id/delete_bookmark_button"
android:icon="@drawable/ic_delete"
android:iconTint="?primaryText"
android:title="@string/bookmark_edit"
android:title="@string/bookmark_menu_delete_button"
app:showAsAction="ifRoom"
tools:targetApi="o" />
</menu>