Update activity display when download fails
This commit is contained in:
parent
4e0a3f5e72
commit
1ad7a6fe93
@ -117,7 +117,7 @@ abstract class BaseDownloader : BaseService(), KoinComponent {
|
|||||||
fun Subject.notifyID() = hashCode()
|
fun Subject.notifyID() = hashCode()
|
||||||
|
|
||||||
private fun notifyFail(subject: Subject) = lastNotify(subject.notifyID()) {
|
private fun notifyFail(subject: Subject) = lastNotify(subject.notifyID()) {
|
||||||
broadcast(-1f, subject)
|
broadcast(-2f, subject)
|
||||||
it.setContentText(getString(R.string.download_file_error))
|
it.setContentText(getString(R.string.download_file_error))
|
||||||
.setSmallIcon(android.R.drawable.stat_notify_error)
|
.setSmallIcon(android.R.drawable.stat_notify_error)
|
||||||
.setOngoing(false)
|
.setOngoing(false)
|
||||||
|
@ -75,6 +75,8 @@ class InstallViewModel(
|
|||||||
this.progress = progress.times(100).roundToInt()
|
this.progress = progress.times(100).roundToInt()
|
||||||
if (this.progress >= 100) {
|
if (this.progress >= 100) {
|
||||||
state = State.LOADED
|
state = State.LOADED
|
||||||
|
} else if (this.progress < -150) {
|
||||||
|
state = State.LOADING_FAILED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -306,6 +306,23 @@
|
|||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
goneUnless="@{viewModel.loadFailed}"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/download_file_error"
|
||||||
|
android:textAppearance="@style/AppearanceFoundation.Title" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
</androidx.core.widget.NestedScrollView>
|
</androidx.core.widget.NestedScrollView>
|
||||||
|
Loading…
Reference in New Issue
Block a user