From 4c9c7a3aa446feda2a94ed49a3fd1dd0210ef85a Mon Sep 17 00:00:00 2001 From: B3S23 Date: Wed, 5 Mar 2025 15:53:47 +0300 Subject: [PATCH 1/7] Update .gitignore --- .gitignore | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index aa724b7..10cfdbf 100644 --- a/.gitignore +++ b/.gitignore @@ -1,12 +1,7 @@ *.iml .gradle /local.properties -/.idea/caches -/.idea/libraries -/.idea/modules.xml -/.idea/workspace.xml -/.idea/navEditor.xml -/.idea/assetWizardSettings.xml +/.idea .DS_Store /build /captures From 09871e8727bf0630008d377edbdf29bf4634a6a5 Mon Sep 17 00:00:00 2001 From: b3s23 Date: Fri, 7 Mar 2025 18:10:43 +0500 Subject: [PATCH 2/7] Fixed the design, added full color schemes for light and dark themes. Fixed number formatting with bitcoin data, as well as the line chart being fully visible on the vertical axis now! :3 --- .idea/misc.xml | 1 - .../bitcoin_summarizer/GlobalResponse.kt | 2 +- .../bitcoin_summarizer/MainActivity.kt | 109 +++++++++++++----- .../bitcoin_summarizer/TickerResponse.kt | 20 ++-- .../bitcoin_summarizer/ui/theme/Color.kt | 10 +- .../bitcoin_summarizer/ui/theme/Theme.kt | 31 +++-- 6 files changed, 121 insertions(+), 52 deletions(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index 74dd639..b2c751a 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,4 +1,3 @@ - diff --git a/app/src/main/java/ru/vendetti/bitcoin_summarizer/GlobalResponse.kt b/app/src/main/java/ru/vendetti/bitcoin_summarizer/GlobalResponse.kt index 56878d1..b62fc37 100644 --- a/app/src/main/java/ru/vendetti/bitcoin_summarizer/GlobalResponse.kt +++ b/app/src/main/java/ru/vendetti/bitcoin_summarizer/GlobalResponse.kt @@ -7,5 +7,5 @@ data class GlobalResponse( @SerializedName("active_currencies") val activeCryptocurrencies: String = "", @SerializedName("total_market_cap_usd") val totalMarketCapUsd: String = "", @SerializedName("total_24h_volume_usd") val total24hVolumeUsd: String = "", - @SerializedName("bitcoin_percentage_of_market_cap") val bitcoinPercentageOfMarketCap: String = "" + @SerializedName("bitcoin_percentage_of_market_cap") val bitcoinPercentageOfMarketCap: String = "0.0" ) \ No newline at end of file diff --git a/app/src/main/java/ru/vendetti/bitcoin_summarizer/MainActivity.kt b/app/src/main/java/ru/vendetti/bitcoin_summarizer/MainActivity.kt index 419ac15..0061377 100644 --- a/app/src/main/java/ru/vendetti/bitcoin_summarizer/MainActivity.kt +++ b/app/src/main/java/ru/vendetti/bitcoin_summarizer/MainActivity.kt @@ -4,6 +4,7 @@ import android.annotation.SuppressLint import android.os.Bundle import androidx.activity.ComponentActivity import androidx.activity.compose.setContent +import androidx.compose.foundation.background import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.PaddingValues @@ -42,28 +43,43 @@ import androidx.compose.ui.unit.TextUnit import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import com.patrykandpatrick.vico.compose.cartesian.CartesianChartHost +import com.patrykandpatrick.vico.compose.cartesian.axis.rememberAxisLabelComponent +import com.patrykandpatrick.vico.compose.cartesian.axis.rememberAxisLineComponent import com.patrykandpatrick.vico.compose.cartesian.axis.rememberBottom import com.patrykandpatrick.vico.compose.cartesian.axis.rememberStart +import com.patrykandpatrick.vico.compose.cartesian.layer.rememberLine import com.patrykandpatrick.vico.compose.cartesian.layer.rememberLineCartesianLayer import com.patrykandpatrick.vico.compose.cartesian.rememberCartesianChart import com.patrykandpatrick.vico.compose.cartesian.rememberVicoZoomState +import com.patrykandpatrick.vico.compose.common.component.rememberLineComponent import com.patrykandpatrick.vico.compose.common.component.rememberTextComponent import com.patrykandpatrick.vico.compose.common.component.shapeComponent import com.patrykandpatrick.vico.compose.common.fill import com.patrykandpatrick.vico.compose.common.shape.rounded +import com.patrykandpatrick.vico.compose.common.vicoTheme import com.patrykandpatrick.vico.core.cartesian.Zoom +import com.patrykandpatrick.vico.core.cartesian.axis.BaseAxis import com.patrykandpatrick.vico.core.cartesian.axis.HorizontalAxis import com.patrykandpatrick.vico.core.cartesian.axis.VerticalAxis import com.patrykandpatrick.vico.core.cartesian.data.CartesianChartModelProducer +import com.patrykandpatrick.vico.core.cartesian.data.CartesianLayerRangeProvider import com.patrykandpatrick.vico.core.cartesian.data.lineSeries import com.patrykandpatrick.vico.core.cartesian.decoration.HorizontalLine +import com.patrykandpatrick.vico.core.cartesian.layer.LineCartesianLayer import com.patrykandpatrick.vico.core.common.Position import com.patrykandpatrick.vico.core.common.component.LineComponent import com.patrykandpatrick.vico.core.common.component.TextComponent import com.patrykandpatrick.vico.core.common.shape.CorneredShape import ru.vendetti.bitcoin_summarizer.ui.theme.BitcoinSummarizerTheme +import ru.vendetti.bitcoin_summarizer.ui.theme.EnglishViolet +import ru.vendetti.bitcoin_summarizer.ui.theme.Flame +import ru.vendetti.bitcoin_summarizer.ui.theme.Green2 import java.text.DateFormat +import java.text.DecimalFormat +import java.text.SimpleDateFormat import java.time.format.DateTimeFormatter +import java.util.Date +import kotlin.math.roundToInt class MainActivity : ComponentActivity() { override fun onCreate(savedInstanceState: Bundle?) { @@ -76,7 +92,7 @@ class MainActivity : ComponentActivity() { } } -@SuppressLint("MutableCollectionMutableState") +@SuppressLint("MutableCollectionMutableState", "SimpleDateFormat") @OptIn(ExperimentalMaterial3Api::class) @Preview @Composable @@ -109,15 +125,24 @@ fun CryptoScreen() { LaunchedEffect(fearGreedDataList) { modelProducer.runTransaction { - var numberValues = Array(fearGreedDataList.count()) { index -> fearGreedDataList[index].value.toInt() } + var numberValues = Array(fearGreedDataList.count()) { + index -> + fearGreedDataList[fearGreedDataList.count() - index - 1] + .value.toInt() + } + if(numberValues.isEmpty()) numberValues = Array(1) {0} + lineSeries { series(numberValues.toList()) } } } val scrollBehavior = TopAppBarDefaults.enterAlwaysScrollBehavior(rememberTopAppBarState()) - val zoomState = rememberVicoZoomState(initialZoom = Zoom.x(fearGreedIndexDaysCount.toDouble())) + val zoomState = rememberVicoZoomState( + zoomEnabled = false, + initialZoom = Zoom.x(fearGreedIndexDaysCount.toDouble())) + // Отображаем результаты на странице Scaffold ( modifier = Modifier @@ -126,8 +151,11 @@ fun CryptoScreen() { topBar = { MediumTopAppBar( colors = TopAppBarDefaults.topAppBarColors( - containerColor = MaterialTheme.colorScheme.primaryContainer, - titleContentColor = MaterialTheme.colorScheme.primary, + containerColor = MaterialTheme.colorScheme.primary, + scrolledContainerColor = MaterialTheme.colorScheme.primary, + titleContentColor = MaterialTheme.colorScheme.onPrimary, + navigationIconContentColor = MaterialTheme.colorScheme.onPrimary, + actionIconContentColor = MaterialTheme.colorScheme.onPrimary, ), title = { Text( @@ -159,7 +187,7 @@ fun CryptoScreen() { { innerPadding -> Box( modifier = Modifier - .fillMaxSize() + .background(Color.Transparent) .padding(innerPadding) .verticalScroll(rememberScrollState()) ) { @@ -171,27 +199,44 @@ fun CryptoScreen() { CartesianChartHost( zoomState = zoomState, chart = rememberCartesianChart( - rememberLineCartesianLayer(), + rememberLineCartesianLayer( + lineProvider = LineCartesianLayer.LineProvider.series( + vicoTheme.lineCartesianLayerColors.map{ + _ -> + LineCartesianLayer + .rememberLine( + LineCartesianLayer.LineFill.single( + fill(MaterialTheme.colorScheme.onPrimary) + ) + ) + } + ), + rangeProvider = remember { CartesianLayerRangeProvider.fixed(minY = 0.0, maxY = 100.0)} + ), startAxis = VerticalAxis.rememberStart( - titleComponent = rememberTextComponent(), - title = "FGI" + title = "FGI", + titleComponent = rememberTextComponent(MaterialTheme.colorScheme.onPrimary), + line = rememberAxisLineComponent(fill(MaterialTheme.colorScheme.onPrimary)), + label = rememberAxisLabelComponent(MaterialTheme.colorScheme.onPrimary) ), bottomAxis = HorizontalAxis.rememberBottom( - titleComponent = rememberTextComponent(), - title = "last $fearGreedIndexDaysCount days" + title = "last $fearGreedIndexDaysCount days", + titleComponent = rememberTextComponent(MaterialTheme.colorScheme.onPrimary), + line = rememberAxisLineComponent(fill(MaterialTheme.colorScheme.onPrimary)), + label = rememberAxisLabelComponent(MaterialTheme.colorScheme.onPrimary) ), decorations = listOf( remember { HorizontalLine( - y = { 15.toDouble() }, - line = LineComponent(fill(Color.Red), 2f), + y = { 25.toDouble() }, + line = LineComponent(fill(Flame), 2f), labelComponent = TextComponent( background = shapeComponent( - fill(Color.Red), + fill(Flame), CorneredShape.rounded( - bottomLeft = 4.dp, - bottomRight = 4.dp + topLeft = 4.dp, + topRight = 4.dp ) ), ), @@ -201,12 +246,12 @@ fun CryptoScreen() { }, remember { HorizontalLine( - y = { 60.toDouble() }, - line = LineComponent(fill(Color.Green), 2f), + y = { 70.toDouble() }, + line = LineComponent(fill(Green2), 2f), labelComponent = TextComponent( background = shapeComponent( - fill(Color.Green), + fill(Green2), CorneredShape.rounded( bottomLeft = 4.dp, bottomRight = 4.dp @@ -229,15 +274,23 @@ fun CryptoScreen() { .align(alignment = Alignment.CenterHorizontally), fontSize = 24.sp ) - Text("Текущая цена: \n ${bitcoinTicker.priceUsd}\n") - Text("Суточный оборот: \n ${bitcoinTicker.volume24hUsd}\n") - Text("Капитализация: \n ${bitcoinTicker.marketCapUsd}\n") + val formatter = DecimalFormat("0.00") + Text("Текущая цена: \n \$ ${formatter.format(bitcoinTicker.priceUsd.toFloat())}\n") + Text("Суточный оборот: \n \$ ${bitcoinTicker.volume24hUsd}\n") + Text("Капитализация: \n \$ ${bitcoinTicker.marketCapUsd}\n") Text( "Изменение курса за: " + - "\n Сутки: ${bitcoinTicker.percentChange24h} " + - "\n Неделю: ${bitcoinTicker.percentChange7d}\n" + "\n Сутки: ${formatter.format(bitcoinTicker.percentChange24h.toFloat())}% " + + "\n Неделю: ${formatter.format(bitcoinTicker.percentChange7d.toFloat())}%\n" ) - Text("Дата последнего обновления: \n ${bitcoinTicker.lastUpdated}\n") + + var humanDate = "" + + if(bitcoinTicker.lastUpdated.isNotEmpty()) + humanDate = DateTimeFormatter.ISO_INSTANT + .format(java.time.Instant.ofEpochSecond(bitcoinTicker.lastUpdated.toLong())) + + Text("Дата последнего обновления: \n ${humanDate}\n") HorizontalDivider(thickness = 2.dp) Text( @@ -246,10 +299,10 @@ fun CryptoScreen() { .align(alignment = Alignment.CenterHorizontally), fontSize = 24.sp ) - Text("Общая капитализация крипторынка: \n ${globalData.totalMarketCapUsd}\n") + Text("Общая капитализация крипторынка: \n \$ ${globalData.totalMarketCapUsd}\n") Text("Всего видов криптовалют: \n ${globalData.activeCryptocurrencies}\n") - Text("Суточный оборот других криптовалют: \n ${globalData.total24hVolumeUsd}\n") - Text("Процент доминации Биткоина: \n ${globalData.bitcoinPercentageOfMarketCap}\n") + Text("Суточный оборот других криптовалют: \n \$ ${globalData.total24hVolumeUsd}\n") + Text("Процент доминации Биткоина: \n ${formatter.format(globalData.bitcoinPercentageOfMarketCap.toFloat())}%\n") } } } diff --git a/app/src/main/java/ru/vendetti/bitcoin_summarizer/TickerResponse.kt b/app/src/main/java/ru/vendetti/bitcoin_summarizer/TickerResponse.kt index a845db9..30b0dfa 100644 --- a/app/src/main/java/ru/vendetti/bitcoin_summarizer/TickerResponse.kt +++ b/app/src/main/java/ru/vendetti/bitcoin_summarizer/TickerResponse.kt @@ -11,15 +11,15 @@ data class TickerData( val name: String = "", val symbol: String = "", val rank: String = "", - @SerializedName("price_usd") val priceUsd: String = "", - @SerializedName("price_btc") val priceBtc: String = "", - @SerializedName("24h_volume_usd") val volume24hUsd: String = "", - @SerializedName("market_cap_usd") val marketCapUsd: String = "", - @SerializedName("available_supply") val availableSupply: String = "", - @SerializedName("total_supply") val totalSupply: String = "", - @SerializedName("max_supply") val maxSupply: String? = "", - @SerializedName("percent_change_1h") val percentChange1h: String = "", - @SerializedName("percent_change_24h") val percentChange24h: String = "", - @SerializedName("percent_change_7d") val percentChange7d: String = "", + @SerializedName("price_usd") val priceUsd: String = "0.0", + @SerializedName("price_btc") val priceBtc: String = "0.0", + @SerializedName("24h_volume_usd") val volume24hUsd: String = "0", + @SerializedName("market_cap_usd") val marketCapUsd: String = "0", + @SerializedName("available_supply") val availableSupply: String = "0", + @SerializedName("total_supply") val totalSupply: String = "0", + @SerializedName("max_supply") val maxSupply: String? = "0", + @SerializedName("percent_change_1h") val percentChange1h: String = "0", + @SerializedName("percent_change_24h") val percentChange24h: String = "0.0", + @SerializedName("percent_change_7d") val percentChange7d: String = "0.0", @SerializedName("last_updated") val lastUpdated: String = "" ) \ No newline at end of file diff --git a/app/src/main/java/ru/vendetti/bitcoin_summarizer/ui/theme/Color.kt b/app/src/main/java/ru/vendetti/bitcoin_summarizer/ui/theme/Color.kt index 3dc063b..9a3f2ed 100644 --- a/app/src/main/java/ru/vendetti/bitcoin_summarizer/ui/theme/Color.kt +++ b/app/src/main/java/ru/vendetti/bitcoin_summarizer/ui/theme/Color.kt @@ -8,4 +8,12 @@ val Pink80 = Color(0xFFEFB8C8) val Purple40 = Color(0xFF6650a4) val PurpleGrey40 = Color(0xFF625b71) -val Pink40 = Color(0xFF7D5260) \ No newline at end of file +val Pink40 = Color(0xFF7D5260) + +val EnglishViolet = Color(0xFF44355B) +val DarkPurple = Color(0xFF31263E) +val RaisinBlack = Color(0xFF221E22) +val HunyadiYellow = Color(0xFFECA72C) +val Flame = Color(0xFFEE5622) + +val Green2 = Color(0xFFB1E434) \ No newline at end of file diff --git a/app/src/main/java/ru/vendetti/bitcoin_summarizer/ui/theme/Theme.kt b/app/src/main/java/ru/vendetti/bitcoin_summarizer/ui/theme/Theme.kt index fa7ac0a..b922d15 100644 --- a/app/src/main/java/ru/vendetti/bitcoin_summarizer/ui/theme/Theme.kt +++ b/app/src/main/java/ru/vendetti/bitcoin_summarizer/ui/theme/Theme.kt @@ -9,28 +9,37 @@ import androidx.compose.material3.dynamicDarkColorScheme import androidx.compose.material3.dynamicLightColorScheme import androidx.compose.material3.lightColorScheme import androidx.compose.runtime.Composable +import androidx.compose.ui.graphics.Color import androidx.compose.ui.platform.LocalContext private val DarkColorScheme = darkColorScheme( - primary = Purple80, - secondary = PurpleGrey80, - tertiary = Pink80 + primary = RaisinBlack, + secondary = DarkPurple, + tertiary = EnglishViolet, + + // Other default colors to override + background = DarkPurple, + surface = Color(0xFFFFFBFE), + onPrimary = HunyadiYellow, + onSecondary = HunyadiYellow, + onTertiary = HunyadiYellow, + onBackground = HunyadiYellow, + onSurface = Color(0xFF1C1B1F), ) private val LightColorScheme = lightColorScheme( - primary = Purple40, - secondary = PurpleGrey40, - tertiary = Pink40 + primary = HunyadiYellow, + secondary = Flame, + tertiary = EnglishViolet, - /* Other default colors to override - background = Color(0xFFFFFBFE), + // Other default colors to override + background = Color.White, surface = Color(0xFFFFFBFE), - onPrimary = Color.White, + onPrimary = RaisinBlack, onSecondary = Color.White, onTertiary = Color.White, - onBackground = Color(0xFF1C1B1F), + onBackground = RaisinBlack, onSurface = Color(0xFF1C1B1F), - */ ) @Composable From 8f0ffb70412a5ea91a4a133e388717f08edcc871 Mon Sep 17 00:00:00 2001 From: B3S23 Date: Sat, 8 Mar 2025 11:44:29 +0300 Subject: [PATCH 3/7] removed dynamic color, cause we are controlling colors by ourself --- .../java/ru/vendetti/bitcoin_summarizer/ui/theme/Theme.kt | 7 ------- 1 file changed, 7 deletions(-) diff --git a/app/src/main/java/ru/vendetti/bitcoin_summarizer/ui/theme/Theme.kt b/app/src/main/java/ru/vendetti/bitcoin_summarizer/ui/theme/Theme.kt index b922d15..cf97fbd 100644 --- a/app/src/main/java/ru/vendetti/bitcoin_summarizer/ui/theme/Theme.kt +++ b/app/src/main/java/ru/vendetti/bitcoin_summarizer/ui/theme/Theme.kt @@ -45,16 +45,9 @@ private val LightColorScheme = lightColorScheme( @Composable fun BitcoinSummarizerTheme( darkTheme: Boolean = isSystemInDarkTheme(), - // Dynamic color is available on Android 12+ - dynamicColor: Boolean = true, content: @Composable () -> Unit ) { val colorScheme = when { - dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> { - val context = LocalContext.current - if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context) - } - darkTheme -> DarkColorScheme else -> LightColorScheme } From 3691477e9205875252ae3a919c1ac7cb1c306285 Mon Sep 17 00:00:00 2001 From: Andy Kolibri Vendetti Date: Sat, 8 Mar 2025 17:24:44 +0500 Subject: [PATCH 4/7] dependencies updated --- .idea/.gitignore | 3 - .idea/.name | 1 - .idea/AndroidProjectSystem.xml | 6 ++ .idea/codeStyles/Project.xml | 123 ----------------------- .idea/codeStyles/codeStyleConfig.xml | 5 - .idea/compiler.xml | 6 -- .idea/deploymentTargetSelector.xml | 10 -- .idea/gradle.xml | 20 ---- .idea/kotlinc.xml | 6 -- .idea/migrations.xml | 10 -- .idea/runConfigurations.xml | 17 ---- .idea/vcs.xml | 6 -- gradle/libs.versions.toml | 6 +- gradle/wrapper/gradle-wrapper.properties | 2 +- 14 files changed, 10 insertions(+), 211 deletions(-) delete mode 100644 .idea/.gitignore delete mode 100644 .idea/.name create mode 100644 .idea/AndroidProjectSystem.xml delete mode 100644 .idea/codeStyles/Project.xml delete mode 100644 .idea/codeStyles/codeStyleConfig.xml delete mode 100644 .idea/compiler.xml delete mode 100644 .idea/deploymentTargetSelector.xml delete mode 100644 .idea/gradle.xml delete mode 100644 .idea/kotlinc.xml delete mode 100644 .idea/migrations.xml delete mode 100644 .idea/runConfigurations.xml delete mode 100644 .idea/vcs.xml diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index 26d3352..0000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml diff --git a/.idea/.name b/.idea/.name deleted file mode 100644 index e44e06d..0000000 --- a/.idea/.name +++ /dev/null @@ -1 +0,0 @@ -Bitcoin summarizer \ No newline at end of file diff --git a/.idea/AndroidProjectSystem.xml b/.idea/AndroidProjectSystem.xml new file mode 100644 index 0000000..4a53bee --- /dev/null +++ b/.idea/AndroidProjectSystem.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml deleted file mode 100644 index 7643783..0000000 --- a/.idea/codeStyles/Project.xml +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml deleted file mode 100644 index 79ee123..0000000 --- a/.idea/codeStyles/codeStyleConfig.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml deleted file mode 100644 index b86273d..0000000 --- a/.idea/compiler.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/deploymentTargetSelector.xml b/.idea/deploymentTargetSelector.xml deleted file mode 100644 index b268ef3..0000000 --- a/.idea/deploymentTargetSelector.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml deleted file mode 100644 index 7b3006b..0000000 --- a/.idea/gradle.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml deleted file mode 100644 index 6d0ee1c..0000000 --- a/.idea/kotlinc.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - \ No newline at end of file diff --git a/.idea/migrations.xml b/.idea/migrations.xml deleted file mode 100644 index f8051a6..0000000 --- a/.idea/migrations.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml deleted file mode 100644 index 16660f1..0000000 --- a/.idea/runConfigurations.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 94a25f7..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index d2fbf2f..cdc58bf 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,13 +1,13 @@ [versions] -agp = "8.8.2" +agp = "8.9.0" converterGson = "2.9.0" kotlin = "2.0.0" coreKtx = "1.15.0" junit = "4.13.2" junitVersion = "1.2.1" espressoCore = "3.6.1" -kotlinxCoroutinesAndroid = "1.7.3" -kotlinxCoroutinesCore = "1.7.3" +kotlinxCoroutinesAndroid = "1.10.1" +kotlinxCoroutinesCore = "1.10.1" lifecycleRuntimeKtx = "2.8.7" activityCompose = "1.10.1" composeBom = "2025.02.00" diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 85913bb..78a6c6f 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Wed Feb 26 23:45:23 YEKT 2025 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists From 28196510a341ebcf9aceec311b28ec05131f7688 Mon Sep 17 00:00:00 2001 From: Andy Kolibri Vendetti Date: Sat, 8 Mar 2025 17:37:03 +0500 Subject: [PATCH 5/7] .idea dir removed from the repo --- .idea/AndroidProjectSystem.xml | 6 ------ .idea/misc.xml | 9 --------- 2 files changed, 15 deletions(-) delete mode 100644 .idea/AndroidProjectSystem.xml delete mode 100644 .idea/misc.xml diff --git a/.idea/AndroidProjectSystem.xml b/.idea/AndroidProjectSystem.xml deleted file mode 100644 index 4a53bee..0000000 --- a/.idea/AndroidProjectSystem.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index b2c751a..0000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - \ No newline at end of file From 08df502b1f91e36a79c31646928739881742e94c Mon Sep 17 00:00:00 2001 From: Andy Kolibri Vendetti Date: Sat, 8 Mar 2025 17:48:53 +0500 Subject: [PATCH 6/7] Some minor fixes (manifest, text typos, gradle app ver etc.) --- app/build.gradle.kts | 4 ++-- app/src/main/AndroidManifest.xml | 4 ++-- .../java/ru/vendetti/bitcoin_summarizer/MainActivity.kt | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 4f87ced..6558deb 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -12,8 +12,8 @@ android { applicationId = "ru.vendetti.bitcoin_summarizer" minSdk = 29 targetSdk = 35 - versionCode = 1 - versionName = "1.0" + versionCode = 2 + versionName = "1.2" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 6830513..dc24fe6 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -3,13 +3,13 @@ xmlns:tools="http://schemas.android.com/tools"> Date: Sun, 9 Mar 2025 00:08:36 +0500 Subject: [PATCH 7/7] Some minor fixes --- .../bitcoin_summarizer/MainActivity.kt | 36 +++++++++---------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/app/src/main/java/ru/vendetti/bitcoin_summarizer/MainActivity.kt b/app/src/main/java/ru/vendetti/bitcoin_summarizer/MainActivity.kt index c54a116..0d020b4 100644 --- a/app/src/main/java/ru/vendetti/bitcoin_summarizer/MainActivity.kt +++ b/app/src/main/java/ru/vendetti/bitcoin_summarizer/MainActivity.kt @@ -7,10 +7,9 @@ import androidx.activity.compose.setContent import androidx.compose.foundation.background import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.PaddingValues -import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.magnifier import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll import androidx.compose.material.icons.Icons @@ -39,7 +38,6 @@ import androidx.compose.ui.graphics.Color import androidx.compose.ui.input.nestedscroll.nestedScroll import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.tooling.preview.Preview -import androidx.compose.ui.unit.TextUnit import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import com.patrykandpatrick.vico.compose.cartesian.CartesianChartHost @@ -51,14 +49,12 @@ import com.patrykandpatrick.vico.compose.cartesian.layer.rememberLine import com.patrykandpatrick.vico.compose.cartesian.layer.rememberLineCartesianLayer import com.patrykandpatrick.vico.compose.cartesian.rememberCartesianChart import com.patrykandpatrick.vico.compose.cartesian.rememberVicoZoomState -import com.patrykandpatrick.vico.compose.common.component.rememberLineComponent import com.patrykandpatrick.vico.compose.common.component.rememberTextComponent import com.patrykandpatrick.vico.compose.common.component.shapeComponent import com.patrykandpatrick.vico.compose.common.fill import com.patrykandpatrick.vico.compose.common.shape.rounded import com.patrykandpatrick.vico.compose.common.vicoTheme import com.patrykandpatrick.vico.core.cartesian.Zoom -import com.patrykandpatrick.vico.core.cartesian.axis.BaseAxis import com.patrykandpatrick.vico.core.cartesian.axis.HorizontalAxis import com.patrykandpatrick.vico.core.cartesian.axis.VerticalAxis import com.patrykandpatrick.vico.core.cartesian.data.CartesianChartModelProducer @@ -71,15 +67,10 @@ import com.patrykandpatrick.vico.core.common.component.LineComponent import com.patrykandpatrick.vico.core.common.component.TextComponent import com.patrykandpatrick.vico.core.common.shape.CorneredShape import ru.vendetti.bitcoin_summarizer.ui.theme.BitcoinSummarizerTheme -import ru.vendetti.bitcoin_summarizer.ui.theme.EnglishViolet import ru.vendetti.bitcoin_summarizer.ui.theme.Flame import ru.vendetti.bitcoin_summarizer.ui.theme.Green2 -import java.text.DateFormat import java.text.DecimalFormat -import java.text.SimpleDateFormat import java.time.format.DateTimeFormatter -import java.util.Date -import kotlin.math.roundToInt class MainActivity : ComponentActivity() { override fun onCreate(savedInstanceState: Bundle?) { @@ -125,14 +116,14 @@ fun CryptoScreen() { LaunchedEffect(fearGreedDataList) { modelProducer.runTransaction { - var numberValues = Array(fearGreedDataList.count()) { + var numberValues = Array(fearGreedDataList.count()) { index -> fearGreedDataList[fearGreedDataList.count() - index - 1] .value.toInt() } if(numberValues.isEmpty()) - numberValues = Array(1) {0} + numberValues = Array(1) {0} lineSeries { series(numberValues.toList()) } } @@ -159,7 +150,7 @@ fun CryptoScreen() { ), title = { Text( - "Bitcoin Summarizer!", + "Bitcoin Summarizer", maxLines = 1, overflow = TextOverflow.Ellipsis ) @@ -220,7 +211,7 @@ fun CryptoScreen() { label = rememberAxisLabelComponent(MaterialTheme.colorScheme.onPrimary) ), bottomAxis = HorizontalAxis.rememberBottom( - title = "last $fearGreedIndexDaysCount days", + title = "последние $fearGreedIndexDaysCount дней", titleComponent = rememberTextComponent(MaterialTheme.colorScheme.onPrimary), line = rememberAxisLineComponent(fill(MaterialTheme.colorScheme.onPrimary)), label = rememberAxisLabelComponent(MaterialTheme.colorScheme.onPrimary) @@ -229,7 +220,7 @@ fun CryptoScreen() { remember { HorizontalLine( y = { 25.toDouble() }, - line = LineComponent(fill(Flame), 2f), + line = LineComponent(fill(Flame), 1f), labelComponent = TextComponent( background = shapeComponent( @@ -240,14 +231,14 @@ fun CryptoScreen() { ) ), ), - label = { "Fear" }, + label = { "Страх" }, verticalLabelPosition = Position.Vertical.Top ) }, remember { HorizontalLine( y = { 70.toDouble() }, - line = LineComponent(fill(Green2), 2f), + line = LineComponent(fill(Green2), 1f), labelComponent = TextComponent( background = shapeComponent( @@ -258,7 +249,7 @@ fun CryptoScreen() { ) ), ), - label = { "Greed" }, + label = { "Жадность" }, verticalLabelPosition = Position.Vertical.Bottom ) } @@ -267,13 +258,16 @@ fun CryptoScreen() { modelProducer = modelProducer, ) /* Fear Greed Chart End */ + Spacer(modifier = Modifier.height(16.dp)) HorizontalDivider(thickness = 2.dp) + Spacer(modifier = Modifier.height(16.dp)) Text( - "Данные о Биткойне", + "Данные о Биткоине", modifier = Modifier .align(alignment = Alignment.CenterHorizontally), fontSize = 24.sp ) + Spacer(modifier = Modifier.height(16.dp)) val formatter = DecimalFormat("0.00") Text("Текущая цена: \n \$ ${formatter.format(bitcoinTicker.priceUsd.toFloat())}\n") Text("Суточный оборот: \n \$ ${bitcoinTicker.volume24hUsd}\n") @@ -293,12 +287,14 @@ fun CryptoScreen() { Text("Время последнего обновления: \n ${humanDate}\n") HorizontalDivider(thickness = 2.dp) + Spacer(modifier = Modifier.height(16.dp)) Text( "Глобальные данные", modifier = Modifier .align(alignment = Alignment.CenterHorizontally), fontSize = 24.sp ) + Spacer(modifier = Modifier.height(16.dp)) Text("Общая капитализация крипторынка: \n \$ ${globalData.totalMarketCapUsd}\n") Text("Всего тикеров: \n ${globalData.activeCryptocurrencies}\n") Text("Суточный оборот всех криптовалют: \n \$ ${globalData.total24hVolumeUsd}\n")