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