fix: Improve DonationsTile

This commit is contained in:
Myzel394 2023-10-26 16:36:16 +02:00
parent e7bc1ac0b3
commit cc3b0736c9
No known key found for this signature in database
GPG Key ID: 79CC92F37B3E1A2B
2 changed files with 40 additions and 19 deletions

View File

@ -4,6 +4,7 @@ import android.content.ClipData
import android.content.ClipboardManager
import android.content.Context
import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.core.animateFloatAsState
import androidx.compose.animation.expandVertically
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
@ -17,6 +18,7 @@ import androidx.compose.foundation.layout.size
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.rememberScrollState
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.ArrowDropDown
import androidx.compose.material.icons.filled.ContentCopy
import androidx.compose.material.icons.filled.CurrencyBitcoin
import androidx.compose.material.icons.filled.CurrencyFranc
@ -38,6 +40,7 @@ import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.draw.rotate
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.semantics.contentDescription
@ -69,26 +72,44 @@ fun DonationsTile() {
MaterialTheme.colorScheme.surfaceVariant
)
.padding(16.dp),
horizontalArrangement = Arrangement.spacedBy(8.dp),
horizontalArrangement = Arrangement.SpaceBetween,
verticalAlignment = Alignment.CenterVertically,
) {
Icon(
listOf(
Icons.Default.CurrencyBitcoin,
Icons.Default.CurrencyFranc,
Icons.Default.CurrencyLira,
Icons.Default.CurrencyPound,
Icons.Default.CurrencyRuble,
Icons.Default.CurrencyRupee,
Icons.Default.CurrencyYen,
Icons.Default.CurrencyYuan,
).asSequence().shuffled().first(),
contentDescription = null,
modifier = Modifier.size(ButtonDefaults.IconSize.times(1.2f))
Row(
horizontalArrangement = Arrangement.spacedBy(8.dp),
verticalAlignment = Alignment.CenterVertically,
) {
Icon(
listOf(
Icons.Default.CurrencyBitcoin,
Icons.Default.CurrencyFranc,
Icons.Default.CurrencyLira,
Icons.Default.CurrencyPound,
Icons.Default.CurrencyRuble,
Icons.Default.CurrencyRupee,
Icons.Default.CurrencyYen,
Icons.Default.CurrencyYuan,
).asSequence().shuffled().first(),
contentDescription = null,
modifier = Modifier.size(ButtonDefaults.IconSize.times(1.2f))
)
Text(
stringResource(R.string.ui_about_contribute_donatation),
fontWeight = FontWeight.Bold,
)
}
val rotation by animateFloatAsState(
if (donationsOpened) -180f else 0f,
label = "iconRotation"
)
Text(
stringResource(R.string.ui_about_contribute_donatation),
fontWeight = FontWeight.Bold,
Icon(
Icons.Default.ArrowDropDown,
contentDescription = null,
modifier = Modifier
.size(ButtonDefaults.IconSize.times(1.2f))
.rotate(rotation)
)
}
@ -109,7 +130,7 @@ fun DonationsTile() {
val clip = ClipData.newPlainText("text", crypto.value)
clipboardManager.setPrimaryClip(clip)
}
.padding(8.dp)
.padding(16.dp)
.horizontalScroll(rememberScrollState()),
horizontalArrangement = Arrangement.spacedBy(8.dp),
verticalAlignment = Alignment.CenterVertically,

View File

@ -95,6 +95,6 @@
<string name="accessibility_open_in_browser">Open link in browser: %s</string>
<string name="ui_about_contribute_translation">Translate Alibi into your language</string>
<string name="ui_about_contribute_donatation">Make a donation</string>
<string name="ui_about_gpg_key_hint">You can copy my GPG key here. This key only exists once and I can use it to prove to you that I\'m really who I am. Please save it now so that you don\'t fall for a phishing attack later on.</string>
<string name="ui_about_gpg_key_hint">You can copy my GPG key here. This key only exists once and I can use it to prove to you that I\'m really who I am. Please save it now so that you can verify my signature later.</string>
<string name="ui_about_gpg_key_copy">Copy GPG Key</string>
</resources>