mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-29 08:20:32 +05:30
refactor: use extension function for receiving arguments
This commit is contained in:
parent
77f9fcb096
commit
35565ad0c7
@ -2,7 +2,6 @@ package com.github.libretube.ui.dialogs
|
|||||||
|
|
||||||
import android.app.Dialog
|
import android.app.Dialog
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.os.Build
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
import androidx.fragment.app.DialogFragment
|
import androidx.fragment.app.DialogFragment
|
||||||
@ -14,6 +13,8 @@ import com.github.libretube.constants.YOUTUBE_FRONTEND_URL
|
|||||||
import com.github.libretube.databinding.DialogShareBinding
|
import com.github.libretube.databinding.DialogShareBinding
|
||||||
import com.github.libretube.db.DatabaseHolder.Database
|
import com.github.libretube.db.DatabaseHolder.Database
|
||||||
import com.github.libretube.enums.ShareObjectType
|
import com.github.libretube.enums.ShareObjectType
|
||||||
|
import com.github.libretube.extensions.parcelable
|
||||||
|
import com.github.libretube.extensions.serializable
|
||||||
import com.github.libretube.helpers.PreferenceHelper
|
import com.github.libretube.helpers.PreferenceHelper
|
||||||
import com.github.libretube.obj.ShareData
|
import com.github.libretube.obj.ShareData
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||||
@ -29,14 +30,8 @@ class ShareDialog : DialogFragment() {
|
|||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
arguments?.let {
|
arguments?.let {
|
||||||
id = it.getString(IntentData.id)!!
|
id = it.getString(IntentData.id)!!
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
shareObjectType = it.serializable(IntentData.shareObjectType)!!
|
||||||
shareObjectType =
|
shareData = it.parcelable(IntentData.shareData)!!
|
||||||
it.getSerializable(IntentData.shareObjectType, ShareObjectType::class.java)!!
|
|
||||||
shareData = it.getParcelable(IntentData.shareData, ShareData::class.java)!!
|
|
||||||
} else {
|
|
||||||
shareObjectType = it.getSerializable(IntentData.shareObjectType) as ShareObjectType
|
|
||||||
shareData = it.getParcelable(IntentData.shareData)!!
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,7 +125,8 @@ class PlaylistOptionsBottomSheet(
|
|||||||
IntentData.requestKey,
|
IntentData.requestKey,
|
||||||
this
|
this
|
||||||
) { _, resultBundle ->
|
) { _, resultBundle ->
|
||||||
val newDescription = resultBundle.getString(IntentData.playlistDescription)!!
|
val newDescription =
|
||||||
|
resultBundle.getString(IntentData.playlistDescription)!!
|
||||||
onChangeDescription.invoke(newDescription)
|
onChangeDescription.invoke(newDescription)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user