1
0
Fork 0

Update Android Components version to 41.0.20200506130132 (#10443)

master
Simon Chae 2020-05-06 13:17:17 -04:00 committed by GitHub
parent 6f97e75579
commit a851b76ea3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 34 additions and 32 deletions

View File

@ -178,7 +178,7 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session
fragment = WeakReference(this), fragment = WeakReference(this),
engineView = WeakReference(engineView), engineView = WeakReference(engineView),
swipeRefresh = WeakReference(swipeRefresh), swipeRefresh = WeakReference(swipeRefresh),
arguments = arguments!! arguments = requireArguments()
).apply { ).apply {
beginAnimateInIfNecessary() beginAnimateInIfNecessary()
} }
@ -829,7 +829,7 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session
// Close find in page bar if opened // Close find in page bar if opened
findInPageIntegration.onBackPressed() findInPageIntegration.onBackPressed()
FenixSnackbar.make( FenixSnackbar.make(
view = view!!, view = requireView(),
duration = Snackbar.LENGTH_SHORT, duration = Snackbar.LENGTH_SHORT,
isDisplayedWithBrowserToolbar = false isDisplayedWithBrowserToolbar = false
) )

View File

@ -331,11 +331,11 @@ class HomeFragment : Fragment() {
} }
} }
createHomeMenu(context!!, WeakReference(view.menuButton)) createHomeMenu(requireContext(), WeakReference(view.menuButton))
view.menuButton.setColorFilter(ContextCompat.getColor( view.menuButton.setColorFilter(ContextCompat.getColor(
context!!, requireContext(),
ThemeManager.resolveAttribute(R.attr.primaryText, context!!) ThemeManager.resolveAttribute(R.attr.primaryText, requireContext())
)) ))
view.toolbar.compoundDrawablePadding = view.toolbar.compoundDrawablePadding =
@ -381,7 +381,7 @@ class HomeFragment : Fragment() {
super.onDestroyView() super.onDestroyView()
_sessionControlInteractor = null _sessionControlInteractor = null
sessionControlView = null sessionControlView = null
view!!.homeAppBar.removeOnOffsetChangedListener(homeAppBarOffSetListener) requireView().homeAppBar.removeOnOffsetChangedListener(homeAppBarOffSetListener)
} }
override fun onStart() { override fun onStart() {
@ -773,7 +773,7 @@ class HomeFragment : Fragment() {
} }
viewLifecycleOwner.lifecycleScope.allowUndo( viewLifecycleOwner.lifecycleScope.allowUndo(
view!!, requireView(),
snackbarMessage, snackbarMessage,
getString(R.string.snackbar_deleted_undo), { getString(R.string.snackbar_deleted_undo), {
listOfSessionsToDelete.forEach { listOfSessionsToDelete.forEach {
@ -813,7 +813,7 @@ class HomeFragment : Fragment() {
} }
viewLifecycleOwner.lifecycleScope.allowUndo( viewLifecycleOwner.lifecycleScope.allowUndo(
view!!, requireView(),
snackbarMessage, snackbarMessage,
getString(R.string.snackbar_deleted_undo), { getString(R.string.snackbar_deleted_undo), {
requireComponents.core.pendingSessionDeletionManager.removeSession(sessionId) requireComponents.core.pendingSessionDeletionManager.removeSession(sessionId)

View File

@ -61,7 +61,7 @@ class BookmarkFragment : LibraryPageFragment<BookmarkNode>(), UserInteractionHan
private val sharedViewModel: BookmarksSharedViewModel by activityViewModels { private val sharedViewModel: BookmarksSharedViewModel by activityViewModels {
ViewModelProvider.NewInstanceFactory() // this is a workaround for #4652 ViewModelProvider.NewInstanceFactory() // this is a workaround for #4652
} }
private val desktopFolders by lazy { DesktopFolders(context!!, showMobileRoot = false) } private val desktopFolders by lazy { DesktopFolders(requireContext(), showMobileRoot = false) }
lateinit var initialJob: Job lateinit var initialJob: Job
private var pendingBookmarkDeletionJob: (suspend () -> Unit)? = null private var pendingBookmarkDeletionJob: (suspend () -> Unit)? = null
@ -83,7 +83,7 @@ class BookmarkFragment : LibraryPageFragment<BookmarkNode>(), UserInteractionHan
bookmarkStore = bookmarkStore, bookmarkStore = bookmarkStore,
viewModel = sharedViewModel, viewModel = sharedViewModel,
bookmarksController = DefaultBookmarkController( bookmarksController = DefaultBookmarkController(
context = context!!, context = requireContext(),
navController = findNavController(), navController = findNavController(),
showSnackbar = ::showSnackBarWithText, showSnackbar = ::showSnackBarWithText,
deleteBookmarkNodes = ::deleteMulti, deleteBookmarkNodes = ::deleteMulti,
@ -133,7 +133,9 @@ class BookmarkFragment : LibraryPageFragment<BookmarkNode>(), UserInteractionHan
super.onResume() super.onResume()
(activity as HomeActivity).getSupportActionBarAndInflateIfNecessary().show() (activity as HomeActivity).getSupportActionBarAndInflateIfNecessary().show()
val currentGuid = BookmarkFragmentArgs.fromBundle(arguments!!).currentRoot.ifEmpty { BookmarkRoot.Mobile.id } val currentGuid = BookmarkFragmentArgs.fromBundle(requireArguments()).currentRoot.ifEmpty {
BookmarkRoot.Mobile.id
}
// Only display the sign-in prompt if we're inside of the virtual "Desktop Bookmarks" node. // Only display the sign-in prompt if we're inside of the virtual "Desktop Bookmarks" node.
// Don't want to pester user too much with it, and if there are lots of bookmarks present, // Don't want to pester user too much with it, and if there are lots of bookmarks present,
@ -277,14 +279,14 @@ class BookmarkFragment : LibraryPageFragment<BookmarkNode>(), UserInteractionHan
val bookmarkNode = selected.first() val bookmarkNode = selected.first()
getString( getString(
R.string.bookmark_deletion_snackbar_message, R.string.bookmark_deletion_snackbar_message,
bookmarkNode.url?.toShortUrl(context!!.components.publicSuffixList) ?: bookmarkNode.title bookmarkNode.url?.toShortUrl(requireContext().components.publicSuffixList) ?: bookmarkNode.title
) )
} }
else -> throw IllegalStateException("Illegal event type in onDeleteSome") else -> throw IllegalStateException("Illegal event type in onDeleteSome")
} }
viewLifecycleOwner.lifecycleScope.allowUndo( viewLifecycleOwner.lifecycleScope.allowUndo(
view!!, message, requireView(), message,
getString(R.string.bookmark_undo_deletion), { getString(R.string.bookmark_undo_deletion), {
undoPendingDeletion(selected) undoPendingDeletion(selected)
}, operation = getDeleteOperation(eventType) }, operation = getDeleteOperation(eventType)
@ -298,7 +300,7 @@ class BookmarkFragment : LibraryPageFragment<BookmarkNode>(), UserInteractionHan
val bookmarkNode = selected.first() val bookmarkNode = selected.first()
getString( getString(
R.string.bookmark_deletion_snackbar_message, R.string.bookmark_deletion_snackbar_message,
bookmarkNode.url?.toShortUrl(context!!.components.publicSuffixList) bookmarkNode.url?.toShortUrl(requireContext().components.publicSuffixList)
?: bookmarkNode.title ?: bookmarkNode.title
) )
} }
@ -322,7 +324,7 @@ class BookmarkFragment : LibraryPageFragment<BookmarkNode>(), UserInteractionHan
dialog.dismiss() dialog.dismiss()
val message = getDeleteDialogString(selected) val message = getDeleteDialogString(selected)
lifecycleScope.allowUndo( lifecycleScope.allowUndo(
view!!, requireView(),
message, message,
getString(R.string.bookmark_undo_deletion), getString(R.string.bookmark_undo_deletion),
{ {

View File

@ -117,7 +117,7 @@ class HistoryFragment : LibraryPageFragment<HistoryItem>(), UserInteractionHandl
} }
} }
viewModel.invalidate() viewModel.invalidate()
showSnackBar(view!!, message) showSnackBar(requireView(), message)
historyStore.dispatch(HistoryFragmentAction.ExitDeletionMode) historyStore.dispatch(HistoryFragmentAction.ExitDeletionMode)
} }
} }

View File

@ -174,7 +174,7 @@ class LoginsFragment : PreferenceFragmentCompat(), AccountObserver {
private fun updateSyncPreferenceStatus() { private fun updateSyncPreferenceStatus() {
val syncLogins = getPreferenceKey(R.string.pref_key_password_sync_logins) val syncLogins = getPreferenceKey(R.string.pref_key_password_sync_logins)
findPreference<Preference>(syncLogins)?.apply { findPreference<Preference>(syncLogins)?.apply {
val syncEnginesStatus = SyncEnginesStorage(context!!).getStatus() val syncEnginesStatus = SyncEnginesStorage(requireContext()).getStatus()
val loginsSyncStatus = syncEnginesStatus.getOrElse(SyncEngine.Passwords) { false } val loginsSyncStatus = syncEnginesStatus.getOrElse(SyncEngine.Passwords) { false }
summary = getString( summary = getString(
if (loginsSyncStatus) R.string.preferences_passwords_sync_logins_on if (loginsSyncStatus) R.string.preferences_passwords_sync_logins_on

View File

@ -98,7 +98,7 @@ class PairFragment : Fragment(R.layout.fragment_pair), UserInteractionHandler {
when (requestCode) { when (requestCode) {
REQUEST_CODE_CAMERA_PERMISSIONS -> { REQUEST_CODE_CAMERA_PERMISSIONS -> {
if (ContextCompat.checkSelfPermission( if (ContextCompat.checkSelfPermission(
context!!, requireContext(),
android.Manifest.permission.CAMERA android.Manifest.permission.CAMERA
) == PackageManager.PERMISSION_GRANTED ) == PackageManager.PERMISSION_GRANTED
) { ) {

View File

@ -88,7 +88,7 @@ class SettingsFragment : PreferenceFragmentCompat() {
// display a "Sign In" preference, which will then get replaced by the correct account information // display a "Sign In" preference, which will then get replaced by the correct account information
// once this call is ran in onResume shortly after. // once this call is ran in onResume shortly after.
updateAccountUIState( updateAccountUIState(
context!!, requireContext(),
requireComponents.backgroundServices.accountManager.accountProfile() requireComponents.backgroundServices.accountManager.accountProfile()
) )
@ -125,7 +125,7 @@ class SettingsFragment : PreferenceFragmentCompat() {
// update it here if we're not going through the `onCreate->onStart->onResume` lifecycle chain. // update it here if we're not going through the `onCreate->onStart->onResume` lifecycle chain.
update(shouldUpdateAccountUIState = !creatingFragment) update(shouldUpdateAccountUIState = !creatingFragment)
view!!.findViewById<RecyclerView>(R.id.recycler_view) requireView().findViewById<RecyclerView>(R.id.recycler_view)
?.hideInitialScrollBar(viewLifecycleOwner.lifecycleScope) ?.hideInitialScrollBar(viewLifecycleOwner.lifecycleScope)
// Consider finish of `onResume` to be the point at which we consider this fragment as 'created'. // Consider finish of `onResume` to be the point at which we consider this fragment as 'created'.
@ -169,7 +169,7 @@ class SettingsFragment : PreferenceFragmentCompat() {
if (shouldUpdateAccountUIState) { if (shouldUpdateAccountUIState) {
updateAccountUIState( updateAccountUIState(
context!!, requireContext(),
requireComponents.backgroundServices.accountManager.accountProfile() requireComponents.backgroundServices.accountManager.accountProfile()
) )
} }
@ -178,7 +178,7 @@ class SettingsFragment : PreferenceFragmentCompat() {
@Suppress("ComplexMethod", "LongMethod") @Suppress("ComplexMethod", "LongMethod")
override fun onPreferenceTreeClick(preference: Preference): Boolean { override fun onPreferenceTreeClick(preference: Preference): Boolean {
// Hide the scrollbar so the animation looks smoother // Hide the scrollbar so the animation looks smoother
val recyclerView = view!!.findViewById<RecyclerView>(R.id.recycler_view) val recyclerView = requireView().findViewById<RecyclerView>(R.id.recycler_view)
recyclerView.isVerticalScrollBarEnabled = false recyclerView.isVerticalScrollBarEnabled = false
val directions: NavDirections? = when (preference.key) { val directions: NavDirections? = when (preference.key) {
@ -217,7 +217,7 @@ class SettingsFragment : PreferenceFragmentCompat() {
resources.getString(R.string.pref_key_help) -> { resources.getString(R.string.pref_key_help) -> {
(activity as HomeActivity).openToBrowserAndLoad( (activity as HomeActivity).openToBrowserAndLoad(
searchTermOrURL = SupportUtils.getSumoURLForTopic( searchTermOrURL = SupportUtils.getSumoURLForTopic(
context!!, requireContext(),
SupportUtils.SumoTopic.HELP SupportUtils.SumoTopic.HELP
), ),
newTab = true, newTab = true,

View File

@ -31,7 +31,7 @@ class TrackingProtectionFragment : PreferenceFragmentCompat() {
private val exceptionsClickListener = Preference.OnPreferenceClickListener { private val exceptionsClickListener = Preference.OnPreferenceClickListener {
val directions = val directions =
TrackingProtectionFragmentDirections.actionTrackingProtectionFragmentToExceptionsFragment() TrackingProtectionFragmentDirections.actionTrackingProtectionFragmentToExceptionsFragment()
view!!.findNavController().navigate(directions) requireView().findNavController().navigate(directions)
true true
} }
private lateinit var radioStrict: RadioButtonInfoPreference private lateinit var radioStrict: RadioButtonInfoPreference
@ -75,7 +75,7 @@ class TrackingProtectionFragment : PreferenceFragmentCompat() {
} }
val trackingProtectionLearnMore = val trackingProtectionLearnMore =
context!!.getPreferenceKey(R.string.pref_key_etp_learn_more) requireContext().getPreferenceKey(R.string.pref_key_etp_learn_more)
val learnMorePreference = findPreference<Preference>(trackingProtectionLearnMore) val learnMorePreference = findPreference<Preference>(trackingProtectionLearnMore)
learnMorePreference?.setOnPreferenceClickListener { learnMorePreference?.setOnPreferenceClickListener {
(activity as HomeActivity).openToBrowserAndLoad( (activity as HomeActivity).openToBrowserAndLoad(

View File

@ -247,7 +247,7 @@ class AccountSettingsFragment : PreferenceFragmentCompat() {
} }
private fun updateSyncEngineStates() { private fun updateSyncEngineStates() {
val syncEnginesStatus = SyncEnginesStorage(context!!).getStatus() val syncEnginesStatus = SyncEnginesStorage(requireContext()).getStatus()
val bookmarksNameKey = getPreferenceKey(R.string.pref_key_sync_bookmarks) val bookmarksNameKey = getPreferenceKey(R.string.pref_key_sync_bookmarks)
findPreference<CheckBoxPreference>(bookmarksNameKey)?.apply { findPreference<CheckBoxPreference>(bookmarksNameKey)?.apply {
isEnabled = syncEnginesStatus.containsKey(SyncEngine.Bookmarks) isEnabled = syncEnginesStatus.containsKey(SyncEngine.Bookmarks)
@ -314,7 +314,7 @@ class AccountSettingsFragment : PreferenceFragmentCompat() {
return Preference.OnPreferenceChangeListener { _, newValue -> return Preference.OnPreferenceChangeListener { _, newValue ->
accountSettingsInteractor.onChangeDeviceName(newValue as String) { accountSettingsInteractor.onChangeDeviceName(newValue as String) {
FenixSnackbar.make( FenixSnackbar.make(
view = view!!, view = requireView(),
duration = FenixSnackbar.LENGTH_LONG, duration = FenixSnackbar.LENGTH_LONG,
isDisplayedWithBrowserToolbar = false isDisplayedWithBrowserToolbar = false
) )

View File

@ -39,7 +39,7 @@ class TurnOnSyncFragment : Fragment(), AccountObserver {
private val paringClickListener = View.OnClickListener { private val paringClickListener = View.OnClickListener {
val directions = TurnOnSyncFragmentDirections.actionTurnOnSyncFragmentToPairFragment() val directions = TurnOnSyncFragmentDirections.actionTurnOnSyncFragmentToPairFragment()
view!!.findNavController().navigate(directions) requireView().findNavController().navigate(directions)
requireComponents.analytics.metrics.track(Event.SyncAuthScanPairing) requireComponents.analytics.metrics.track(Event.SyncAuthScanPairing)
} }

View File

@ -210,7 +210,7 @@ class DeleteBrowsingDataFragment : Fragment(R.layout.fragment_delete_browsing_da
} }
private fun getCheckboxes(): List<DeleteBrowsingDataItem> { private fun getCheckboxes(): List<DeleteBrowsingDataItem> {
val fragmentView = view!! val fragmentView = requireView()
return listOf( return listOf(
fragmentView.open_tabs_item, fragmentView.open_tabs_item,
fragmentView.browsing_data_item, fragmentView.browsing_data_item,

View File

@ -39,7 +39,7 @@ class SitePermissionsFragment : PreferenceFragmentCompat() {
exceptionsCategory.onPreferenceClickListener = OnPreferenceClickListener { exceptionsCategory.onPreferenceClickListener = OnPreferenceClickListener {
val directions = SitePermissionsFragmentDirections.actionSitePermissionsToExceptions() val directions = SitePermissionsFragmentDirections.actionSitePermissionsToExceptions()
Navigation.findNavController(view!!).navigate(directions) Navigation.findNavController(requireView()).navigate(directions)
true true
} }
} }
@ -78,6 +78,6 @@ class SitePermissionsFragment : PreferenceFragmentCompat() {
private fun navigateToPhoneFeature(phoneFeature: PhoneFeature) { private fun navigateToPhoneFeature(phoneFeature: PhoneFeature) {
val directions = SitePermissionsFragmentDirections val directions = SitePermissionsFragmentDirections
.actionSitePermissionsToManagePhoneFeatures(phoneFeature.id) .actionSitePermissionsToManagePhoneFeatures(phoneFeature.id)
Navigation.findNavController(view!!).navigate(directions) Navigation.findNavController(requireView()).navigate(directions)
} }
} }

View File

@ -3,5 +3,5 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
object AndroidComponents { object AndroidComponents {
const val VERSION = "41.0.20200505190119" const val VERSION = "41.0.20200506130132"
} }