Skip to content

Commit c216da6

Browse files
committed
Change fragmentManager!! to requireFragmentManager() to appease the linter.
1 parent b50feea commit c216da6

File tree

7 files changed

+9
-9
lines changed

7 files changed

+9
-9
lines changed

app/src/main/java/com/etesync/syncadapter/ui/AccountSettingsActivity.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ class LegacyAccountSettingsFragment : PreferenceFragmentCompat(), LoaderManager.
217217
val prefPassword = findPreference("password") as EditTextPreference
218218
prefPassword.onPreferenceChangeListener = Preference.OnPreferenceChangeListener { _, newValue ->
219219
val credentials = if (newValue != null) LoginCredentials(settings.uri, account.name, newValue as String) else null
220-
LoginCredentialsChangeFragment.newInstance(account, credentials!!).show(fragmentManager!!, null)
220+
LoginCredentialsChangeFragment.newInstance(account, credentials!!).show(requireFragmentManager(), null)
221221
loaderManager.restartLoader(0, arguments, this@LegacyAccountSettingsFragment)
222222
false
223223
}

app/src/main/java/com/etesync/syncadapter/ui/CreateCollectionFragment.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class CreateCollectionFragment : DialogFragment(), LoaderManager.LoaderCallbacks
6464
val parent = activity
6565
if (parent != null) {
6666
if (exception != null)
67-
fragmentManager!!.beginTransaction()
67+
requireFragmentManager().beginTransaction()
6868
.add(ExceptionInfoFragment.newInstance(exception, account), null)
6969
.commitAllowingStateLoss()
7070
else

app/src/main/java/com/etesync/syncadapter/ui/DeleteCollectionFragment.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class DeleteCollectionFragment : DialogFragment(), LoaderManager.LoaderCallbacks
5959
dismissAllowingStateLoss()
6060

6161
if (exception != null)
62-
fragmentManager!!.beginTransaction()
62+
requireFragmentManager().beginTransaction()
6363
.add(ExceptionInfoFragment.newInstance(exception, account), null)
6464
.commitAllowingStateLoss()
6565
else {
@@ -124,7 +124,7 @@ class DeleteCollectionFragment : DialogFragment(), LoaderManager.LoaderCallbacks
124124
.setPositiveButton(android.R.string.yes) { dialog, _ ->
125125
val frag = DeleteCollectionFragment()
126126
frag.arguments = arguments
127-
frag.show(fragmentManager!!, null)
127+
frag.show(requireFragmentManager(), null)
128128
}
129129
.setNegativeButton(android.R.string.no) { _, _ -> dismiss() }
130130
.create()

app/src/main/java/com/etesync/syncadapter/ui/MigrateV2Activity.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ class LoginFragment() : Fragment() {
340340
login.setOnClickListener {
341341
val credentials = validateLoginData()
342342
if (credentials != null)
343-
LoginDoFragment.newInstance(accountV1, credentials).show(fragmentManager!!, null)
343+
LoginDoFragment.newInstance(accountV1, credentials).show(requireFragmentManager(), null)
344344
}
345345

346346
val forgotPassword = v.findViewById<View>(R.id.forgot_password) as TextView

app/src/main/java/com/etesync/syncadapter/ui/setup/EncryptionDetailsFragment.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class EncryptionDetailsFragment : Fragment() {
2727
val v = inflater.inflate(R.layout.login_encryption_details, container, false)
2828

2929
val btnBack = v.findViewById<View>(R.id.back) as Button
30-
btnBack.setOnClickListener { fragmentManager!!.popBackStack() }
30+
btnBack.setOnClickListener { requireFragmentManager().popBackStack() }
3131

3232
val config = arguments!!.getSerializable(KEY_CONFIG) as BaseConfigurationFinder.Configuration
3333

@@ -50,7 +50,7 @@ class EncryptionDetailsFragment : Fragment() {
5050
return@OnClickListener
5151
}
5252

53-
SetupEncryptionFragment.newInstance(config).show(fragmentManager!!, null)
53+
SetupEncryptionFragment.newInstance(config).show(requireFragmentManager(), null)
5454
})
5555

5656
return v

app/src/main/java/com/etesync/syncadapter/ui/setup/LoginCredentialsChangeFragment.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class LoginCredentialsChangeFragment : DialogFragment(), LoaderManager.LoaderCal
5454
if (data != null) {
5555
if (data.isFailed)
5656
// no service found: show error message
57-
fragmentManager!!.beginTransaction()
57+
requireFragmentManager().beginTransaction()
5858
.add(NothingDetectedFragment.newInstance(data.error!!.localizedMessage), null)
5959
.commitAllowingStateLoss()
6060
else {

app/src/main/java/com/etesync/syncadapter/ui/setup/LoginCredentialsFragment.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class LoginCredentialsFragment : Fragment() {
6464
login.setOnClickListener {
6565
val credentials = validateLoginData()
6666
if (credentials != null)
67-
DetectConfigurationFragment.newInstance(credentials).show(fragmentManager!!, null)
67+
DetectConfigurationFragment.newInstance(credentials).show(requireFragmentManager(), null)
6868
}
6969

7070
val forgotPassword = v.findViewById<View>(R.id.forgot_password) as TextView

0 commit comments

Comments
 (0)