commit 23aae63e336a2a429234c9393f10229078bef22a Author: sicampus Date: Tue Apr 4 22:43:12 2023 +0700 Initial commit 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..8c5382d --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + \ 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..ace65e5 --- /dev/null +++ b/app/src/main/java/ru/myitschool/lab23/MainActivity.kt @@ -0,0 +1,59 @@ +package ru.myitschool.lab23 + +import android.os.Bundle +import android.view.View +import android.widget.Button +import android.widget.EditText +import android.widget.TextView +import androidx.appcompat.app.AppCompatActivity +import androidx.lifecycle.ViewModelProvider +import com.google.android.material.snackbar.Snackbar + +class MainActivity : AppCompatActivity() { + lateinit var viewModel: MainViewModel + lateinit var textRate: TextView + lateinit var textTargetRate: EditText + 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) + textTargetRate = findViewById(R.id.textTargetRate) + rootView = findViewById(R.id.rootView) + + findViewById