Compare commits
70 Commits
30110f17aa
...
1.4
Author | SHA1 | Date | |
---|---|---|---|
dbb9dee02b | |||
![]() |
ed305ffeba | ||
d72cd46830 | |||
![]() |
30102eb8aa | ||
289472d4c9 | |||
![]() |
70c6eb0834 | ||
fc1cdfea0a | |||
4edf0f7352 | |||
5529b3dafc | |||
087b732fa5 | |||
08df502b1f | |||
28196510a3 | |||
3691477e92 | |||
580c5b6611 | |||
8f0ffb7041 | |||
0494efc2ad | |||
![]() |
09871e8727 | ||
d220a03a89 | |||
95b2c1e70b | |||
4005a39696 | |||
407a5d32a5 | |||
81ab379e0e | |||
5a4d30b9f8 | |||
5c92f74ceb | |||
0906b95273 | |||
4c9c7a3aa4 | |||
07ad6cb59d | |||
fcd27175ac | |||
a9c5282bdc | |||
52386c1987 | |||
fb59407f8b | |||
1261b80346 | |||
a1b7569ef0 | |||
d1bc545a07 | |||
9c184c08a8 | |||
186f1e693c | |||
3e6e44c4b3 | |||
da80ba3abd | |||
f05f4fbbad | |||
91a8b0380b | |||
3b196de1d8 | |||
b4beaf4f94 | |||
85c9bd50cd | |||
e6e9d7e082 | |||
d3d7bd391b | |||
3142cd79f6 | |||
e6d8a5b7aa | |||
821162964b | |||
fa0905486a | |||
c0d5908a6e | |||
d0598853bd | |||
3a62d99c40 | |||
9dfdd328db | |||
286109dc38 | |||
fd77fbd97e | |||
69d8ae9d7a | |||
08bdb6f481 | |||
fc9f054dec | |||
f33906b965 | |||
be208912b7 | |||
2f7a94b5de | |||
b42487feba | |||
9f0d1de386 | |||
a77610c285 | |||
0c182b0c63 | |||
a3b0dc9abe | |||
60742d3aff | |||
9874a208fa | |||
dc3539ce39 | |||
1fad039339 |
40
.gitea/workflows/build.yaml
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
name: Gitea Android Builder
|
||||||
|
run-name: ${{ gitea.actor }} is building an Android application
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- pipeline-test
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
Build:
|
||||||
|
runs-on: ubuntu-24.04
|
||||||
|
steps:
|
||||||
|
- name: Checkout the repo
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Set up JDK 23
|
||||||
|
uses: actions/setup-java@v4
|
||||||
|
with:
|
||||||
|
java-version: '23'
|
||||||
|
distribution: 'temurin'
|
||||||
|
- name: Set up Android SDK
|
||||||
|
uses: android-actions/setup-android@v3
|
||||||
|
- name: Grant execute permission for gradlew
|
||||||
|
run: chmod +x gradlew
|
||||||
|
- name: Cache Gradle packages
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.gradle/caches
|
||||||
|
~/.gradle/wrapper
|
||||||
|
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
|
||||||
|
- name: Build with Gradle
|
||||||
|
uses: gradle/gradle-build-action@v2
|
||||||
|
with:
|
||||||
|
arguments: assembleDebug
|
||||||
|
- name: Upload .apk Artifact
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: android-app-apk
|
||||||
|
path: app/build/outputs/apk/debug/*.apk
|
||||||
|
- name: Status
|
||||||
|
run: echo "This job's status is ${{ job.status }}."
|
40
.gitea/workflows/debug.yaml
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
name: Gitea Android Builder
|
||||||
|
run-name: ${{ gitea.actor }} is building an Android application
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "*"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
Build:
|
||||||
|
runs-on: ubuntu-24.04
|
||||||
|
steps:
|
||||||
|
- name: Checkout the repo
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Set up JDK 23
|
||||||
|
uses: actions/setup-java@v4
|
||||||
|
with:
|
||||||
|
java-version: '23'
|
||||||
|
distribution: 'temurin'
|
||||||
|
- name: Set up Android SDK
|
||||||
|
uses: android-actions/setup-android@v3
|
||||||
|
- name: Grant execute permission for gradlew
|
||||||
|
run: chmod +x gradlew
|
||||||
|
- name: Cache Gradle packages
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.gradle/caches
|
||||||
|
~/.gradle/wrapper
|
||||||
|
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
|
||||||
|
- name: Build with Gradle
|
||||||
|
uses: gradle/gradle-build-action@v2
|
||||||
|
with:
|
||||||
|
arguments: assembleDebug
|
||||||
|
- name: Upload .apk Artifact
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: android-app-apk
|
||||||
|
path: app/build/outputs/apk/debug/*.apk
|
||||||
|
- name: Status
|
||||||
|
run: echo "This job's status is ${{ job.status }}."
|
10
.gitignore
vendored
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
*.iml
|
||||||
|
.gradle
|
||||||
|
/local.properties
|
||||||
|
/.idea
|
||||||
|
.DS_Store
|
||||||
|
/build
|
||||||
|
/captures
|
||||||
|
.externalNativeBuild
|
||||||
|
.cxx
|
||||||
|
local.properties
|
@@ -1,3 +1,5 @@
|
|||||||
# bitcoin-summarizer
|
# bitcoin-summarizer
|
||||||
|
|
||||||
Open Source app that uses alternative.me API to check Bitcoin info
|
Open Source app that uses alternative.me API to check Bitcoin info
|
||||||
|
|
||||||
|
:3
|
1
app/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/build
|
70
app/build.gradle.kts
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
|
||||||
|
plugins {
|
||||||
|
alias(libs.plugins.android.application)
|
||||||
|
alias(libs.plugins.kotlin.android)
|
||||||
|
alias(libs.plugins.kotlin.compose)
|
||||||
|
}
|
||||||
|
|
||||||
|
android {
|
||||||
|
namespace = "ru.vendetti.bitcoin_summarizer"
|
||||||
|
compileSdk = 35
|
||||||
|
|
||||||
|
defaultConfig {
|
||||||
|
applicationId = "ru.vendetti.bitcoin_summarizer"
|
||||||
|
minSdk = 29
|
||||||
|
targetSdk = 35
|
||||||
|
versionCode = 2
|
||||||
|
versionName = "1.2"
|
||||||
|
|
||||||
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
}
|
||||||
|
|
||||||
|
buildTypes {
|
||||||
|
release {
|
||||||
|
isMinifyEnabled = false
|
||||||
|
proguardFiles(
|
||||||
|
getDefaultProguardFile("proguard-android-optimize.txt"),
|
||||||
|
"proguard-rules.pro"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility = JavaVersion.VERSION_11
|
||||||
|
targetCompatibility = JavaVersion.VERSION_11
|
||||||
|
}
|
||||||
|
kotlinOptions {
|
||||||
|
jvmTarget = "11"
|
||||||
|
}
|
||||||
|
buildFeatures {
|
||||||
|
compose = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
|
||||||
|
implementation(libs.androidx.core.ktx)
|
||||||
|
implementation(libs.androidx.lifecycle.runtime.ktx)
|
||||||
|
implementation(libs.androidx.activity.compose)
|
||||||
|
implementation(platform(libs.androidx.compose.bom))
|
||||||
|
implementation(libs.androidx.ui)
|
||||||
|
implementation(libs.androidx.ui.graphics)
|
||||||
|
implementation(libs.androidx.ui.tooling.preview)
|
||||||
|
implementation(libs.androidx.material3)
|
||||||
|
implementation(libs.androidx.fragment.ktx)
|
||||||
|
testImplementation(libs.junit)
|
||||||
|
androidTestImplementation(libs.androidx.junit)
|
||||||
|
androidTestImplementation(libs.androidx.espresso.core)
|
||||||
|
androidTestImplementation(platform(libs.androidx.compose.bom))
|
||||||
|
androidTestImplementation(libs.androidx.ui.test.junit4)
|
||||||
|
debugImplementation(libs.androidx.ui.tooling)
|
||||||
|
debugImplementation(libs.androidx.ui.test.manifest)
|
||||||
|
|
||||||
|
implementation(libs.retrofit)
|
||||||
|
implementation(libs.converter.gson)
|
||||||
|
implementation(libs.kotlinx.coroutines.android)
|
||||||
|
implementation(libs.kotlinx.coroutines.core)
|
||||||
|
implementation(libs.vico.compose.m3)
|
||||||
|
implementation(libs.cicerone)
|
||||||
|
implementation(libs.androidx.datastore)
|
||||||
|
|
||||||
|
}
|
21
app/proguard-rules.pro
vendored
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
# Add project specific ProGuard rules here.
|
||||||
|
# You can control the set of applied configuration files using the
|
||||||
|
# proguardFiles setting in build.gradle.
|
||||||
|
#
|
||||||
|
# For more details, see
|
||||||
|
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||||
|
|
||||||
|
# If your project uses WebView with JS, uncomment the following
|
||||||
|
# and specify the fully qualified class name to the JavaScript interface
|
||||||
|
# class:
|
||||||
|
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||||
|
# public *;
|
||||||
|
#}
|
||||||
|
|
||||||
|
# Uncomment this to preserve the line number information for
|
||||||
|
# debugging stack traces.
|
||||||
|
#-keepattributes SourceFile,LineNumberTable
|
||||||
|
|
||||||
|
# If you keep the line number information, uncomment this to
|
||||||
|
# hide the original source file name.
|
||||||
|
#-renamesourcefileattribute SourceFile
|
@@ -0,0 +1,24 @@
|
|||||||
|
package ru.vendetti.bitcoin_summarizer
|
||||||
|
|
||||||
|
import androidx.test.platform.app.InstrumentationRegistry
|
||||||
|
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||||
|
|
||||||
|
import org.junit.Test
|
||||||
|
import org.junit.runner.RunWith
|
||||||
|
|
||||||
|
import org.junit.Assert.*
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instrumented test, which will execute on an Android device.
|
||||||
|
*
|
||||||
|
* See [testing documentation](http://d.android.com/tools/testing).
|
||||||
|
*/
|
||||||
|
@RunWith(AndroidJUnit4::class)
|
||||||
|
class ExampleInstrumentedTest {
|
||||||
|
@Test
|
||||||
|
fun useAppContext() {
|
||||||
|
// Context of the app under test.
|
||||||
|
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
|
||||||
|
assertEquals("ru.vendetti.bitcoin_summarizer", appContext.packageName)
|
||||||
|
}
|
||||||
|
}
|
28
app/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
<application
|
||||||
|
android:name=".App"
|
||||||
|
android:allowBackup="false"
|
||||||
|
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||||
|
android:fullBackupContent="@xml/backup_rules"
|
||||||
|
android:icon="@mipmap/ic_launcher"
|
||||||
|
android:label="@string/app_name"
|
||||||
|
android:roundIcon="@mipmap/ic_launcher_round"
|
||||||
|
android:supportsRtl="false"
|
||||||
|
android:theme="@style/Theme.BitcoinSummarizer"
|
||||||
|
tools:targetApi="31">
|
||||||
|
<activity
|
||||||
|
android:name=".MainActivity"
|
||||||
|
android:exported="true"
|
||||||
|
android:theme="@style/Theme.BitcoinSummarizer">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
||||||
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
</application>
|
||||||
|
|
||||||
|
</manifest>
|
BIN
app/src/main/ic_launcher-playstore.png
Normal file
After Width: | Height: | Size: 36 KiB |
@@ -0,0 +1,224 @@
|
|||||||
|
package ru.vendetti.bitcoin_summarizer
|
||||||
|
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import androidx.compose.foundation.Image
|
||||||
|
import androidx.compose.foundation.background
|
||||||
|
import androidx.compose.foundation.layout.Box
|
||||||
|
import androidx.compose.foundation.layout.Column
|
||||||
|
import androidx.compose.foundation.layout.Spacer
|
||||||
|
import androidx.compose.foundation.layout.height
|
||||||
|
import androidx.compose.foundation.layout.padding
|
||||||
|
import androidx.compose.foundation.layout.width
|
||||||
|
import androidx.compose.foundation.rememberScrollState
|
||||||
|
import androidx.compose.foundation.text.selection.SelectionContainer
|
||||||
|
import androidx.compose.foundation.verticalScroll
|
||||||
|
import androidx.compose.material.icons.Icons
|
||||||
|
import androidx.compose.material.icons.filled.Menu
|
||||||
|
import androidx.compose.material.icons.filled.MoreVert
|
||||||
|
import androidx.compose.material3.CenterAlignedTopAppBar
|
||||||
|
import androidx.compose.material3.DrawerValue
|
||||||
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||||
|
import androidx.compose.material3.HorizontalDivider
|
||||||
|
import androidx.compose.material3.Icon
|
||||||
|
import androidx.compose.material3.IconButton
|
||||||
|
import androidx.compose.material3.MaterialTheme
|
||||||
|
import androidx.compose.material3.MediumTopAppBar
|
||||||
|
import androidx.compose.material3.ModalNavigationDrawer
|
||||||
|
import androidx.compose.material3.Scaffold
|
||||||
|
import androidx.compose.material3.Text
|
||||||
|
import androidx.compose.material3.TopAppBarDefaults
|
||||||
|
import androidx.compose.material3.rememberDrawerState
|
||||||
|
import androidx.compose.material3.rememberTopAppBarState
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.runtime.rememberCoroutineScope
|
||||||
|
import androidx.compose.ui.Alignment
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
|
import androidx.compose.ui.input.nestedscroll.nestedScroll
|
||||||
|
import androidx.compose.ui.platform.ClipboardManager
|
||||||
|
import androidx.compose.ui.platform.ComposeView
|
||||||
|
import androidx.compose.ui.platform.LocalClipboardManager
|
||||||
|
import androidx.compose.ui.res.painterResource
|
||||||
|
import androidx.compose.ui.text.AnnotatedString
|
||||||
|
import androidx.compose.ui.text.ExperimentalTextApi
|
||||||
|
import androidx.compose.ui.text.LinkAnnotation
|
||||||
|
import androidx.compose.ui.text.SpanStyle
|
||||||
|
import androidx.compose.ui.text.TextLinkStyles
|
||||||
|
import androidx.compose.ui.text.buildAnnotatedString
|
||||||
|
import androidx.compose.ui.text.style.TextOverflow
|
||||||
|
import androidx.compose.ui.text.withLink
|
||||||
|
import androidx.compose.ui.text.withStyle
|
||||||
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
|
import androidx.compose.ui.unit.sp
|
||||||
|
import androidx.fragment.app.Fragment
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
|
import ru.vendetti.bitcoin_summarizer.ui.theme.BitcoinSummarizerTheme
|
||||||
|
import ru.vendetti.bitcoin_summarizer.ui.theme.Flame
|
||||||
|
|
||||||
|
class AboutFragment: Fragment() {
|
||||||
|
override fun onCreateView(
|
||||||
|
inflater: LayoutInflater,
|
||||||
|
container: ViewGroup?,
|
||||||
|
savedInstanceState: Bundle?
|
||||||
|
): View {
|
||||||
|
return inflater.inflate(R.layout.fragment_compose_view,
|
||||||
|
container,
|
||||||
|
false).apply {
|
||||||
|
findViewById<ComposeView>(R.id.compose_view).setContent {
|
||||||
|
BitcoinSummarizerTheme {
|
||||||
|
AboutComposable()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@OptIn(ExperimentalMaterial3Api::class, ExperimentalTextApi::class)
|
||||||
|
@Composable
|
||||||
|
@Preview
|
||||||
|
fun AboutComposable() {
|
||||||
|
val drawerState = rememberDrawerState(initialValue = DrawerValue.Closed)
|
||||||
|
val scope = rememberCoroutineScope()
|
||||||
|
|
||||||
|
ModalNavigationDrawer(
|
||||||
|
drawerState = drawerState,
|
||||||
|
drawerContent = {
|
||||||
|
MyHamburgerModal(ScreenKey.About)
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
Scaffold(
|
||||||
|
modifier = Modifier,
|
||||||
|
|
||||||
|
topBar = {
|
||||||
|
CenterAlignedTopAppBar(
|
||||||
|
colors = TopAppBarDefaults.topAppBarColors(
|
||||||
|
containerColor = MaterialTheme.colorScheme.primary,
|
||||||
|
scrolledContainerColor = MaterialTheme.colorScheme.primary,
|
||||||
|
titleContentColor = MaterialTheme.colorScheme.onPrimary,
|
||||||
|
navigationIconContentColor = MaterialTheme.colorScheme.onPrimary,
|
||||||
|
actionIconContentColor = MaterialTheme.colorScheme.onPrimary,
|
||||||
|
),
|
||||||
|
title = {
|
||||||
|
Text(
|
||||||
|
"About",
|
||||||
|
maxLines = 1,
|
||||||
|
overflow = TextOverflow.Ellipsis
|
||||||
|
)
|
||||||
|
},
|
||||||
|
navigationIcon = {
|
||||||
|
IconButton(onClick = {
|
||||||
|
scope.launch {
|
||||||
|
drawerState.apply {
|
||||||
|
if(isClosed) open() else close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}) {
|
||||||
|
Icon(
|
||||||
|
imageVector = Icons.Filled.Menu,
|
||||||
|
contentDescription = "Navigation hamburger menu"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
scrollBehavior = TopAppBarDefaults.pinnedScrollBehavior(rememberTopAppBarState())
|
||||||
|
)
|
||||||
|
},
|
||||||
|
)
|
||||||
|
{ innerPadding ->
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.background(Color.Transparent)
|
||||||
|
.padding(innerPadding)
|
||||||
|
.verticalScroll(rememberScrollState())
|
||||||
|
) {
|
||||||
|
Column(
|
||||||
|
modifier = Modifier
|
||||||
|
.padding(16.dp, 16.dp, 16.dp, 36.dp)
|
||||||
|
) {
|
||||||
|
Icon(
|
||||||
|
painter = painterResource(id = R.mipmap.ic_launcher_foreground),
|
||||||
|
contentDescription = null,
|
||||||
|
modifier = Modifier
|
||||||
|
.width(160.dp)
|
||||||
|
.height(160.dp)
|
||||||
|
.align(Alignment.CenterHorizontally)
|
||||||
|
)
|
||||||
|
|
||||||
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
|
Text(
|
||||||
|
"Репозиторий проекта",
|
||||||
|
modifier = Modifier
|
||||||
|
.align(alignment = Alignment.CenterHorizontally),
|
||||||
|
fontSize = 24.sp
|
||||||
|
)
|
||||||
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
|
|
||||||
|
val repositoryLinkString = buildAnnotatedString {
|
||||||
|
withLink(LinkAnnotation.Url(
|
||||||
|
url = "https://git.vendetti.ru/andy/bitcoin-summarizer/tags",
|
||||||
|
styles = TextLinkStyles(style = SpanStyle(color = Flame))
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
append("Ссылка на репозиторий")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Text(text = repositoryLinkString)
|
||||||
|
|
||||||
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
|
HorizontalDivider()
|
||||||
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
|
|
||||||
|
Text(
|
||||||
|
"Авторы",
|
||||||
|
modifier = Modifier
|
||||||
|
.align(alignment = Alignment.CenterHorizontally),
|
||||||
|
fontSize = 24.sp
|
||||||
|
)
|
||||||
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
|
|
||||||
|
Text("Студенты гр. 9ИСП-42-21, ГБПОУ УКРТБ")
|
||||||
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
|
|
||||||
|
Text("Васильев Андрей Дмитриевич - Back-end: CI/CD (Continuous Integration), Api interactions, Database interactions")
|
||||||
|
Spacer(modifier = Modifier.height(8.dp))
|
||||||
|
SelectionContainer {
|
||||||
|
Text("andy@vendetti.ru", color = Flame)
|
||||||
|
}
|
||||||
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
|
|
||||||
|
Text("Зубарев Артемий Альбертович - Front-end: Charts, App navigation (Cicerone)")
|
||||||
|
|
||||||
|
Spacer(modifier = Modifier.height(8.dp))
|
||||||
|
SelectionContainer {
|
||||||
|
Text("artemiy.work32@gmail.com", color = Flame)
|
||||||
|
}
|
||||||
|
|
||||||
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
|
HorizontalDivider()
|
||||||
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
|
|
||||||
|
Text(
|
||||||
|
"Используемый API",
|
||||||
|
modifier = Modifier
|
||||||
|
.align(alignment = Alignment.CenterHorizontally),
|
||||||
|
fontSize = 24.sp
|
||||||
|
)
|
||||||
|
|
||||||
|
val apiLinkString = buildAnnotatedString {
|
||||||
|
withLink(LinkAnnotation.Url(
|
||||||
|
url = "https://alternative.me/crypto/api/",
|
||||||
|
styles = TextLinkStyles(style = SpanStyle(color = Flame))
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
append("Ссылка на API")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Text(text = apiLinkString)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
23
app/src/main/java/ru/vendetti/bitcoin_summarizer/App.kt
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
package ru.vendetti.bitcoin_summarizer
|
||||||
|
|
||||||
|
import android.app.Application
|
||||||
|
import android.os.Debug
|
||||||
|
import android.util.Log
|
||||||
|
import com.github.terrakok.cicerone.Cicerone
|
||||||
|
|
||||||
|
class App : Application() {
|
||||||
|
private val cicerone = Cicerone.create()
|
||||||
|
val router get() = cicerone.router
|
||||||
|
val navigatorHolder get() = cicerone.getNavigatorHolder()
|
||||||
|
|
||||||
|
override fun onCreate() {
|
||||||
|
super.onCreate()
|
||||||
|
INSTANCE = this
|
||||||
|
Log.println(Log.DEBUG, "App", "Instance is $INSTANCE")
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
internal lateinit var INSTANCE: App
|
||||||
|
private set
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,22 @@
|
|||||||
|
package ru.vendetti.bitcoin_summarizer
|
||||||
|
|
||||||
|
import retrofit2.Response
|
||||||
|
import retrofit2.http.GET
|
||||||
|
import retrofit2.http.Query
|
||||||
|
|
||||||
|
// Retrofit-API-интерфейс
|
||||||
|
interface CryptoApiService {
|
||||||
|
// Получение индекса страха и жадности (по умолчанию за 30 дней)
|
||||||
|
@GET("fng/")
|
||||||
|
suspend fun getFearAndGreedIndex(
|
||||||
|
@Query("limit") limit: Int = 30
|
||||||
|
): Response<FearAndGreedResponse>
|
||||||
|
|
||||||
|
// Получение глобальной информации
|
||||||
|
@GET("v1/global/")
|
||||||
|
suspend fun getGlobalData(): Response<GlobalResponse>
|
||||||
|
|
||||||
|
// Получение данных Bitcoin
|
||||||
|
@GET("v1/ticker/bitcoin/")
|
||||||
|
suspend fun getBitcoinTicker(): Response<TickerResponse>
|
||||||
|
}
|
@@ -0,0 +1,521 @@
|
|||||||
|
package ru.vendetti.bitcoin_summarizer
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.pm.PackageManager
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.util.Log
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import androidx.activity.compose.rememberLauncherForActivityResult
|
||||||
|
import androidx.activity.result.contract.ActivityResultContracts
|
||||||
|
import androidx.compose.foundation.background
|
||||||
|
import androidx.compose.foundation.layout.Box
|
||||||
|
import androidx.compose.foundation.layout.Column
|
||||||
|
import androidx.compose.foundation.layout.Spacer
|
||||||
|
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.foundation.layout.wrapContentSize
|
||||||
|
import androidx.compose.foundation.rememberScrollState
|
||||||
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
|
import androidx.compose.foundation.verticalScroll
|
||||||
|
import androidx.compose.material.icons.Icons
|
||||||
|
import androidx.compose.material.icons.filled.Menu
|
||||||
|
import androidx.compose.material3.AlertDialog
|
||||||
|
import androidx.compose.material3.ButtonColors
|
||||||
|
import androidx.compose.material3.ButtonDefaults
|
||||||
|
import androidx.compose.material3.Card
|
||||||
|
import androidx.compose.material3.CenterAlignedTopAppBar
|
||||||
|
import androidx.compose.material3.DrawerValue
|
||||||
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||||
|
import androidx.compose.material3.HorizontalDivider
|
||||||
|
import androidx.compose.material3.Icon
|
||||||
|
import androidx.compose.material3.IconButton
|
||||||
|
import androidx.compose.material3.MaterialTheme
|
||||||
|
import androidx.compose.material3.ModalNavigationDrawer
|
||||||
|
import androidx.compose.material3.Scaffold
|
||||||
|
import androidx.compose.material3.Text
|
||||||
|
import androidx.compose.material3.TextButton
|
||||||
|
import androidx.compose.material3.TopAppBarDefaults
|
||||||
|
import androidx.compose.material3.rememberDrawerState
|
||||||
|
import androidx.compose.material3.rememberTopAppBarState
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.runtime.LaunchedEffect
|
||||||
|
import androidx.compose.runtime.getValue
|
||||||
|
import androidx.compose.runtime.mutableIntStateOf
|
||||||
|
import androidx.compose.runtime.mutableStateOf
|
||||||
|
import androidx.compose.runtime.remember
|
||||||
|
import androidx.compose.runtime.rememberCoroutineScope
|
||||||
|
import androidx.compose.runtime.setValue
|
||||||
|
import androidx.compose.ui.Alignment
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
|
import androidx.compose.ui.graphics.vector.ImageVector
|
||||||
|
import androidx.compose.ui.input.nestedscroll.nestedScroll
|
||||||
|
import androidx.compose.ui.platform.ComposeView
|
||||||
|
import androidx.compose.ui.platform.LocalContext
|
||||||
|
import androidx.compose.ui.text.style.TextAlign
|
||||||
|
import androidx.compose.ui.text.style.TextOverflow
|
||||||
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
|
import androidx.compose.ui.unit.sp
|
||||||
|
import androidx.compose.ui.window.Dialog
|
||||||
|
import androidx.core.content.ContextCompat
|
||||||
|
import androidx.fragment.app.Fragment
|
||||||
|
import com.google.gson.Gson
|
||||||
|
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.rememberVicoScrollState
|
||||||
|
import com.patrykandpatrick.vico.compose.cartesian.rememberVicoZoomState
|
||||||
|
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.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 kotlinx.coroutines.launch
|
||||||
|
import ru.vendetti.bitcoin_summarizer.ui.theme.BitcoinSummarizerTheme
|
||||||
|
import ru.vendetti.bitcoin_summarizer.ui.theme.Flame
|
||||||
|
import ru.vendetti.bitcoin_summarizer.ui.theme.Green2
|
||||||
|
import java.io.FileInputStream
|
||||||
|
import java.io.FileOutputStream
|
||||||
|
import java.lang.StringBuilder
|
||||||
|
import java.text.DecimalFormat
|
||||||
|
import java.time.Instant
|
||||||
|
import java.time.format.DateTimeFormatter
|
||||||
|
|
||||||
|
class CryptoFragment: Fragment() {
|
||||||
|
override fun onCreateView(
|
||||||
|
inflater: LayoutInflater,
|
||||||
|
container: ViewGroup?,
|
||||||
|
savedInstanceState: Bundle?
|
||||||
|
): View {
|
||||||
|
return inflater.inflate(R.layout.fragment_compose_view,
|
||||||
|
container,
|
||||||
|
false).apply {
|
||||||
|
findViewById<ComposeView>(R.id.compose_view).setContent {
|
||||||
|
BitcoinSummarizerTheme {
|
||||||
|
CryptoComposable()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun ShowAlertDialog(
|
||||||
|
onDismissRequest: () -> Unit,
|
||||||
|
onConfirmation: () -> Unit,
|
||||||
|
dialogTitle: String,
|
||||||
|
dialogText: String,
|
||||||
|
) {
|
||||||
|
AlertDialog(
|
||||||
|
icon = {},
|
||||||
|
title = {
|
||||||
|
Text(text = dialogTitle)
|
||||||
|
},
|
||||||
|
text = {
|
||||||
|
Text(text = dialogText)
|
||||||
|
},
|
||||||
|
onDismissRequest = {
|
||||||
|
onDismissRequest()
|
||||||
|
},
|
||||||
|
confirmButton = {},
|
||||||
|
dismissButton = {
|
||||||
|
TextButton(
|
||||||
|
onClick = {
|
||||||
|
onDismissRequest()
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
Text(
|
||||||
|
text = "Окей",
|
||||||
|
color = MaterialTheme.colorScheme.onPrimary
|
||||||
|
)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
containerColor = MaterialTheme.colorScheme.primary,
|
||||||
|
titleContentColor = MaterialTheme.colorScheme.onPrimary,
|
||||||
|
textContentColor = MaterialTheme.colorScheme.onPrimary,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressLint("MutableCollectionMutableState", "SimpleDateFormat")
|
||||||
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
|
@Preview
|
||||||
|
@Composable
|
||||||
|
fun CryptoComposable() {
|
||||||
|
val openAlertDialog1 = remember { mutableStateOf(false) }
|
||||||
|
val openAlertDialog2 = remember { mutableStateOf(false) }
|
||||||
|
|
||||||
|
// Создаем репозиторий для работы с API
|
||||||
|
val cryptoRepository = remember { CryptoRepository(RetrofitClient.apiService) }
|
||||||
|
// Состояния для хранения результатов запросов
|
||||||
|
var bitcoinTicker by remember { mutableStateOf(TickerData()) }
|
||||||
|
var globalData by remember { mutableStateOf(GlobalResponse()) }
|
||||||
|
var fearGreedDataList by remember { mutableStateOf(ArrayList<FearAndGreedData>()) }
|
||||||
|
|
||||||
|
var fearGreedIndexDaysCount by remember { mutableIntStateOf(30) }
|
||||||
|
|
||||||
|
val gson = Gson()
|
||||||
|
|
||||||
|
val context = LocalContext.current
|
||||||
|
|
||||||
|
when {
|
||||||
|
openAlertDialog1.value -> {
|
||||||
|
ShowAlertDialog(
|
||||||
|
onDismissRequest = {openAlertDialog1.value = false},
|
||||||
|
onConfirmation = {},
|
||||||
|
dialogTitle = "Внимание!",
|
||||||
|
dialogText = "Отсутствует интернет-подключение, загружаю сохраненные данные. " +
|
||||||
|
"" +
|
||||||
|
"Обратите внимание, что данные могут быть неактуальными.",
|
||||||
|
)
|
||||||
|
}
|
||||||
|
openAlertDialog2.value -> {
|
||||||
|
ShowAlertDialog(
|
||||||
|
onDismissRequest = {
|
||||||
|
openAlertDialog2.value = false
|
||||||
|
App.INSTANCE.router.exit()
|
||||||
|
},
|
||||||
|
onConfirmation = {},
|
||||||
|
dialogTitle = "Внимание!",
|
||||||
|
dialogText = "При первом подключении необходимо подключение к интернету!",
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Запускаем корутину для выполнения сетевых запросов
|
||||||
|
LaunchedEffect(fearGreedIndexDaysCount, context) {
|
||||||
|
try {
|
||||||
|
// Запрос Bitcoin Ticker
|
||||||
|
val tickerResponse = cryptoRepository.fetchBitcoinTicker()
|
||||||
|
bitcoinTicker = tickerResponse!!.first()
|
||||||
|
|
||||||
|
// Запрос глобальных данных
|
||||||
|
val globalResponse = cryptoRepository.fetchGlobalData()
|
||||||
|
globalData = globalResponse!!
|
||||||
|
|
||||||
|
// Запрос индекса страха и жадности
|
||||||
|
val fearResponse = cryptoRepository.fetchFearAndGreedData(fearGreedIndexDaysCount)
|
||||||
|
fearGreedDataList = fearResponse?.dataList as ArrayList<FearAndGreedData>
|
||||||
|
fearGreedDataList.reverse()
|
||||||
|
|
||||||
|
// *** Сохраняем на диск ***
|
||||||
|
// 1) Сбор данных в один класс
|
||||||
|
val fullStatistics = StatisticsFull(
|
||||||
|
FGI_list = fearGreedDataList,
|
||||||
|
TickerData = bitcoinTicker,
|
||||||
|
GlobalData = globalData,
|
||||||
|
)
|
||||||
|
|
||||||
|
// 2) Перевод класса в json-строку
|
||||||
|
val statisticsJsonString = gson.toJson(fullStatistics)
|
||||||
|
|
||||||
|
// 3) Сохранение в файл во внутреннем хранилище
|
||||||
|
val fos: FileOutputStream =
|
||||||
|
context.openFileOutput("statistics.txt", Context.MODE_PRIVATE)
|
||||||
|
fos.write(statisticsJsonString.toByteArray())
|
||||||
|
fos.flush()
|
||||||
|
fos.close()
|
||||||
|
}
|
||||||
|
catch (e: Exception) {
|
||||||
|
try {
|
||||||
|
// *** Загрузка данных из файла ***
|
||||||
|
// 1) Получение строки из файла
|
||||||
|
val fis: FileInputStream =
|
||||||
|
context.openFileInput("statistics.txt")
|
||||||
|
var a: Int
|
||||||
|
val temp = StringBuilder()
|
||||||
|
while (fis.read().also { a = it } != -1) {
|
||||||
|
temp.append(a.toChar())
|
||||||
|
}
|
||||||
|
|
||||||
|
// Показ предупреждения.
|
||||||
|
openAlertDialog1.value = true
|
||||||
|
|
||||||
|
val statisticsJsonString = temp.toString()
|
||||||
|
|
||||||
|
// 2) Перевод строки в класс
|
||||||
|
val statisticsFull = gson.fromJson(statisticsJsonString, StatisticsFull::class.java)
|
||||||
|
|
||||||
|
// 3) Распределение данных по переменным
|
||||||
|
bitcoinTicker = statisticsFull.TickerData
|
||||||
|
globalData = statisticsFull.GlobalData
|
||||||
|
fearGreedDataList = statisticsFull.FGI_list
|
||||||
|
}
|
||||||
|
catch (e: Exception) {
|
||||||
|
openAlertDialog2.value = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val modelProducer = remember { CartesianChartModelProducer() }
|
||||||
|
|
||||||
|
LaunchedEffect(fearGreedDataList) {
|
||||||
|
modelProducer.runTransaction {
|
||||||
|
var numberValues = Array(fearGreedDataList.count()) {
|
||||||
|
index ->
|
||||||
|
fearGreedDataList[index]
|
||||||
|
.value.toInt()
|
||||||
|
}
|
||||||
|
|
||||||
|
if(numberValues.isEmpty())
|
||||||
|
numberValues = Array(1) {0}
|
||||||
|
|
||||||
|
lineSeries { series(numberValues.toList()) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val scrollBehavior = TopAppBarDefaults.enterAlwaysScrollBehavior(rememberTopAppBarState())
|
||||||
|
|
||||||
|
// Отображаем результаты на странице
|
||||||
|
|
||||||
|
val drawerState = rememberDrawerState(initialValue = DrawerValue.Closed)
|
||||||
|
val scope = rememberCoroutineScope()
|
||||||
|
|
||||||
|
ModalNavigationDrawer(
|
||||||
|
drawerState = drawerState,
|
||||||
|
drawerContent = {
|
||||||
|
MyHamburgerModal(ScreenKey.Crypto)
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
Scaffold(
|
||||||
|
modifier = Modifier
|
||||||
|
.nestedScroll(scrollBehavior.nestedScrollConnection),
|
||||||
|
|
||||||
|
topBar = {
|
||||||
|
CenterAlignedTopAppBar(
|
||||||
|
colors = TopAppBarDefaults.topAppBarColors(
|
||||||
|
containerColor = MaterialTheme.colorScheme.primary,
|
||||||
|
scrolledContainerColor = MaterialTheme.colorScheme.primary,
|
||||||
|
titleContentColor = MaterialTheme.colorScheme.onPrimary,
|
||||||
|
navigationIconContentColor = MaterialTheme.colorScheme.onPrimary,
|
||||||
|
actionIconContentColor = MaterialTheme.colorScheme.onPrimary,
|
||||||
|
),
|
||||||
|
title = {
|
||||||
|
Text(
|
||||||
|
"Crypto statistics",
|
||||||
|
maxLines = 1,
|
||||||
|
overflow = TextOverflow.Ellipsis
|
||||||
|
)
|
||||||
|
},
|
||||||
|
navigationIcon = {
|
||||||
|
IconButton(onClick = {
|
||||||
|
scope.launch {
|
||||||
|
drawerState.apply {
|
||||||
|
if(isClosed) open() else close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}) {
|
||||||
|
Icon(
|
||||||
|
imageVector = Icons.Filled.Menu,
|
||||||
|
contentDescription = "Navigation hamburger menu"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
scrollBehavior = scrollBehavior
|
||||||
|
)
|
||||||
|
},
|
||||||
|
)
|
||||||
|
{ innerPadding ->
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.background(Color.Transparent)
|
||||||
|
.padding(innerPadding)
|
||||||
|
.verticalScroll(rememberScrollState())
|
||||||
|
) {
|
||||||
|
Column(
|
||||||
|
modifier = Modifier
|
||||||
|
.padding(16.dp, 16.dp, 16.dp, 36.dp)
|
||||||
|
) {
|
||||||
|
/* Fear Greed Chart Start */
|
||||||
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
|
Text(
|
||||||
|
"Индекс страха/жадности",
|
||||||
|
modifier = Modifier
|
||||||
|
.align(alignment = Alignment.CenterHorizontally),
|
||||||
|
fontSize = 24.sp
|
||||||
|
)
|
||||||
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
|
if (fearGreedDataList.count() > 1) {
|
||||||
|
CartesianChartHost(
|
||||||
|
zoomState = rememberVicoZoomState(
|
||||||
|
zoomEnabled = true,
|
||||||
|
initialZoom = Zoom.x(fearGreedIndexDaysCount.toDouble()),
|
||||||
|
),
|
||||||
|
scrollState = rememberVicoScrollState(scrollEnabled = true),
|
||||||
|
chart = rememberCartesianChart(
|
||||||
|
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(
|
||||||
|
title = "FGI",
|
||||||
|
titleComponent = rememberTextComponent(MaterialTheme.colorScheme.onPrimary),
|
||||||
|
line = rememberAxisLineComponent(fill(MaterialTheme.colorScheme.onPrimary)),
|
||||||
|
label = rememberAxisLabelComponent(MaterialTheme.colorScheme.onPrimary)
|
||||||
|
),
|
||||||
|
bottomAxis = HorizontalAxis.rememberBottom(
|
||||||
|
valueFormatter = { _, value, _ ->
|
||||||
|
val date = DateTimeFormatter.ISO_INSTANT
|
||||||
|
.format(Instant.ofEpochSecond(fearGreedDataList[value.toInt()].timestamp.toLong()))
|
||||||
|
val dateComponents = date.split("T")[0].split("-")
|
||||||
|
// returns dd.mm
|
||||||
|
"${dateComponents[2]}.${dateComponents[1]}"
|
||||||
|
},
|
||||||
|
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 = { 25.toDouble() },
|
||||||
|
line = LineComponent(fill(Flame), 1f),
|
||||||
|
labelComponent = TextComponent(
|
||||||
|
background =
|
||||||
|
shapeComponent(
|
||||||
|
fill(Flame),
|
||||||
|
CorneredShape.rounded(
|
||||||
|
topLeft = 4.dp,
|
||||||
|
topRight = 4.dp
|
||||||
|
)
|
||||||
|
),
|
||||||
|
),
|
||||||
|
label = { "Страх" },
|
||||||
|
verticalLabelPosition = Position.Vertical.Top
|
||||||
|
)
|
||||||
|
},
|
||||||
|
remember {
|
||||||
|
HorizontalLine(
|
||||||
|
y = { 70.toDouble() },
|
||||||
|
line = LineComponent(fill(Green2), 1f),
|
||||||
|
labelComponent = TextComponent(
|
||||||
|
background =
|
||||||
|
shapeComponent(
|
||||||
|
fill(Green2),
|
||||||
|
CorneredShape.rounded(
|
||||||
|
bottomLeft = 4.dp,
|
||||||
|
bottomRight = 4.dp
|
||||||
|
)
|
||||||
|
),
|
||||||
|
),
|
||||||
|
label = { "Жадность" },
|
||||||
|
verticalLabelPosition = Position.Vertical.Bottom
|
||||||
|
)
|
||||||
|
}
|
||||||
|
),
|
||||||
|
),
|
||||||
|
modelProducer = modelProducer,
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
Text("Загрузка...")
|
||||||
|
}
|
||||||
|
/* 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 decimalFormatter = DecimalFormat("0.00")
|
||||||
|
val largeNumberFormatter = DecimalFormat("#,###")
|
||||||
|
|
||||||
|
if (bitcoinTicker.lastUpdated.isNotEmpty()) {
|
||||||
|
Text("Текущая цена: \n \$ ${decimalFormatter.format(bitcoinTicker.priceUsd.toFloat())}\n")
|
||||||
|
Text("Суточный оборот: \n \$ ${largeNumberFormatter.format(bitcoinTicker.volume24hUsd.toFloat())}\n")
|
||||||
|
Text("Капитализация: \n \$ ${largeNumberFormatter.format(bitcoinTicker.marketCapUsd.toFloat())}\n")
|
||||||
|
Text(
|
||||||
|
"Изменение курса за: " +
|
||||||
|
"\n Сутки: ${decimalFormatter.format(bitcoinTicker.percentChange24h.toFloat())}% " +
|
||||||
|
"\n Неделю: ${decimalFormatter.format(bitcoinTicker.percentChange7d.toFloat())}%\n"
|
||||||
|
)
|
||||||
|
|
||||||
|
val humanDate = DateTimeFormatter.ISO_INSTANT
|
||||||
|
.format(Instant.ofEpochSecond(bitcoinTicker.lastUpdated.toLong()))
|
||||||
|
|
||||||
|
Text(
|
||||||
|
"Время последнего обновления: \n ${humanDate.split("T")[0]}, " +
|
||||||
|
"${
|
||||||
|
humanDate.split("T")[1].replace(
|
||||||
|
Regex(":[0-9]+[A-Z]"),
|
||||||
|
""
|
||||||
|
)
|
||||||
|
}\n"
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
Text("Загрузка...")
|
||||||
|
}
|
||||||
|
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))
|
||||||
|
if (globalData.totalMarketCapUsd.isNotEmpty()) {
|
||||||
|
Text(
|
||||||
|
"Общая капитализация крипторынка: \n \$ ${
|
||||||
|
largeNumberFormatter.format(
|
||||||
|
globalData.totalMarketCapUsd.toFloat()
|
||||||
|
)
|
||||||
|
}\n"
|
||||||
|
)
|
||||||
|
Text("Всего тикеров: \n ${globalData.activeCryptocurrencies}\n")
|
||||||
|
Text(
|
||||||
|
"Суточный оборот всех криптовалют: \n \$ ${
|
||||||
|
largeNumberFormatter.format(
|
||||||
|
globalData.total24hVolumeUsd.toFloat()
|
||||||
|
)
|
||||||
|
}\n"
|
||||||
|
)
|
||||||
|
Text("Процент доминации Биткоина: \n ${decimalFormatter.format(globalData.bitcoinPercentageOfMarketCap.toFloat())}%\n")
|
||||||
|
} else {
|
||||||
|
Text("Загрузка...")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,58 @@
|
|||||||
|
package ru.vendetti.bitcoin_summarizer
|
||||||
|
|
||||||
|
//Репозиторий для обработки запросов
|
||||||
|
class CryptoRepository(private val apiService: CryptoApiService) {
|
||||||
|
/**
|
||||||
|
* Запрашивает данные для Bitcoin-тикера
|
||||||
|
*/
|
||||||
|
suspend fun fetchBitcoinTicker(): TickerResponse? {
|
||||||
|
return try {
|
||||||
|
val response = apiService.getBitcoinTicker()
|
||||||
|
if (response.isSuccessful) {
|
||||||
|
response.body()
|
||||||
|
} else {
|
||||||
|
println("Ошибка запроса Bitcoin Ticker: ${response.code()}")
|
||||||
|
null
|
||||||
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
|
println("Exception при получении Bitcoin Ticker: ${e.localizedMessage}")
|
||||||
|
null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Запрашивает глобальные данные крипторынка
|
||||||
|
*/
|
||||||
|
suspend fun fetchGlobalData(): GlobalResponse? {
|
||||||
|
return try {
|
||||||
|
val response = apiService.getGlobalData()
|
||||||
|
if (response.isSuccessful) {
|
||||||
|
response.body()
|
||||||
|
} else {
|
||||||
|
println("Ошибка запроса Global Data: ${response.code()}")
|
||||||
|
null
|
||||||
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
|
println("Exception при получении Global Data: ${e.localizedMessage}")
|
||||||
|
null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Запрашивает индекс страха и жадности за указанный период (по умолчанию 30 дней)
|
||||||
|
*/
|
||||||
|
suspend fun fetchFearAndGreedData(limit: Int = 30): FearAndGreedResponse? {
|
||||||
|
return try {
|
||||||
|
val response = apiService.getFearAndGreedIndex(limit)
|
||||||
|
if (response.isSuccessful) {
|
||||||
|
response.body()
|
||||||
|
} else {
|
||||||
|
println("Ошибка запроса Fear & Greed Index: ${response.code()}")
|
||||||
|
null
|
||||||
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
|
println("Exception при получении Fear & Greed Index: ${e.localizedMessage}")
|
||||||
|
null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,23 @@
|
|||||||
|
package ru.vendetti.bitcoin_summarizer
|
||||||
|
|
||||||
|
import com.google.gson.annotations.SerializedName
|
||||||
|
|
||||||
|
// Обёртка для данных (тут вложенность есть и это API v2, а не v1, поэтому чуть сложнее структура, чем в GlobalResponse.kt)
|
||||||
|
data class FearAndGreedResponse(
|
||||||
|
@SerializedName("name")
|
||||||
|
val name: String,
|
||||||
|
@SerializedName("data")
|
||||||
|
val dataList: List<FearAndGreedData>
|
||||||
|
)
|
||||||
|
|
||||||
|
// Сами данные
|
||||||
|
data class FearAndGreedData(
|
||||||
|
@SerializedName("value")
|
||||||
|
val value: String,
|
||||||
|
@SerializedName("value_classification")
|
||||||
|
val valueClassification: String,
|
||||||
|
@SerializedName("timestamp")
|
||||||
|
val timestamp: String,
|
||||||
|
@SerializedName("time_until_update")
|
||||||
|
val timeUntilUpdate: String
|
||||||
|
)
|
@@ -0,0 +1,11 @@
|
|||||||
|
package ru.vendetti.bitcoin_summarizer
|
||||||
|
|
||||||
|
import com.google.gson.annotations.SerializedName
|
||||||
|
|
||||||
|
// Данные
|
||||||
|
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 = "0.0"
|
||||||
|
)
|
@@ -0,0 +1,126 @@
|
|||||||
|
package ru.vendetti.bitcoin_summarizer
|
||||||
|
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import androidx.compose.foundation.background
|
||||||
|
import androidx.compose.foundation.layout.Box
|
||||||
|
import androidx.compose.foundation.layout.Column
|
||||||
|
import androidx.compose.foundation.layout.padding
|
||||||
|
import androidx.compose.foundation.rememberScrollState
|
||||||
|
import androidx.compose.foundation.verticalScroll
|
||||||
|
import androidx.compose.material.icons.Icons
|
||||||
|
import androidx.compose.material.icons.filled.Menu
|
||||||
|
import androidx.compose.material.icons.filled.MoreVert
|
||||||
|
import androidx.compose.material3.CenterAlignedTopAppBar
|
||||||
|
import androidx.compose.material3.DrawerValue
|
||||||
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||||
|
import androidx.compose.material3.Icon
|
||||||
|
import androidx.compose.material3.IconButton
|
||||||
|
import androidx.compose.material3.MaterialTheme
|
||||||
|
import androidx.compose.material3.MediumTopAppBar
|
||||||
|
import androidx.compose.material3.ModalNavigationDrawer
|
||||||
|
import androidx.compose.material3.Scaffold
|
||||||
|
import androidx.compose.material3.Text
|
||||||
|
import androidx.compose.material3.TopAppBarDefaults
|
||||||
|
import androidx.compose.material3.rememberDrawerState
|
||||||
|
import androidx.compose.material3.rememberTopAppBarState
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.runtime.rememberCoroutineScope
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
|
import androidx.compose.ui.input.nestedscroll.nestedScroll
|
||||||
|
import androidx.compose.ui.platform.ComposeView
|
||||||
|
import androidx.compose.ui.text.style.TextOverflow
|
||||||
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
|
import androidx.fragment.app.Fragment
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
|
import ru.vendetti.bitcoin_summarizer.ui.theme.BitcoinSummarizerTheme
|
||||||
|
|
||||||
|
class LearnFragment: Fragment() {
|
||||||
|
override fun onCreateView(
|
||||||
|
inflater: LayoutInflater,
|
||||||
|
container: ViewGroup?,
|
||||||
|
savedInstanceState: Bundle?
|
||||||
|
): View {
|
||||||
|
return inflater.inflate(R.layout.fragment_compose_view,
|
||||||
|
container,
|
||||||
|
false).apply {
|
||||||
|
findViewById<ComposeView>(R.id.compose_view).setContent {
|
||||||
|
BitcoinSummarizerTheme {
|
||||||
|
LearnComposable()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
|
@Composable
|
||||||
|
@Preview
|
||||||
|
fun LearnComposable() {
|
||||||
|
val drawerState = rememberDrawerState(initialValue = DrawerValue.Closed)
|
||||||
|
val scope = rememberCoroutineScope()
|
||||||
|
|
||||||
|
ModalNavigationDrawer(
|
||||||
|
drawerState = drawerState,
|
||||||
|
drawerContent = {
|
||||||
|
MyHamburgerModal(ScreenKey.Learn)
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
Scaffold(
|
||||||
|
modifier = Modifier,
|
||||||
|
|
||||||
|
topBar = {
|
||||||
|
CenterAlignedTopAppBar(
|
||||||
|
colors = TopAppBarDefaults.topAppBarColors(
|
||||||
|
containerColor = MaterialTheme.colorScheme.primary,
|
||||||
|
scrolledContainerColor = MaterialTheme.colorScheme.primary,
|
||||||
|
titleContentColor = MaterialTheme.colorScheme.onPrimary,
|
||||||
|
navigationIconContentColor = MaterialTheme.colorScheme.onPrimary,
|
||||||
|
actionIconContentColor = MaterialTheme.colorScheme.onPrimary,
|
||||||
|
),
|
||||||
|
title = {
|
||||||
|
Text(
|
||||||
|
"Learn",
|
||||||
|
maxLines = 1,
|
||||||
|
overflow = TextOverflow.Ellipsis
|
||||||
|
)
|
||||||
|
},
|
||||||
|
navigationIcon = {
|
||||||
|
IconButton(onClick = {
|
||||||
|
scope.launch {
|
||||||
|
drawerState.apply {
|
||||||
|
if(isClosed) open() else close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}) {
|
||||||
|
Icon(
|
||||||
|
imageVector = Icons.Filled.Menu,
|
||||||
|
contentDescription = "Navigation hamburger menu"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
scrollBehavior = TopAppBarDefaults.pinnedScrollBehavior(rememberTopAppBarState())
|
||||||
|
)
|
||||||
|
},
|
||||||
|
)
|
||||||
|
{ innerPadding ->
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.background(Color.Transparent)
|
||||||
|
.padding(innerPadding)
|
||||||
|
.verticalScroll(rememberScrollState())
|
||||||
|
) {
|
||||||
|
Column (
|
||||||
|
modifier = Modifier
|
||||||
|
.padding(16.dp, 16.dp, 16.dp, 36.dp)
|
||||||
|
) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,99 @@
|
|||||||
|
package ru.vendetti.bitcoin_summarizer
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.widget.FrameLayout
|
||||||
|
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.Spacer
|
||||||
|
import androidx.compose.foundation.layout.height
|
||||||
|
import androidx.compose.foundation.layout.padding
|
||||||
|
import androidx.compose.foundation.rememberScrollState
|
||||||
|
import androidx.compose.foundation.verticalScroll
|
||||||
|
import androidx.compose.material.icons.Icons
|
||||||
|
import androidx.compose.material.icons.filled.Menu
|
||||||
|
import androidx.compose.material.icons.filled.MoreVert
|
||||||
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||||
|
import androidx.compose.material3.HorizontalDivider
|
||||||
|
import androidx.compose.material3.Icon
|
||||||
|
import androidx.compose.material3.IconButton
|
||||||
|
import androidx.compose.material3.MaterialTheme
|
||||||
|
import androidx.compose.material3.MediumTopAppBar
|
||||||
|
import androidx.compose.material3.Scaffold
|
||||||
|
import androidx.compose.material3.Text
|
||||||
|
import androidx.compose.material3.TopAppBarDefaults
|
||||||
|
import androidx.compose.material3.rememberTopAppBarState
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.runtime.LaunchedEffect
|
||||||
|
import androidx.compose.runtime.getValue
|
||||||
|
import androidx.compose.runtime.mutableIntStateOf
|
||||||
|
import androidx.compose.runtime.mutableStateOf
|
||||||
|
import androidx.compose.runtime.remember
|
||||||
|
import androidx.compose.runtime.setValue
|
||||||
|
import androidx.compose.ui.Alignment
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
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.dp
|
||||||
|
import androidx.compose.ui.unit.sp
|
||||||
|
import androidx.fragment.app.FragmentActivity
|
||||||
|
import com.github.terrakok.cicerone.androidx.AppNavigator
|
||||||
|
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.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.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.Flame
|
||||||
|
import ru.vendetti.bitcoin_summarizer.ui.theme.Green2
|
||||||
|
import java.text.DecimalFormat
|
||||||
|
import java.time.format.DateTimeFormatter
|
||||||
|
|
||||||
|
class MainActivity : FragmentActivity() {
|
||||||
|
|
||||||
|
private val navigator = AppNavigator(this, R.id.container)
|
||||||
|
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
setContentView(R.layout.fragment_container_main)
|
||||||
|
|
||||||
|
// start the root fragment
|
||||||
|
App.INSTANCE.router.newRootScreen(Screens.Crypto)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onResumeFragments() {
|
||||||
|
super.onResumeFragments()
|
||||||
|
App.INSTANCE.navigatorHolder.setNavigator(navigator)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onPause() {
|
||||||
|
App.INSTANCE.navigatorHolder.removeNavigator()
|
||||||
|
super.onPause()
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,72 @@
|
|||||||
|
package ru.vendetti.bitcoin_summarizer
|
||||||
|
|
||||||
|
import androidx.compose.foundation.layout.padding
|
||||||
|
import androidx.compose.material3.HorizontalDivider
|
||||||
|
import androidx.compose.material3.MaterialTheme
|
||||||
|
import androidx.compose.material3.ModalDrawerSheet
|
||||||
|
import androidx.compose.material3.NavigationDrawerItem
|
||||||
|
import androidx.compose.material3.NavigationDrawerItemColors
|
||||||
|
import androidx.compose.material3.NavigationDrawerItemDefaults
|
||||||
|
import androidx.compose.material3.Text
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
|
import androidx.compose.ui.unit.sp
|
||||||
|
import ru.vendetti.bitcoin_summarizer.ui.theme.BitcoinSummarizerTheme
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun MyHamburgerModal(
|
||||||
|
screenKey: ScreenKey
|
||||||
|
) {
|
||||||
|
ModalDrawerSheet(
|
||||||
|
drawerContainerColor = MaterialTheme.colorScheme.primary,
|
||||||
|
drawerContentColor = MaterialTheme.colorScheme.onPrimary,
|
||||||
|
) {
|
||||||
|
Text("Bitcoin summarizer",
|
||||||
|
modifier = Modifier.padding(16.dp),
|
||||||
|
fontSize = 24.sp)
|
||||||
|
HorizontalDivider()
|
||||||
|
NavigationDrawerItem(
|
||||||
|
colors = NavigationDrawerItemDefaults.colors(
|
||||||
|
selectedContainerColor = MaterialTheme.colorScheme.tertiary,
|
||||||
|
selectedTextColor = MaterialTheme.colorScheme.onTertiary,
|
||||||
|
unselectedTextColor = MaterialTheme.colorScheme.onPrimary,
|
||||||
|
),
|
||||||
|
label = { Text("Crypto statistics") },
|
||||||
|
selected = (screenKey == ScreenKey.Crypto),
|
||||||
|
onClick = {
|
||||||
|
if (screenKey != ScreenKey.Crypto) {
|
||||||
|
App.INSTANCE.router.replaceScreen(Screens.Crypto)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
NavigationDrawerItem(
|
||||||
|
colors = NavigationDrawerItemDefaults.colors(
|
||||||
|
selectedContainerColor = MaterialTheme.colorScheme.tertiary,
|
||||||
|
selectedTextColor = MaterialTheme.colorScheme.onTertiary,
|
||||||
|
unselectedTextColor = MaterialTheme.colorScheme.onPrimary,
|
||||||
|
),
|
||||||
|
label = { Text("About") },
|
||||||
|
selected = (screenKey == ScreenKey.About),
|
||||||
|
onClick = {
|
||||||
|
if (screenKey != ScreenKey.About) {
|
||||||
|
App.INSTANCE.router.replaceScreen(Screens.About)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
/*NavigationDrawerItem(
|
||||||
|
colors = NavigationDrawerItemDefaults.colors(
|
||||||
|
selectedContainerColor = MaterialTheme.colorScheme.tertiary,
|
||||||
|
selectedTextColor = MaterialTheme.colorScheme.onTertiary,
|
||||||
|
unselectedTextColor = MaterialTheme.colorScheme.onPrimary,
|
||||||
|
),
|
||||||
|
label = { Text("Learn") },
|
||||||
|
selected = (screenKey == ScreenKey.Learn),
|
||||||
|
onClick = {
|
||||||
|
if (screenKey != ScreenKey.Learn) {
|
||||||
|
App.INSTANCE.router.replaceScreen(Screens.Learn)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)*/
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,16 @@
|
|||||||
|
package ru.vendetti.bitcoin_summarizer
|
||||||
|
|
||||||
|
import retrofit2.Retrofit
|
||||||
|
import retrofit2.converter.gson.GsonConverterFactory
|
||||||
|
|
||||||
|
object RetrofitClient {
|
||||||
|
private const val BASE_URL = "https://api.alternative.me/"
|
||||||
|
|
||||||
|
val apiService: CryptoApiService by lazy {
|
||||||
|
Retrofit.Builder()
|
||||||
|
.baseUrl(BASE_URL)
|
||||||
|
.addConverterFactory(GsonConverterFactory.create())
|
||||||
|
.build()
|
||||||
|
.create(CryptoApiService::class.java)
|
||||||
|
}
|
||||||
|
}
|
23
app/src/main/java/ru/vendetti/bitcoin_summarizer/Screens.kt
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
package ru.vendetti.bitcoin_summarizer
|
||||||
|
|
||||||
|
import androidx.fragment.app.Fragment
|
||||||
|
import androidx.fragment.app.FragmentFactory
|
||||||
|
import com.github.terrakok.cicerone.androidx.FragmentScreen
|
||||||
|
|
||||||
|
class Screens {
|
||||||
|
object Crypto: FragmentScreen {
|
||||||
|
override fun createFragment(factory: FragmentFactory) = CryptoFragment()
|
||||||
|
}
|
||||||
|
object About: FragmentScreen {
|
||||||
|
override fun createFragment(factory: FragmentFactory) = AboutFragment()
|
||||||
|
}
|
||||||
|
object Learn: FragmentScreen {
|
||||||
|
override fun createFragment(factory: FragmentFactory) = LearnFragment()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
enum class ScreenKey {
|
||||||
|
Crypto,
|
||||||
|
About,
|
||||||
|
Learn
|
||||||
|
}
|
@@ -0,0 +1,7 @@
|
|||||||
|
package ru.vendetti.bitcoin_summarizer
|
||||||
|
|
||||||
|
class StatisticsFull (
|
||||||
|
val FGI_list: ArrayList<FearAndGreedData>,
|
||||||
|
val TickerData: TickerData,
|
||||||
|
val GlobalData: GlobalResponse,
|
||||||
|
)
|
@@ -0,0 +1,25 @@
|
|||||||
|
package ru.vendetti.bitcoin_summarizer
|
||||||
|
|
||||||
|
import com.google.gson.annotations.SerializedName
|
||||||
|
|
||||||
|
// Обёртка для данных (тут json-массив с одним элементом, поэтому выглядит так)
|
||||||
|
typealias TickerResponse = List<TickerData>
|
||||||
|
|
||||||
|
// Сами данные
|
||||||
|
data class TickerData(
|
||||||
|
val id: String = "",
|
||||||
|
val name: String = "",
|
||||||
|
val symbol: String = "",
|
||||||
|
val rank: 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 = ""
|
||||||
|
)
|
@@ -0,0 +1,19 @@
|
|||||||
|
package ru.vendetti.bitcoin_summarizer.ui.theme
|
||||||
|
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
|
|
||||||
|
val Purple80 = Color(0xFFD0BCFF)
|
||||||
|
val PurpleGrey80 = Color(0xFFCCC2DC)
|
||||||
|
val Pink80 = Color(0xFFEFB8C8)
|
||||||
|
|
||||||
|
val Purple40 = Color(0xFF6650a4)
|
||||||
|
val PurpleGrey40 = Color(0xFF625b71)
|
||||||
|
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)
|
@@ -0,0 +1,60 @@
|
|||||||
|
package ru.vendetti.bitcoin_summarizer.ui.theme
|
||||||
|
|
||||||
|
import android.app.Activity
|
||||||
|
import android.os.Build
|
||||||
|
import androidx.compose.foundation.isSystemInDarkTheme
|
||||||
|
import androidx.compose.material3.MaterialTheme
|
||||||
|
import androidx.compose.material3.darkColorScheme
|
||||||
|
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 = RaisinBlack,
|
||||||
|
secondary = DarkPurple,
|
||||||
|
tertiary = HunyadiYellow,
|
||||||
|
|
||||||
|
// Other default colors to override
|
||||||
|
background = DarkPurple,
|
||||||
|
surface = Color(0xFFFFFBFE),
|
||||||
|
onPrimary = HunyadiYellow,
|
||||||
|
onSecondary = HunyadiYellow,
|
||||||
|
onTertiary = DarkPurple,
|
||||||
|
onBackground = HunyadiYellow,
|
||||||
|
onSurface = Color(0xFF1C1B1F),
|
||||||
|
)
|
||||||
|
|
||||||
|
private val LightColorScheme = lightColorScheme(
|
||||||
|
primary = HunyadiYellow,
|
||||||
|
secondary = Flame,
|
||||||
|
tertiary = EnglishViolet,
|
||||||
|
|
||||||
|
// Other default colors to override
|
||||||
|
background = Color.White,
|
||||||
|
surface = Color(0xFFFFFBFE),
|
||||||
|
onPrimary = RaisinBlack,
|
||||||
|
onSecondary = Color.White,
|
||||||
|
onTertiary = Color.White,
|
||||||
|
onBackground = RaisinBlack,
|
||||||
|
onSurface = Color(0xFF1C1B1F),
|
||||||
|
)
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun BitcoinSummarizerTheme(
|
||||||
|
darkTheme: Boolean = isSystemInDarkTheme(),
|
||||||
|
content: @Composable () -> Unit
|
||||||
|
) {
|
||||||
|
val colorScheme = when {
|
||||||
|
darkTheme -> DarkColorScheme
|
||||||
|
else -> LightColorScheme
|
||||||
|
}
|
||||||
|
|
||||||
|
MaterialTheme(
|
||||||
|
colorScheme = colorScheme,
|
||||||
|
typography = Typography,
|
||||||
|
content = content
|
||||||
|
)
|
||||||
|
}
|
@@ -0,0 +1,34 @@
|
|||||||
|
package ru.vendetti.bitcoin_summarizer.ui.theme
|
||||||
|
|
||||||
|
import androidx.compose.material3.Typography
|
||||||
|
import androidx.compose.ui.text.TextStyle
|
||||||
|
import androidx.compose.ui.text.font.FontFamily
|
||||||
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
|
import androidx.compose.ui.unit.sp
|
||||||
|
|
||||||
|
// Set of Material typography styles to start with
|
||||||
|
val Typography = Typography(
|
||||||
|
bodyLarge = TextStyle(
|
||||||
|
fontFamily = FontFamily.Default,
|
||||||
|
fontWeight = FontWeight.Normal,
|
||||||
|
fontSize = 16.sp,
|
||||||
|
lineHeight = 24.sp,
|
||||||
|
letterSpacing = 0.5.sp
|
||||||
|
)
|
||||||
|
/* Other default text styles to override
|
||||||
|
titleLarge = TextStyle(
|
||||||
|
fontFamily = FontFamily.Default,
|
||||||
|
fontWeight = FontWeight.Normal,
|
||||||
|
fontSize = 22.sp,
|
||||||
|
lineHeight = 28.sp,
|
||||||
|
letterSpacing = 0.sp
|
||||||
|
),
|
||||||
|
labelSmall = TextStyle(
|
||||||
|
fontFamily = FontFamily.Default,
|
||||||
|
fontWeight = FontWeight.Medium,
|
||||||
|
fontSize = 11.sp,
|
||||||
|
lineHeight = 16.sp,
|
||||||
|
letterSpacing = 0.5.sp
|
||||||
|
)
|
||||||
|
*/
|
||||||
|
)
|
170
app/src/main/res/drawable/ic_launcher_background.xml
Normal file
@@ -0,0 +1,170 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="108dp"
|
||||||
|
android:height="108dp"
|
||||||
|
android:viewportWidth="108"
|
||||||
|
android:viewportHeight="108">
|
||||||
|
<path
|
||||||
|
android:fillColor="#3DDC84"
|
||||||
|
android:pathData="M0,0h108v108h-108z" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M9,0L9,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,0L19,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M29,0L29,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M39,0L39,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M49,0L49,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M59,0L59,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M69,0L69,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M79,0L79,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M89,0L89,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M99,0L99,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,9L108,9"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,19L108,19"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,29L108,29"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,39L108,39"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,49L108,49"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,59L108,59"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,69L108,69"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,79L108,79"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,89L108,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,99L108,99"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,29L89,29"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,39L89,39"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,49L89,49"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,59L89,59"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,69L89,69"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,79L89,79"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M29,19L29,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M39,19L39,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M49,19L49,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M59,19L59,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M69,19L69,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M79,19L79,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
</vector>
|
30
app/src/main/res/drawable/ic_launcher_foreground.xml
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:aapt="http://schemas.android.com/aapt"
|
||||||
|
android:width="108dp"
|
||||||
|
android:height="108dp"
|
||||||
|
android:viewportWidth="108"
|
||||||
|
android:viewportHeight="108">
|
||||||
|
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
|
||||||
|
<aapt:attr name="android:fillColor">
|
||||||
|
<gradient
|
||||||
|
android:endX="85.84757"
|
||||||
|
android:endY="92.4963"
|
||||||
|
android:startX="42.9492"
|
||||||
|
android:startY="49.59793"
|
||||||
|
android:type="linear">
|
||||||
|
<item
|
||||||
|
android:color="#44000000"
|
||||||
|
android:offset="0.0" />
|
||||||
|
<item
|
||||||
|
android:color="#00000000"
|
||||||
|
android:offset="1.0" />
|
||||||
|
</gradient>
|
||||||
|
</aapt:attr>
|
||||||
|
</path>
|
||||||
|
<path
|
||||||
|
android:fillColor="#FFFFFF"
|
||||||
|
android:fillType="nonZero"
|
||||||
|
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
|
||||||
|
android:strokeWidth="1"
|
||||||
|
android:strokeColor="#00000000" />
|
||||||
|
</vector>
|
10
app/src/main/res/layout/fragment_compose_view.xml
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
<androidx.compose.ui.platform.ComposeView
|
||||||
|
android:id="@+id/compose_view"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent" />
|
||||||
|
</LinearLayout>
|
10
app/src/main/res/layout/fragment_container_main.xml
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
<FrameLayout
|
||||||
|
android:id="@+id/container"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"/>
|
||||||
|
</LinearLayout>
|
6
app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<background android:drawable="@color/black2"/>
|
||||||
|
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||||
|
<monochrome android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||||
|
</adaptive-icon>
|
6
app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<background android:drawable="@color/ic_launcher_background"/>
|
||||||
|
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||||
|
<monochrome android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||||
|
</adaptive-icon>
|
BIN
app/src/main/res/mipmap-hdpi/ic_launcher.webp
Normal file
After Width: | Height: | Size: 2.5 KiB |
BIN
app/src/main/res/mipmap-hdpi/ic_launcher_foreground.webp
Normal file
After Width: | Height: | Size: 2.3 KiB |
BIN
app/src/main/res/mipmap-hdpi/ic_launcher_round.webp
Normal file
After Width: | Height: | Size: 4.2 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher.webp
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher_foreground.webp
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher_round.webp
Normal file
After Width: | Height: | Size: 2.6 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher.webp
Normal file
After Width: | Height: | Size: 3.0 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.webp
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp
Normal file
After Width: | Height: | Size: 5.5 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher.webp
Normal file
After Width: | Height: | Size: 4.6 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.webp
Normal file
After Width: | Height: | Size: 5.0 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp
Normal file
After Width: | Height: | Size: 8.3 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
Normal file
After Width: | Height: | Size: 6.1 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.webp
Normal file
After Width: | Height: | Size: 6.7 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp
Normal file
After Width: | Height: | Size: 11 KiB |
11
app/src/main/res/values/colors.xml
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<color name="purple_200">#FFBB86FC</color>
|
||||||
|
<color name="purple_500">#FF6200EE</color>
|
||||||
|
<color name="purple_700">#FF3700B3</color>
|
||||||
|
<color name="teal_200">#FF03DAC5</color>
|
||||||
|
<color name="teal_700">#FF018786</color>
|
||||||
|
<color name="black">#FF000000</color>
|
||||||
|
<color name="white">#FFFFFFFF</color>
|
||||||
|
<color name="black2">#221E22</color>
|
||||||
|
</resources>
|
4
app/src/main/res/values/ic_launcher_background.xml
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<color name="ic_launcher_background">#FFFFFF</color>
|
||||||
|
</resources>
|
4
app/src/main/res/values/ids.xml
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<item name="container" type="id" />
|
||||||
|
</resources>
|
3
app/src/main/res/values/strings.xml
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
<resources>
|
||||||
|
<string name="app_name">Bitcoin summarizer</string>
|
||||||
|
</resources>
|
5
app/src/main/res/values/themes.xml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
|
||||||
|
<style name="Theme.BitcoinSummarizer" parent="android:Theme.Material.Light.NoActionBar" />
|
||||||
|
</resources>
|
13
app/src/main/res/xml/backup_rules.xml
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
|
Sample backup rules file; uncomment and customize as necessary.
|
||||||
|
See https://developer.android.com/guide/topics/data/autobackup
|
||||||
|
for details.
|
||||||
|
Note: This file is ignored for devices older that API 31
|
||||||
|
See https://developer.android.com/about/versions/12/backup-restore
|
||||||
|
-->
|
||||||
|
<full-backup-content>
|
||||||
|
<!--
|
||||||
|
<include domain="sharedpref" path="."/>
|
||||||
|
<exclude domain="sharedpref" path="device.xml"/>
|
||||||
|
-->
|
||||||
|
</full-backup-content>
|
19
app/src/main/res/xml/data_extraction_rules.xml
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
|
Sample data extraction rules file; uncomment and customize as necessary.
|
||||||
|
See https://developer.android.com/about/versions/12/backup-restore#xml-changes
|
||||||
|
for details.
|
||||||
|
-->
|
||||||
|
<data-extraction-rules>
|
||||||
|
<cloud-backup>
|
||||||
|
<!-- TODO: Use <include> and <exclude> to control what is backed up.
|
||||||
|
<include .../>
|
||||||
|
<exclude .../>
|
||||||
|
-->
|
||||||
|
</cloud-backup>
|
||||||
|
<!--
|
||||||
|
<device-transfer>
|
||||||
|
<include .../>
|
||||||
|
<exclude .../>
|
||||||
|
</device-transfer>
|
||||||
|
-->
|
||||||
|
</data-extraction-rules>
|
@@ -0,0 +1,17 @@
|
|||||||
|
package ru.vendetti.bitcoin_summarizer
|
||||||
|
|
||||||
|
import org.junit.Test
|
||||||
|
|
||||||
|
import org.junit.Assert.*
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Example local unit test, which will execute on the development machine (host).
|
||||||
|
*
|
||||||
|
* See [testing documentation](http://d.android.com/tools/testing).
|
||||||
|
*/
|
||||||
|
class ExampleUnitTest {
|
||||||
|
@Test
|
||||||
|
fun addition_isCorrect() {
|
||||||
|
assertEquals(4, 2 + 2)
|
||||||
|
}
|
||||||
|
}
|
6
build.gradle.kts
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
|
plugins {
|
||||||
|
alias(libs.plugins.android.application) apply false
|
||||||
|
alias(libs.plugins.kotlin.android) apply false
|
||||||
|
alias(libs.plugins.kotlin.compose) apply false
|
||||||
|
}
|
25
gradle.properties
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
# Project-wide Gradle settings.
|
||||||
|
# IDE (e.g. Android Studio) users:
|
||||||
|
# Gradle settings configured through the IDE *will override*
|
||||||
|
# any settings specified in this file.
|
||||||
|
# For more details on how to configure your build environment visit
|
||||||
|
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||||
|
# Specifies the JVM arguments used for the daemon process.
|
||||||
|
# The setting is particularly useful for tweaking memory settings.
|
||||||
|
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
|
||||||
|
# When configured, Gradle will run in incubating parallel mode.
|
||||||
|
# This option should only be used with decoupled projects. For more details, visit
|
||||||
|
# https://developer.android.com/r/tools/gradle-multi-project-decoupled-projects
|
||||||
|
# org.gradle.parallel=true
|
||||||
|
# AndroidX package structure to make it clearer which packages are bundled with the
|
||||||
|
# Android operating system, and which are packaged with your app's APK
|
||||||
|
# https://developer.android.com/topic/libraries/support-library/androidx-rn
|
||||||
|
android.useAndroidX=true
|
||||||
|
# Kotlin code style for this project: "official" or "obsolete":
|
||||||
|
kotlin.code.style=official
|
||||||
|
# Enables namespacing of each library's R class so that its R class includes only the
|
||||||
|
# resources declared in the library itself and none from the library's dependencies,
|
||||||
|
# thereby reducing the size of the R class for that library
|
||||||
|
android.nonTransitiveRClass=true
|
||||||
|
org.gradle.caching=true
|
||||||
|
org.gradle.parallel=true
|
48
gradle/libs.versions.toml
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
[versions]
|
||||||
|
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.10.1"
|
||||||
|
kotlinxCoroutinesCore = "1.10.1"
|
||||||
|
lifecycleRuntimeKtx = "2.8.7"
|
||||||
|
activityCompose = "1.10.1"
|
||||||
|
composeBom = "2025.02.00"
|
||||||
|
retrofit = "2.9.0"
|
||||||
|
vico = "2.0.2"
|
||||||
|
ciceroneVer = "7.1"
|
||||||
|
fragmentKtx = "1.8.6"
|
||||||
|
protoDataStore = "1.1.3"
|
||||||
|
|
||||||
|
[libraries]
|
||||||
|
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
|
||||||
|
converter-gson = { module = "com.squareup.retrofit2:converter-gson", version.ref = "converterGson" }
|
||||||
|
junit = { group = "junit", name = "junit", version.ref = "junit" }
|
||||||
|
androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
|
||||||
|
androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
|
||||||
|
androidx-lifecycle-runtime-ktx = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "lifecycleRuntimeKtx" }
|
||||||
|
androidx-activity-compose = { group = "androidx.activity", name = "activity-compose", version.ref = "activityCompose" }
|
||||||
|
androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "composeBom" }
|
||||||
|
androidx-ui = { group = "androidx.compose.ui", name = "ui" }
|
||||||
|
androidx-ui-graphics = { group = "androidx.compose.ui", name = "ui-graphics" }
|
||||||
|
androidx-ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling" }
|
||||||
|
androidx-ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-tooling-preview" }
|
||||||
|
androidx-ui-test-manifest = { group = "androidx.compose.ui", name = "ui-test-manifest" }
|
||||||
|
androidx-ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit4" }
|
||||||
|
androidx-material3 = { group = "androidx.compose.material3", name = "material3" }
|
||||||
|
kotlinx-coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "kotlinxCoroutinesAndroid" }
|
||||||
|
kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinxCoroutinesCore" }
|
||||||
|
retrofit = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofit" }
|
||||||
|
vico-compose-m3 = { group = "com.patrykandpatrick.vico", name = "compose-m3", version.ref = "vico" }
|
||||||
|
cicerone = {module = "com.github.terrakok:cicerone", version.ref = "ciceroneVer"}
|
||||||
|
androidx-fragment-ktx = { group = "androidx.fragment", name = "fragment-ktx", version.ref = "fragmentKtx" }
|
||||||
|
androidx-datastore = {group = "androidx.datastore", name = "datastore", version.ref = "protoDataStore"}
|
||||||
|
|
||||||
|
[plugins]
|
||||||
|
android-application = { id = "com.android.application", version.ref = "agp" }
|
||||||
|
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
|
||||||
|
kotlin-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
|
||||||
|
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
6
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@@ -0,0 +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.11.1-bin.zip
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
185
gradlew
vendored
Executable file
@@ -0,0 +1,185 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright 2015 the original author or authors.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
##
|
||||||
|
## Gradle start up script for UN*X
|
||||||
|
##
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
# Attempt to set APP_HOME
|
||||||
|
# Resolve links: $0 may be a link
|
||||||
|
PRG="$0"
|
||||||
|
# Need this for relative symlinks.
|
||||||
|
while [ -h "$PRG" ] ; do
|
||||||
|
ls=`ls -ld "$PRG"`
|
||||||
|
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||||
|
if expr "$link" : '/.*' > /dev/null; then
|
||||||
|
PRG="$link"
|
||||||
|
else
|
||||||
|
PRG=`dirname "$PRG"`"/$link"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
SAVED="`pwd`"
|
||||||
|
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||||
|
APP_HOME="`pwd -P`"
|
||||||
|
cd "$SAVED" >/dev/null
|
||||||
|
|
||||||
|
APP_NAME="Gradle"
|
||||||
|
APP_BASE_NAME=`basename "$0"`
|
||||||
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
|
|
||||||
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
|
MAX_FD="maximum"
|
||||||
|
|
||||||
|
warn () {
|
||||||
|
echo "$*"
|
||||||
|
}
|
||||||
|
|
||||||
|
die () {
|
||||||
|
echo
|
||||||
|
echo "$*"
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# OS specific support (must be 'true' or 'false').
|
||||||
|
cygwin=false
|
||||||
|
msys=false
|
||||||
|
darwin=false
|
||||||
|
nonstop=false
|
||||||
|
case "`uname`" in
|
||||||
|
CYGWIN* )
|
||||||
|
cygwin=true
|
||||||
|
;;
|
||||||
|
Darwin* )
|
||||||
|
darwin=true
|
||||||
|
;;
|
||||||
|
MINGW* )
|
||||||
|
msys=true
|
||||||
|
;;
|
||||||
|
NONSTOP* )
|
||||||
|
nonstop=true
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
|
# Determine the Java command to use to start the JVM.
|
||||||
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
|
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||||
|
else
|
||||||
|
JAVACMD="$JAVA_HOME/bin/java"
|
||||||
|
fi
|
||||||
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
JAVACMD="java"
|
||||||
|
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Increase the maximum file descriptors if we can.
|
||||||
|
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||||
|
MAX_FD_LIMIT=`ulimit -H -n`
|
||||||
|
if [ $? -eq 0 ] ; then
|
||||||
|
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||||
|
MAX_FD="$MAX_FD_LIMIT"
|
||||||
|
fi
|
||||||
|
ulimit -n $MAX_FD
|
||||||
|
if [ $? -ne 0 ] ; then
|
||||||
|
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Darwin, add options to specify how the application appears in the dock
|
||||||
|
if $darwin; then
|
||||||
|
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
|
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||||
|
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||||
|
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||||
|
|
||||||
|
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||||
|
|
||||||
|
# We build the pattern for arguments to be converted via cygpath
|
||||||
|
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||||
|
SEP=""
|
||||||
|
for dir in $ROOTDIRSRAW ; do
|
||||||
|
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||||
|
SEP="|"
|
||||||
|
done
|
||||||
|
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||||
|
# Add a user-defined pattern to the cygpath arguments
|
||||||
|
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||||
|
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||||
|
fi
|
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
i=0
|
||||||
|
for arg in "$@" ; do
|
||||||
|
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||||
|
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||||
|
|
||||||
|
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||||
|
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||||
|
else
|
||||||
|
eval `echo args$i`="\"$arg\""
|
||||||
|
fi
|
||||||
|
i=`expr $i + 1`
|
||||||
|
done
|
||||||
|
case $i in
|
||||||
|
0) set -- ;;
|
||||||
|
1) set -- "$args0" ;;
|
||||||
|
2) set -- "$args0" "$args1" ;;
|
||||||
|
3) set -- "$args0" "$args1" "$args2" ;;
|
||||||
|
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||||
|
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||||
|
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||||
|
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||||
|
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||||
|
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Escape application args
|
||||||
|
save () {
|
||||||
|
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||||
|
echo " "
|
||||||
|
}
|
||||||
|
APP_ARGS=`save "$@"`
|
||||||
|
|
||||||
|
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||||
|
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||||
|
|
||||||
|
exec "$JAVACMD" "$@"
|
89
gradlew.bat
vendored
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
@rem
|
||||||
|
@rem Copyright 2015 the original author or authors.
|
||||||
|
@rem
|
||||||
|
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
@rem you may not use this file except in compliance with the License.
|
||||||
|
@rem You may obtain a copy of the License at
|
||||||
|
@rem
|
||||||
|
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
@rem
|
||||||
|
@rem Unless required by applicable law or agreed to in writing, software
|
||||||
|
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
@rem See the License for the specific language governing permissions and
|
||||||
|
@rem limitations under the License.
|
||||||
|
@rem
|
||||||
|
|
||||||
|
@if "%DEBUG%" == "" @echo off
|
||||||
|
@rem ##########################################################################
|
||||||
|
@rem
|
||||||
|
@rem Gradle startup script for Windows
|
||||||
|
@rem
|
||||||
|
@rem ##########################################################################
|
||||||
|
|
||||||
|
@rem Set local scope for the variables with windows NT shell
|
||||||
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
|
set DIRNAME=%~dp0
|
||||||
|
if "%DIRNAME%" == "" set DIRNAME=.
|
||||||
|
set APP_BASE_NAME=%~n0
|
||||||
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||||
|
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||||
|
|
||||||
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||||
|
|
||||||
|
@rem Find java.exe
|
||||||
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
|
set JAVA_EXE=java.exe
|
||||||
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
|
if "%ERRORLEVEL%" == "0" goto execute
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:findJavaFromJavaHome
|
||||||
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
|
if exist "%JAVA_EXE%" goto execute
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:execute
|
||||||
|
@rem Setup the command line
|
||||||
|
|
||||||
|
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
|
@rem Execute Gradle
|
||||||
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||||
|
|
||||||
|
:end
|
||||||
|
@rem End local scope for the variables with windows NT shell
|
||||||
|
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||||
|
|
||||||
|
:fail
|
||||||
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
|
rem the _cmd.exe /c_ return code!
|
||||||
|
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||||
|
exit /b 1
|
||||||
|
|
||||||
|
:mainEnd
|
||||||
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|
||||||
|
:omega
|
23
settings.gradle.kts
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
pluginManagement {
|
||||||
|
repositories {
|
||||||
|
google {
|
||||||
|
content {
|
||||||
|
includeGroupByRegex("com\\.android.*")
|
||||||
|
includeGroupByRegex("com\\.google.*")
|
||||||
|
includeGroupByRegex("androidx.*")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mavenCentral()
|
||||||
|
gradlePluginPortal()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dependencyResolutionManagement {
|
||||||
|
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
||||||
|
repositories {
|
||||||
|
google()
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
rootProject.name = "Bitcoin summarizer"
|
||||||
|
include(":app")
|