From 80718dbf81d5580a8fb5ad8a1c36cd979abc89ac Mon Sep 17 00:00:00 2001 From: sicampus Date: Tue, 4 Apr 2023 22:39:18 +0700 Subject: [PATCH] Initial commit --- .gitignore | 15 ++ app/.gitignore | 1 + app/build.gradle.kts | 99 ++++++++++ app/lint.xml | 44 +++++ app/proguard-rules.pro | 21 ++ .../ru/myitschool/lab23/RateServiceTest.kt | 12 ++ app/src/main/AndroidManifest.xml | 26 +++ .../java/ru/myitschool/lab23/MainActivity.kt | 40 ++++ .../java/ru/myitschool/lab23/MainViewModel.kt | 26 +++ .../java/ru/myitschool/lab23/NetworkClient.kt | 41 ++++ .../myitschool/lab23/RateCheckInteractor.kt | 24 +++ .../res/drawable/ic_launcher_background.xml | 170 ++++++++++++++++ .../res/drawable/ic_launcher_foreground.xml | 30 +++ app/src/main/res/layout/activity_main.xml | 42 ++++ app/src/main/res/mipmap-hdpi/ic_launcher.webp | Bin 0 -> 1404 bytes .../res/mipmap-hdpi/ic_launcher_round.webp | Bin 0 -> 2898 bytes app/src/main/res/mipmap-mdpi/ic_launcher.webp | Bin 0 -> 982 bytes .../res/mipmap-mdpi/ic_launcher_round.webp | Bin 0 -> 1772 bytes .../main/res/mipmap-xhdpi/ic_launcher.webp | Bin 0 -> 1900 bytes .../res/mipmap-xhdpi/ic_launcher_round.webp | Bin 0 -> 3918 bytes .../main/res/mipmap-xxhdpi/ic_launcher.webp | Bin 0 -> 2884 bytes .../res/mipmap-xxhdpi/ic_launcher_round.webp | Bin 0 -> 5914 bytes .../main/res/mipmap-xxxhdpi/ic_launcher.webp | Bin 0 -> 3844 bytes .../res/mipmap-xxxhdpi/ic_launcher_round.webp | Bin 0 -> 7778 bytes app/src/main/res/values/colors.xml | 10 + app/src/main/res/values/strings.xml | 11 ++ app/src/main/res/values/themes.xml | 22 +++ .../ru/myitschool/lab23/ExampleUnitTest.java | 17 ++ build.gradle.kts | 17 ++ gradle.properties | 22 +++ gradle/libs.versions.toml | 160 +++++++++++++++ gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 59203 bytes gradle/wrapper/gradle-wrapper.properties | 6 + gradlew | 185 ++++++++++++++++++ gradlew.bat | 89 +++++++++ settings.gradle.kts | 18 ++ 36 files changed, 1148 insertions(+) create mode 100644 .gitignore create mode 100644 app/.gitignore create mode 100644 app/build.gradle.kts create mode 100644 app/lint.xml create mode 100644 app/proguard-rules.pro create mode 100644 app/src/androidTest/java/ru/myitschool/lab23/RateServiceTest.kt create mode 100644 app/src/main/AndroidManifest.xml create mode 100644 app/src/main/java/ru/myitschool/lab23/MainActivity.kt create mode 100644 app/src/main/java/ru/myitschool/lab23/MainViewModel.kt create mode 100644 app/src/main/java/ru/myitschool/lab23/NetworkClient.kt create mode 100644 app/src/main/java/ru/myitschool/lab23/RateCheckInteractor.kt create mode 100644 app/src/main/res/drawable/ic_launcher_background.xml create mode 100644 app/src/main/res/drawable/ic_launcher_foreground.xml create mode 100644 app/src/main/res/layout/activity_main.xml create mode 100644 app/src/main/res/mipmap-hdpi/ic_launcher.webp create mode 100644 app/src/main/res/mipmap-hdpi/ic_launcher_round.webp create mode 100644 app/src/main/res/mipmap-mdpi/ic_launcher.webp create mode 100644 app/src/main/res/mipmap-mdpi/ic_launcher_round.webp create mode 100644 app/src/main/res/mipmap-xhdpi/ic_launcher.webp create mode 100644 app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp create mode 100644 app/src/main/res/mipmap-xxhdpi/ic_launcher.webp create mode 100644 app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp create mode 100644 app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp create mode 100644 app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp create mode 100644 app/src/main/res/values/colors.xml create mode 100644 app/src/main/res/values/strings.xml create mode 100644 app/src/main/res/values/themes.xml create mode 100644 app/src/test/java/ru/myitschool/lab23/ExampleUnitTest.java create mode 100644 build.gradle.kts create mode 100644 gradle.properties create mode 100644 gradle/libs.versions.toml create mode 100644 gradle/wrapper/gradle-wrapper.jar create mode 100644 gradle/wrapper/gradle-wrapper.properties create mode 100644 gradlew create mode 100644 gradlew.bat create mode 100644 settings.gradle.kts diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..aa724b7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,15 @@ +*.iml +.gradle +/local.properties +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store +/build +/captures +.externalNativeBuild +.cxx +local.properties diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/app/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/app/build.gradle.kts b/app/build.gradle.kts new file mode 100644 index 0000000..b1226ff --- /dev/null +++ b/app/build.gradle.kts @@ -0,0 +1,99 @@ +@file:Suppress("UnstableApiUsage") + +@Suppress("DSL_SCOPE_VIOLATION") +plugins { + id(libs.plugins.android.application.get().pluginId) + id(libs.plugins.kotlin.android.get().pluginId) + id(libs.plugins.kotlin.kapt.get().pluginId) + id(libs.plugins.kotlin.parcelize.get().pluginId) +} + +android { + defaultConfig { + applicationId = "ru.myitschool.lab23" + versionCode = 1 + versionName = "0.0.1" + + targetSdk = 33 + minSdk = 27 + compileSdk = 33 + + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + } + + lint { + warningsAsErrors = true + ignoreWarnings = false + abortOnError = true + checkAllWarnings = true + lintConfig = file("lint.xml") + lint { + disable.addAll( + listOf( + "InvalidPackage", + "UnusedIds", + "GradleDependency", + "UnusedResources", + "UnknownNullness", + "SyntheticAccessor", + ), + ) + } + } + + applicationVariants.all { + val lintTask = tasks["lint${name.capitalize()}"] + assembleProvider.get().dependsOn.add(lintTask) + } + + buildFeatures { + viewBinding = true + } + namespace = "ru.myitschool.lab23" +} + +dependencies { + + implementation(libs.android.material) + implementation(libs.androidx.appcompat) + implementation(libs.androidx.lifecycle.livedata.ktx) + implementation(libs.androidx.lifecycle.viewmodel.ktx) + implementation(libs.androidx.core.ktx) + implementation(libs.koin.core) + implementation(libs.koin.android) + implementation(libs.androidx.constraintlayout) + + implementation(libs.androidx.appcompat) + implementation(libs.androidx.navigation.fragment) + implementation(libs.androidx.navigation.ui) + + // Networking + implementation(libs.retrofit.core) + implementation(libs.retrofit.kotlin.serialization) + implementation(libs.retrofit.converter.gson) + implementation(libs.retrofit.converter.jackson) + implementation(libs.retrofit.converter.moshi) + implementation(libs.retrofit.converter.protobuf) + implementation(libs.okhttp.logging) + implementation(libs.volley) + + implementation(libs.kotlinx.coroutines.android) + + debugImplementation(libs.leakcanary) + + androidTestImplementation(libs.truth) + androidTestImplementation(libs.kakao) + androidTestImplementation(libs.androidx.test.uiautomator) + androidTestImplementation(libs.androidx.test.ext) + androidTestImplementation(libs.androidx.test.runner) + androidTestImplementation(libs.androidx.test.rules) + androidTestImplementation(libs.androidx.test.espresso.core) + androidTestImplementation(libs.androidx.test.espresso.intents) + androidTestImplementation(libs.androidx.navigation.testing) + androidTestImplementation(libs.androidx.test.ext) + androidTestImplementation(libs.androidx.test.rules) + androidTestImplementation(libs.androidx.test.espresso.accessibility) + androidTestImplementation(libs.kotlinx.coroutines.test) + androidTestImplementation(kotlin("test")) + testImplementation(libs.androidx.test.ext) +} diff --git a/app/lint.xml b/app/lint.xml new file mode 100644 index 0000000..36f1805 --- /dev/null +++ b/app/lint.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro new file mode 100644 index 0000000..481bb43 --- /dev/null +++ b/app/proguard-rules.pro @@ -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 \ No newline at end of file diff --git a/app/src/androidTest/java/ru/myitschool/lab23/RateServiceTest.kt b/app/src/androidTest/java/ru/myitschool/lab23/RateServiceTest.kt new file mode 100644 index 0000000..299d95b --- /dev/null +++ b/app/src/androidTest/java/ru/myitschool/lab23/RateServiceTest.kt @@ -0,0 +1,12 @@ +package ru.myitschool.lab23 + +import androidx.test.ext.junit.runners.AndroidJUnit4 +import androidx.test.filters.MediumTest +import org.junit.FixMethodOrder +import org.junit.runner.RunWith +import org.junit.runners.MethodSorters + +@RunWith(AndroidJUnit4::class) +@FixMethodOrder(MethodSorters.NAME_ASCENDING) +@MediumTest +class RateServiceTest diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..eb39eb6 --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/java/ru/myitschool/lab23/MainActivity.kt b/app/src/main/java/ru/myitschool/lab23/MainActivity.kt new file mode 100644 index 0000000..e81b31b --- /dev/null +++ b/app/src/main/java/ru/myitschool/lab23/MainActivity.kt @@ -0,0 +1,40 @@ +package ru.myitschool.lab23 + +import android.os.Bundle +import android.view.View +import android.widget.Button +import android.widget.TextView +import androidx.appcompat.app.AppCompatActivity +import androidx.lifecycle.ViewModelProvider + +class MainActivity : AppCompatActivity() { + lateinit var viewModel: MainViewModel + lateinit var textRate: TextView + lateinit var rootView: View + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.activity_main) + + initViewModel() + initView() + } + + fun initViewModel() { + viewModel = ViewModelProvider(this).get(MainViewModel::class.java) + + viewModel.usdRate.observe(this) { + textRate.text = it + } + + viewModel.onCreate() + } + + fun initView() { + textRate = findViewById(R.id.textUsdRubRate) + rootView = findViewById(R.id.rootView) + findViewById