mirror of
https://github.com/vector-im/element-android.git
synced 2024-11-15 01:35:07 +08:00
Fix lint error, following the upgrade of the libs
This commit is contained in:
parent
a0998e4aff
commit
92e809fa6d
@ -26,7 +26,8 @@ import im.vector.riotx.features.settings.troubleshoot.TroubleshootTest
|
||||
class TestBatteryOptimization(val fragment: Fragment) : TroubleshootTest(R.string.settings_troubleshoot_test_battery_title) {
|
||||
|
||||
override fun perform() {
|
||||
if (fragment.context != null && isIgnoringBatteryOptimizations(fragment.context!!)) {
|
||||
val context = fragment.context
|
||||
if (context != null && isIgnoringBatteryOptimizations(context)) {
|
||||
description = fragment.getString(R.string.settings_troubleshoot_test_battery_success)
|
||||
status = TestStatus.SUCCESS
|
||||
quickFix = null
|
||||
|
@ -90,8 +90,6 @@ class VectorListPreference : ListPreference {
|
||||
fun setWarningIconVisible(isVisible: Boolean) {
|
||||
mIsWarningIconVisible = isVisible
|
||||
|
||||
if (null != mWarningIconView) {
|
||||
mWarningIconView!!.visibility = if (mIsWarningIconVisible) View.VISIBLE else View.GONE
|
||||
}
|
||||
mWarningIconView?.visibility = if (mIsWarningIconVisible) View.VISIBLE else View.GONE
|
||||
}
|
||||
}
|
||||
|
@ -162,7 +162,7 @@ fun startImportTextFromFileIntent(fragment: Fragment, requestCode: Int) {
|
||||
val intent = Intent(Intent.ACTION_GET_CONTENT).apply {
|
||||
type = "text/plain"
|
||||
}
|
||||
if (intent.resolveActivity(fragment.activity!!.packageManager) != null) {
|
||||
if (intent.resolveActivity(fragment.requireActivity().packageManager) != null) {
|
||||
fragment.startActivityForResult(intent, requestCode)
|
||||
} else {
|
||||
fragment.activity?.toast(R.string.error_no_external_application_found)
|
||||
|
@ -176,7 +176,7 @@ class KeysBackupSetupStep2Fragment @Inject constructor() : VectorBaseFragment()
|
||||
else -> {
|
||||
viewModel.megolmBackupCreationInfo = null
|
||||
|
||||
viewModel.prepareRecoveryKey(activity!!, viewModel.passphrase.value)
|
||||
viewModel.prepareRecoveryKey(requireActivity(), viewModel.passphrase.value)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -188,7 +188,7 @@ class KeysBackupSetupStep2Fragment @Inject constructor() : VectorBaseFragment()
|
||||
// Generate a recovery key for the user
|
||||
viewModel.megolmBackupCreationInfo = null
|
||||
|
||||
viewModel.prepareRecoveryKey(activity!!, null)
|
||||
viewModel.prepareRecoveryKey(requireActivity(), null)
|
||||
}
|
||||
else -> {
|
||||
// User has entered a passphrase but want to skip this step.
|
||||
|
@ -105,7 +105,7 @@ class KeysBackupSetupStep3Fragment @Inject constructor() : VectorBaseFragment()
|
||||
|
||||
@OnClick(R.id.keys_backup_setup_step3_copy_button)
|
||||
fun onCopyButtonClicked() {
|
||||
val dialog = BottomSheetDialog(activity!!)
|
||||
val dialog = BottomSheetDialog(requireActivity())
|
||||
dialog.setContentView(R.layout.bottom_sheet_save_recovery_key)
|
||||
dialog.setCanceledOnTouchOutside(true)
|
||||
val recoveryKey = viewModel.recoveryKey.value!!
|
||||
@ -124,7 +124,7 @@ class KeysBackupSetupStep3Fragment @Inject constructor() : VectorBaseFragment()
|
||||
}
|
||||
|
||||
it.debouncedClicks {
|
||||
copyToClipboard(activity!!, recoveryKey)
|
||||
copyToClipboard(requireActivity(), recoveryKey)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -159,7 +159,7 @@ class KeysBackupSetupStep3Fragment @Inject constructor() : VectorBaseFragment()
|
||||
viewModel.recoveryKey.value?.let {
|
||||
viewModel.copyHasBeenMade = true
|
||||
|
||||
copyToClipboard(activity!!, it)
|
||||
copyToClipboard(requireActivity(), it)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -78,7 +78,7 @@ class BootstrapSaveRecoveryKeyFragment @Inject constructor(
|
||||
if (resultCode == RESULT_OK && uri != null) {
|
||||
GlobalScope.launch(Dispatchers.IO) {
|
||||
try {
|
||||
sharedViewModel.handle(BootstrapActions.SaveKeyToUri(context!!.contentResolver!!.openOutputStream(uri)!!))
|
||||
sharedViewModel.handle(BootstrapActions.SaveKeyToUri(requireContext().contentResolver!!.openOutputStream(uri)!!))
|
||||
} catch (failure: Throwable) {
|
||||
sharedViewModel.handle(BootstrapActions.SaveReqFailed)
|
||||
}
|
||||
|
@ -1541,7 +1541,7 @@ class RoomDetailFragment @Inject constructor(
|
||||
}
|
||||
|
||||
private fun showSnackWithMessage(message: String, duration: Int = Snackbar.LENGTH_SHORT) {
|
||||
Snackbar.make(view!!, message, duration).show()
|
||||
Snackbar.make(requireView(), message, duration).show()
|
||||
}
|
||||
|
||||
// VectorInviteView.Callback
|
||||
|
@ -243,7 +243,7 @@ class RoomProfileFragment @Inject constructor(
|
||||
private fun onAvatarClicked(view: View, matrixItem: MatrixItem.RoomItem) = withState(roomProfileViewModel) {
|
||||
if (matrixItem.avatarUrl?.isNotEmpty() == true) {
|
||||
val intent = BigImageViewerActivity.newIntent(requireContext(), matrixItem.getBestName(), matrixItem.avatarUrl!!, it.canChangeAvatar)
|
||||
val options = ActivityOptionsCompat.makeSceneTransitionAnimation(activity!!, view, ViewCompat.getTransitionName(view) ?: "")
|
||||
val options = ActivityOptionsCompat.makeSceneTransitionAnimation(requireActivity(), view, ViewCompat.getTransitionName(view) ?: "")
|
||||
startActivityForResult(intent, BigImageViewerActivity.REQUEST_CODE, options.toBundle())
|
||||
} else if (it.canChangeAvatar) {
|
||||
showAvatarSelector()
|
||||
|
@ -83,8 +83,8 @@ abstract class VectorSettingsBaseFragment : PreferenceFragmentCompat(), HasScree
|
||||
* ========================================================================================== */
|
||||
|
||||
protected fun notImplemented() {
|
||||
// Snackbar cannot be display on PreferenceFragment
|
||||
// Snackbar.make(view!!, R.string.not_implemented, Snackbar.LENGTH_SHORT)
|
||||
// Snackbar cannot be display on PreferenceFragment. TODO It's maybe because the show() method is not used...
|
||||
// Snackbar.make(requireView(), R.string.not_implemented, Snackbar.LENGTH_SHORT)
|
||||
activity?.toast(R.string.not_implemented)
|
||||
}
|
||||
|
||||
|
@ -221,7 +221,7 @@ class VectorSettingsGeneralFragment : VectorSettingsBaseFragment() {
|
||||
|
||||
it.onPreferenceClickListener = Preference.OnPreferenceClickListener {
|
||||
displayLoadingView()
|
||||
MainActivity.restartApp(activity!!, MainActivityArgs(clearCache = true))
|
||||
MainActivity.restartApp(requireActivity(), MainActivityArgs(clearCache = true))
|
||||
false
|
||||
}
|
||||
}
|
||||
@ -622,7 +622,7 @@ class VectorSettingsGeneralFragment : VectorSettingsBaseFragment() {
|
||||
var order = addEmailBtn.order
|
||||
|
||||
for ((index, email3PID) in currentEmail3PID.withIndex()) {
|
||||
val preference = VectorPreference(activity!!)
|
||||
val preference = VectorPreference(requireActivity())
|
||||
|
||||
preference.title = getString(R.string.settings_email_address)
|
||||
preference.summary = "TODO" // email3PID.address
|
||||
|
@ -72,7 +72,7 @@ class VectorSettingsNotificationsTroubleshootFragment @Inject constructor(
|
||||
mRecyclerView.addItemDecoration(dividerItemDecoration)
|
||||
|
||||
mSummaryButton.debouncedClicks {
|
||||
bugReporter.openBugReportScreen(activity!!)
|
||||
bugReporter.openBugReportScreen(requireActivity())
|
||||
}
|
||||
|
||||
mRunButton.debouncedClicks {
|
||||
|
@ -134,7 +134,7 @@ class VectorSettingsPreferencesFragment @Inject constructor(
|
||||
selectedLanguagePreference.summary = VectorLocale.localeToLocalisedString(VectorLocale.applicationLocale)
|
||||
|
||||
// Text size
|
||||
textSizePreference.summary = getString(FontScale.getFontScaleValue(activity!!).nameResId)
|
||||
textSizePreference.summary = getString(FontScale.getFontScaleValue(requireActivity()).nameResId)
|
||||
|
||||
textSizePreference.onPreferenceClickListener = Preference.OnPreferenceClickListener {
|
||||
activity?.let { displayTextSizeSelection(it) }
|
||||
|
@ -107,7 +107,7 @@ class DeactivateAccountFragment @Inject constructor(
|
||||
displayErrorDialog(it.throwable)
|
||||
}
|
||||
DeactivateAccountViewEvents.Done ->
|
||||
MainActivity.restartApp(activity!!, MainActivityArgs(clearCredentials = true, isAccountDeactivated = true))
|
||||
MainActivity.restartApp(requireActivity(), MainActivityArgs(clearCredentials = true, isAccountDeactivated = true))
|
||||
}.exhaustive
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user