Initial commit
1
app/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/build
|
90
app/build.gradle.kts
Normal file
@@ -0,0 +1,90 @@
|
||||
@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("com.instabug.library:instabug:11.8.0")
|
||||
implementation(libs.androidx.appcompat)
|
||||
|
||||
implementation(libs.room.runtime)
|
||||
implementation(libs.room.ktx)
|
||||
kapt(libs.room.compiler)
|
||||
implementation(libs.kotlinx.coroutines.android)
|
||||
|
||||
androidTestImplementation("com.google.truth:truth:1.1.3")
|
||||
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.navigation.testing)
|
||||
androidTestImplementation(libs.androidx.test.ext)
|
||||
androidTestImplementation(libs.androidx.test.rules)
|
||||
androidTestImplementation("androidx.arch.core:core-testing:2.1.0")
|
||||
// only this version does not generate gradle merge problems
|
||||
androidTestImplementation(libs.androidx.test.espresso.accessibility)
|
||||
androidTestImplementation(libs.kotlinx.coroutines.test)
|
||||
androidTestImplementation(kotlin("test"))
|
||||
testImplementation(libs.androidx.test.ext)
|
||||
}
|
44
app/lint.xml
Normal file
@@ -0,0 +1,44 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<lint>
|
||||
<issue id="UnusedAttribute" severity="error">
|
||||
<ignore regexp="importantForAutofill"/>
|
||||
<ignore regexp="autofillHints"/>
|
||||
</issue>
|
||||
<issue id="InvalidPackage">
|
||||
<ignore path="**/freemarker-2.*.*.jar" />
|
||||
<ignore path="**/nnio-0.2.jar"/>
|
||||
<ignore path="**/bcpkix-jdk15on-1.69.jar" />
|
||||
</issue>
|
||||
|
||||
<issue id="UnusedResources" severity="error">
|
||||
<ignore regexp="store_short_desc|store_full_desc|store_short_dev_desc|store_full_dev_desc" />
|
||||
</issue>
|
||||
|
||||
<issue id="UnusedResources">
|
||||
<ignore path="**/values-**/strings.xml" />
|
||||
<ignore path="**/values/setup.xml" />
|
||||
</issue>
|
||||
|
||||
<issue id="Typos">
|
||||
<ignore path="**/values-**/strings.xml" />
|
||||
<ignore path="**/values/setup.xml" />
|
||||
</issue>
|
||||
|
||||
<issue id="RestrictedApi" severity="error">
|
||||
<ignore path="build" />
|
||||
</issue>
|
||||
|
||||
<issue id="NewApi" severity="error">
|
||||
<ignore path="build" />
|
||||
</issue>
|
||||
|
||||
<issue id="ObsoleteLintCustomCheck" severity="warning">
|
||||
<ignore path="**/fragment-1.2.5/**/lint.jar" />
|
||||
<ignore path="**/work-runtime-2.**/**/lint.jar" />
|
||||
<ignore path="**/jetified-butterknife-runtime-10.**/**/lint.jar" />
|
||||
<ignore path="**/jetified-dagger-lint-aar-2.**.**/**/lint.jar" />
|
||||
<ignore path="**/jetified-annotation-experimental-1.**/**/lint.jar" />
|
||||
<ignore path="**/jetified-firebase-installations**/**/lint.jar" />
|
||||
<ignore path="**/appcompat-1.**/**/lint.jar" />
|
||||
</issue>
|
||||
</lint>
|
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,177 @@
|
||||
package ru.myitschool.lab23
|
||||
|
||||
import android.app.Instrumentation
|
||||
import android.content.Context
|
||||
import androidx.arch.core.executor.testing.InstantTaskExecutorRule
|
||||
import androidx.room.Room
|
||||
import androidx.test.espresso.*
|
||||
import androidx.test.espresso.accessibility.AccessibilityChecks
|
||||
import androidx.test.espresso.matcher.ViewMatchers.*
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.filters.SmallTest
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import androidx.test.uiautomator.UiDevice
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||
import kotlinx.coroutines.flow.first
|
||||
import kotlinx.coroutines.test.runTest
|
||||
import org.junit.*
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.runner.RunWith
|
||||
import org.junit.runners.MethodSorters
|
||||
import ru.myitschool.lab23.data.QuestionsCache
|
||||
import ru.myitschool.lab23.data.QuestionsDao
|
||||
import ru.myitschool.lab23.data.QuestionsDatabase
|
||||
import java.io.IOException
|
||||
import java.util.*
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
@OptIn(ExperimentalCoroutinesApi::class)
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
@SmallTest
|
||||
class InstrumentedTestRoom {
|
||||
|
||||
@get:Rule
|
||||
var instantTaskExecutorRule = InstantTaskExecutorRule()
|
||||
|
||||
private var uiDevice: UiDevice? = null
|
||||
|
||||
private lateinit var appContext: Context
|
||||
private lateinit var mInstrumentation: Instrumentation
|
||||
private lateinit var db: QuestionsDatabase
|
||||
private lateinit var dao: QuestionsDao
|
||||
|
||||
@Before
|
||||
fun setUp() {
|
||||
mInstrumentation = InstrumentationRegistry.getInstrumentation()
|
||||
|
||||
uiDevice = UiDevice.getInstance(mInstrumentation)
|
||||
uiDevice?.pressHome()
|
||||
|
||||
val nonLocalizedContext = mInstrumentation.targetContext
|
||||
val configuration = nonLocalizedContext.resources.configuration
|
||||
configuration.setLocale(Locale.UK)
|
||||
appContext = nonLocalizedContext.createConfigurationContext(configuration)
|
||||
|
||||
db = Room.inMemoryDatabaseBuilder(appContext, QuestionsDatabase::class.java)
|
||||
// just for testing
|
||||
.allowMainThreadQueries()
|
||||
.build()
|
||||
dao = db.questionsDao()
|
||||
}
|
||||
|
||||
@After
|
||||
@Throws(IOException::class)
|
||||
fun clear() {
|
||||
db.close()
|
||||
}
|
||||
|
||||
@Test(timeout = MAX_TIMEOUT)
|
||||
fun testGetQuestions() = runTest {
|
||||
checkGetQuestions()
|
||||
}
|
||||
|
||||
@Test(timeout = MAX_TIMEOUT)
|
||||
fun testGetQuestionsSnapshot() = runTest {
|
||||
assertEquals(null, dao.getQuestion("What is AAPT?"))
|
||||
dao.insert(fakeData[2])
|
||||
val actualList = dao.getAllQuestionsSnapshot()
|
||||
assertThat(actualList).hasSize(1)
|
||||
assertEquals(fakeData[2], actualList[0])
|
||||
val actual = dao.getQuestion("How to stop a service?")
|
||||
assertEquals(null, actual)
|
||||
|
||||
dao.clearQuestionsCache()
|
||||
val emptyList = dao.getAllQuestionsSnapshot()
|
||||
assertThat(emptyList).hasSize(0)
|
||||
}
|
||||
|
||||
@Test(timeout = MAX_TIMEOUT)
|
||||
fun testQuestionsForTopic() = runTest {
|
||||
fakeData.forEach { dao.insert(it) }
|
||||
val actualList = dao.getQuestionsForTopic("service")
|
||||
assertThat(actualList).hasSize(2)
|
||||
assertThat(actualList).contains(fakeData[0])
|
||||
assertThat(actualList).contains(fakeData[1])
|
||||
}
|
||||
|
||||
private fun checkGetQuestions() = runTest {
|
||||
assertEquals(null, dao.getQuestion(fakeData[0].question))
|
||||
fakeData.forEach { dao.insert(it) }
|
||||
val actualList = dao.getAllQuestionsSnapshot()
|
||||
assertEquals(fakeData[4], actualList[0])
|
||||
|
||||
val liveDataList = dao.getAllQuestionsStream().getOrAwaitValue()
|
||||
assertThat(liveDataList).contains(fakeData[6])
|
||||
assertEquals(fakeData[4], liveDataList[0])
|
||||
|
||||
val flowList = dao.getAllQuestionsFlow().first()
|
||||
assertThat(flowList).contains(fakeData[5])
|
||||
assertEquals(fakeData[4], flowList[0])
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val MAX_TIMEOUT: Long = 3_000
|
||||
|
||||
private val fakeData = arrayOf(
|
||||
QuestionsCache(
|
||||
1,
|
||||
"What are different types of services in Android?",
|
||||
"Foreground Service (e.g. music players or download managers); " +
|
||||
"Background Service (e.g. network monitoring or analytics); " +
|
||||
"Bound Service (e.g. voice recognition or location tracking)",
|
||||
2
|
||||
),
|
||||
QuestionsCache(
|
||||
2,
|
||||
"How to stop a service?",
|
||||
"We can use the `stopService(intent)` method. " +
|
||||
"An alternative way to stop a service is to use the `stopSelf()` in the service itself.",
|
||||
2
|
||||
),
|
||||
QuestionsCache(
|
||||
3,
|
||||
"What is AAPT?",
|
||||
"Android Asset Packaging Tool",
|
||||
4
|
||||
),
|
||||
QuestionsCache(
|
||||
4,
|
||||
"How can we optimize the size of the .dex file?",
|
||||
"We can use Proguard to reduce the size of dex (Dalvik EXecutable) files; " +
|
||||
"it is a tool that shrinks and obfuscates the code of an app.",
|
||||
4
|
||||
),
|
||||
QuestionsCache(
|
||||
5,
|
||||
"What is Intent filter?",
|
||||
"An intent filter describes the types of intents that an app is interested in, " +
|
||||
"such as requests to view a specific type of data or to perform a certain action.",
|
||||
1
|
||||
),
|
||||
QuestionsCache(
|
||||
6,
|
||||
"What are four launch modes for activities?",
|
||||
"Standard, SingleTop, SingleTask, SingleInstance",
|
||||
3
|
||||
),
|
||||
QuestionsCache(
|
||||
7,
|
||||
"What is a retained fragment?",
|
||||
"A retained fragment is a type of fragment that is not destroyed and recreated with the activity, " +
|
||||
"but instead is retained in memory. " +
|
||||
"Any data stored in it will survive configuration changes and can be retrieved by the activity afterwards.",
|
||||
3
|
||||
),
|
||||
)
|
||||
|
||||
@BeforeClass
|
||||
@JvmStatic
|
||||
fun enableAccessibilityChecks() {
|
||||
AccessibilityChecks.enable()
|
||||
IdlingPolicies.setMasterPolicyTimeout(7, TimeUnit.SECONDS)
|
||||
IdlingPolicies.setIdlingResourceTimeout(7, TimeUnit.SECONDS)
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Copyright (C) 2019 The Android Open Source Project
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* http://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.
|
||||
*/
|
||||
package ru.myitschool.lab23
|
||||
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.Observer
|
||||
import java.util.concurrent.CountDownLatch
|
||||
import java.util.concurrent.TimeUnit
|
||||
import java.util.concurrent.TimeoutException
|
||||
|
||||
/**
|
||||
* Gets the value of a [LiveData] or waits for it to have one, with a timeout.
|
||||
*
|
||||
* Use this extension from host-side (JVM) tests. It's recommended to use it alongside
|
||||
* `InstantTaskExecutorRule` or a similar mechanism to execute tasks synchronously.
|
||||
*/
|
||||
fun <T> LiveData<T>.getOrAwaitValue(
|
||||
time: Long = 2,
|
||||
timeUnit: TimeUnit = TimeUnit.SECONDS,
|
||||
afterObserve: () -> Unit = {}
|
||||
): T {
|
||||
var data: T? = null
|
||||
val latch = CountDownLatch(1)
|
||||
val observer = object : Observer<T> {
|
||||
override fun onChanged(o: T?) {
|
||||
data = o
|
||||
latch.countDown()
|
||||
this@getOrAwaitValue.removeObserver(this)
|
||||
}
|
||||
}
|
||||
this.observeForever(observer)
|
||||
|
||||
afterObserve.invoke()
|
||||
|
||||
// Don't wait indefinitely if the LiveData is not set.
|
||||
if (!latch.await(time, timeUnit)) {
|
||||
this.removeObserver(observer)
|
||||
throw TimeoutException("LiveData value was never set.")
|
||||
}
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
return data as T
|
||||
}
|
||||
|
||||
/**
|
||||
* Observes a [LiveData] until the `block` is done executing.
|
||||
*/
|
||||
suspend fun <T> LiveData<T>.observeForTesting(block: suspend () -> Unit) {
|
||||
val observer = Observer<T> { }
|
||||
try {
|
||||
observeForever(observer)
|
||||
block()
|
||||
} finally {
|
||||
removeObserver(observer)
|
||||
}
|
||||
}
|
26
app/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="ru.myitschool.lab23">
|
||||
|
||||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.Lab">
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
</application>
|
||||
|
||||
</manifest>
|
19
app/src/main/java/ru/myitschool/lab23/MainActivity.java
Normal file
@@ -0,0 +1,19 @@
|
||||
package ru.myitschool.lab23;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import ru.myitschool.lab23.databinding.ActivityMainBinding;
|
||||
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
ActivityMainBinding binding = ActivityMainBinding.inflate(getLayoutInflater());
|
||||
setContentView(binding.getRoot());
|
||||
|
||||
}
|
||||
}
|
13
app/src/main/java/ru/myitschool/lab23/data/QuestionsCache.kt
Normal file
@@ -0,0 +1,13 @@
|
||||
package ru.myitschool.lab23.data
|
||||
|
||||
import androidx.room.ColumnInfo
|
||||
import androidx.room.Entity
|
||||
import androidx.room.PrimaryKey
|
||||
|
||||
@Entity(tableName = "questions_table")
|
||||
data class QuestionsCache(
|
||||
@PrimaryKey @ColumnInfo(name = "id") val id: Int,
|
||||
@ColumnInfo(name = "question") val question: String,
|
||||
@ColumnInfo(name = "answer") val answer: String,
|
||||
@ColumnInfo(name = "level") val level: Int
|
||||
)
|
10
app/src/main/java/ru/myitschool/lab23/data/QuestionsDao.kt
Normal file
@@ -0,0 +1,10 @@
|
||||
package ru.myitschool.lab23.data
|
||||
|
||||
import androidx.room.Dao
|
||||
|
||||
@Dao
|
||||
interface QuestionsDao {
|
||||
|
||||
// TODO: add methods
|
||||
|
||||
}
|
@@ -0,0 +1,10 @@
|
||||
package ru.myitschool.lab23.data
|
||||
|
||||
import androidx.room.Database
|
||||
import androidx.room.RoomDatabase
|
||||
|
||||
@Database(entities = [QuestionsCache::class], version = 1)
|
||||
abstract class QuestionsDatabase : RoomDatabase() {
|
||||
|
||||
abstract fun questionsDao(): QuestionsDao
|
||||
}
|
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/activity_main.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
tools:context=".MainActivity">
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
BIN
app/src/main/res/mipmap-hdpi/ic_launcher.webp
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
app/src/main/res/mipmap-hdpi/ic_launcher_round.webp
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher.webp
Normal file
After Width: | Height: | Size: 982 B |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher_round.webp
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher.webp
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp
Normal file
After Width: | Height: | Size: 3.8 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher.webp
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp
Normal file
After Width: | Height: | Size: 5.8 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
Normal file
After Width: | Height: | Size: 3.8 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp
Normal file
After Width: | Height: | Size: 7.6 KiB |
10
app/src/main/res/values/colors.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="blue_200">#3E91FF</color>
|
||||
<color name="blue_500">#0381FE</color>
|
||||
<color name="blue_700">#0072DE</color>
|
||||
<color name="teal_200">#3E91FF</color>
|
||||
<color name="teal_700">#3E91FF</color>
|
||||
<color name="black">#FF000000</color>
|
||||
<color name="white">#FFFFFFFF</color>
|
||||
</resources>
|
3
app/src/main/res/values/strings.xml
Normal file
@@ -0,0 +1,3 @@
|
||||
<resources>
|
||||
<string name="app_name">Android Interview</string>
|
||||
</resources>
|
22
app/src/main/res/values/themes.xml
Normal file
@@ -0,0 +1,22 @@
|
||||
<resources>
|
||||
<!-- Base application theme. -->
|
||||
<style name="Theme.Lab" parent="Theme.Material3.DayNight">
|
||||
<!-- Primary color -->
|
||||
<item name="colorPrimary">@color/blue_500</item>
|
||||
<item name="colorPrimaryVariant">@color/blue_700</item>
|
||||
<item name="colorOnPrimary">@color/white</item>
|
||||
<!-- Secondary color -->
|
||||
<item name="colorSecondary">@color/teal_200</item>
|
||||
<item name="colorSecondaryVariant">@color/teal_700</item>
|
||||
<item name="colorOnSecondary">@color/black</item>
|
||||
<!-- Floating Action Button Container -->
|
||||
<item name="colorPrimaryContainer">@color/blue_500</item>
|
||||
<!--ActionBar -->
|
||||
<item name="colorSurface">@color/blue_700</item>
|
||||
<item name="colorOnSurface">@color/white</item>
|
||||
|
||||
<item name="android:navigationBarColor">@color/blue_200</item>
|
||||
<item name="android:windowLightNavigationBar">true</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
17
app/src/test/java/ru/myitschool/lab23/ExampleUnitTest.java
Normal file
@@ -0,0 +1,17 @@
|
||||
package ru.myitschool.lab23;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
public class ExampleUnitTest {
|
||||
@Test
|
||||
public void addition_isCorrect() {
|
||||
assertEquals(4, 2 + 2);
|
||||
}
|
||||
}
|