forked from github/wulkanowy-mirror
Fix dialog state (#214)
This commit is contained in:
parent
65230a31ec
commit
840b21a213
@ -130,7 +130,7 @@ class AttendanceFragment : BaseSessionFragment(), AttendanceView, MainView.MainC
|
||||
}
|
||||
|
||||
override fun showAttendanceDialog(lesson: Attendance) {
|
||||
AttendanceDialog.newInstance(lesson).show(fragmentManager, lesson.toString())
|
||||
(activity as? MainActivity)?.showDialogFragment(AttendanceDialog.newInstance(lesson))
|
||||
}
|
||||
|
||||
override fun openSummaryView() {
|
||||
|
@ -13,6 +13,7 @@ import eu.davidea.flexibleadapter.items.AbstractFlexibleItem
|
||||
import io.github.wulkanowy.R
|
||||
import io.github.wulkanowy.data.db.entities.Exam
|
||||
import io.github.wulkanowy.ui.base.session.BaseSessionFragment
|
||||
import io.github.wulkanowy.ui.modules.main.MainActivity
|
||||
import io.github.wulkanowy.ui.modules.main.MainView
|
||||
import io.github.wulkanowy.utils.setOnItemClickListener
|
||||
import kotlinx.android.synthetic.main.fragment_exam.*
|
||||
@ -106,7 +107,7 @@ class ExamFragment : BaseSessionFragment(), ExamView, MainView.MainChildView, Ma
|
||||
}
|
||||
|
||||
override fun showExamDialog(exam: Exam) {
|
||||
ExamDialog.newInstance(exam).show(fragmentManager, exam.toString())
|
||||
(activity as? MainActivity)?.showDialogFragment(ExamDialog.newInstance(exam))
|
||||
}
|
||||
|
||||
override fun onSaveInstanceState(outState: Bundle) {
|
||||
|
@ -20,6 +20,7 @@ import io.github.wulkanowy.data.db.entities.Grade
|
||||
import io.github.wulkanowy.ui.base.session.BaseSessionFragment
|
||||
import io.github.wulkanowy.ui.modules.grade.GradeFragment
|
||||
import io.github.wulkanowy.ui.modules.grade.GradeView
|
||||
import io.github.wulkanowy.ui.modules.main.MainActivity
|
||||
import io.github.wulkanowy.utils.setOnItemClickListener
|
||||
import kotlinx.android.synthetic.main.fragment_grade_details.*
|
||||
import javax.inject.Inject
|
||||
@ -131,7 +132,7 @@ class GradeDetailsFragment : BaseSessionFragment(), GradeDetailsView, GradeView.
|
||||
}
|
||||
|
||||
override fun showGradeDialog(grade: Grade) {
|
||||
GradeDetailsDialog.newInstance(grade).show(fragmentManager, grade.toString())
|
||||
(activity as? MainActivity)?.showDialogFragment(GradeDetailsDialog.newInstance(grade))
|
||||
}
|
||||
|
||||
override fun onParentLoadData(semesterId: Int, forceRefresh: Boolean) {
|
||||
|
@ -10,6 +10,7 @@ import eu.davidea.flexibleadapter.items.AbstractFlexibleItem
|
||||
import io.github.wulkanowy.R
|
||||
import io.github.wulkanowy.data.db.entities.Homework
|
||||
import io.github.wulkanowy.ui.base.session.BaseSessionFragment
|
||||
import io.github.wulkanowy.ui.modules.main.MainActivity
|
||||
import io.github.wulkanowy.ui.modules.main.MainView
|
||||
import io.github.wulkanowy.utils.setOnItemClickListener
|
||||
import kotlinx.android.synthetic.main.fragment_homework.*
|
||||
@ -95,7 +96,7 @@ class HomeworkFragment : BaseSessionFragment(), HomeworkView, MainView.TitledVie
|
||||
}
|
||||
|
||||
override fun showTimetableDialog(homework: Homework) {
|
||||
HomeworkDialog.newInstance(homework).show(fragmentManager, homework.toString())
|
||||
(activity as? MainActivity)?.showDialogFragment(HomeworkDialog.newInstance(homework))
|
||||
}
|
||||
|
||||
override fun onSaveInstanceState(outState: Bundle) {
|
||||
|
@ -7,6 +7,7 @@ import android.view.Menu
|
||||
import android.view.MenuItem
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.fragment.app.DialogFragment
|
||||
import androidx.fragment.app.Fragment
|
||||
import com.aurelhubert.ahbottomnavigation.AHBottomNavigation.TitleState.ALWAYS_SHOW
|
||||
import com.aurelhubert.ahbottomnavigation.AHBottomNavigationItem
|
||||
@ -147,6 +148,10 @@ class MainActivity : BaseActivity(), MainView {
|
||||
(navController.currentStack?.get(0) as? MainView.MainChildView)?.onFragmentReselected()
|
||||
}
|
||||
|
||||
fun showDialogFragment(dialog: DialogFragment) {
|
||||
navController.showDialogFragment(dialog)
|
||||
}
|
||||
|
||||
fun pushView(fragment: Fragment) {
|
||||
navController.pushFragment(fragment)
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ import eu.davidea.flexibleadapter.items.AbstractFlexibleItem
|
||||
import io.github.wulkanowy.R
|
||||
import io.github.wulkanowy.data.db.entities.Note
|
||||
import io.github.wulkanowy.ui.base.session.BaseSessionFragment
|
||||
import io.github.wulkanowy.ui.modules.main.MainActivity
|
||||
import io.github.wulkanowy.ui.modules.main.MainView
|
||||
import io.github.wulkanowy.utils.setOnItemClickListener
|
||||
import kotlinx.android.synthetic.main.fragment_note.*
|
||||
@ -57,7 +58,7 @@ class NoteFragment : BaseSessionFragment(), NoteView, MainView.TitledView {
|
||||
}
|
||||
|
||||
override fun showNoteDialog(note: Note) {
|
||||
NoteDialog.newInstance(note).show(fragmentManager, note.toString())
|
||||
(activity as? MainActivity)?.showDialogFragment(NoteDialog.newInstance(note))
|
||||
}
|
||||
|
||||
override fun updateData(data: List<NoteItem>) {
|
||||
|
@ -10,6 +10,7 @@ import eu.davidea.flexibleadapter.items.AbstractFlexibleItem
|
||||
import io.github.wulkanowy.R
|
||||
import io.github.wulkanowy.data.db.entities.Timetable
|
||||
import io.github.wulkanowy.ui.base.session.BaseSessionFragment
|
||||
import io.github.wulkanowy.ui.modules.main.MainActivity
|
||||
import io.github.wulkanowy.ui.modules.main.MainView
|
||||
import io.github.wulkanowy.utils.setOnItemClickListener
|
||||
import kotlinx.android.synthetic.main.fragment_timetable.*
|
||||
@ -107,7 +108,7 @@ class TimetableFragment : BaseSessionFragment(), TimetableView, MainView.MainChi
|
||||
}
|
||||
|
||||
override fun showTimetableDialog(lesson: Timetable) {
|
||||
TimetableDialog.newInstance(lesson).show(fragmentManager, lesson.toString())
|
||||
(activity as? MainActivity)?.showDialogFragment(TimetableDialog.newInstance(lesson))
|
||||
}
|
||||
|
||||
override fun onSaveInstanceState(outState: Bundle) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user