Disable swipe to refresh on data loading (#270)

This commit is contained in:
Mikołaj Pich 2019-03-09 21:40:20 +01:00 committed by Rafał Borcz
parent f21feabc49
commit f773310cdb
36 changed files with 94 additions and 0 deletions

View File

@ -118,6 +118,10 @@ class AttendanceFragment : BaseSessionFragment(), AttendanceView, MainView.MainC
attendanceProgress.visibility = if (show) View.VISIBLE else View.GONE attendanceProgress.visibility = if (show) View.VISIBLE else View.GONE
} }
override fun enableSwipe(enable: Boolean) {
attendanceSwipe.isEnabled = enable
}
override fun showContent(show: Boolean) { override fun showContent(show: Boolean) {
attendanceRecycler.visibility = if (show) View.VISIBLE else View.GONE attendanceRecycler.visibility = if (show) View.VISIBLE else View.GONE
} }

View File

@ -105,6 +105,7 @@ class AttendancePresenter @Inject constructor(
view?.run { view?.run {
hideRefresh() hideRefresh()
showProgress(false) showProgress(false)
enableSwipe(true)
} }
} }
.subscribe({ .subscribe({
@ -128,6 +129,7 @@ class AttendancePresenter @Inject constructor(
Timber.i("Reload attendance view with the date ${currentDate.toFormattedString()}") Timber.i("Reload attendance view with the date ${currentDate.toFormattedString()}")
view?.apply { view?.apply {
showProgress(true) showProgress(true)
enableSwipe(false)
showContent(false) showContent(false)
showEmpty(false) showEmpty(false)
clearData() clearData()

View File

@ -25,6 +25,8 @@ interface AttendanceView : BaseSessionView {
fun showProgress(show: Boolean) fun showProgress(show: Boolean)
fun enableSwipe(enable: Boolean)
fun showContent(show: Boolean) fun showContent(show: Boolean)
fun showPreButton(show: Boolean) fun showPreButton(show: Boolean)

View File

@ -97,6 +97,10 @@ class AttendanceSummaryFragment : BaseSessionFragment(), AttendanceSummaryView,
attendanceSummaryProgress.visibility = if (show) VISIBLE else GONE attendanceSummaryProgress.visibility = if (show) VISIBLE else GONE
} }
override fun enableSwipe(enable: Boolean) {
attendanceSummarySwipe.isEnabled = enable
}
override fun showContent(show: Boolean) { override fun showContent(show: Boolean) {
attendanceSummaryRecycler.visibility = if (show) VISIBLE else GONE attendanceSummaryRecycler.visibility = if (show) VISIBLE else GONE
} }

View File

@ -51,6 +51,7 @@ class AttendanceSummaryPresenter @Inject constructor(
view?.run { view?.run {
showContent(false) showContent(false)
showProgress(true) showProgress(true)
enableSwipe(false)
clearView() clearView()
} }
(subjects.singleOrNull { it.name == name }?.realId ?: -1).let { (subjects.singleOrNull { it.name == name }?.realId ?: -1).let {

View File

@ -14,6 +14,8 @@ interface AttendanceSummaryView : BaseSessionView {
fun showProgress(show: Boolean) fun showProgress(show: Boolean)
fun enableSwipe(enable: Boolean)
fun showEmpty(show: Boolean) fun showEmpty(show: Boolean)
fun updateDataSet(data: List<AttendanceSummaryItem>, header: AttendanceSummaryScrollableHeader) fun updateDataSet(data: List<AttendanceSummaryItem>, header: AttendanceSummaryScrollableHeader)

View File

@ -99,6 +99,10 @@ class ExamFragment : BaseSessionFragment(), ExamView, MainView.MainChildView, Ma
examProgress.visibility = if (show) VISIBLE else GONE examProgress.visibility = if (show) VISIBLE else GONE
} }
override fun enableSwipe(enable: Boolean) {
examSwipe.isEnabled = enable
}
override fun showContent(show: Boolean) { override fun showContent(show: Boolean) {
examRecycler.visibility = if (show) VISIBLE else GONE examRecycler.visibility = if (show) VISIBLE else GONE
} }

View File

@ -92,6 +92,7 @@ class ExamPresenter @Inject constructor(
view?.run { view?.run {
hideRefresh() hideRefresh()
showProgress(false) showProgress(false)
enableSwipe(true)
} }
} }
.subscribe({ .subscribe({
@ -122,6 +123,7 @@ class ExamPresenter @Inject constructor(
Timber.i("Reload exam view with the date ${currentDate.toFormattedString()}") Timber.i("Reload exam view with the date ${currentDate.toFormattedString()}")
view?.apply { view?.apply {
showProgress(true) showProgress(true)
enableSwipe(false)
showContent(false) showContent(false)
showEmpty(false) showEmpty(false)
clearData() clearData()

View File

@ -23,6 +23,8 @@ interface ExamView : BaseSessionView {
fun showProgress(show: Boolean) fun showProgress(show: Boolean)
fun enableSwipe(enable: Boolean)
fun showContent(show: Boolean) fun showContent(show: Boolean)
fun showNextButton(show: Boolean) fun showNextButton(show: Boolean)

View File

@ -125,6 +125,10 @@ class GradeDetailsFragment : BaseSessionFragment(), GradeDetailsView, GradeView.
gradeDetailsProgress.visibility = if (show) VISIBLE else GONE gradeDetailsProgress.visibility = if (show) VISIBLE else GONE
} }
override fun enableSwipe(enable: Boolean) {
gradeDetailsSwipe.isEnabled = enable
}
override fun showContent(show: Boolean) { override fun showContent(show: Boolean) {
gradeDetailsRecycler.visibility = if (show) VISIBLE else INVISIBLE gradeDetailsRecycler.visibility = if (show) VISIBLE else INVISIBLE
} }

View File

@ -97,6 +97,7 @@ class GradeDetailsPresenter @Inject constructor(
fun onParentViewChangeSemester() { fun onParentViewChangeSemester() {
view?.run { view?.run {
showProgress(true) showProgress(true)
enableSwipe(false)
showRefresh(false) showRefresh(false)
showContent(false) showContent(false)
showEmpty(false) showEmpty(false)
@ -119,6 +120,7 @@ class GradeDetailsPresenter @Inject constructor(
view?.run { view?.run {
showRefresh(false) showRefresh(false)
showProgress(false) showProgress(false)
enableSwipe(true)
notifyParentDataLoaded(semesterId) notifyParentDataLoaded(semesterId)
} }
} }

View File

@ -38,6 +38,8 @@ interface GradeDetailsView : BaseSessionView {
fun showProgress(show: Boolean) fun showProgress(show: Boolean)
fun enableSwipe(enable: Boolean)
fun showRefresh(show: Boolean) fun showRefresh(show: Boolean)
fun notifyParentDataLoaded(semesterId: Int) fun notifyParentDataLoaded(semesterId: Int)

View File

@ -149,6 +149,10 @@ class GradeStatisticsFragment : BaseSessionFragment(), GradeStatisticsView, Grad
gradeStatisticsProgress.visibility = if (show) View.VISIBLE else View.GONE gradeStatisticsProgress.visibility = if (show) View.VISIBLE else View.GONE
} }
override fun enableSwipe(enable: Boolean) {
gradeStatisticsSwipe.isEnabled = enable
}
override fun showRefresh(show: Boolean) { override fun showRefresh(show: Boolean) {
gradeStatisticsSwipe.isRefreshing = show gradeStatisticsSwipe.isRefreshing = show
} }

View File

@ -46,6 +46,7 @@ class GradeStatisticsPresenter @Inject constructor(
fun onParentViewChangeSemester() { fun onParentViewChangeSemester() {
view?.run { view?.run {
showProgress(true) showProgress(true)
enableSwipe(false)
showRefresh(false) showRefresh(false)
showContent(false) showContent(false)
showEmpty(false) showEmpty(false)
@ -64,6 +65,7 @@ class GradeStatisticsPresenter @Inject constructor(
view?.run { view?.run {
showContent(false) showContent(false)
showProgress(true) showProgress(true)
enableSwipe(false)
showEmpty(false) showEmpty(false)
clearView() clearView()
} }
@ -78,6 +80,7 @@ class GradeStatisticsPresenter @Inject constructor(
view?.run { view?.run {
showContent(false) showContent(false)
showProgress(true) showProgress(true)
enableSwipe(false)
showEmpty(false) showEmpty(false)
clearView() clearView()
} }
@ -121,6 +124,7 @@ class GradeStatisticsPresenter @Inject constructor(
view?.run { view?.run {
showRefresh(false) showRefresh(false)
showProgress(false) showProgress(false)
enableSwipe(true)
notifyParentDataLoaded(semesterId) notifyParentDataLoaded(semesterId)
} }
} }

View File

@ -27,5 +27,7 @@ interface GradeStatisticsView : BaseSessionView {
fun showProgress(show: Boolean) fun showProgress(show: Boolean)
fun enableSwipe(enable: Boolean)
fun showRefresh(show: Boolean) fun showRefresh(show: Boolean)
} }

View File

@ -86,6 +86,10 @@ class GradeSummaryFragment : BaseSessionFragment(), GradeSummaryView, GradeView.
gradeSummaryProgress.visibility = if (show) VISIBLE else GONE gradeSummaryProgress.visibility = if (show) VISIBLE else GONE
} }
override fun enableSwipe(enable: Boolean) {
gradeSummarySwipe.isEnabled = enable
}
override fun showRefresh(show: Boolean) { override fun showRefresh(show: Boolean) {
gradeSummarySwipe.isRefreshing = show gradeSummarySwipe.isRefreshing = show
} }

View File

@ -63,6 +63,7 @@ class GradeSummaryPresenter @Inject constructor(
view?.run { view?.run {
showRefresh(false) showRefresh(false)
showProgress(false) showProgress(false)
enableSwipe(true)
notifyParentDataLoaded(semesterId) notifyParentDataLoaded(semesterId)
} }
}.subscribe({ }.subscribe({
@ -94,6 +95,7 @@ class GradeSummaryPresenter @Inject constructor(
fun onParentViewChangeSemester() { fun onParentViewChangeSemester() {
view?.run { view?.run {
showProgress(true) showProgress(true)
enableSwipe(false)
showRefresh(false) showRefresh(false)
showContent(false) showContent(false)
showEmpty(false) showEmpty(false)

View File

@ -20,6 +20,8 @@ interface GradeSummaryView : BaseSessionView {
fun showProgress(show: Boolean) fun showProgress(show: Boolean)
fun enableSwipe(enable: Boolean)
fun showRefresh(show: Boolean) fun showRefresh(show: Boolean)
fun showContent(show: Boolean) fun showContent(show: Boolean)

View File

@ -88,6 +88,10 @@ class HomeworkFragment : BaseSessionFragment(), HomeworkView, MainView.TitledVie
homeworkProgress.visibility = if (show) View.VISIBLE else View.GONE homeworkProgress.visibility = if (show) View.VISIBLE else View.GONE
} }
override fun enableSwipe(enable: Boolean) {
homeworkSwipe.isEnabled = enable
}
override fun showContent(show: Boolean) { override fun showContent(show: Boolean) {
homeworkRecycler.visibility = if (show) View.VISIBLE else View.GONE homeworkRecycler.visibility = if (show) View.VISIBLE else View.GONE
} }

View File

@ -77,6 +77,7 @@ class HomeworkPresenter @Inject constructor(
view?.run { view?.run {
hideRefresh() hideRefresh()
showProgress(false) showProgress(false)
enableSwipe(true)
} }
} }
.subscribe({ .subscribe({
@ -99,6 +100,7 @@ class HomeworkPresenter @Inject constructor(
Timber.i("Reload homework view with the date ${currentDate.toFormattedString()}") Timber.i("Reload homework view with the date ${currentDate.toFormattedString()}")
view?.apply { view?.apply {
showProgress(true) showProgress(true)
enableSwipe(false)
showContent(false) showContent(false)
showEmpty(false) showEmpty(false)
clearData() clearData()

View File

@ -21,6 +21,8 @@ interface HomeworkView : BaseSessionView {
fun showProgress(show: Boolean) fun showProgress(show: Boolean)
fun enableSwipe(enable: Boolean)
fun showContent(show: Boolean) fun showContent(show: Boolean)
fun showPreButton(show: Boolean) fun showPreButton(show: Boolean)

View File

@ -54,6 +54,10 @@ class LuckyNumberFragment : BaseSessionFragment(), LuckyNumberView, MainView.Tit
luckyNumberProgress.visibility = if (show) View.VISIBLE else View.GONE luckyNumberProgress.visibility = if (show) View.VISIBLE else View.GONE
} }
override fun enableSwipe(enable: Boolean) {
luckyNumberSwipe.isEnabled = enable
}
override fun showContent(show: Boolean) { override fun showContent(show: Boolean) {
luckyNumberContent.visibility = if (show) View.VISIBLE else View.GONE luckyNumberContent.visibility = if (show) View.VISIBLE else View.GONE
} }

View File

@ -39,6 +39,7 @@ class LuckyNumberPresenter @Inject constructor(
view?.run { view?.run {
hideRefresh() hideRefresh()
showProgress(false) showProgress(false)
enableSwipe(true)
} }
} }
.subscribe({ .subscribe({

View File

@ -15,6 +15,8 @@ interface LuckyNumberView : BaseSessionView {
fun showProgress(show: Boolean) fun showProgress(show: Boolean)
fun enableSwipe(enable: Boolean)
fun showContent(show: Boolean) fun showContent(show: Boolean)
fun isViewEmpty(): Boolean fun isViewEmpty(): Boolean

View File

@ -91,6 +91,10 @@ class MessageTabFragment : BaseSessionFragment(), MessageTabView, MessageView.Me
messageTabProgress.visibility = if (show) VISIBLE else GONE messageTabProgress.visibility = if (show) VISIBLE else GONE
} }
override fun enableSwipe(enable: Boolean) {
messageTabSwipe.isEnabled = enable
}
override fun showContent(show: Boolean) { override fun showContent(show: Boolean) {
messageTabRecycler.visibility = if (show) VISIBLE else INVISIBLE messageTabRecycler.visibility = if (show) VISIBLE else INVISIBLE
} }

View File

@ -47,6 +47,7 @@ class MessageTabPresenter @Inject constructor(
view?.run { view?.run {
showRefresh(false) showRefresh(false)
showProgress(false) showProgress(false)
enableSwipe(true)
notifyParentDataLoaded() notifyParentDataLoaded()
} }
} }

View File

@ -20,6 +20,8 @@ interface MessageTabView : BaseSessionView {
fun showProgress(show: Boolean) fun showProgress(show: Boolean)
fun enableSwipe(enable: Boolean)
fun showContent(show: Boolean) fun showContent(show: Boolean)
fun showEmpty(show: Boolean) fun showEmpty(show: Boolean)

View File

@ -86,6 +86,10 @@ class NoteFragment : BaseSessionFragment(), NoteView, MainView.TitledView {
noteProgress.visibility = if (show) VISIBLE else GONE noteProgress.visibility = if (show) VISIBLE else GONE
} }
override fun enableSwipe(enable: Boolean) {
noteSwipe.isEnabled = enable
}
override fun showContent(show: Boolean) { override fun showContent(show: Boolean) {
noteRecycler.visibility = if (show) VISIBLE else GONE noteRecycler.visibility = if (show) VISIBLE else GONE
} }

View File

@ -46,6 +46,7 @@ class NotePresenter @Inject constructor(
view?.run { view?.run {
hideRefresh() hideRefresh()
showProgress(false) showProgress(false)
enableSwipe(true)
} }
}.subscribe({ }.subscribe({
Timber.i("Loading note result: Success") Timber.i("Loading note result: Success")

View File

@ -20,6 +20,8 @@ interface NoteView : BaseSessionView {
fun showProgress(show: Boolean) fun showProgress(show: Boolean)
fun enableSwipe(enable: Boolean)
fun showContent(show: Boolean) fun showContent(show: Boolean)
fun hideRefresh() fun hideRefresh()

View File

@ -125,6 +125,10 @@ class TimetableFragment : BaseSessionFragment(), TimetableView, MainView.MainChi
timetableProgress.visibility = if (show) View.VISIBLE else View.GONE timetableProgress.visibility = if (show) View.VISIBLE else View.GONE
} }
override fun enableSwipe(enable: Boolean) {
timetableSwipe.isEnabled = enable
}
override fun showContent(show: Boolean) { override fun showContent(show: Boolean) {
timetableRecycler.visibility = if (show) View.VISIBLE else View.GONE timetableRecycler.visibility = if (show) View.VISIBLE else View.GONE
} }

View File

@ -99,6 +99,7 @@ class TimetablePresenter @Inject constructor(
view?.run { view?.run {
hideRefresh() hideRefresh()
showProgress(false) showProgress(false)
enableSwipe(true)
} }
} }
.subscribe({ .subscribe({
@ -121,6 +122,7 @@ class TimetablePresenter @Inject constructor(
Timber.i("Reload timetable view with the date ${currentDate.toFormattedString()}") Timber.i("Reload timetable view with the date ${currentDate.toFormattedString()}")
view?.apply { view?.apply {
showProgress(true) showProgress(true)
enableSwipe(false)
showContent(false) showContent(false)
showEmpty(false) showEmpty(false)
clearData() clearData()

View File

@ -27,6 +27,8 @@ interface TimetableView : BaseSessionView {
fun showProgress(show: Boolean) fun showProgress(show: Boolean)
fun enableSwipe(enable: Boolean)
fun showContent(show: Boolean) fun showContent(show: Boolean)
fun showPreButton(show: Boolean) fun showPreButton(show: Boolean)

View File

@ -92,6 +92,10 @@ class CompletedLessonsFragment : BaseSessionFragment(), CompletedLessonsView, Ma
completedLessonsProgress.visibility = if (show) View.VISIBLE else View.GONE completedLessonsProgress.visibility = if (show) View.VISIBLE else View.GONE
} }
override fun enableSwipe(enable: Boolean) {
completedLessonsSwipe.isEnabled = enable
}
override fun showContent(show: Boolean) { override fun showContent(show: Boolean) {
completedLessonsRecycler.visibility = if (show) View.VISIBLE else View.GONE completedLessonsRecycler.visibility = if (show) View.VISIBLE else View.GONE
} }

View File

@ -83,6 +83,7 @@ class CompletedLessonsPresenter @Inject constructor(
view?.run { view?.run {
hideRefresh() hideRefresh()
showProgress(false) showProgress(false)
enableSwipe(true)
} }
} }
.subscribe({ .subscribe({
@ -105,6 +106,7 @@ class CompletedLessonsPresenter @Inject constructor(
Timber.i("Reload completed lessons view with the date ${currentDate.toFormattedString()}") Timber.i("Reload completed lessons view with the date ${currentDate.toFormattedString()}")
view?.apply { view?.apply {
showProgress(true) showProgress(true)
enableSwipe(false)
showContent(false) showContent(false)
showEmpty(false) showEmpty(false)
clearData() clearData()

View File

@ -23,6 +23,8 @@ interface CompletedLessonsView : BaseSessionView {
fun showProgress(show: Boolean) fun showProgress(show: Boolean)
fun enableSwipe(enable: Boolean)
fun showContent(show: Boolean) fun showContent(show: Boolean)
fun showPreButton(show: Boolean) fun showPreButton(show: Boolean)