Compare commits

..

No commits in common. "65cd9ce1704f54aafd10be29d28898e9df1e7d21" and "dad71108d824da91c6113c305d276f9430a5e1a2" have entirely different histories.

6 changed files with 39 additions and 60 deletions

View file

@ -6,13 +6,24 @@ 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
@ -56,4 +67,28 @@ class HomeActivity : ComponentActivity() {
intent.putExtra("walletId", walletId)
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
)
}
}
}

View file

@ -1,55 +0,0 @@
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
)
}
}
}

View file

@ -5,6 +5,7 @@ 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

View file

@ -89,7 +89,7 @@ fun TransactionDialog(
.weight(1f)
.focusRequester(firstFocus)
.focusProperties { next = secondFocus },
supportingText = { Text(stringResource(R.string.create_transaction_title)) },
supportingText = { Text(stringResource(R.string.create_transaction_label)) },
keyboardOptions = KeyboardOptions.Default.copy(
imeAction = ImeAction.Next
),

View file

@ -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_title">Tytuł</string>
<string name="create_transaction_label">Etykieta</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,5 +17,4 @@
<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>

View file

@ -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_title">Title</string>
<string name="create_transaction_label">Label</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,5 +17,4 @@
<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>