Skip to content

Commit add5181

Browse files
committed
Initial commit
0 parents  commit add5181

File tree

68 files changed

+2526
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+2526
-0
lines changed

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
*.iml
2+
.gradle
3+
.idea
4+
/local.properties
5+
.DS_Store
6+
/build
7+
/captures
8+
.externalNativeBuild
9+
.cxx
10+
local.properties

app/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

app/build.gradle.kts

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
plugins {
2+
id("com.android.application")
3+
id("org.jetbrains.kotlin.android")
4+
id("com.google.devtools.ksp")
5+
id("kotlin-parcelize")
6+
}
7+
8+
android {
9+
namespace = "com.alexereh.cocktailbar"
10+
compileSdk = 34
11+
12+
defaultConfig {
13+
applicationId = "com.alexereh.cocktailbar"
14+
minSdk = 26
15+
targetSdk = 34
16+
versionCode = 1
17+
versionName = "1.0"
18+
19+
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
20+
vectorDrawables {
21+
useSupportLibrary = true
22+
}
23+
}
24+
25+
buildTypes {
26+
release {
27+
isMinifyEnabled = false
28+
proguardFiles(
29+
getDefaultProguardFile("proguard-android-optimize.txt"),
30+
"proguard-rules.pro"
31+
)
32+
}
33+
}
34+
compileOptions {
35+
sourceCompatibility = JavaVersion.VERSION_1_8
36+
targetCompatibility = JavaVersion.VERSION_1_8
37+
}
38+
kotlinOptions {
39+
jvmTarget = "1.8"
40+
}
41+
buildFeatures {
42+
compose = true
43+
}
44+
composeOptions {
45+
kotlinCompilerExtensionVersion = "1.5.0"
46+
}
47+
packaging {
48+
resources {
49+
excludes += "/META-INF/{AL2.0,LGPL2.1}"
50+
}
51+
}
52+
}
53+
54+
dependencies {
55+
val decomposeVersion = "2.0.1"
56+
implementation("com.arkivanov.decompose:decompose:$decomposeVersion")
57+
implementation("com.arkivanov.decompose:extensions-compose-jetpack:$decomposeVersion")
58+
59+
val room_version = "2.5.2"
60+
61+
implementation("androidx.room:room-runtime:$room_version")
62+
ksp("androidx.room:room-compiler:$room_version")
63+
implementation("androidx.room:room-ktx:$room_version")
64+
65+
implementation("com.google.code.gson:gson:2.10.1")
66+
67+
implementation("io.coil-kt:coil:2.4.0")
68+
implementation("io.coil-kt:coil-compose:2.4.0")
69+
70+
implementation("io.insert-koin:koin-android:3.4.3")
71+
implementation("io.insert-koin:koin-androidx-compose:3.4.6")
72+
73+
implementation("androidx.core:core-ktx:1.10.1")
74+
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.6.1")
75+
implementation("androidx.activity:activity-ktx:1.7.2")
76+
implementation("androidx.activity:activity-compose:1.7.2")
77+
implementation(platform("androidx.compose:compose-bom:2023.06.01"))
78+
implementation("androidx.compose.ui:ui")
79+
implementation("androidx.compose.ui:ui-graphics")
80+
implementation("androidx.compose.ui:ui-tooling-preview")
81+
implementation("androidx.compose.material3:material3")
82+
implementation("androidx.compose.material:material")
83+
implementation("androidx.compose.material:material-icons-extended")
84+
testImplementation("junit:junit:4.13.2")
85+
androidTestImplementation("androidx.test.ext:junit:1.1.5")
86+
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
87+
androidTestImplementation(platform("androidx.compose:compose-bom:2023.06.01"))
88+
androidTestImplementation("androidx.compose.ui:ui-test-junit4")
89+
debugImplementation("androidx.compose.ui:ui-tooling")
90+
debugImplementation("androidx.compose.ui:ui-test-manifest")
91+
}

app/proguard-rules.pro

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package com.alexereh.cocktailbar
2+
3+
import androidx.test.platform.app.InstrumentationRegistry
4+
import androidx.test.ext.junit.runners.AndroidJUnit4
5+
6+
import org.junit.Test
7+
import org.junit.runner.RunWith
8+
9+
import org.junit.Assert.*
10+
11+
/**
12+
* Instrumented test, which will execute on an Android device.
13+
*
14+
* See [testing documentation](http://d.android.com/tools/testing).
15+
*/
16+
@RunWith(AndroidJUnit4::class)
17+
class ExampleInstrumentedTest {
18+
@Test
19+
fun useAppContext() {
20+
// Context of the app under test.
21+
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
22+
assertEquals("com.alexereh.cocktailbar", appContext.packageName)
23+
}
24+
}

