diff --git a/app/src/main/java/io/legado/app/ui/dict/DictDialog.kt b/app/src/main/java/io/legado/app/ui/dict/DictDialog.kt new file mode 100644 index 000000000..d4f9fefab --- /dev/null +++ b/app/src/main/java/io/legado/app/ui/dict/DictDialog.kt @@ -0,0 +1,32 @@ +package io.legado.app.ui.dict + +import android.os.Bundle +import android.view.View +import androidx.fragment.app.FragmentManager +import androidx.fragment.app.viewModels +import io.legado.app.base.BaseDialogFragment + +class DictDialog : BaseDialogFragment() { + + companion object { + + fun dict(manager: FragmentManager, word: String) { + DictDialog().apply { + val bundle = Bundle() + bundle.putString("word", word) + arguments = bundle + }.show(manager, word) + } + + } + + private val viewModel by viewModels() + + override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) { + viewModel.word = arguments?.getString("word") ?: "" + + + } + + +} \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/ui/dict/DictViewModel.kt b/app/src/main/java/io/legado/app/ui/dict/DictViewModel.kt new file mode 100644 index 000000000..8b694776f --- /dev/null +++ b/app/src/main/java/io/legado/app/ui/dict/DictViewModel.kt @@ -0,0 +1,11 @@ +package io.legado.app.ui.dict + +import android.app.Application +import androidx.lifecycle.AndroidViewModel + +class DictViewModel(application: Application) : AndroidViewModel(application) { + + var word: String? = null + + +} \ No newline at end of file