From e2eb29224192af6dd02a075efad0f991724d8fb7 Mon Sep 17 00:00:00 2001 From: Sawyer Blatz Date: Tue, 10 Sep 2019 09:04:05 -0700 Subject: [PATCH] [fenix] No issue: Only use iconTint in XML for bookmark menus (https://github.com/mozilla-mobile/fenix/pull/5145) --- .../fenix/library/bookmarks/BookmarkFragment.kt | 12 ++---------- .../bookmarks/addfolder/AddBookmarkFolderFragment.kt | 5 ----- .../library/bookmarks/edit/EditBookmarkFragment.kt | 9 --------- .../selectfolder/SelectBookmarkFolderFragment.kt | 10 +++------- app/src/main/res/menu/bookmarks_edit.xml | 1 + app/src/main/res/menu/bookmarks_select_multi.xml | 2 +- buildSrc/src/main/java/Config.kt | 4 +--- 7 files changed, 8 insertions(+), 35 deletions(-) diff --git a/app/src/main/java/org/mozilla/fenix/library/bookmarks/BookmarkFragment.kt b/app/src/main/java/org/mozilla/fenix/library/bookmarks/BookmarkFragment.kt index bffe5dee75..552c820531 100644 --- a/app/src/main/java/org/mozilla/fenix/library/bookmarks/BookmarkFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/library/bookmarks/BookmarkFragment.kt @@ -4,8 +4,6 @@ package org.mozilla.fenix.library.bookmarks -import android.graphics.PorterDuff.Mode.SRC_IN -import android.graphics.PorterDuffColorFilter import android.os.Bundle import android.view.LayoutInflater import android.view.Menu @@ -14,7 +12,6 @@ import android.view.MenuItem import android.view.View import android.view.ViewGroup import androidx.appcompat.app.AppCompatActivity -import androidx.core.content.ContextCompat import androidx.fragment.app.activityViewModels import androidx.lifecycle.Observer import androidx.lifecycle.ViewModelProvider @@ -177,13 +174,8 @@ class BookmarkFragment : LibraryPageFragment(), BackHandler, Accou } else { inflater.inflate(R.menu.bookmarks_select_multi, menu) } - menu.findItem(R.id.edit_bookmark_multi_select)?.run { - isVisible = mode.selectedItems.size == 1 - icon.colorFilter = PorterDuffColorFilter( - ContextCompat.getColor(context!!, R.color.white_color), - SRC_IN - ) - } + + menu.findItem(R.id.edit_bookmark_multi_select)?.isVisible = mode.selectedItems.size == 1 } } } diff --git a/app/src/main/java/org/mozilla/fenix/library/bookmarks/addfolder/AddBookmarkFolderFragment.kt b/app/src/main/java/org/mozilla/fenix/library/bookmarks/addfolder/AddBookmarkFolderFragment.kt index 82b0df204d..3c79a690a7 100644 --- a/app/src/main/java/org/mozilla/fenix/library/bookmarks/addfolder/AddBookmarkFolderFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/library/bookmarks/addfolder/AddBookmarkFolderFragment.kt @@ -4,8 +4,6 @@ package org.mozilla.fenix.library.bookmarks.addfolder -import android.graphics.PorterDuff.Mode.SRC_IN -import android.graphics.PorterDuffColorFilter import android.os.Bundle import android.view.LayoutInflater import android.view.Menu @@ -26,7 +24,6 @@ import kotlinx.coroutines.launch import mozilla.appservices.places.BookmarkRoot import org.mozilla.fenix.R import org.mozilla.fenix.components.metrics.Event -import org.mozilla.fenix.ext.getColorFromAttr import org.mozilla.fenix.ext.nav import org.mozilla.fenix.ext.requireComponents import org.mozilla.fenix.library.bookmarks.BookmarksSharedViewModel @@ -73,8 +70,6 @@ class AddBookmarkFolderFragment : Fragment() { override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) { inflater.inflate(R.menu.bookmarks_add_folder, menu) - menu.findItem(R.id.confirm_add_folder_button).icon.colorFilter = - PorterDuffColorFilter(context!!.getColorFromAttr(R.attr.primaryText), SRC_IN) } override fun onOptionsItemSelected(item: MenuItem): Boolean { diff --git a/app/src/main/java/org/mozilla/fenix/library/bookmarks/edit/EditBookmarkFragment.kt b/app/src/main/java/org/mozilla/fenix/library/bookmarks/edit/EditBookmarkFragment.kt index 7c190c3eb8..4b944a7d97 100644 --- a/app/src/main/java/org/mozilla/fenix/library/bookmarks/edit/EditBookmarkFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/library/bookmarks/edit/EditBookmarkFragment.kt @@ -5,8 +5,6 @@ package org.mozilla.fenix.library.bookmarks.edit import android.content.DialogInterface -import android.graphics.PorterDuff.Mode.SRC_IN -import android.graphics.PorterDuffColorFilter import android.os.Bundle import android.view.LayoutInflater import android.view.Menu @@ -20,7 +18,6 @@ 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 androidx.lifecycle.ViewModelProvider import com.jakewharton.rxbinding3.widget.textChanges import com.uber.autodispose.AutoDispose @@ -41,7 +38,6 @@ import mozilla.components.support.ktx.android.view.hideKeyboard import org.mozilla.fenix.R import org.mozilla.fenix.components.FenixSnackbar import org.mozilla.fenix.components.metrics.Event -import org.mozilla.fenix.ext.getColorFromAttr import org.mozilla.fenix.ext.nav import org.mozilla.fenix.ext.requireComponents import org.mozilla.fenix.ext.setRootTitles @@ -153,11 +149,6 @@ class EditBookmarkFragment : Fragment() { override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) { inflater.inflate(R.menu.bookmarks_edit, menu) - 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 { diff --git a/app/src/main/java/org/mozilla/fenix/library/bookmarks/selectfolder/SelectBookmarkFolderFragment.kt b/app/src/main/java/org/mozilla/fenix/library/bookmarks/selectfolder/SelectBookmarkFolderFragment.kt index 11b1d39aa7..43995b0c24 100644 --- a/app/src/main/java/org/mozilla/fenix/library/bookmarks/selectfolder/SelectBookmarkFolderFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/library/bookmarks/selectfolder/SelectBookmarkFolderFragment.kt @@ -4,8 +4,6 @@ package org.mozilla.fenix.library.bookmarks.selectfolder -import android.graphics.PorterDuff.Mode.SRC_IN -import android.graphics.PorterDuffColorFilter import android.os.Bundle import android.view.LayoutInflater import android.view.Menu @@ -20,6 +18,7 @@ import androidx.lifecycle.Observer import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.lifecycleScope import androidx.navigation.fragment.findNavController +import androidx.navigation.fragment.navArgs import kotlinx.android.synthetic.main.fragment_select_bookmark_folder.* import kotlinx.android.synthetic.main.fragment_select_bookmark_folder.view.* import kotlinx.coroutines.Dispatchers.IO @@ -32,7 +31,6 @@ import mozilla.components.concept.sync.AccountObserver import mozilla.components.concept.sync.AuthType import mozilla.components.concept.sync.OAuthAccount import org.mozilla.fenix.R -import org.mozilla.fenix.ext.getColorFromAttr import org.mozilla.fenix.ext.nav import org.mozilla.fenix.ext.requireComponents import org.mozilla.fenix.ext.setRootTitles @@ -105,11 +103,9 @@ class SelectBookmarkFolderFragment : Fragment(), AccountObserver { } override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) { - val visitedAddBookmark = SelectBookmarkFolderFragmentArgs.fromBundle(arguments!!).visitedAddBookmark - if (!visitedAddBookmark) { + val args: SelectBookmarkFolderFragmentArgs by navArgs() + if (!args.visitedAddBookmark) { inflater.inflate(R.menu.bookmarks_select_folder, menu) - menu.findItem(R.id.add_folder_button).icon.colorFilter = - PorterDuffColorFilter(context!!.getColorFromAttr(R.attr.primaryText), SRC_IN) } } diff --git a/app/src/main/res/menu/bookmarks_edit.xml b/app/src/main/res/menu/bookmarks_edit.xml index 1381179207..cee53e6633 100644 --- a/app/src/main/res/menu/bookmarks_edit.xml +++ b/app/src/main/res/menu/bookmarks_edit.xml @@ -10,6 +10,7 @@ android:icon="@drawable/ic_delete" android:iconTint="?primaryText" android:title="@string/bookmark_menu_delete_button" + android:contentDescription="@string/bookmark_menu_delete_button" app:showAsAction="ifRoom" tools:targetApi="o" /> diff --git a/app/src/main/res/menu/bookmarks_select_multi.xml b/app/src/main/res/menu/bookmarks_select_multi.xml index 27389b0511..75b975836d 100644 --- a/app/src/main/res/menu/bookmarks_select_multi.xml +++ b/app/src/main/res/menu/bookmarks_select_multi.xml @@ -7,7 +7,7 @@ diff --git a/buildSrc/src/main/java/Config.kt b/buildSrc/src/main/java/Config.kt index 6f165bd22d..d48e3684ff 100644 --- a/buildSrc/src/main/java/Config.kt +++ b/buildSrc/src/main/java/Config.kt @@ -1,5 +1,4 @@ import org.gradle.api.Project -import java.lang.Math.pow import java.lang.RuntimeException import java.text.SimpleDateFormat @@ -118,8 +117,7 @@ object Config { var version = 0x78200000 // 1111000001000000000000000000000 // We reserve 1 "middle" high order bit for the future, and 3 low order bits // for architecture and APK splits. - version = version or (base shl 3) - + version = version or (base shl 3) // 'x' bit is 1 for x86/x86-64 architectures if (abi == "x86_64" || abi == "x86") {