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 @@
* /shelf
!/codeStyles/Project.xml /caches
!/codeStyles/codeStyleConfig.xml /libraries
!/vcs.xml /assetWizardSettings.xml
!/kotlinc.xml /deploymentTarget*.xml
!/compiler.xml /gradle.xml
!/migrations.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.ImageView
import android.widget.ProgressBar import android.widget.ProgressBar
import android.widget.TextView import android.widget.TextView
import androidx.annotation.StringRes
import androidx.lifecycle.lifecycleScope import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.DividerItemDecoration import androidx.recyclerview.widget.DividerItemDecoration
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
@ -43,17 +42,37 @@ class DownloadWizardProgressFragment : DownloadWizardActivity.DownloadWizardStep
} }
private data class ProgressItem( private data class ProgressItem(
@StringRes val titleRes: Int, val titleRes: Int,
var state: ProgressState = ProgressState.NotStarted, var state: ProgressState,
var errorMessage: SimplifiedErrorMessages? = null, var errorMessage: SimplifiedErrorMessages?,
) )
private val progressItems = arrayOf( private val progressItems = arrayOf(
ProgressItem(R.string.download_wizard_progress_step_preparing), ProgressItem(
ProgressItem(R.string.download_wizard_progress_step_connecting), R.string.download_wizard_progress_step_preparing,
ProgressItem(R.string.download_wizard_progress_step_authenticating), ProgressState.NotStarted,
ProgressItem(R.string.download_wizard_progress_step_downloading), null
ProgressItem(R.string.download_wizard_progress_step_finalizing) ),
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() private val adapter = ProgressItemAdapter()
@ -137,8 +156,9 @@ class DownloadWizardProgressFragment : DownloadWizardActivity.DownloadWizardStep
refreshButtons() refreshButtons()
} }
is EuiccChannelManagerService.ForegroundTaskState.InProgress -> is EuiccChannelManagerService.ForegroundTaskState.InProgress -> {
updateProgress(it.progress) updateProgress(it.progress)
}
else -> {} else -> {}
} }
@ -232,13 +252,14 @@ class DownloadWizardProgressFragment : DownloadWizardActivity.DownloadWizardStep
icon.setImageResource(R.drawable.ic_error_outline) icon.setImageResource(R.drawable.ic_error_outline)
icon.visibility = View.VISIBLE icon.visibility = View.VISIBLE
item.errorMessage?.titleResId?.let { if (item.errorMessage != null) {
errorTitle.visibility = View.VISIBLE errorTitle.visibility = View.VISIBLE
errorTitle.text = getString(it) errorTitle.text = getString(item.errorMessage!!.titleResId)
}
item.errorMessage?.suggestResId?.let { if (item.errorMessage!!.suggestResId != null) {
errorSuggestion.visibility = View.VISIBLE errorSuggestion.visibility = View.VISIBLE
errorSuggestion.text = getString(it) errorSuggestion.text = getString(item.errorMessage!!.suggestResId!!)
}
} }
} }
} }