|
|
@ -1,6 +1,7 @@ |
|
|
|
package io.legado.app.base |
|
|
|
package io.legado.app.base |
|
|
|
|
|
|
|
|
|
|
|
import android.os.Bundle |
|
|
|
import android.os.Bundle |
|
|
|
|
|
|
|
import android.view.View |
|
|
|
import androidx.fragment.app.DialogFragment |
|
|
|
import androidx.fragment.app.DialogFragment |
|
|
|
import io.legado.app.help.coroutine.Coroutine |
|
|
|
import io.legado.app.help.coroutine.Coroutine |
|
|
|
import kotlinx.coroutines.CoroutineScope |
|
|
|
import kotlinx.coroutines.CoroutineScope |
|
|
@ -18,6 +19,14 @@ abstract class BaseDialogFragment : DialogFragment(), CoroutineScope { |
|
|
|
job = Job() |
|
|
|
job = Job() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { |
|
|
|
|
|
|
|
super.onViewCreated(view, savedInstanceState) |
|
|
|
|
|
|
|
onFragmentCreated(view, savedInstanceState) |
|
|
|
|
|
|
|
observeLiveBus() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
abstract fun onFragmentCreated(view: View, savedInstanceState: Bundle?) |
|
|
|
|
|
|
|
|
|
|
|
override fun onDestroy() { |
|
|
|
override fun onDestroy() { |
|
|
|
super.onDestroy() |
|
|
|
super.onDestroy() |
|
|
|
job.cancel() |
|
|
|
job.cancel() |
|
|
@ -30,4 +39,7 @@ abstract class BaseDialogFragment : DialogFragment(), CoroutineScope { |
|
|
|
): Coroutine<T> { |
|
|
|
): Coroutine<T> { |
|
|
|
return Coroutine.async(scope, context) { block() } |
|
|
|
return Coroutine.async(scope, context) { block() } |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
open fun observeLiveBus() { |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |