|
|
@@ -6,11 +6,13 @@ import androidx.fragment.app.viewModels
|
|
|
import com.adealink.frame.mvvm.view.viewBinding
|
|
|
import com.adealink.frame.util.naviBarHeight
|
|
|
import com.adealink.weparty.commonui.widget.BottomDialogFragment
|
|
|
+import com.adealink.weparty.module.profile.data.UserVoiceEditData
|
|
|
import com.adealink.weparty.module.profile.data.VoiceData
|
|
|
import com.adealink.weparty.profile.R
|
|
|
import com.adealink.weparty.profile.databinding.DialogEditTalentVoiceBinding
|
|
|
import com.adealink.weparty.profile.edit.dialog.fragment.VoiceEditFragment
|
|
|
import com.adealink.weparty.profile.edit.dialog.fragment.VoiceFragment
|
|
|
+import com.adealink.weparty.profile.edit.dialog.fragment.VoiceUnderReviewFragment
|
|
|
import com.adealink.weparty.profile.edit.dialog.viewmodel.EditVoicePage
|
|
|
import com.adealink.weparty.profile.edit.dialog.viewmodel.EditVoiceViewModel
|
|
|
|
|
|
@@ -19,6 +21,8 @@ class EditTalentVoiceDialog : BottomDialogFragment(R.layout.dialog_edit_talent_v
|
|
|
companion object {
|
|
|
private const val TAG_VOICE = "TAG_TALENT_VOICE"
|
|
|
private const val TAG_VOICE_EDIT = "TAG_TALENT_VOICE_EDIT"
|
|
|
+
|
|
|
+ private const val TAG_VOICE_REVIEW = "TAG_TALENT_VOICE_REVIEW"
|
|
|
}
|
|
|
|
|
|
private val binding by viewBinding(DialogEditTalentVoiceBinding::bind)
|
|
|
@@ -26,10 +30,12 @@ class EditTalentVoiceDialog : BottomDialogFragment(R.layout.dialog_edit_talent_v
|
|
|
private val viewModel by viewModels<EditVoiceViewModel>()
|
|
|
private var callback: ITalentVoiceCallback? = null
|
|
|
|
|
|
+ private var editVoice: UserVoiceEditData? = null
|
|
|
private var voice: VoiceData? = null
|
|
|
|
|
|
- fun setVoice(voice: VoiceData?) {
|
|
|
- this.voice = voice
|
|
|
+ fun setVoice(voice: UserVoiceEditData?) {
|
|
|
+ this.editVoice = voice
|
|
|
+ this.voice = VoiceData(url = voice?.voiceBar, null, null)
|
|
|
}
|
|
|
|
|
|
fun setCallback(callback: ITalentVoiceCallback?) {
|
|
|
@@ -54,25 +60,22 @@ class EditTalentVoiceDialog : BottomDialogFragment(R.layout.dialog_edit_talent_v
|
|
|
EditVoicePage.EDIT -> {
|
|
|
inflateVoiceEditFragment()
|
|
|
}
|
|
|
+
|
|
|
+ EditVoicePage.REVIEW -> {
|
|
|
+ inflateUnderReviewFragment()
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
override fun loadData() {
|
|
|
super.loadData()
|
|
|
- viewModel.showPage(EditVoicePage.EDIT)
|
|
|
- // TODO: zhangfei 先做录音部分, 审核后续再加
|
|
|
-// if (voice == null || voice?.isNull() == true) {
|
|
|
-// //未上传声音
|
|
|
-// viewModel.showPage(EditVoicePage.EDIT)
|
|
|
-// } else {
|
|
|
-// viewModel.showPage(EditVoicePage.VOICE)
|
|
|
-// }
|
|
|
+ viewModel.setEditVoice(editVoice)
|
|
|
}
|
|
|
|
|
|
private fun inflateVoiceFragment() {
|
|
|
val fragment = childFragmentManager.findFragmentByTag(TAG_VOICE)
|
|
|
- if (fragment?.isDetached == true) {
|
|
|
+ if (fragment?.isAdded == true) {
|
|
|
return
|
|
|
}
|
|
|
childFragmentManager.beginTransaction()
|
|
|
@@ -86,7 +89,7 @@ class EditTalentVoiceDialog : BottomDialogFragment(R.layout.dialog_edit_talent_v
|
|
|
|
|
|
private fun inflateVoiceEditFragment() {
|
|
|
val fragment = childFragmentManager.findFragmentByTag(TAG_VOICE_EDIT)
|
|
|
- if (fragment?.isDetached == true) {
|
|
|
+ if (fragment?.isAdded == true) {
|
|
|
return
|
|
|
}
|
|
|
childFragmentManager.beginTransaction()
|
|
|
@@ -98,6 +101,20 @@ class EditTalentVoiceDialog : BottomDialogFragment(R.layout.dialog_edit_talent_v
|
|
|
.commitAllowingStateLoss()
|
|
|
}
|
|
|
|
|
|
+ private fun inflateUnderReviewFragment() {
|
|
|
+ val fragment = childFragmentManager.findFragmentByTag(TAG_VOICE_REVIEW)
|
|
|
+ if (fragment?.isAdded == true) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ childFragmentManager.beginTransaction()
|
|
|
+ .replace(
|
|
|
+ R.id.fl_content,
|
|
|
+ VoiceUnderReviewFragment(),
|
|
|
+ TAG_VOICE_REVIEW
|
|
|
+ )
|
|
|
+ .commitAllowingStateLoss()
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
interface ITalentVoiceCallback {
|
|
|
fun onEditVoice(voice: VoiceData?)
|