mirror of
https://github.com/YTVanced/VancedManager
synced 2025-01-05 15:01:01 +00:00
added progress indicators to download dialogs
This commit is contained in:
parent
ad299ed96d
commit
ad17c6dfec
4 changed files with 66 additions and 21 deletions
|
@ -1,5 +1,6 @@
|
||||||
package com.vanced.manager.ui.dialogs
|
package com.vanced.manager.ui.dialogs
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint
|
||||||
import android.content.BroadcastReceiver
|
import android.content.BroadcastReceiver
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
|
@ -80,12 +81,14 @@ class AppDownloadDialog : BindingDialogFragment<DialogAppDownloadBinding>() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("SetTextI18n")
|
||||||
private fun DialogAppDownloadBinding.bindDownloadProgress() {
|
private fun DialogAppDownloadBinding.bindDownloadProgress() {
|
||||||
downloadProgress.observe(viewLifecycleOwner) {
|
downloadProgress.observe(viewLifecycleOwner) {
|
||||||
appDownloadProgressbar.progress = it
|
appDownloadProgressbar.progress = it
|
||||||
|
appDownloadProgress.text = "$it%"
|
||||||
}
|
}
|
||||||
installing.observe(viewLifecycleOwner) { installing ->
|
installing.observe(viewLifecycleOwner) { installing ->
|
||||||
appDownloadProgressbar.isVisible = !installing
|
appDownloadProgressbarContainer.isVisible = !installing
|
||||||
appInstallProgressbar.isVisible = installing
|
appInstallProgressbar.isVisible = installing
|
||||||
appDownloadFile.isVisible = !installing
|
appDownloadFile.isVisible = !installing
|
||||||
appDownloadCancel.isEnabled = !installing
|
appDownloadCancel.isEnabled = !installing
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.vanced.manager.ui.dialogs
|
package com.vanced.manager.ui.dialogs
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint
|
||||||
import android.content.BroadcastReceiver
|
import android.content.BroadcastReceiver
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
|
@ -77,10 +78,12 @@ class ManagerUpdateDialog : BindingDialogFragment<DialogManagerUpdateBinding>()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("SetTextI18n")
|
||||||
private fun DialogManagerUpdateBinding.bindDownloadProgress() {
|
private fun DialogManagerUpdateBinding.bindDownloadProgress() {
|
||||||
downloadProgress.observe(viewLifecycleOwner) {
|
downloadProgress.observe(viewLifecycleOwner) {
|
||||||
managerUpdateProgressbar.progress = it
|
managerUpdateProgressbar.progress = it
|
||||||
managerUpdateProgressbar.isVisible = it != 0
|
managerUpdateProgressbarContainer.isVisible = it != 0
|
||||||
|
managerUpdateProgress.text = "$it%"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,18 +17,39 @@
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/app_download_patient"
|
android:id="@+id/app_download_patient"
|
||||||
|
style="@style/DialogCardSubtitle"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@id/app_download_header"
|
android:layout_below="@id/app_download_header"
|
||||||
android:text="@string/please_be_patient"
|
android:layout_marginBottom="18dp"
|
||||||
style="@style/DialogCardSubtitle" />
|
android:text="@string/please_be_patient" />
|
||||||
|
|
||||||
<com.google.android.material.progressindicator.LinearProgressIndicator
|
<RelativeLayout
|
||||||
android:id="@+id/app_download_progressbar"
|
android:id="@+id/app_download_progressbar_container"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@id/app_download_patient"
|
android:layout_below="@id/app_download_patient">
|
||||||
android:layout_marginTop="24dp"
|
|
||||||
app:trackCornerRadius="15dp"
|
<com.google.android.material.progressindicator.LinearProgressIndicator
|
||||||
tools:progress="10" />
|
android:id="@+id/app_download_progressbar"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:trackCornerRadius="15dp"
|
||||||
|
android:layout_alignParentStart="true"
|
||||||
|
android:layout_toStartOf="@id/app_download_progress"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_marginEnd="8dp"
|
||||||
|
tools:progress="10" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/app_download_progress"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:textSize="15sp"
|
||||||
|
tools:text="20%" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
<com.google.android.material.progressindicator.LinearProgressIndicator
|
<com.google.android.material.progressindicator.LinearProgressIndicator
|
||||||
android:id="@+id/app_install_progressbar"
|
android:id="@+id/app_install_progressbar"
|
||||||
|
@ -36,8 +57,7 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
android:layout_alignParentStart="true"
|
android:layout_alignParentStart="true"
|
||||||
android:layout_below="@id/app_download_progressbar"
|
android:layout_below="@id/app_download_progressbar_container"
|
||||||
android:layout_marginTop="24dp"
|
|
||||||
android:indeterminate="true"
|
android:indeterminate="true"
|
||||||
app:trackCornerRadius="15dp" />
|
app:trackCornerRadius="15dp" />
|
||||||
|
|
||||||
|
@ -45,7 +65,7 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@id/app_install_progressbar"
|
android:layout_below="@id/app_install_progressbar"
|
||||||
android:layout_marginTop="8dp">
|
android:layout_marginTop="6dp">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/app_download_file"
|
android:id="@+id/app_download_file"
|
||||||
|
|
|
@ -21,23 +21,42 @@
|
||||||
android:text="@string/checking_updates"
|
android:text="@string/checking_updates"
|
||||||
style="@style/DialogCardSubtitle"/>
|
style="@style/DialogCardSubtitle"/>
|
||||||
|
|
||||||
<com.google.android.material.progressindicator.LinearProgressIndicator
|
<RelativeLayout
|
||||||
android:id="@+id/manager_update_progressbar"
|
android:id="@+id/manager_update_progressbar_container"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@id/manager_update_patient"
|
android:layout_below="@id/manager_update_patient"
|
||||||
android:layout_marginTop="32dp"
|
android:layout_marginTop="18dp">
|
||||||
android:paddingBottom="8dp"
|
|
||||||
app:trackCornerRadius="15dp"
|
<com.google.android.material.progressindicator.LinearProgressIndicator
|
||||||
tools:progress="10"
|
android:id="@+id/manager_update_progressbar"
|
||||||
tools:visibility="visible" />
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:trackCornerRadius="15dp"
|
||||||
|
android:layout_alignParentStart="true"
|
||||||
|
android:layout_toStartOf="@id/manager_update_progress"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_marginEnd="8dp"
|
||||||
|
tools:progress="10" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/manager_update_progress"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:textSize="15sp"
|
||||||
|
tools:text="20%" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
<com.vanced.manager.ui.core.ThemedOutlinedMaterialButton
|
<com.vanced.manager.ui.core.ThemedOutlinedMaterialButton
|
||||||
android:id="@+id/manager_update_cancel"
|
android:id="@+id/manager_update_cancel"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
android:layout_below="@id/manager_update_progressbar"
|
android:layout_below="@id/manager_update_progressbar_container"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
android:text="@string/cancel"
|
android:text="@string/cancel"
|
||||||
style="@style/OutlinedButtonStyle" />
|
style="@style/OutlinedButtonStyle" />
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue