diff --git a/.idea/.gitignore b/.idea/.gitignore index d2293f6..2e12995 100644 --- a/.idea/.gitignore +++ b/.idea/.gitignore @@ -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 \ No newline at end of file diff --git a/app-common/src/main/java/im/angry/openeuicc/ui/wizard/DownloadWizardProgressFragment.kt b/app-common/src/main/java/im/angry/openeuicc/ui/wizard/DownloadWizardProgressFragment.kt index 0048190..29e87b0 100644 --- a/app-common/src/main/java/im/angry/openeuicc/ui/wizard/DownloadWizardProgressFragment.kt +++ b/app-common/src/main/java/im/angry/openeuicc/ui/wizard/DownloadWizardProgressFragment.kt @@ -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!!) + } } } }