@@ -17,6 +17,7 @@ import androidx.compose.foundation.rememberScrollState
17
17
import androidx.compose.foundation.shape.RoundedCornerShape
18
18
import androidx.compose.foundation.verticalScroll
19
19
import androidx.compose.material3.Button
20
+ import androidx.compose.material3.CircularProgressIndicator
20
21
import androidx.compose.material3.ExperimentalMaterial3Api
21
22
import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi
22
23
import androidx.compose.material3.Icon
@@ -77,6 +78,7 @@ fun HomeBottomContent(
77
78
}
78
79
var isError by remember { mutableStateOf(false ) }
79
80
var isNameError by remember { mutableStateOf(false ) }
81
+ var isFetchingMetadata by remember { mutableStateOf(false ) }
80
82
// Tags
81
83
var newTagName by remember { mutableStateOf(" " ) }
82
84
val allTags by viewModel.allTags.collectAsState()
@@ -171,9 +173,11 @@ fun HomeBottomContent(
171
173
172
174
OutlinedButton (
173
175
modifier = Modifier .fillMaxWidth(),
174
- enabled = deeprInfo.link.isNotBlank(),
176
+ enabled = deeprInfo.link.isNotBlank() && ! isFetchingMetadata ,
175
177
onClick = {
178
+ isFetchingMetadata = true
176
179
viewModel.fetchMetaData(deeprInfo.link) {
180
+ isFetchingMetadata = false
177
181
if (it != null ) {
178
182
deeprInfo = deeprInfo.copy(name = it.title ? : " " )
179
183
isNameError = false
@@ -188,6 +192,13 @@ fun HomeBottomContent(
188
192
}
189
193
},
190
194
) {
195
+ if (isFetchingMetadata) {
196
+ CircularProgressIndicator (
197
+ modifier = Modifier .size(20 .dp),
198
+ strokeWidth = 2 .dp,
199
+ )
200
+ Spacer (modifier = Modifier .width(8 .dp))
201
+ }
191
202
Text (stringResource(R .string.fetch_name_from_link))
192
203
}
193
204
0 commit comments