Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Gradle files
.gradle/
build/

# Local configuration file (sdk path, etc)
local.properties

# Log/OS Files
*.log

# Android Studio generated files and folders
captures/
.externalNativeBuild/
.cxx/
*.apk
output.json

# IntelliJ
*.iml
.idea/
misc.xml
deploymentTargetDropDown.xml
render.experimental.xml

# Keystore files
*.jks
*.keystore

# Google Services (e.g. APIs or Firebase)
google-services.json

# Android Profiling
*.hprof
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Лабораторная работа по android, выполненная с помощью Jetpack Compose


![Alt text](screens/screen1.jpg)
![Alt text](screens/screen2.jpg)
1 change: 1 addition & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
69 changes: 69 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
}

android {
namespace 'com.example.android_ck'
compileSdk 34

defaultConfig {
applicationId "com.example.android_ck"
minSdk 24
targetSdk 34
versionCode 1
versionName "1.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
release {
minifyEnabled true
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
buildFeatures {
compose true
}
composeOptions {
kotlinCompilerExtensionVersion '1.3.2'
}
packagingOptions {
resources {
excludes += '/META-INF/{AL2.0,LGPL2.1}'
}
}
}

dependencies {

implementation 'androidx.core:core-ktx:1.12.0'
implementation platform('org.jetbrains.kotlin:kotlin-bom:1.8.0')
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.6.2'
implementation 'androidx.activity:activity-compose:1.8.0'
implementation platform('androidx.compose:compose-bom:2022.10.00')
implementation 'androidx.compose.ui:ui'
implementation 'androidx.compose.ui:ui-graphics'
implementation 'androidx.compose.ui:ui-tooling-preview'
implementation 'androidx.compose.material3:material3'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
androidTestImplementation platform('androidx.compose:compose-bom:2022.10.00')
androidTestImplementation 'androidx.compose.ui:ui-test-junit4'
debugImplementation 'androidx.compose.ui:ui-tooling'
debugImplementation 'androidx.compose.ui:ui-test-manifest'
implementation 'androidx.lifecycle:lifecycle-viewmodel-compose:2.6.2'
implementation 'androidx.activity:activity-compose:1.8.0'
implementation "androidx.compose.runtime:runtime-livedata:1.6.0-alpha08"
implementation "androidx.compose.runtime:runtime-rxjava2:1.6.0-alpha08"
implementation "com.google.accompanist:accompanist-systemuicontroller:0.27.0"
implementation 'com.google.android.material:material:1.10.0'
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.example.android_ck

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("com.example.android_ck", appContext.packageName)
}
}
29 changes: 29 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<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.Android_CK">
<activity
android:name=".MainActivity"
android:exported="true"
android:label="@string/app_name"
android:theme="@style/Theme.Android_CK">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

<meta-data
android:name="android.app.lib_name"
android:value="" />
</activity>
</application>

</manifest>
51 changes: 51 additions & 0 deletions app/src/main/java/com/example/android_ck/MainActivity.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package com.example.android_ck

import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.runtime.Composable
import androidx.compose.runtime.SideEffect
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.core.view.WindowCompat
import com.example.android_ck.ui.theme.AppTheme
import com.google.accompanist.systemuicontroller.rememberSystemUiController

class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

WindowCompat.setDecorFitsSystemWindows(window, false)
setContent {
MainScreen()
}
}
}

@Composable
fun MainScreen() {
MaterialTheme {

ApplySystemBarColors()

Surface(
color = AppTheme.BgColors.primary,
modifier = Modifier.fillMaxSize(),
) {
DotaScreen()
}
}
}

@Composable
private fun ApplySystemBarColors(){
val systemUiController = rememberSystemUiController()

SideEffect {
systemUiController.setStatusBarColor(color = Color.Transparent)
systemUiController.setNavigationBarColor(color = Color.Transparent)
}
}
20 changes: 20 additions & 0 deletions app/src/main/java/com/example/android_ck/ui/theme/Color.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.example.android_ck.ui.theme

import androidx.compose.material3.darkColorScheme
import androidx.compose.material3.lightColorScheme
import androidx.compose.ui.graphics.Color


val LightColorScheme = lightColorScheme(
primary = Color(color = 0xFF6750A4),
secondary = Color(color = 0xFF625B71),
tertiary = Color(color = 0xFF7D5260),
background = Color(color = 0xFFFFFBFE)
)

val DarkColorScheme = darkColorScheme(
primary = Color(color = 0xFFD0BCFF),
secondary = Color(color = 0xFFCCC2DC),
tertiary = Color(color = 0xFFEFB8C8),
background = Color(color = 0xFF1C1B1F)
)
12 changes: 12 additions & 0 deletions app/src/main/java/com/example/android_ck/ui/theme/Fonts.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.example.android_ck.ui.theme

import androidx.compose.ui.text.font.Font
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontWeight
import com.example.android_ck.R

internal val FontFamily = FontFamily(
Font(R.font.sk_modernist_regular_font),
Font(R.font.sk_modernist_mono_font, weight = FontWeight.Medium),
Font(R.font.sk_modernist_bold_font, weight = FontWeight.Bold)
)
11 changes: 11 additions & 0 deletions app/src/main/java/com/example/android_ck/ui/theme/Shape.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.example.android_ck.ui.theme

import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Shapes
import androidx.compose.ui.unit.dp

val Shapes = Shapes(
small = RoundedCornerShape(4.dp),
medium = RoundedCornerShape(4.dp),
large = RoundedCornerShape(0.dp)
)
Loading