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),
engineView = WeakReference(engineView),
swipeRefresh = WeakReference(swipeRefresh),
arguments = arguments!!
arguments = requireArguments()
).apply {
beginAnimateInIfNecessary()
}
@ -829,7 +829,7 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session
// Close find in page bar if opened
findInPageIntegration.onBackPressed()
FenixSnackbar.make(
view = view!!,
view = requireView(),
duration = Snackbar.LENGTH_SHORT,
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(
context!!,
ThemeManager.resolveAttribute(R.attr.primaryText, context!!)
requireContext(),
ThemeManager.resolveAttribute(R.attr.primaryText, requireContext())
))
view.toolbar.compoundDrawablePadding =
@ -381,7 +381,7 @@ class HomeFragment : Fragment() {
super.onDestroyView()
_sessionControlInteractor = null
sessionControlView = null
view!!.homeAppBar.removeOnOffsetChangedListener(homeAppBarOffSetListener)
requireView().homeAppBar.removeOnOffsetChangedListener(homeAppBarOffSetListener)
}
override fun onStart() {
@ -773,7 +773,7 @@ class HomeFragment : Fragment() {
}
viewLifecycleOwner.lifecycleScope.allowUndo(
view!!,
requireView(),
snackbarMessage,
getString(R.string.snackbar_deleted_undo), {
listOfSessionsToDelete.forEach {
@ -813,7 +813,7 @@ class HomeFragment : Fragment() {
}
viewLifecycleOwner.lifecycleScope.allowUndo(
view!!,
requireView(),
snackbarMessage,
getString(R.string.snackbar_deleted_undo), {
requireComponents.core.pendingSessionDeletionManager.removeSession(sessionId)

View File

@ -61,7 +61,7 @@ class BookmarkFragment : LibraryPageFragment<BookmarkNode>(), UserInteractionHan
private val sharedViewModel: BookmarksSharedViewModel by activityViewModels {
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
private var pendingBookmarkDeletionJob: (suspend () -> Unit)? = null
@ -83,7 +83,7 @@ class BookmarkFragment : LibraryPageFragment<BookmarkNode>(), UserInteractionHan
bookmarkStore = bookmarkStore,
viewModel = sharedViewModel,
bookmarksController = DefaultBookmarkController(
context = context!!,
context = requireContext(),
navController = findNavController(),
showSnackbar = ::showSnackBarWithText,
deleteBookmarkNodes = ::deleteMulti,
@ -133,7 +133,9 @@ class BookmarkFragment : LibraryPageFragment<BookmarkNode>(), UserInteractionHan
super.onResume()
(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.
// 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()
getString(
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")
}
viewLifecycleOwner.lifecycleScope.allowUndo(
view!!, message,
requireView(), message,
getString(R.string.bookmark_undo_deletion), {
undoPendingDeletion(selected)
}, operation = getDeleteOperation(eventType)
@ -298,7 +300,7 @@ class BookmarkFragment : LibraryPageFragment<BookmarkNode>(), UserInteractionHan
val bookmarkNode = selected.first()
getString(
R.string.bookmark_deletion_snackbar_message,
bookmarkNode.url?.toShortUrl(context!!.components.publicSuffixList)
bookmarkNode.url?.toShortUrl(requireContext().components.publicSuffixList)
?: bookmarkNode.title
)
}
@ -322,7 +324,7 @@ class BookmarkFragment : LibraryPageFragment<BookmarkNode>(), UserInteractionHan
dialog.dismiss()
val message = getDeleteDialogString(selected)
lifecycleScope.allowUndo(
view!!,
requireView(),
message,
getString(R.string.bookmark_undo_deletion),
{

View File

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

View File

@ -174,7 +174,7 @@ class LoginsFragment : PreferenceFragmentCompat(), AccountObserver {
private fun updateSyncPreferenceStatus() {
val syncLogins = getPreferenceKey(R.string.pref_key_password_sync_logins)
findPreference<Preference>(syncLogins)?.apply {
val syncEnginesStatus = SyncEnginesStorage(context!!).getStatus()
val syncEnginesStatus = SyncEnginesStorage(requireContext()).getStatus()
val loginsSyncStatus = syncEnginesStatus.getOrElse(SyncEngine.Passwords) { false }
summary = getString(
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) {
REQUEST_CODE_CAMERA_PERMISSIONS -> {
if (ContextCompat.checkSelfPermission(
context!!,
requireContext(),
android.Manifest.permission.CAMERA
) == 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
// once this call is ran in onResume shortly after.
updateAccountUIState(
context!!,
requireContext(),
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(shouldUpdateAccountUIState = !creatingFragment)
view!!.findViewById<RecyclerView>(R.id.recycler_view)
requireView().findViewById<RecyclerView>(R.id.recycler_view)
?.hideInitialScrollBar(viewLifecycleOwner.lifecycleScope)
// 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) {
updateAccountUIState(
context!!,
requireContext(),
requireComponents.backgroundServices.accountManager.accountProfile()
)
}
@ -178,7 +178,7 @@ class SettingsFragment : PreferenceFragmentCompat() {
@Suppress("ComplexMethod", "LongMethod")
override fun onPreferenceTreeClick(preference: Preference): Boolean {
// 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
val directions: NavDirections? = when (preference.key) {
@ -217,7 +217,7 @@ class SettingsFragment : PreferenceFragmentCompat() {
resources.getString(R.string.pref_key_help) -> {
(activity as HomeActivity).openToBrowserAndLoad(
searchTermOrURL = SupportUtils.getSumoURLForTopic(
context!!,
requireContext(),
SupportUtils.SumoTopic.HELP
),
newTab = true,

View File

@ -31,7 +31,7 @@ class TrackingProtectionFragment : PreferenceFragmentCompat() {
private val exceptionsClickListener = Preference.OnPreferenceClickListener {
val directions =
TrackingProtectionFragmentDirections.actionTrackingProtectionFragmentToExceptionsFragment()
view!!.findNavController().navigate(directions)
requireView().findNavController().navigate(directions)
true
}
private lateinit var radioStrict: RadioButtonInfoPreference
@ -75,7 +75,7 @@ class TrackingProtectionFragment : PreferenceFragmentCompat() {
}
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)
learnMorePreference?.setOnPreferenceClickListener {
(activity as HomeActivity).openToBrowserAndLoad(

View File

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

View File

@ -39,7 +39,7 @@ class TurnOnSyncFragment : Fragment(), AccountObserver {
private val paringClickListener = View.OnClickListener {
val directions = TurnOnSyncFragmentDirections.actionTurnOnSyncFragmentToPairFragment()
view!!.findNavController().navigate(directions)
requireView().findNavController().navigate(directions)
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> {
val fragmentView = view!!
val fragmentView = requireView()
return listOf(
fragmentView.open_tabs_item,
fragmentView.browsing_data_item,

View File

@ -39,7 +39,7 @@ class SitePermissionsFragment : PreferenceFragmentCompat() {
exceptionsCategory.onPreferenceClickListener = OnPreferenceClickListener {
val directions = SitePermissionsFragmentDirections.actionSitePermissionsToExceptions()
Navigation.findNavController(view!!).navigate(directions)
Navigation.findNavController(requireView()).navigate(directions)
true
}
}
@ -78,6 +78,6 @@ class SitePermissionsFragment : PreferenceFragmentCompat() {
private fun navigateToPhoneFeature(phoneFeature: PhoneFeature) {
val directions = SitePermissionsFragmentDirections
.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/. */
object AndroidComponents {
const val VERSION = "41.0.20200505190119"
const val VERSION = "41.0.20200506130132"
}