code clean

This commit is contained in:
Hemanth S 2020-12-05 19:02:49 +05:30
parent 6845f75ea0
commit 1b08b775ac
10 changed files with 37 additions and 48 deletions

View file

@ -16,6 +16,7 @@ package code.name.monkey.retromusic.dialogs
import android.app.Dialog
import android.os.Bundle
import androidx.core.os.bundleOf
import androidx.core.text.HtmlCompat
import androidx.fragment.app.DialogFragment
import code.name.monkey.retromusic.EXTRA_SONG
@ -40,11 +41,11 @@ class DeleteSongsDialog : DialogFragment() {
}
fun create(songs: List<Song>): DeleteSongsDialog {
val dialog = DeleteSongsDialog()
val args = Bundle()
args.putParcelableArrayList(EXTRA_SONG, ArrayList(songs))
dialog.arguments = args
return dialog
return DeleteSongsDialog().apply {
arguments = bundleOf(
EXTRA_SONG to ArrayList(songs)
)
}
}
}

View file

@ -164,7 +164,6 @@ class SleepTimerDialog : DialogFragment() {
) {
override fun onTick(millisUntilFinished: Long) {
println("onTick: $millisUntilFinished")
seekBar.progress = millisUntilFinished.toInt()
}

View file

@ -23,6 +23,7 @@ import android.util.Log
import android.view.LayoutInflater
import android.widget.TextView
import androidx.annotation.NonNull
import androidx.core.os.bundleOf
import androidx.core.text.HtmlCompat
import androidx.fragment.app.DialogFragment
import code.name.monkey.retromusic.EXTRA_SONG
@ -155,11 +156,11 @@ class SongDetailDialog : DialogFragment() {
val TAG: String = SongDetailDialog::class.java.simpleName
fun create(song: Song): SongDetailDialog {
val dialog = SongDetailDialog()
val args = Bundle()
args.putParcelable(EXTRA_SONG, song)
dialog.arguments = args
return dialog
return SongDetailDialog().apply {
arguments = bundleOf(
EXTRA_SONG to song
)
}
}
private fun makeTextWithTitle(context: Context, titleResId: Int, text: String?): Spanned {

View file

@ -17,6 +17,7 @@ package code.name.monkey.retromusic.dialogs
import android.app.Dialog
import android.content.Intent
import android.os.Bundle
import androidx.core.os.bundleOf
import androidx.fragment.app.DialogFragment
import code.name.monkey.retromusic.EXTRA_SONG
import code.name.monkey.retromusic.R
@ -93,11 +94,11 @@ class SongShareDialog : DialogFragment() {
companion object {
fun create(song: Song): SongShareDialog {
val dialog = SongShareDialog()
val args = Bundle()
args.putParcelable(EXTRA_SONG, song)
dialog.arguments = args
return dialog
return SongShareDialog().apply {
arguments = bundleOf(
EXTRA_SONG to song
)
}
}
}
}