@@ -8,9 +8,6 @@ import androidx.compose.foundation.layout.fillMaxWidth
88import androidx.compose.foundation.layout.height
99import androidx.compose.foundation.layout.padding
1010import androidx.compose.runtime.Composable
11- import androidx.compose.runtime.LaunchedEffect
12- import androidx.compose.runtime.mutableLongStateOf
13- import androidx.compose.runtime.remember
1411import androidx.compose.ui.Alignment
1512import androidx.compose.ui.Modifier
1613import androidx.compose.ui.tooling.preview.Preview
@@ -19,12 +16,6 @@ import to.bitkit.models.ConvertedAmount
1916import to.bitkit.models.PrimaryDisplay
2017import to.bitkit.ui.LocalCurrencies
2118import to.bitkit.ui.currencyViewModel
22- import androidx.compose.runtime.getValue
23- import androidx.compose.runtime.setValue
24- import androidx.compose.runtime.mutableIntStateOf
25- import androidx.compose.runtime.mutableStateOf
26- import to.bitkit.ext.removeSpaces
27- import to.bitkit.models.BitcoinDisplayUnit
2819import to.bitkit.ui.shared.util.clickableAlpha
2920import to.bitkit.ui.theme.AppThemeSurface
3021import to.bitkit.ui.theme.Colors
@@ -71,76 +62,6 @@ fun BalanceHeaderView(
7162 }
7263}
7364
74- @Composable
75- fun BalanceHeaderEditable (
76- input : String ,
77- showBitcoinSymbol : Boolean = true,
78- onSatsChanged : (String ) -> Unit ,
79- modifier : Modifier = Modifier ,
80- ) {
81- val (rates, _, _, _, displayUnit, primaryDisplay) = LocalCurrencies .current
82- val currency = currencyViewModel ? : return
83-
84- var placeholder: String by remember { mutableStateOf(" 0" ) }
85- var placeholderFractional: String by remember { mutableStateOf(" " ) }
86- var value: String by remember { mutableStateOf(" " ) }
87-
88- if (displayUnit == BitcoinDisplayUnit .CLASSIC ) {
89- placeholderFractional = " 00000000"
90- }
91-
92- if (primaryDisplay == PrimaryDisplay .FIAT ) {
93- placeholderFractional = " 00"
94- }
95-
96- if (placeholderFractional.isNotEmpty()) {
97- placeholder = " 0.$placeholderFractional "
98- }
99-
100- if (input.isNotEmpty()) {
101-
102- val whole = input.split(" ." ).firstOrNull().orEmpty().removeSpaces()
103- val fraction = input.split(" ." ).getOrNull(1 ).orEmpty().removeSpaces()
104-
105- if (primaryDisplay == PrimaryDisplay .FIAT ) {
106- value = whole // TODO FORMAT FIAT
107- }
108-
109- if (input.contains(" ." )) {
110- placeholder = fraction // TODO GET FRACTIONAL LENGTH
111-
112- // truncate to 2 decimals for fiat
113- if (primaryDisplay == PrimaryDisplay .FIAT ) {
114-
115- value = " $whole .$fraction " // TODO FORMAT MONEY
116- }
117- } else {
118- if (displayUnit == BitcoinDisplayUnit .MODERN && primaryDisplay == PrimaryDisplay .BITCOIN ) {
119- value = input // TODO FORMAT SATOSHI
120- placeholder = " "
121- } else {
122- placeholder = " .$placeholderFractional "
123- }
124- }
125- }
126-
127- var smallRowPrefix: String by remember { mutableStateOf(" " ) }
128- var smallRowText: String by remember { mutableStateOf(" " ) }
129- var smallRowSymbol: String by remember { mutableStateOf(" " ) }
130-
131- BalanceHeader (
132- modifier = modifier,
133- smallRowPrefix = smallRowPrefix,
134- smallRowSymbol = smallRowSymbol,
135- smallRowText = smallRowText,
136- largeRowPrefix = largeRowPrefix,
137- largeRowText = largeRowText,
138- largeRowSymbol = largeRowSymbol,
139- showSymbol = showBitcoinSymbol,
140- onClick = { }
141- )
142- }
143-
14465@Composable
14566fun BalanceHeader (
14667 modifier : Modifier = Modifier ,
0 commit comments