Compare commits
3 commits
dad71108d8
...
65cd9ce170
Author | SHA1 | Date | |
---|---|---|---|
65cd9ce170 | |||
2535e4bea6 | |||
0ee9ece012 |
6 changed files with 60 additions and 39 deletions
|
@ -6,24 +6,13 @@ import androidx.activity.ComponentActivity
|
|||
import androidx.activity.compose.setContent
|
||||
import androidx.activity.enableEdgeToEdge
|
||||
import androidx.activity.viewModels
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material3.Scaffold
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import eu.m724.coincounter.CurrencyUtils
|
||||
import eu.m724.coincounter.home.compose.HomeActivityView
|
||||
import eu.m724.coincounter.ui.theme.CoinCounterTheme
|
||||
import eu.m724.coincounter.wallet.WalletActivity
|
||||
|
@ -68,27 +57,3 @@ class HomeActivity : ComponentActivity() {
|
|||
startActivity(intent)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun BalanceView(balance: Int) {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.height(150.dp)
|
||||
.fillMaxWidth(),
|
||||
verticalArrangement = Arrangement.Center,
|
||||
horizontalAlignment = Alignment.CenterHorizontally
|
||||
) {
|
||||
Row(
|
||||
verticalAlignment = Alignment.Bottom
|
||||
) {
|
||||
Text(
|
||||
text = CurrencyUtils.formatNoCurrency(balance),
|
||||
fontSize = 32.sp
|
||||
)
|
||||
Text(
|
||||
text = CurrencyUtils.currencySymbol,
|
||||
fontSize = 14.sp
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
package eu.m724.coincounter.home.compose
|
||||
|
||||
import android.widget.Toast
|
||||
import androidx.compose.foundation.gestures.detectTapGestures
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.input.pointer.pointerInput
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import eu.m724.coincounter.CurrencyUtils
|
||||
import eu.m724.coincounter.R
|
||||
|
||||
@Composable
|
||||
fun BalanceView(balance: Int) {
|
||||
val context = LocalContext.current
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.height(150.dp)
|
||||
.fillMaxWidth(),
|
||||
verticalArrangement = Arrangement.Center,
|
||||
horizontalAlignment = Alignment.CenterHorizontally
|
||||
) {
|
||||
Row(
|
||||
modifier = Modifier.pointerInput(Unit) {
|
||||
detectTapGestures(
|
||||
onDoubleTap = {
|
||||
Toast.makeText(
|
||||
context,
|
||||
context.getString(R.string.translation_credits),
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
}
|
||||
)
|
||||
},
|
||||
verticalAlignment = Alignment.Bottom
|
||||
) {
|
||||
Text(
|
||||
text = CurrencyUtils.formatNoCurrency(balance),
|
||||
fontSize = 32.sp
|
||||
)
|
||||
Text(
|
||||
text = CurrencyUtils.currencySymbol,
|
||||
fontSize = 14.sp
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -5,7 +5,6 @@ import androidx.compose.runtime.Composable
|
|||
import androidx.compose.runtime.collectAsState
|
||||
import androidx.compose.runtime.getValue
|
||||
import eu.m724.coincounter.data.entity.Wallet
|
||||
import eu.m724.coincounter.home.BalanceView
|
||||
import eu.m724.coincounter.home.HomeViewModel
|
||||
|
||||
@Composable
|
||||
|
|
|
@ -89,7 +89,7 @@ fun TransactionDialog(
|
|||
.weight(1f)
|
||||
.focusRequester(firstFocus)
|
||||
.focusProperties { next = secondFocus },
|
||||
supportingText = { Text(stringResource(R.string.create_transaction_label)) },
|
||||
supportingText = { Text(stringResource(R.string.create_transaction_title)) },
|
||||
keyboardOptions = KeyboardOptions.Default.copy(
|
||||
imeAction = ImeAction.Next
|
||||
),
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<string name="create_transaction_absolute">Bezwzględna</string>
|
||||
<string name="create_transaction_value_error">Błąd</string>
|
||||
<string name="create_transaction_value">Wartość (%1$s)</string>
|
||||
<string name="create_transaction_label">Etykieta</string>
|
||||
<string name="create_transaction_title">Tytuł</string>
|
||||
<string name="wallet_actions_rename">Zmień nazwę portfela</string>
|
||||
<string name="wallet_actions_delete">Usuń portfel</string>
|
||||
<string name="wallet_actions_cancel">Anuluj</string>
|
||||
|
@ -17,4 +17,5 @@
|
|||
<string name="wallet_rename_confirm">Zmień nazwę</string>
|
||||
<string name="wallet_new_transaction">Nowa transakcja</string>
|
||||
<string name="home_add_wallet">Utwórz portfel</string>
|
||||
<string name="translation_credits">Polskie tłumaczenie autorstwa m724</string>
|
||||
</resources>
|
|
@ -8,7 +8,7 @@
|
|||
<string name="create_transaction_absolute">Absolute</string>
|
||||
<string name="create_transaction_value_error">Error</string>
|
||||
<string name="create_transaction_value">Value (%1$s)</string>
|
||||
<string name="create_transaction_label">Label</string>
|
||||
<string name="create_transaction_title">Title</string>
|
||||
<string name="wallet_actions_rename">Rename wallet</string>
|
||||
<string name="wallet_actions_delete">Delete wallet</string>
|
||||
<string name="wallet_actions_cancel">Cancel</string>
|
||||
|
@ -17,4 +17,5 @@
|
|||
<string name="wallet_rename_confirm">Rename</string>
|
||||
<string name="wallet_new_transaction">New transaction</string>
|
||||
<string name="home_add_wallet">Create wallet</string>
|
||||
<string name="translation_credits">English language by the CoinCounter Team</string>
|
||||
</resources>
|
Loading…
Reference in a new issue