Compare commits

..

No commits in common. "472f9d05ac5470a28bb80fee725eb87711905ca6" and "acfeda8dc9ff251cce5511b6946541add6949999" have entirely different histories.

2 changed files with 51 additions and 23 deletions

21
.idea/.gitignore generated vendored
View file

@ -1,7 +1,14 @@
*
!/codeStyles/Project.xml
!/codeStyles/codeStyleConfig.xml
!/vcs.xml
!/kotlinc.xml
!/compiler.xml
!/migrations.xml
/shelf
/caches
/libraries
/assetWizardSettings.xml
/deploymentTarget*.xml
/gradle.xml
/misc.xml
/modules.xml
/navEditor.xml
/runConfigurations.xml
/workspace.xml
/AndroidProjectSystem.xml
**/*.iml

View file

@ -7,7 +7,6 @@ import android.view.ViewGroup
import android.widget.ImageView
import android.widget.ProgressBar
import android.widget.TextView
import androidx.annotation.StringRes
import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.DividerItemDecoration
import androidx.recyclerview.widget.LinearLayoutManager
@ -43,17 +42,37 @@ class DownloadWizardProgressFragment : DownloadWizardActivity.DownloadWizardStep
}
private data class ProgressItem(
@StringRes val titleRes: Int,
var state: ProgressState = ProgressState.NotStarted,
var errorMessage: SimplifiedErrorMessages? = null,
val titleRes: Int,
var state: ProgressState,
var errorMessage: SimplifiedErrorMessages?,
)
private val progressItems = arrayOf(
ProgressItem(R.string.download_wizard_progress_step_preparing),
ProgressItem(R.string.download_wizard_progress_step_connecting),
ProgressItem(R.string.download_wizard_progress_step_authenticating),
ProgressItem(R.string.download_wizard_progress_step_downloading),
ProgressItem(R.string.download_wizard_progress_step_finalizing)
ProgressItem(
R.string.download_wizard_progress_step_preparing,
ProgressState.NotStarted,
null
),
ProgressItem(
R.string.download_wizard_progress_step_connecting,
ProgressState.NotStarted,
null
),
ProgressItem(
R.string.download_wizard_progress_step_authenticating,
ProgressState.NotStarted,
null
),
ProgressItem(
R.string.download_wizard_progress_step_downloading,
ProgressState.NotStarted,
null
),
ProgressItem(
R.string.download_wizard_progress_step_finalizing,
ProgressState.NotStarted,
null
)
)
private val adapter = ProgressItemAdapter()
@ -137,8 +156,9 @@ class DownloadWizardProgressFragment : DownloadWizardActivity.DownloadWizardStep
refreshButtons()
}
is EuiccChannelManagerService.ForegroundTaskState.InProgress ->
is EuiccChannelManagerService.ForegroundTaskState.InProgress -> {
updateProgress(it.progress)
}
else -> {}
}
@ -232,13 +252,14 @@ class DownloadWizardProgressFragment : DownloadWizardActivity.DownloadWizardStep
icon.setImageResource(R.drawable.ic_error_outline)
icon.visibility = View.VISIBLE
item.errorMessage?.titleResId?.let {
if (item.errorMessage != null) {
errorTitle.visibility = View.VISIBLE
errorTitle.text = getString(it)
}
item.errorMessage?.suggestResId?.let {
errorSuggestion.visibility = View.VISIBLE
errorSuggestion.text = getString(it)
errorTitle.text = getString(item.errorMessage!!.titleResId)
if (item.errorMessage!!.suggestResId != null) {
errorSuggestion.visibility = View.VISIBLE
errorSuggestion.text = getString(item.errorMessage!!.suggestResId!!)
}
}
}
}