Use bundleOf().

This commit is contained in:
Isira Seneviratne 2020-10-17 15:38:45 +05:30
parent 7e9fba2d96
commit 55d242fa08
2 changed files with 4 additions and 11 deletions

View File

@ -29,6 +29,7 @@ import android.view.MenuItem
import android.view.View
import android.view.ViewGroup
import androidx.appcompat.app.AlertDialog
import androidx.core.os.bundleOf
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProvider
import androidx.preference.PreferenceManager
@ -330,12 +331,7 @@ class FeedFragment : BaseListFragment<FeedState, Unit>() {
@JvmStatic
fun newInstance(groupId: Long = FeedGroupEntity.GROUP_ALL_ID, groupName: String? = null): FeedFragment {
val feedFragment = FeedFragment()
feedFragment.arguments = Bundle().apply {
putLong(KEY_GROUP_ID, groupId)
putString(KEY_GROUP_NAME, groupName)
}
feedFragment.arguments = bundleOf(KEY_GROUP_ID to groupId, KEY_GROUP_NAME to groupName)
return feedFragment
}
}

View File

@ -12,6 +12,7 @@ import android.view.ViewGroup
import android.view.inputmethod.InputMethodManager
import android.widget.Toast
import androidx.core.content.getSystemService
import androidx.core.os.bundleOf
import androidx.fragment.app.DialogFragment
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProvider
@ -501,11 +502,7 @@ class FeedGroupDialog : DialogFragment(), BackPressable {
fun newInstance(groupId: Long = NO_GROUP_SELECTED): FeedGroupDialog {
val dialog = FeedGroupDialog()
dialog.arguments = Bundle().apply {
putLong(KEY_GROUP_ID, groupId)
}
dialog.arguments = bundleOf(KEY_GROUP_ID to groupId)
return dialog
}
}