@@ -10,6 +10,7 @@ import android.os.Bundle
1010import android.os.Environment
1111import android.provider.MediaStore.Images.Media
1212import android.util.Log
13+ import android.view.View
1314import androidx.activity.viewModels
1415import androidx.annotation.RequiresApi
1516import androidx.appcompat.app.AppCompatActivity
@@ -109,27 +110,46 @@ class EvaluationsActivity : AppCompatActivity() {
109110 startActivity(intent)
110111 }
111112
113+ hideCard()
112114 mViewModel.listEvaluations(packageName)
113115
114116 val shareImmediately = intent.getBooleanExtra(EXTRA_SHARE_IMMEDIATELY , false )
115117 if (shareImmediately) {
116- if (settings.isRootConfigurationEnabled()) {
117- combine(
118- microgUserReceived, microgRootReceived, bareAospUserReceived,
119- bareAospRootReceived, iconReceived
120- ) { _, _, _, _, _ ->
121- share(takeScreenshot(), appName)
122- }.launchIn(lifecycleScope)
123- } else {
124- combine(microgUserReceived, bareAospUserReceived, iconReceived) { _, _, _ ->
125- share(takeScreenshot(), appName)
126- }.launchIn(lifecycleScope)
118+ onElementsLoaded {
119+ share(takeScreenshot(), appName)
127120 }
128121 }
129122
123+ onElementsLoaded {
124+ showCard()
125+ }
126+
130127 handleRootConfigurationSetting()
131128 }
132129
130+ private fun hideCard () {
131+ mBinding.card.visibility = View .INVISIBLE
132+ }
133+
134+ private fun showCard () {
135+ mBinding.card.visibility = View .VISIBLE
136+ }
137+
138+ private fun onElementsLoaded (callback : () -> Unit ) {
139+ if (settings.isRootConfigurationEnabled()) {
140+ combine(
141+ microgUserReceived, microgRootReceived, bareAospUserReceived,
142+ bareAospRootReceived, iconReceived
143+ ) { _, _, _, _, _ ->
144+ callback.invoke()
145+ }.launchIn(lifecycleScope)
146+ } else {
147+ combine(microgUserReceived, bareAospUserReceived, iconReceived) { _, _, _ ->
148+ callback.invoke()
149+ }.launchIn(lifecycleScope)
150+ }
151+ }
152+
133153 private fun handleRootConfigurationSetting () {
134154 val shouldShow = settings.isRootConfigurationEnabled()
135155 with (mBinding) {
0 commit comments