app/src/main/AndroidManifest.xml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:tools="http://schemas.android.com/tools">
4+
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"
5+
tools:ignore="ScopedStorage" />
6+
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
7+
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
8+
<application
9+
android:allowBackup="true"
10+
android:name=".MainApplication"
11+
android:dataExtractionRules="@xml/data_extraction_rules"
12+
android:fullBackupContent="@xml/backup_rules"
13+
android:icon="@mipmap/ic_launcher"
14+
android:label="@string/app_name"
15+
android:roundIcon="@mipmap/ic_launcher_round"
16+
android:supportsRtl="true"
17+
android:theme="@style/Theme.CocktailBar"
18+
tools:targetApi="31">
19+
<activity
20+
android:name=".MainActivity"
21+
android:exported="true"
22+
android:theme="@style/Theme.CocktailBar">
23+
<intent-filter>
24+
<action android:name="android.intent.action.MAIN" />
25+
26+
<category android:name="android.intent.category.LAUNCHER" />
27+
</intent-filter>
28+
</activity>
29+
</application>
30+
31+
</manifest>
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
package com.alexereh.cocktailbar
2+
3+
import android.os.Bundle
4+
import androidx.activity.ComponentActivity
5+
import androidx.activity.compose.setContent
6+
import androidx.compose.foundation.layout.fillMaxSize
7+
import androidx.compose.material3.MaterialTheme
8+
import androidx.compose.material3.Surface
9+
import androidx.compose.material3.Text
10+
import androidx.compose.runtime.Composable
11+
import androidx.compose.ui.Modifier
12+
import androidx.compose.ui.tooling.preview.Preview
13+
import com.alexereh.cocktailbar.components.root.DefaultRootComponent
14+
import com.alexereh.cocktailbar.components.root.RootContent
15+
import com.alexereh.cocktailbar.ui.theme.CocktailBarTheme
16+
import com.arkivanov.decompose.defaultComponentContext
17+
18+
class MainActivity : ComponentActivity() {
19+
override fun onCreate(savedInstanceState: Bundle?) {
20+
super.onCreate(savedInstanceState)
21+
22+
val root = DefaultRootComponent(
23+
componentContext = defaultComponentContext()
24+
)
25+
26+
setContent {
27+
CocktailBarTheme {
28+
Surface(
29+
modifier = Modifier.fillMaxSize(),
30+
color = MaterialTheme.colorScheme.background
31+
) {
32+
RootContent(component = root, modifier = Modifier.fillMaxSize())
33+
}
34+
}
35+
}
36+
}
37+
}
38+
39+
@Composable
40+
fun Greeting(name: String, modifier: Modifier = Modifier) {
41+
Text(
42+
text = "Hello $name!",
43+
modifier = modifier
44+
)
45+
}
46+
47+
@Preview(showBackground = true)
48+
@Composable
49+
fun GreetingPreview() {
50+
CocktailBarTheme {
51+
Greeting("Android")
52+
}
53+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package com.alexereh.cocktailbar
2+
3+
import android.app.Application
4+
import com.alexereh.cocktailbar.di.mainModule
5+
import org.koin.android.ext.koin.androidContext
6+
import org.koin.android.ext.koin.androidLogger
7+
import org.koin.core.context.GlobalContext.startKoin
8+
9+
class MainApplication: Application() {
10+
override fun onCreate() {
11+
super.onCreate()
12+
13+
startKoin {
14+
// Log Koin into Android logger
15+
androidLogger()
16+
// Reference Android context
17+
androidContext(this@MainApplication)
18+
// Load modules
19+
modules(mainModule)
20+
}
21+
22+
}
23+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package com.alexereh.cocktailbar.components.cocktaildetails
2+
3+
import com.alexereh.cocktailbar.model.Cocktail
4+
import kotlinx.coroutines.flow.StateFlow
5+
6+
interface CocktailDetailsComponent {
7+
val cocktail: StateFlow<Cocktail?>
8+
fun edit()
9+
fun delete()
10+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package com.alexereh.cocktailbar.components.cocktaildetails
2+
3+
import com.alexereh.cocktailbar.model.Cocktail
4+
import kotlinx.coroutines.flow.StateFlow
5+
6+
class FakeCocktailDetailsComponent: CocktailDetailsComponent {
7+
override val cocktail: StateFlow<Cocktail>
8+
get() = TODO("Not yet implemented")
9+
10+
override fun edit() {
11+
}
12+
13+
override fun delete() {
14+
}
15+
}

0 commit comments

Comments
 (0)