Skip to content

Commit 4f93018

Browse files
committed
Change arguments!! to requireArguments() to appease the linter.
1 parent c216da6 commit 4f93018

11 files changed

+19
-19
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ class CollectionMembersListFragment : ListFragment(), AdapterView.OnItemClickLis
3535
override fun onCreate(savedInstanceState: Bundle?) {
3636
super.onCreate(savedInstanceState)
3737
data = (requireContext().applicationContext as App).data
38-
account = arguments!!.getParcelable(Constants.KEY_ACCOUNT)!!
39-
info = arguments!!.getSerializable(Constants.KEY_COLLECTION_INFO) as CollectionInfo
38+
account = requireArguments().getParcelable(Constants.KEY_ACCOUNT)!!
39+
info = requireArguments().getSerializable(Constants.KEY_COLLECTION_INFO) as CollectionInfo
4040
journalEntity = JournalModel.Journal.fetch(data, info.getServiceEntity(data), info.uid)
4141
}
4242

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ class CreateCollectionFragment : DialogFragment(), LoaderManager.LoaderCallbacks
3737
override fun onCreate(savedInstanceState: Bundle?) {
3838
super.onCreate(savedInstanceState)
3939

40-
account = arguments!!.getParcelable(ARG_ACCOUNT)!!
41-
info = arguments!!.getSerializable(ARG_COLLECTION_INFO) as CollectionInfo
40+
account = requireArguments().getParcelable(ARG_ACCOUNT)!!
41+
info = requireArguments().getSerializable(ARG_COLLECTION_INFO) as CollectionInfo
4242

4343
loaderManager.initLoader(0, null, this)
4444
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ class DeleteCollectionFragment : DialogFragment(), LoaderManager.LoaderCallbacks
115115
class ConfirmDeleteCollectionFragment : DialogFragment() {
116116

117117
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
118-
val collectionInfo = arguments!!.getSerializable(ARG_COLLECTION_INFO) as CollectionInfo
118+
val collectionInfo = requireArguments().getSerializable(ARG_COLLECTION_INFO) as CollectionInfo
119119
val name = if (TextUtils.isEmpty(collectionInfo.displayName)) collectionInfo.uid else collectionInfo.displayName
120120

121121
return AlertDialog.Builder(requireContext())

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ class JournalItemActivity : BaseActivity(), Refreshable {
192192

193193
val tv = v.findViewById<View>(R.id.content) as TextView
194194

195-
val syncEntry = arguments!!.getSerializable(KEY_SYNC_ENTRY) as SyncEntry
195+
val syncEntry = requireArguments().getSerializable(KEY_SYNC_ENTRY) as SyncEntry
196196
tv.text = syncEntry.content
197197

198198
return v
@@ -217,8 +217,8 @@ class JournalItemActivity : BaseActivity(), Refreshable {
217217
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
218218
var v: View? = null
219219

220-
info = arguments!!.getSerializable(Constants.KEY_COLLECTION_INFO) as CollectionInfo
221-
syncEntry = arguments!!.getSerializable(KEY_SYNC_ENTRY) as SyncEntry
220+
info = requireArguments().getSerializable(Constants.KEY_COLLECTION_INFO) as CollectionInfo
221+
syncEntry = requireArguments().getSerializable(KEY_SYNC_ENTRY) as SyncEntry
222222

223223
when (info.enumType) {
224224
CollectionInfo.Type.ADDRESS_BOOK -> {

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ class RemoveMemberFragment : DialogFragment() {
1919

2020
override fun onCreate(savedInstanceState: Bundle?) {
2121
super.onCreate(savedInstanceState)
22-
val account = arguments!!.getParcelable<Account>(Constants.KEY_ACCOUNT)
23-
info = arguments!!.getSerializable(Constants.KEY_COLLECTION_INFO) as CollectionInfo
24-
memberEmail = arguments!!.getString(KEY_MEMBER)
22+
val account = requireArguments().getParcelable<Account>(Constants.KEY_ACCOUNT)
23+
info = requireArguments().getSerializable(Constants.KEY_COLLECTION_INFO) as CollectionInfo
24+
memberEmail = requireArguments().getString(KEY_MEMBER)
2525
try {
2626
settings = AccountSettings(requireContext(), account!!)
2727
} catch (e: InvalidAccountException) {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class StartupDialogFragment : DialogFragment() {
3939
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
4040
isCancelable = false
4141

42-
val mode = Mode.valueOf(arguments!!.getString(ARGS_MODE)!!)
42+
val mode = Mode.valueOf(requireArguments().getString(ARGS_MODE)!!)
4343
when (mode) {
4444
StartupDialogFragment.Mode.BATTERY_OPTIMIZATIONS -> return AlertDialog.Builder(requireActivity())
4545
.setTitle(R.string.startup_battery_optimization)

app/src/main/java/com/etesync/syncadapter/ui/journalviewer/ListEntriesFragment.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ class ListEntriesFragment : ListFragment(), AdapterView.OnItemClickListener {
4242
override fun onCreate(savedInstanceState: Bundle?) {
4343
super.onCreate(savedInstanceState)
4444
data = (requireContext().applicationContext as App).data
45-
account = arguments!!.getParcelable(ViewCollectionActivity.EXTRA_ACCOUNT)!!
46-
info = arguments!!.getSerializable(EXTRA_COLLECTION_INFO) as CollectionInfo
45+
account = requireArguments().getParcelable(ViewCollectionActivity.EXTRA_ACCOUNT)!!
46+
info = requireArguments().getSerializable(EXTRA_COLLECTION_INFO) as CollectionInfo
4747
}
4848

4949
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class EncryptionDetailsFragment : Fragment() {
2929
val btnBack = v.findViewById<View>(R.id.back) as Button
3030
btnBack.setOnClickListener { requireFragmentManager().popBackStack() }
3131

32-
val config = arguments!!.getSerializable(KEY_CONFIG) as BaseConfigurationFinder.Configuration
32+
val config = requireArguments().getSerializable(KEY_CONFIG) as BaseConfigurationFinder.Configuration
3333

3434
val encryptionFormInfo = v.findViewById<View>(R.id.encryption_form_info) as TextView
3535
if (config.userInfo == null) {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class LoginCredentialsChangeFragment : DialogFragment(), LoaderManager.LoaderCal
4343
super.onCreate(savedInstanceState)
4444

4545
loaderManager.initLoader(0, arguments, this)
46-
account = arguments!!.getParcelable(ARG_ACCOUNT)!!
46+
account = requireArguments().getParcelable(ARG_ACCOUNT)!!
4747
}
4848

4949
override fun onCreateLoader(id: Int, args: Bundle?): Loader<Configuration> {
@@ -88,7 +88,7 @@ class LoginCredentialsChangeFragment : DialogFragment(), LoaderManager.LoaderCal
8888
.setMessage(R.string.login_wrong_username_or_password)
8989
.setNeutralButton(R.string.login_view_logs) { dialog, which ->
9090
val intent = DebugInfoActivity.newIntent(context, this::class.toString())
91-
intent.putExtra(DebugInfoActivity.KEY_LOGS, arguments!!.getString(KEY_LOGS))
91+
intent.putExtra(DebugInfoActivity.KEY_LOGS, requireArguments().getString(KEY_LOGS))
9292
startActivity(intent)
9393
}
9494
.setPositiveButton(android.R.string.ok) { dialog, which ->

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class SetupEncryptionFragment : DialogFragment() {
4747
override fun onCreate(savedInstanceState: Bundle?) {
4848
super.onCreate(savedInstanceState)
4949

50-
SetupEncryptionLoader(requireContext(), arguments!!.getSerializable(KEY_CONFIG) as Configuration).execute()
50+
SetupEncryptionLoader(requireContext(), requireArguments().getSerializable(KEY_CONFIG) as Configuration).execute()
5151
}
5252

5353
private inner class SetupEncryptionLoader(internal val context: Context, internal val config: Configuration) : AsyncTask<Void, Void, Configuration>() {

0 commit comments

Comments
 (0)