|
|
@ -5,6 +5,7 @@ import android.view.View |
|
|
|
import androidx.annotation.LayoutRes |
|
|
|
import androidx.annotation.LayoutRes |
|
|
|
import androidx.fragment.app.DialogFragment |
|
|
|
import androidx.fragment.app.DialogFragment |
|
|
|
import androidx.fragment.app.FragmentManager |
|
|
|
import androidx.fragment.app.FragmentManager |
|
|
|
|
|
|
|
import io.legado.app.R |
|
|
|
import io.legado.app.help.coroutine.Coroutine |
|
|
|
import io.legado.app.help.coroutine.Coroutine |
|
|
|
import io.legado.app.lib.theme.ThemeStore |
|
|
|
import io.legado.app.lib.theme.ThemeStore |
|
|
|
import kotlinx.coroutines.CoroutineScope |
|
|
|
import kotlinx.coroutines.CoroutineScope |
|
|
@ -14,12 +15,28 @@ import kotlinx.coroutines.cancel |
|
|
|
import kotlin.coroutines.CoroutineContext |
|
|
|
import kotlin.coroutines.CoroutineContext |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
abstract class BaseDialogFragment(@LayoutRes layoutID: Int) : DialogFragment(layoutID), |
|
|
|
abstract class BaseDialogFragment( |
|
|
|
|
|
|
|
@LayoutRes layoutID: Int, |
|
|
|
|
|
|
|
private val adaptationSoftKeyboard: Boolean = false |
|
|
|
|
|
|
|
) : DialogFragment(layoutID), |
|
|
|
|
|
|
|
|
|
|
|
CoroutineScope by MainScope() { |
|
|
|
CoroutineScope by MainScope() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
override fun onStart() { |
|
|
|
|
|
|
|
super.onStart() |
|
|
|
|
|
|
|
if (adaptationSoftKeyboard) { |
|
|
|
|
|
|
|
dialog?.window?.setBackgroundDrawableResource(R.color.transparent) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { |
|
|
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { |
|
|
|
super.onViewCreated(view, savedInstanceState) |
|
|
|
super.onViewCreated(view, savedInstanceState) |
|
|
|
view.setBackgroundColor(ThemeStore.backgroundColor()) |
|
|
|
if (adaptationSoftKeyboard) { |
|
|
|
|
|
|
|
view.findViewById<View>(R.id.vw_bg)?.setOnClickListener(null) |
|
|
|
|
|
|
|
view.setOnClickListener { dismiss() } |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
view.setBackgroundColor(ThemeStore.backgroundColor()) |
|
|
|
|
|
|
|
} |
|
|
|
onFragmentCreated(view, savedInstanceState) |
|
|
|
onFragmentCreated(view, savedInstanceState) |
|
|
|
observeLiveBus() |
|
|
|
observeLiveBus() |
|
|
|
} |
|
|
|
} |
|
|
|