Utilize bundleOf KTX extension
This commit is contained in:
parent
3a84650cd1
commit
3aa7523435
4 changed files with 18 additions and 19 deletions
|
@ -19,6 +19,7 @@ import android.view.LayoutInflater
|
|||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.ImageView
|
||||
import androidx.core.os.bundleOf
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.FragmentManager
|
||||
|
@ -206,9 +207,7 @@ class AlbumCoverPagerAdapter(
|
|||
|
||||
fun newInstance(song: Song): AlbumCoverFragment {
|
||||
val frag = AlbumCoverFragment()
|
||||
val args = Bundle()
|
||||
args.putParcelable(SONG_ARG, song)
|
||||
frag.arguments = args
|
||||
frag.arguments = bundleOf(SONG_ARG to song)
|
||||
return frag
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ package code.name.monkey.retromusic.appshortcuts
|
|||
import android.app.Activity
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import androidx.core.os.bundleOf
|
||||
import code.name.monkey.retromusic.appshortcuts.shortcuttype.LastAddedShortcutType
|
||||
import code.name.monkey.retromusic.appshortcuts.shortcuttype.ShuffleAllShortcutType
|
||||
import code.name.monkey.retromusic.appshortcuts.shortcuttype.TopTracksShortcutType
|
||||
|
@ -63,9 +64,10 @@ class AppShortcutLauncherActivity : Activity() {
|
|||
val intent = Intent(this, MusicService::class.java)
|
||||
intent.action = ACTION_PLAY_PLAYLIST
|
||||
|
||||
val bundle = Bundle()
|
||||
bundle.putParcelable(INTENT_EXTRA_PLAYLIST, playlist)
|
||||
bundle.putInt(INTENT_EXTRA_SHUFFLE_MODE, shuffleMode)
|
||||
val bundle = bundleOf(
|
||||
INTENT_EXTRA_PLAYLIST to playlist,
|
||||
INTENT_EXTRA_SHUFFLE_MODE to shuffleMode
|
||||
)
|
||||
|
||||
intent.putExtras(bundle)
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ import android.content.Context
|
|||
import android.content.Intent
|
||||
import android.content.pm.ShortcutInfo
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import androidx.core.os.bundleOf
|
||||
import code.name.monkey.retromusic.appshortcuts.AppShortcutLauncherActivity
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.N_MR1)
|
||||
|
@ -36,8 +36,7 @@ abstract class BaseShortcutType(internal var context: Context) {
|
|||
internal fun getPlaySongsIntent(shortcutType: Long): Intent {
|
||||
val intent = Intent(context, AppShortcutLauncherActivity::class.java)
|
||||
intent.action = Intent.ACTION_VIEW
|
||||
val b = Bundle()
|
||||
b.putLong(AppShortcutLauncherActivity.KEY_SHORTCUT_TYPE, shortcutType)
|
||||
val b = bundleOf(AppShortcutLauncherActivity.KEY_SHORTCUT_TYPE to shortcutType)
|
||||
intent.putExtras(b)
|
||||
return intent
|
||||
}
|
||||
|
|
|
@ -2,9 +2,9 @@ package code.name.monkey.retromusic.auto
|
|||
|
||||
import android.content.Context
|
||||
import android.net.Uri
|
||||
import android.os.Bundle
|
||||
import android.support.v4.media.MediaBrowserCompat
|
||||
import android.support.v4.media.MediaDescriptionCompat
|
||||
import androidx.core.os.bundleOf
|
||||
import code.name.monkey.retromusic.util.ImageUtil
|
||||
|
||||
|
||||
|
@ -55,15 +55,14 @@ internal object AutoMediaItem {
|
|||
|
||||
fun gridLayout(isGrid: Boolean): Builder {
|
||||
|
||||
val hints = Bundle()
|
||||
hints.putBoolean(CONTENT_STYLE_SUPPORTED, true)
|
||||
hints.putInt(
|
||||
CONTENT_STYLE_BROWSABLE_HINT,
|
||||
if (isGrid) CONTENT_STYLE_GRID_ITEM_HINT_VALUE else CONTENT_STYLE_LIST_ITEM_HINT_VALUE
|
||||
)
|
||||
hints.putInt(
|
||||
CONTENT_STYLE_PLAYABLE_HINT,
|
||||
if (isGrid) CONTENT_STYLE_GRID_ITEM_HINT_VALUE else CONTENT_STYLE_LIST_ITEM_HINT_VALUE
|
||||
val hints = bundleOf(
|
||||
CONTENT_STYLE_SUPPORTED to true,
|
||||
CONTENT_STYLE_BROWSABLE_HINT to
|
||||
if (isGrid) CONTENT_STYLE_GRID_ITEM_HINT_VALUE
|
||||
else CONTENT_STYLE_LIST_ITEM_HINT_VALUE,
|
||||
CONTENT_STYLE_PLAYABLE_HINT to
|
||||
if (isGrid) CONTENT_STYLE_GRID_ITEM_HINT_VALUE
|
||||
else CONTENT_STYLE_LIST_ITEM_HINT_VALUE
|
||||
)
|
||||
mBuilder?.setExtras(hints)
|
||||
return this
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue