Merge pull request 'main' (#25) from main into pipeline-test
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				Gitea Android Builder / Build (push) Successful in 1m18s
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	Gitea Android Builder / Build (push) Successful in 1m18s
				
			Reviewed-on: #25
This commit is contained in:
		
							
								
								
									
										7
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										7
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @@ -1,12 +1,7 @@ | |||||||
| *.iml | *.iml | ||||||
| .gradle | .gradle | ||||||
| /local.properties | /local.properties | ||||||
| /.idea/caches | /.idea | ||||||
| /.idea/libraries |  | ||||||
| /.idea/modules.xml |  | ||||||
| /.idea/workspace.xml |  | ||||||
| /.idea/navEditor.xml |  | ||||||
| /.idea/assetWizardSettings.xml |  | ||||||
| .DS_Store | .DS_Store | ||||||
| /build | /build | ||||||
| /captures | /captures | ||||||
|   | |||||||
							
								
								
									
										3
									
								
								.idea/.gitignore
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								.idea/.gitignore
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -1,3 +0,0 @@ | |||||||
| # Default ignored files |  | ||||||
| /shelf/ |  | ||||||
| /workspace.xml |  | ||||||
							
								
								
									
										1
									
								
								.idea/.name
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										1
									
								
								.idea/.name
									
									
									
										generated
									
									
									
								
							| @@ -1 +0,0 @@ | |||||||
| Bitcoin summarizer |  | ||||||
							
								
								
									
										123
									
								
								.idea/codeStyles/Project.xml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										123
									
								
								.idea/codeStyles/Project.xml
									
									
									
										generated
									
									
									
								
							| @@ -1,123 +0,0 @@ | |||||||
| <component name="ProjectCodeStyleConfiguration"> |  | ||||||
|   <code_scheme name="Project" version="173"> |  | ||||||
|     <JetCodeStyleSettings> |  | ||||||
|       <option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" /> |  | ||||||
|     </JetCodeStyleSettings> |  | ||||||
|     <codeStyleSettings language="XML"> |  | ||||||
|       <option name="FORCE_REARRANGE_MODE" value="1" /> |  | ||||||
|       <indentOptions> |  | ||||||
|         <option name="CONTINUATION_INDENT_SIZE" value="4" /> |  | ||||||
|       </indentOptions> |  | ||||||
|       <arrangement> |  | ||||||
|         <rules> |  | ||||||
|           <section> |  | ||||||
|             <rule> |  | ||||||
|               <match> |  | ||||||
|                 <AND> |  | ||||||
|                   <NAME>xmlns:android</NAME> |  | ||||||
|                   <XML_ATTRIBUTE /> |  | ||||||
|                   <XML_NAMESPACE>^$</XML_NAMESPACE> |  | ||||||
|                 </AND> |  | ||||||
|               </match> |  | ||||||
|             </rule> |  | ||||||
|           </section> |  | ||||||
|           <section> |  | ||||||
|             <rule> |  | ||||||
|               <match> |  | ||||||
|                 <AND> |  | ||||||
|                   <NAME>xmlns:.*</NAME> |  | ||||||
|                   <XML_ATTRIBUTE /> |  | ||||||
|                   <XML_NAMESPACE>^$</XML_NAMESPACE> |  | ||||||
|                 </AND> |  | ||||||
|               </match> |  | ||||||
|               <order>BY_NAME</order> |  | ||||||
|             </rule> |  | ||||||
|           </section> |  | ||||||
|           <section> |  | ||||||
|             <rule> |  | ||||||
|               <match> |  | ||||||
|                 <AND> |  | ||||||
|                   <NAME>.*:id</NAME> |  | ||||||
|                   <XML_ATTRIBUTE /> |  | ||||||
|                   <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE> |  | ||||||
|                 </AND> |  | ||||||
|               </match> |  | ||||||
|             </rule> |  | ||||||
|           </section> |  | ||||||
|           <section> |  | ||||||
|             <rule> |  | ||||||
|               <match> |  | ||||||
|                 <AND> |  | ||||||
|                   <NAME>.*:name</NAME> |  | ||||||
|                   <XML_ATTRIBUTE /> |  | ||||||
|                   <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE> |  | ||||||
|                 </AND> |  | ||||||
|               </match> |  | ||||||
|             </rule> |  | ||||||
|           </section> |  | ||||||
|           <section> |  | ||||||
|             <rule> |  | ||||||
|               <match> |  | ||||||
|                 <AND> |  | ||||||
|                   <NAME>name</NAME> |  | ||||||
|                   <XML_ATTRIBUTE /> |  | ||||||
|                   <XML_NAMESPACE>^$</XML_NAMESPACE> |  | ||||||
|                 </AND> |  | ||||||
|               </match> |  | ||||||
|             </rule> |  | ||||||
|           </section> |  | ||||||
|           <section> |  | ||||||
|             <rule> |  | ||||||
|               <match> |  | ||||||
|                 <AND> |  | ||||||
|                   <NAME>style</NAME> |  | ||||||
|                   <XML_ATTRIBUTE /> |  | ||||||
|                   <XML_NAMESPACE>^$</XML_NAMESPACE> |  | ||||||
|                 </AND> |  | ||||||
|               </match> |  | ||||||
|             </rule> |  | ||||||
|           </section> |  | ||||||
|           <section> |  | ||||||
|             <rule> |  | ||||||
|               <match> |  | ||||||
|                 <AND> |  | ||||||
|                   <NAME>.*</NAME> |  | ||||||
|                   <XML_ATTRIBUTE /> |  | ||||||
|                   <XML_NAMESPACE>^$</XML_NAMESPACE> |  | ||||||
|                 </AND> |  | ||||||
|               </match> |  | ||||||
|               <order>BY_NAME</order> |  | ||||||
|             </rule> |  | ||||||
|           </section> |  | ||||||
|           <section> |  | ||||||
|             <rule> |  | ||||||
|               <match> |  | ||||||
|                 <AND> |  | ||||||
|                   <NAME>.*</NAME> |  | ||||||
|                   <XML_ATTRIBUTE /> |  | ||||||
|                   <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE> |  | ||||||
|                 </AND> |  | ||||||
|               </match> |  | ||||||
|               <order>ANDROID_ATTRIBUTE_ORDER</order> |  | ||||||
|             </rule> |  | ||||||
|           </section> |  | ||||||
|           <section> |  | ||||||
|             <rule> |  | ||||||
|               <match> |  | ||||||
|                 <AND> |  | ||||||
|                   <NAME>.*</NAME> |  | ||||||
|                   <XML_ATTRIBUTE /> |  | ||||||
|                   <XML_NAMESPACE>.*</XML_NAMESPACE> |  | ||||||
|                 </AND> |  | ||||||
|               </match> |  | ||||||
|               <order>BY_NAME</order> |  | ||||||
|             </rule> |  | ||||||
|           </section> |  | ||||||
|         </rules> |  | ||||||
|       </arrangement> |  | ||||||
|     </codeStyleSettings> |  | ||||||
|     <codeStyleSettings language="kotlin"> |  | ||||||
|       <option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" /> |  | ||||||
|     </codeStyleSettings> |  | ||||||
|   </code_scheme> |  | ||||||
| </component> |  | ||||||
							
								
								
									
										5
									
								
								.idea/codeStyles/codeStyleConfig.xml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										5
									
								
								.idea/codeStyles/codeStyleConfig.xml
									
									
									
										generated
									
									
									
								
							| @@ -1,5 +0,0 @@ | |||||||
| <component name="ProjectCodeStyleConfiguration"> |  | ||||||
|   <state> |  | ||||||
|     <option name="USE_PER_PROJECT_SETTINGS" value="true" /> |  | ||||||
|   </state> |  | ||||||
| </component> |  | ||||||
							
								
								
									
										6
									
								
								.idea/compiler.xml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										6
									
								
								.idea/compiler.xml
									
									
									
										generated
									
									
									
								
							| @@ -1,6 +0,0 @@ | |||||||
| <?xml version="1.0" encoding="UTF-8"?> |  | ||||||
| <project version="4"> |  | ||||||
|   <component name="CompilerConfiguration"> |  | ||||||
|     <bytecodeTargetLevel target="21" /> |  | ||||||
|   </component> |  | ||||||
| </project> |  | ||||||
							
								
								
									
										10
									
								
								.idea/deploymentTargetSelector.xml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										10
									
								
								.idea/deploymentTargetSelector.xml
									
									
									
										generated
									
									
									
								
							| @@ -1,10 +0,0 @@ | |||||||
| <?xml version="1.0" encoding="UTF-8"?> |  | ||||||
| <project version="4"> |  | ||||||
|   <component name="deploymentTargetSelector"> |  | ||||||
|     <selectionStates> |  | ||||||
|       <SelectionState runConfigName="app"> |  | ||||||
|         <option name="selectionMode" value="DROPDOWN" /> |  | ||||||
|       </SelectionState> |  | ||||||
|     </selectionStates> |  | ||||||
|   </component> |  | ||||||
| </project> |  | ||||||
							
								
								
									
										20
									
								
								.idea/gradle.xml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										20
									
								
								.idea/gradle.xml
									
									
									
										generated
									
									
									
								
							| @@ -1,20 +0,0 @@ | |||||||
| <?xml version="1.0" encoding="UTF-8"?> |  | ||||||
| <project version="4"> |  | ||||||
|   <component name="GradleMigrationSettings" migrationVersion="1" /> |  | ||||||
|   <component name="GradleSettings"> |  | ||||||
|     <option name="linkedExternalProjectsSettings"> |  | ||||||
|       <GradleProjectSettings> |  | ||||||
|         <option name="testRunner" value="CHOOSE_PER_TEST" /> |  | ||||||
|         <option name="externalProjectPath" value="$PROJECT_DIR$" /> |  | ||||||
|         <option name="gradleJvm" value="#GRADLE_LOCAL_JAVA_HOME" /> |  | ||||||
|         <option name="modules"> |  | ||||||
|           <set> |  | ||||||
|             <option value="$PROJECT_DIR$" /> |  | ||||||
|             <option value="$PROJECT_DIR$/app" /> |  | ||||||
|           </set> |  | ||||||
|         </option> |  | ||||||
|         <option name="resolveExternalAnnotations" value="false" /> |  | ||||||
|       </GradleProjectSettings> |  | ||||||
|     </option> |  | ||||||
|   </component> |  | ||||||
| </project> |  | ||||||
							
								
								
									
										6
									
								
								.idea/kotlinc.xml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										6
									
								
								.idea/kotlinc.xml
									
									
									
										generated
									
									
									
								
							| @@ -1,6 +0,0 @@ | |||||||
| <?xml version="1.0" encoding="UTF-8"?> |  | ||||||
| <project version="4"> |  | ||||||
|   <component name="KotlinJpsPluginSettings"> |  | ||||||
|     <option name="version" value="2.0.0" /> |  | ||||||
|   </component> |  | ||||||
| </project> |  | ||||||
							
								
								
									
										10
									
								
								.idea/migrations.xml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										10
									
								
								.idea/migrations.xml
									
									
									
										generated
									
									
									
								
							| @@ -1,10 +0,0 @@ | |||||||
| <?xml version="1.0" encoding="UTF-8"?> |  | ||||||
| <project version="4"> |  | ||||||
|   <component name="ProjectMigrations"> |  | ||||||
|     <option name="MigrateToGradleLocalJavaHome"> |  | ||||||
|       <set> |  | ||||||
|         <option value="$PROJECT_DIR$" /> |  | ||||||
|       </set> |  | ||||||
|     </option> |  | ||||||
|   </component> |  | ||||||
| </project> |  | ||||||
							
								
								
									
										10
									
								
								.idea/misc.xml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										10
									
								
								.idea/misc.xml
									
									
									
										generated
									
									
									
								
							| @@ -1,10 +0,0 @@ | |||||||
| <?xml version="1.0" encoding="UTF-8"?> |  | ||||||
| <project version="4"> |  | ||||||
|   <component name="ExternalStorageConfigurationManager" enabled="true" /> |  | ||||||
|   <component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="jbr-21" project-jdk-type="JavaSDK"> |  | ||||||
|     <output url="file://$PROJECT_DIR$/build/classes" /> |  | ||||||
|   </component> |  | ||||||
|   <component name="ProjectType"> |  | ||||||
|     <option name="id" value="Android" /> |  | ||||||
|   </component> |  | ||||||
| </project> |  | ||||||
							
								
								
									
										17
									
								
								.idea/runConfigurations.xml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										17
									
								
								.idea/runConfigurations.xml
									
									
									
										generated
									
									
									
								
							| @@ -1,17 +0,0 @@ | |||||||
| <?xml version="1.0" encoding="UTF-8"?> |  | ||||||
| <project version="4"> |  | ||||||
|   <component name="RunConfigurationProducerService"> |  | ||||||
|     <option name="ignoredProducers"> |  | ||||||
|       <set> |  | ||||||
|         <option value="com.intellij.execution.junit.AbstractAllInDirectoryConfigurationProducer" /> |  | ||||||
|         <option value="com.intellij.execution.junit.AllInPackageConfigurationProducer" /> |  | ||||||
|         <option value="com.intellij.execution.junit.PatternConfigurationProducer" /> |  | ||||||
|         <option value="com.intellij.execution.junit.TestInClassConfigurationProducer" /> |  | ||||||
|         <option value="com.intellij.execution.junit.UniqueIdConfigurationProducer" /> |  | ||||||
|         <option value="com.intellij.execution.junit.testDiscovery.JUnitTestDiscoveryConfigurationProducer" /> |  | ||||||
|         <option value="org.jetbrains.kotlin.idea.junit.KotlinJUnitRunConfigurationProducer" /> |  | ||||||
|         <option value="org.jetbrains.kotlin.idea.junit.KotlinPatternConfigurationProducer" /> |  | ||||||
|       </set> |  | ||||||
|     </option> |  | ||||||
|   </component> |  | ||||||
| </project> |  | ||||||
							
								
								
									
										6
									
								
								.idea/vcs.xml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										6
									
								
								.idea/vcs.xml
									
									
									
										generated
									
									
									
								
							| @@ -1,6 +0,0 @@ | |||||||
| <?xml version="1.0" encoding="UTF-8"?> |  | ||||||
| <project version="4"> |  | ||||||
|   <component name="VcsDirectoryMappings"> |  | ||||||
|     <mapping directory="$PROJECT_DIR$" vcs="Git" /> |  | ||||||
|   </component> |  | ||||||
| </project> |  | ||||||
| @@ -12,8 +12,8 @@ android { | |||||||
|         applicationId = "ru.vendetti.bitcoin_summarizer" |         applicationId = "ru.vendetti.bitcoin_summarizer" | ||||||
|         minSdk = 29 |         minSdk = 29 | ||||||
|         targetSdk = 35 |         targetSdk = 35 | ||||||
|         versionCode = 1 |         versionCode = 2 | ||||||
|         versionName = "1.0" |         versionName = "1.2" | ||||||
|  |  | ||||||
|         testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" |         testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -3,13 +3,13 @@ | |||||||
|     xmlns:tools="http://schemas.android.com/tools"> |     xmlns:tools="http://schemas.android.com/tools"> | ||||||
|     <uses-permission android:name="android.permission.INTERNET" /> |     <uses-permission android:name="android.permission.INTERNET" /> | ||||||
|     <application |     <application | ||||||
|         android:allowBackup="true" |         android:allowBackup="false" | ||||||
|         android:dataExtractionRules="@xml/data_extraction_rules" |         android:dataExtractionRules="@xml/data_extraction_rules" | ||||||
|         android:fullBackupContent="@xml/backup_rules" |         android:fullBackupContent="@xml/backup_rules" | ||||||
|         android:icon="@mipmap/ic_launcher" |         android:icon="@mipmap/ic_launcher" | ||||||
|         android:label="@string/app_name" |         android:label="@string/app_name" | ||||||
|         android:roundIcon="@mipmap/ic_launcher_round" |         android:roundIcon="@mipmap/ic_launcher_round" | ||||||
|         android:supportsRtl="true" |         android:supportsRtl="false" | ||||||
|         android:theme="@style/Theme.BitcoinSummarizer" |         android:theme="@style/Theme.BitcoinSummarizer" | ||||||
|         tools:targetApi="31"> |         tools:targetApi="31"> | ||||||
|         <activity |         <activity | ||||||
|   | |||||||
| @@ -7,5 +7,5 @@ data class GlobalResponse( | |||||||
|     @SerializedName("active_currencies") val activeCryptocurrencies: String = "", |     @SerializedName("active_currencies") val activeCryptocurrencies: String = "", | ||||||
|     @SerializedName("total_market_cap_usd") val totalMarketCapUsd: String = "", |     @SerializedName("total_market_cap_usd") val totalMarketCapUsd: String = "", | ||||||
|     @SerializedName("total_24h_volume_usd") val total24hVolumeUsd: 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" | ||||||
| ) | ) | ||||||
| @@ -4,12 +4,12 @@ import android.annotation.SuppressLint | |||||||
| import android.os.Bundle | import android.os.Bundle | ||||||
| import androidx.activity.ComponentActivity | import androidx.activity.ComponentActivity | ||||||
| import androidx.activity.compose.setContent | import androidx.activity.compose.setContent | ||||||
|  | import androidx.compose.foundation.background | ||||||
| import androidx.compose.foundation.layout.Box | import androidx.compose.foundation.layout.Box | ||||||
| import androidx.compose.foundation.layout.Column | import androidx.compose.foundation.layout.Column | ||||||
| import androidx.compose.foundation.layout.PaddingValues | import androidx.compose.foundation.layout.Spacer | ||||||
| import androidx.compose.foundation.layout.fillMaxSize | import androidx.compose.foundation.layout.height | ||||||
| import androidx.compose.foundation.layout.padding | import androidx.compose.foundation.layout.padding | ||||||
| import androidx.compose.foundation.magnifier |  | ||||||
| import androidx.compose.foundation.rememberScrollState | import androidx.compose.foundation.rememberScrollState | ||||||
| import androidx.compose.foundation.verticalScroll | import androidx.compose.foundation.verticalScroll | ||||||
| import androidx.compose.material.icons.Icons | import androidx.compose.material.icons.Icons | ||||||
| @@ -38,12 +38,14 @@ import androidx.compose.ui.graphics.Color | |||||||
| import androidx.compose.ui.input.nestedscroll.nestedScroll | import androidx.compose.ui.input.nestedscroll.nestedScroll | ||||||
| import androidx.compose.ui.text.style.TextOverflow | import androidx.compose.ui.text.style.TextOverflow | ||||||
| import androidx.compose.ui.tooling.preview.Preview | import androidx.compose.ui.tooling.preview.Preview | ||||||
| import androidx.compose.ui.unit.TextUnit |  | ||||||
| import androidx.compose.ui.unit.dp | import androidx.compose.ui.unit.dp | ||||||
| import androidx.compose.ui.unit.sp | import androidx.compose.ui.unit.sp | ||||||
| import com.patrykandpatrick.vico.compose.cartesian.CartesianChartHost | 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.rememberBottom | ||||||
| import com.patrykandpatrick.vico.compose.cartesian.axis.rememberStart | 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.layer.rememberLineCartesianLayer | ||||||
| import com.patrykandpatrick.vico.compose.cartesian.rememberCartesianChart | import com.patrykandpatrick.vico.compose.cartesian.rememberCartesianChart | ||||||
| import com.patrykandpatrick.vico.compose.cartesian.rememberVicoZoomState | import com.patrykandpatrick.vico.compose.cartesian.rememberVicoZoomState | ||||||
| @@ -51,18 +53,23 @@ import com.patrykandpatrick.vico.compose.common.component.rememberTextComponent | |||||||
| import com.patrykandpatrick.vico.compose.common.component.shapeComponent | import com.patrykandpatrick.vico.compose.common.component.shapeComponent | ||||||
| import com.patrykandpatrick.vico.compose.common.fill | import com.patrykandpatrick.vico.compose.common.fill | ||||||
| import com.patrykandpatrick.vico.compose.common.shape.rounded | 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.Zoom | ||||||
| import com.patrykandpatrick.vico.core.cartesian.axis.HorizontalAxis | import com.patrykandpatrick.vico.core.cartesian.axis.HorizontalAxis | ||||||
| import com.patrykandpatrick.vico.core.cartesian.axis.VerticalAxis | import com.patrykandpatrick.vico.core.cartesian.axis.VerticalAxis | ||||||
| import com.patrykandpatrick.vico.core.cartesian.data.CartesianChartModelProducer | 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.data.lineSeries | ||||||
| import com.patrykandpatrick.vico.core.cartesian.decoration.HorizontalLine | 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.Position | ||||||
| import com.patrykandpatrick.vico.core.common.component.LineComponent | import com.patrykandpatrick.vico.core.common.component.LineComponent | ||||||
| import com.patrykandpatrick.vico.core.common.component.TextComponent | import com.patrykandpatrick.vico.core.common.component.TextComponent | ||||||
| import com.patrykandpatrick.vico.core.common.shape.CorneredShape | import com.patrykandpatrick.vico.core.common.shape.CorneredShape | ||||||
| import ru.vendetti.bitcoin_summarizer.ui.theme.BitcoinSummarizerTheme | import ru.vendetti.bitcoin_summarizer.ui.theme.BitcoinSummarizerTheme | ||||||
| import java.text.DateFormat | import ru.vendetti.bitcoin_summarizer.ui.theme.Flame | ||||||
|  | import ru.vendetti.bitcoin_summarizer.ui.theme.Green2 | ||||||
|  | import java.text.DecimalFormat | ||||||
| import java.time.format.DateTimeFormatter | import java.time.format.DateTimeFormatter | ||||||
|  |  | ||||||
| class MainActivity : ComponentActivity() { | class MainActivity : ComponentActivity() { | ||||||
| @@ -76,7 +83,7 @@ class MainActivity : ComponentActivity() { | |||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
| @SuppressLint("MutableCollectionMutableState") | @SuppressLint("MutableCollectionMutableState", "SimpleDateFormat") | ||||||
| @OptIn(ExperimentalMaterial3Api::class) | @OptIn(ExperimentalMaterial3Api::class) | ||||||
| @Preview | @Preview | ||||||
| @Composable | @Composable | ||||||
| @@ -109,15 +116,24 @@ fun CryptoScreen() { | |||||||
|  |  | ||||||
|     LaunchedEffect(fearGreedDataList) { |     LaunchedEffect(fearGreedDataList) { | ||||||
|         modelProducer.runTransaction { |         modelProducer.runTransaction { | ||||||
|             var numberValues = Array<Int>(fearGreedDataList.count()) { index -> fearGreedDataList[index].value.toInt() } |             var numberValues = Array(fearGreedDataList.count()) { | ||||||
|  |                 index -> | ||||||
|  |                     fearGreedDataList[fearGreedDataList.count() - index - 1] | ||||||
|  |                         .value.toInt() | ||||||
|  |             } | ||||||
|  |  | ||||||
|             if(numberValues.isEmpty()) |             if(numberValues.isEmpty()) | ||||||
|                 numberValues = Array<Int>(1) {0} |                 numberValues = Array(1) {0} | ||||||
|  |  | ||||||
|             lineSeries { series(numberValues.toList()) } |             lineSeries { series(numberValues.toList()) } | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     val scrollBehavior = TopAppBarDefaults.enterAlwaysScrollBehavior(rememberTopAppBarState()) |     val scrollBehavior = TopAppBarDefaults.enterAlwaysScrollBehavior(rememberTopAppBarState()) | ||||||
|     val zoomState = rememberVicoZoomState(initialZoom = Zoom.x(fearGreedIndexDaysCount.toDouble())) |     val zoomState = rememberVicoZoomState( | ||||||
|  |         zoomEnabled = false, | ||||||
|  |         initialZoom = Zoom.x(fearGreedIndexDaysCount.toDouble())) | ||||||
|  |  | ||||||
|     // Отображаем результаты на странице |     // Отображаем результаты на странице | ||||||
|     Scaffold ( |     Scaffold ( | ||||||
|         modifier = Modifier |         modifier = Modifier | ||||||
| @@ -126,12 +142,15 @@ fun CryptoScreen() { | |||||||
|         topBar = { |         topBar = { | ||||||
|             MediumTopAppBar( |             MediumTopAppBar( | ||||||
|                 colors = TopAppBarDefaults.topAppBarColors( |                 colors = TopAppBarDefaults.topAppBarColors( | ||||||
|                     containerColor = MaterialTheme.colorScheme.primaryContainer, |                     containerColor = MaterialTheme.colorScheme.primary, | ||||||
|                     titleContentColor = MaterialTheme.colorScheme.primary, |                     scrolledContainerColor = MaterialTheme.colorScheme.primary, | ||||||
|  |                     titleContentColor = MaterialTheme.colorScheme.onPrimary, | ||||||
|  |                     navigationIconContentColor = MaterialTheme.colorScheme.onPrimary, | ||||||
|  |                     actionIconContentColor = MaterialTheme.colorScheme.onPrimary, | ||||||
|                 ), |                 ), | ||||||
|                 title = { |                 title = { | ||||||
|                     Text( |                     Text( | ||||||
|                         "Bitcoin Summarizer!", |                         "Bitcoin Summarizer", | ||||||
|                         maxLines = 1, |                         maxLines = 1, | ||||||
|                         overflow = TextOverflow.Ellipsis |                         overflow = TextOverflow.Ellipsis | ||||||
|                     ) |                     ) | ||||||
| @@ -159,7 +178,7 @@ fun CryptoScreen() { | |||||||
|     { innerPadding -> |     { innerPadding -> | ||||||
|         Box( |         Box( | ||||||
|             modifier = Modifier |             modifier = Modifier | ||||||
|                 .fillMaxSize() |                 .background(Color.Transparent) | ||||||
|                 .padding(innerPadding) |                 .padding(innerPadding) | ||||||
|                 .verticalScroll(rememberScrollState()) |                 .verticalScroll(rememberScrollState()) | ||||||
|         ) { |         ) { | ||||||
| @@ -171,49 +190,66 @@ fun CryptoScreen() { | |||||||
|                 CartesianChartHost( |                 CartesianChartHost( | ||||||
|                     zoomState = zoomState, |                     zoomState = zoomState, | ||||||
|                     chart = rememberCartesianChart( |                     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( |                         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( |                         bottomAxis = HorizontalAxis.rememberBottom( | ||||||
|                             titleComponent = rememberTextComponent(), |                             title = "последние $fearGreedIndexDaysCount дней", | ||||||
|                             title = "last $fearGreedIndexDaysCount days" |                             titleComponent = rememberTextComponent(MaterialTheme.colorScheme.onPrimary), | ||||||
|  |                             line = rememberAxisLineComponent(fill(MaterialTheme.colorScheme.onPrimary)), | ||||||
|  |                             label = rememberAxisLabelComponent(MaterialTheme.colorScheme.onPrimary) | ||||||
|                         ), |                         ), | ||||||
|                         decorations = listOf( |                         decorations = listOf( | ||||||
|                             remember { |                             remember { | ||||||
|                                 HorizontalLine( |                                 HorizontalLine( | ||||||
|                                     y = { 15.toDouble() }, |                                     y = { 25.toDouble() }, | ||||||
|                                     line = LineComponent(fill(Color.Red), 2f), |                                     line = LineComponent(fill(Flame), 1f), | ||||||
|                                     labelComponent = TextComponent( |                                     labelComponent = TextComponent( | ||||||
|                                         background = |                                         background = | ||||||
|                                         shapeComponent( |                                         shapeComponent( | ||||||
|                                             fill(Color.Red), |                                             fill(Flame), | ||||||
|                                             CorneredShape.rounded( |                                             CorneredShape.rounded( | ||||||
|                                                 bottomLeft = 4.dp, |                                                 topLeft = 4.dp, | ||||||
|                                                 bottomRight = 4.dp |                                                 topRight = 4.dp | ||||||
|                                             ) |                                             ) | ||||||
|                                         ), |                                         ), | ||||||
|                                     ), |                                     ), | ||||||
|                                     label = { "Fear" }, |                                     label = { "Страх" }, | ||||||
|                                     verticalLabelPosition = Position.Vertical.Top |                                     verticalLabelPosition = Position.Vertical.Top | ||||||
|                                 ) |                                 ) | ||||||
|                             }, |                             }, | ||||||
|                             remember { |                             remember { | ||||||
|                                 HorizontalLine( |                                 HorizontalLine( | ||||||
|                                     y = { 60.toDouble() }, |                                     y = { 70.toDouble() }, | ||||||
|                                     line = LineComponent(fill(Color.Green), 2f), |                                     line = LineComponent(fill(Green2), 1f), | ||||||
|                                     labelComponent = TextComponent( |                                     labelComponent = TextComponent( | ||||||
|                                         background = |                                         background = | ||||||
|                                         shapeComponent( |                                         shapeComponent( | ||||||
|                                             fill(Color.Green), |                                             fill(Green2), | ||||||
|                                             CorneredShape.rounded( |                                             CorneredShape.rounded( | ||||||
|                                                 bottomLeft = 4.dp, |                                                 bottomLeft = 4.dp, | ||||||
|                                                 bottomRight = 4.dp |                                                 bottomRight = 4.dp | ||||||
|                                             ) |                                             ) | ||||||
|                                         ), |                                         ), | ||||||
|                                     ), |                                     ), | ||||||
|                                     label = { "Greed" }, |                                     label = { "Жадность" }, | ||||||
|                                     verticalLabelPosition = Position.Vertical.Bottom |                                     verticalLabelPosition = Position.Vertical.Bottom | ||||||
|                                 ) |                                 ) | ||||||
|                             } |                             } | ||||||
| @@ -222,34 +258,47 @@ fun CryptoScreen() { | |||||||
|                     modelProducer = modelProducer, |                     modelProducer = modelProducer, | ||||||
|                 ) |                 ) | ||||||
|                 /* Fear Greed Chart End */ |                 /* Fear Greed Chart End */ | ||||||
|  |                 Spacer(modifier = Modifier.height(16.dp)) | ||||||
|                 HorizontalDivider(thickness = 2.dp) |                 HorizontalDivider(thickness = 2.dp) | ||||||
|  |                 Spacer(modifier = Modifier.height(16.dp)) | ||||||
|                 Text( |                 Text( | ||||||
|                     "Данные о Биткойне", |                     "Данные о Биткоине", | ||||||
|                     modifier = Modifier |                     modifier = Modifier | ||||||
|                         .align(alignment = Alignment.CenterHorizontally), |                         .align(alignment = Alignment.CenterHorizontally), | ||||||
|                     fontSize = 24.sp |                     fontSize = 24.sp | ||||||
|                 ) |                 ) | ||||||
|                 Text("Текущая цена: \n ${bitcoinTicker.priceUsd}\n") |                 Spacer(modifier = Modifier.height(16.dp)) | ||||||
|                 Text("Суточный оборот: \n ${bitcoinTicker.volume24hUsd}\n") |                 val formatter = DecimalFormat("0.00") | ||||||
|                 Text("Капитализация: \n ${bitcoinTicker.marketCapUsd}\n") |                 Text("Текущая цена: \n \$ ${formatter.format(bitcoinTicker.priceUsd.toFloat())}\n") | ||||||
|  |                 Text("Суточный оборот: \n \$ ${bitcoinTicker.volume24hUsd}\n") | ||||||
|  |                 Text("Капитализация: \n \$ ${bitcoinTicker.marketCapUsd}\n") | ||||||
|                 Text( |                 Text( | ||||||
|                     "Изменение курса за: " + |                     "Изменение курса за: " + | ||||||
|                             "\n Сутки: ${bitcoinTicker.percentChange24h} " + |                             "\n Сутки: ${formatter.format(bitcoinTicker.percentChange24h.toFloat())}% " + | ||||||
|                             "\n Неделю: ${bitcoinTicker.percentChange7d}\n" |                             "\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) |                 HorizontalDivider(thickness = 2.dp) | ||||||
|  |                 Spacer(modifier = Modifier.height(16.dp)) | ||||||
|                 Text( |                 Text( | ||||||
|                     "Глобальные данные", |                     "Глобальные данные", | ||||||
|                     modifier = Modifier |                     modifier = Modifier | ||||||
|                         .align(alignment = Alignment.CenterHorizontally), |                         .align(alignment = Alignment.CenterHorizontally), | ||||||
|                     fontSize = 24.sp |                     fontSize = 24.sp | ||||||
|                 ) |                 ) | ||||||
|                 Text("Общая капитализация крипторынка: \n ${globalData.totalMarketCapUsd}\n") |                 Spacer(modifier = Modifier.height(16.dp)) | ||||||
|                 Text("Всего видов криптовалют: \n ${globalData.activeCryptocurrencies}\n") |                 Text("Общая капитализация крипторынка: \n \$ ${globalData.totalMarketCapUsd}\n") | ||||||
|                 Text("Суточный оборот других криптовалют: \n ${globalData.total24hVolumeUsd}\n") |                 Text("Всего тикеров: \n ${globalData.activeCryptocurrencies}\n") | ||||||
|                 Text("Процент доминации Биткоина: \n ${globalData.bitcoinPercentageOfMarketCap}\n") |                 Text("Суточный оборот всех криптовалют: \n \$ ${globalData.total24hVolumeUsd}\n") | ||||||
|  |                 Text("Процент доминации Биткоина: \n ${formatter.format(globalData.bitcoinPercentageOfMarketCap.toFloat())}%\n") | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -11,15 +11,15 @@ data class TickerData( | |||||||
|     val name: String = "", |     val name: String = "", | ||||||
|     val symbol: String = "", |     val symbol: String = "", | ||||||
|     val rank: String = "", |     val rank: String = "", | ||||||
|     @SerializedName("price_usd") val priceUsd: String = "", |     @SerializedName("price_usd") val priceUsd: String = "0.0", | ||||||
|     @SerializedName("price_btc") val priceBtc: String = "", |     @SerializedName("price_btc") val priceBtc: String = "0.0", | ||||||
|     @SerializedName("24h_volume_usd") val volume24hUsd: String = "", |     @SerializedName("24h_volume_usd") val volume24hUsd: String = "0", | ||||||
|     @SerializedName("market_cap_usd") val marketCapUsd: String = "", |     @SerializedName("market_cap_usd") val marketCapUsd: String = "0", | ||||||
|     @SerializedName("available_supply") val availableSupply: String = "", |     @SerializedName("available_supply") val availableSupply: String = "0", | ||||||
|     @SerializedName("total_supply") val totalSupply: String = "", |     @SerializedName("total_supply") val totalSupply: String = "0", | ||||||
|     @SerializedName("max_supply") val maxSupply: String? = "", |     @SerializedName("max_supply") val maxSupply: String? = "0", | ||||||
|     @SerializedName("percent_change_1h") val percentChange1h: String = "", |     @SerializedName("percent_change_1h") val percentChange1h: String = "0", | ||||||
|     @SerializedName("percent_change_24h") val percentChange24h: String = "", |     @SerializedName("percent_change_24h") val percentChange24h: String = "0.0", | ||||||
|     @SerializedName("percent_change_7d") val percentChange7d: String = "", |     @SerializedName("percent_change_7d") val percentChange7d: String = "0.0", | ||||||
|     @SerializedName("last_updated") val lastUpdated: String = "" |     @SerializedName("last_updated") val lastUpdated: String = "" | ||||||
| ) | ) | ||||||
| @@ -9,3 +9,11 @@ val Pink80 = Color(0xFFEFB8C8) | |||||||
| val Purple40 = Color(0xFF6650a4) | val Purple40 = Color(0xFF6650a4) | ||||||
| val PurpleGrey40 = Color(0xFF625b71) | val PurpleGrey40 = Color(0xFF625b71) | ||||||
| val Pink40 = Color(0xFF7D5260) | 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) | ||||||
| @@ -9,43 +9,45 @@ import androidx.compose.material3.dynamicDarkColorScheme | |||||||
| import androidx.compose.material3.dynamicLightColorScheme | import androidx.compose.material3.dynamicLightColorScheme | ||||||
| import androidx.compose.material3.lightColorScheme | import androidx.compose.material3.lightColorScheme | ||||||
| import androidx.compose.runtime.Composable | import androidx.compose.runtime.Composable | ||||||
|  | import androidx.compose.ui.graphics.Color | ||||||
| import androidx.compose.ui.platform.LocalContext | import androidx.compose.ui.platform.LocalContext | ||||||
|  |  | ||||||
| private val DarkColorScheme = darkColorScheme( | private val DarkColorScheme = darkColorScheme( | ||||||
|     primary = Purple80, |     primary = RaisinBlack, | ||||||
|     secondary = PurpleGrey80, |     secondary = DarkPurple, | ||||||
|     tertiary = Pink80 |     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( | private val LightColorScheme = lightColorScheme( | ||||||
|     primary = Purple40, |     primary = HunyadiYellow, | ||||||
|     secondary = PurpleGrey40, |     secondary = Flame, | ||||||
|     tertiary = Pink40 |     tertiary = EnglishViolet, | ||||||
|  |  | ||||||
|     /* Other default colors to override |     // Other default colors to override | ||||||
|     background = Color(0xFFFFFBFE), |     background = Color.White, | ||||||
|     surface = Color(0xFFFFFBFE), |     surface = Color(0xFFFFFBFE), | ||||||
|     onPrimary = Color.White, |     onPrimary = RaisinBlack, | ||||||
|     onSecondary = Color.White, |     onSecondary = Color.White, | ||||||
|     onTertiary = Color.White, |     onTertiary = Color.White, | ||||||
|     onBackground = Color(0xFF1C1B1F), |     onBackground = RaisinBlack, | ||||||
|     onSurface = Color(0xFF1C1B1F), |     onSurface = Color(0xFF1C1B1F), | ||||||
|     */ |  | ||||||
| ) | ) | ||||||
|  |  | ||||||
| @Composable | @Composable | ||||||
| fun BitcoinSummarizerTheme( | fun BitcoinSummarizerTheme( | ||||||
|     darkTheme: Boolean = isSystemInDarkTheme(), |     darkTheme: Boolean = isSystemInDarkTheme(), | ||||||
|     // Dynamic color is available on Android 12+ |  | ||||||
|     dynamicColor: Boolean = true, |  | ||||||
|     content: @Composable () -> Unit |     content: @Composable () -> Unit | ||||||
| ) { | ) { | ||||||
|     val colorScheme = when { |     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 |         darkTheme -> DarkColorScheme | ||||||
|         else -> LightColorScheme |         else -> LightColorScheme | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -1,13 +1,13 @@ | |||||||
| [versions] | [versions] | ||||||
| agp = "8.8.2" | agp = "8.9.0" | ||||||
| converterGson = "2.9.0" | converterGson = "2.9.0" | ||||||
| kotlin = "2.0.0" | kotlin = "2.0.0" | ||||||
| coreKtx = "1.15.0" | coreKtx = "1.15.0" | ||||||
| junit = "4.13.2" | junit = "4.13.2" | ||||||
| junitVersion = "1.2.1" | junitVersion = "1.2.1" | ||||||
| espressoCore = "3.6.1" | espressoCore = "3.6.1" | ||||||
| kotlinxCoroutinesAndroid = "1.7.3" | kotlinxCoroutinesAndroid = "1.10.1" | ||||||
| kotlinxCoroutinesCore = "1.7.3" | kotlinxCoroutinesCore = "1.10.1" | ||||||
| lifecycleRuntimeKtx = "2.8.7" | lifecycleRuntimeKtx = "2.8.7" | ||||||
| activityCompose = "1.10.1" | activityCompose = "1.10.1" | ||||||
| composeBom = "2025.02.00" | composeBom = "2025.02.00" | ||||||
|   | |||||||
							
								
								
									
										2
									
								
								gradle/wrapper/gradle-wrapper.properties
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								gradle/wrapper/gradle-wrapper.properties
									
									
									
									
										vendored
									
									
								
							| @@ -1,6 +1,6 @@ | |||||||
| #Wed Feb 26 23:45:23 YEKT 2025 | #Wed Feb 26 23:45:23 YEKT 2025 | ||||||
| distributionBase=GRADLE_USER_HOME | distributionBase=GRADLE_USER_HOME | ||||||
| distributionPath=wrapper/dists | 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 | zipStoreBase=GRADLE_USER_HOME | ||||||
| zipStorePath=wrapper/dists | zipStorePath=wrapper/dists | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user