mirror of
https://github.com/szkolny-eu/szkolny-android.git
synced 2025-01-31 05:48:19 +01:00
[Base] Update TemplateFragment.
This commit is contained in:
parent
673378d8d9
commit
59819b4a96
@ -10,9 +10,7 @@ import kotlinx.coroutines.Dispatchers
|
|||||||
import kotlinx.coroutines.Job
|
import kotlinx.coroutines.Job
|
||||||
import pl.szczodrzynski.edziennik.App
|
import pl.szczodrzynski.edziennik.App
|
||||||
import pl.szczodrzynski.edziennik.MainActivity
|
import pl.szczodrzynski.edziennik.MainActivity
|
||||||
import pl.szczodrzynski.edziennik.R
|
|
||||||
import pl.szczodrzynski.edziennik.databinding.FragmentTemplateBinding
|
import pl.szczodrzynski.edziennik.databinding.FragmentTemplateBinding
|
||||||
import pl.szczodrzynski.edziennik.utils.Themes
|
|
||||||
import kotlin.coroutines.CoroutineContext
|
import kotlin.coroutines.CoroutineContext
|
||||||
|
|
||||||
class TemplateFragment : Fragment(), CoroutineScope {
|
class TemplateFragment : Fragment(), CoroutineScope {
|
||||||
@ -34,18 +32,13 @@ class TemplateFragment : Fragment(), CoroutineScope {
|
|||||||
activity = (getActivity() as MainActivity?) ?: return null
|
activity = (getActivity() as MainActivity?) ?: return null
|
||||||
context ?: return null
|
context ?: return null
|
||||||
app = activity.application as App
|
app = activity.application as App
|
||||||
context!!.theme.applyStyle(Themes.appTheme, true)
|
|
||||||
if (app.profile == null)
|
|
||||||
return inflater.inflate(R.layout.fragment_loading, container, false)
|
|
||||||
// activity, context and profile is valid
|
|
||||||
b = FragmentTemplateBinding.inflate(inflater)
|
b = FragmentTemplateBinding.inflate(inflater)
|
||||||
b.refreshLayout.setParent(activity.swipeRefreshLayout)
|
b.refreshLayout.setParent(activity.swipeRefreshLayout)
|
||||||
return b.root
|
return b.root
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
// TODO check if app, activity, b can be null
|
if (!isAdded)
|
||||||
if (app.profile == null || !isAdded)
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user