2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-19 09:25:34 +00:00

[fenix] No issue: Only use iconTint in XML for bookmark menus (https://github.com/mozilla-mobile/fenix/pull/5145)

This commit is contained in:
Sawyer Blatz 2019-09-10 09:04:05 -07:00 committed by GitHub
parent 0e9d9d82c5
commit e2eb292241
7 changed files with 8 additions and 35 deletions

View File

@ -4,8 +4,6 @@
package org.mozilla.fenix.library.bookmarks package org.mozilla.fenix.library.bookmarks
import android.graphics.PorterDuff.Mode.SRC_IN
import android.graphics.PorterDuffColorFilter
import android.os.Bundle import android.os.Bundle
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.Menu import android.view.Menu
@ -14,7 +12,6 @@ import android.view.MenuItem
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat
import androidx.fragment.app.activityViewModels import androidx.fragment.app.activityViewModels
import androidx.lifecycle.Observer import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.ViewModelProvider
@ -177,13 +174,8 @@ class BookmarkFragment : LibraryPageFragment<BookmarkNode>(), BackHandler, Accou
} else { } else {
inflater.inflate(R.menu.bookmarks_select_multi, menu) inflater.inflate(R.menu.bookmarks_select_multi, menu)
} }
menu.findItem(R.id.edit_bookmark_multi_select)?.run {
isVisible = mode.selectedItems.size == 1 menu.findItem(R.id.edit_bookmark_multi_select)?.isVisible = mode.selectedItems.size == 1
icon.colorFilter = PorterDuffColorFilter(
ContextCompat.getColor(context!!, R.color.white_color),
SRC_IN
)
}
} }
} }
} }

View File

@ -4,8 +4,6 @@
package org.mozilla.fenix.library.bookmarks.addfolder package org.mozilla.fenix.library.bookmarks.addfolder
import android.graphics.PorterDuff.Mode.SRC_IN
import android.graphics.PorterDuffColorFilter
import android.os.Bundle import android.os.Bundle
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.Menu import android.view.Menu
@ -26,7 +24,6 @@ import kotlinx.coroutines.launch
import mozilla.appservices.places.BookmarkRoot import mozilla.appservices.places.BookmarkRoot
import org.mozilla.fenix.R import org.mozilla.fenix.R
import org.mozilla.fenix.components.metrics.Event import org.mozilla.fenix.components.metrics.Event
import org.mozilla.fenix.ext.getColorFromAttr
import org.mozilla.fenix.ext.nav import org.mozilla.fenix.ext.nav
import org.mozilla.fenix.ext.requireComponents import org.mozilla.fenix.ext.requireComponents
import org.mozilla.fenix.library.bookmarks.BookmarksSharedViewModel import org.mozilla.fenix.library.bookmarks.BookmarksSharedViewModel
@ -73,8 +70,6 @@ class AddBookmarkFolderFragment : Fragment() {
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) { override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
inflater.inflate(R.menu.bookmarks_add_folder, menu) 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 { override fun onOptionsItemSelected(item: MenuItem): Boolean {

View File

@ -5,8 +5,6 @@
package org.mozilla.fenix.library.bookmarks.edit package org.mozilla.fenix.library.bookmarks.edit
import android.content.DialogInterface import android.content.DialogInterface
import android.graphics.PorterDuff.Mode.SRC_IN
import android.graphics.PorterDuffColorFilter
import android.os.Bundle import android.os.Bundle
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.Menu import android.view.Menu
@ -20,7 +18,6 @@ import androidx.fragment.app.Fragment
import androidx.fragment.app.activityViewModels import androidx.fragment.app.activityViewModels
import androidx.lifecycle.lifecycleScope import androidx.lifecycle.lifecycleScope
import androidx.navigation.Navigation import androidx.navigation.Navigation
import androidx.core.view.MenuItemCompat.setContentDescription
import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.ViewModelProvider
import com.jakewharton.rxbinding3.widget.textChanges import com.jakewharton.rxbinding3.widget.textChanges
import com.uber.autodispose.AutoDispose 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.R
import org.mozilla.fenix.components.FenixSnackbar import org.mozilla.fenix.components.FenixSnackbar
import org.mozilla.fenix.components.metrics.Event import org.mozilla.fenix.components.metrics.Event
import org.mozilla.fenix.ext.getColorFromAttr
import org.mozilla.fenix.ext.nav import org.mozilla.fenix.ext.nav
import org.mozilla.fenix.ext.requireComponents import org.mozilla.fenix.ext.requireComponents
import org.mozilla.fenix.ext.setRootTitles import org.mozilla.fenix.ext.setRootTitles
@ -153,11 +149,6 @@ class EditBookmarkFragment : Fragment() {
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) { override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
inflater.inflate(R.menu.bookmarks_edit, menu) 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 { override fun onOptionsItemSelected(item: MenuItem): Boolean {

View File

@ -4,8 +4,6 @@
package org.mozilla.fenix.library.bookmarks.selectfolder package org.mozilla.fenix.library.bookmarks.selectfolder
import android.graphics.PorterDuff.Mode.SRC_IN
import android.graphics.PorterDuffColorFilter
import android.os.Bundle import android.os.Bundle
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.Menu import android.view.Menu
@ -20,6 +18,7 @@ import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.lifecycleScope import androidx.lifecycle.lifecycleScope
import androidx.navigation.fragment.findNavController 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.*
import kotlinx.android.synthetic.main.fragment_select_bookmark_folder.view.* import kotlinx.android.synthetic.main.fragment_select_bookmark_folder.view.*
import kotlinx.coroutines.Dispatchers.IO 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.AuthType
import mozilla.components.concept.sync.OAuthAccount import mozilla.components.concept.sync.OAuthAccount
import org.mozilla.fenix.R import org.mozilla.fenix.R
import org.mozilla.fenix.ext.getColorFromAttr
import org.mozilla.fenix.ext.nav import org.mozilla.fenix.ext.nav
import org.mozilla.fenix.ext.requireComponents import org.mozilla.fenix.ext.requireComponents
import org.mozilla.fenix.ext.setRootTitles import org.mozilla.fenix.ext.setRootTitles
@ -105,11 +103,9 @@ class SelectBookmarkFolderFragment : Fragment(), AccountObserver {
} }
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) { override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
val visitedAddBookmark = SelectBookmarkFolderFragmentArgs.fromBundle(arguments!!).visitedAddBookmark val args: SelectBookmarkFolderFragmentArgs by navArgs()
if (!visitedAddBookmark) { if (!args.visitedAddBookmark) {
inflater.inflate(R.menu.bookmarks_select_folder, menu) 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)
} }
} }

View File

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

View File

@ -7,7 +7,7 @@
<item <item
android:id="@+id/edit_bookmark_multi_select" android:id="@+id/edit_bookmark_multi_select"
android:icon="@drawable/ic_edit" android:icon="@drawable/ic_edit"
android:iconTint="?primaryText" android:iconTint="@color/white_color"
android:title="@string/bookmark_edit" android:title="@string/bookmark_edit"
app:showAsAction="ifRoom" app:showAsAction="ifRoom"
tools:targetApi="o" /> tools:targetApi="o" />

View File

@ -1,5 +1,4 @@
import org.gradle.api.Project import org.gradle.api.Project
import java.lang.Math.pow
import java.lang.RuntimeException import java.lang.RuntimeException
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
@ -120,7 +119,6 @@ object Config {
// for architecture and APK splits. // 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 // 'x' bit is 1 for x86/x86-64 architectures
if (abi == "x86_64" || abi == "x86") { if (abi == "x86_64" || abi == "x86") {
version = version or (1 shl 2) version = version or (1 shl 2)