Skip to content

Commit e811401

Browse files
committed
[Issue-27] - Adding compose helper classes
1 parent e6ee028 commit e811401

File tree

16 files changed

+174
-15
lines changed

16 files changed

+174
-15
lines changed

app/build.gradle.kts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,22 @@
1+
@file:Suppress("UnstableApiUsage")
2+
android {
3+
buildFeatures {
4+
compose = true
5+
}
6+
7+
composeOptions {
8+
kotlinCompilerExtensionVersion = Versions.composeCompilerVersion
9+
}
10+
}
11+
112
dependencies {
213
implementation(project(Dependencies.Module.feature_list_streams))
314
implementation(project(Dependencies.Module.core_networking))
15+
implementation(project(Dependencies.Module.core_ui))
416
implementation(Dependencies.Koin.koin)
17+
implementation(Dependencies.Compose.composeUI)
18+
implementation(Dependencies.Compose.composeMaterial3)
19+
implementation(Dependencies.Compose.composeNavigation)
520
Dependencies.Kotlin.list.forEach { implementation(it) }
621
Dependencies.Support.list.forEach { implementation(it) }
722
Dependencies.UnitTest.list.forEach { testImplementation(it) }

app/src/main/AndroidManifest.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@
1212
android:theme="@style/Theme.StreamPlayerApp"
1313
tools:targetApi="31"
1414
android:name=".CustomApplication">
15+
<activity
16+
android:name=".MainActivity"
17+
android:exported="true">
18+
<intent-filter>
19+
<action android:name="android.intent.action.MAIN"/>
20+
<category android:name="android.intent.category.LAUNCHER"/>
21+
</intent-filter>
22+
</activity>
1523
</application>
1624

1725
</manifest>

app/src/main/java/com/codandotv/streamplayerapp/MainActivity.kt

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,32 @@ package com.codandotv.streamplayerapp
22

33
import androidx.appcompat.app.AppCompatActivity
44
import android.os.Bundle
5+
import androidx.activity.compose.setContent
6+
import androidx.compose.foundation.layout.Box
7+
import androidx.compose.foundation.layout.padding
8+
import androidx.compose.material3.ExperimentalMaterial3Api
9+
import androidx.compose.material3.Scaffold
10+
import androidx.compose.runtime.Composable
11+
import androidx.compose.ui.Modifier
12+
import com.codandotv.streamplayerapp.core_ui.theme.StreamPlayerTheme
13+
import com.codandotv.streamplayerapp.feature_list_streams.presentation.screens.ListStreamsScreen
514

615
class MainActivity : AppCompatActivity() {
716
override fun onCreate(savedInstanceState: Bundle?) {
817
super.onCreate(savedInstanceState)
9-
setContentView(R.layout.activity_main)
18+
setContent {
19+
StreamPlayerApp()
20+
}
1021
}
11-
}
22+
}
23+
@OptIn(ExperimentalMaterial3Api::class)
24+
@Composable
25+
fun StreamPlayerApp() {
26+
StreamPlayerTheme {
27+
Scaffold { innerPadding ->
28+
Box(Modifier.padding(innerPadding)) {
29+
ListStreamsScreen()
30+
}
31+
}
32+
}
33+
}

app/src/main/res/values/themes.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<resources xmlns:tools="http://schemas.android.com/tools">
22
<!-- Base application theme. -->
3-
<style name="Theme.StreamPlayerApp" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
3+
<style name="Theme.StreamPlayerApp" parent="Theme.MaterialComponents.DayNight.NoActionBar">
44
<!-- Primary brand color. -->
55
<item name="colorPrimary">@color/purple_500</item>
66
<item name="colorPrimaryVariant">@color/purple_700</item>
@@ -10,7 +10,7 @@
1010
<item name="colorSecondaryVariant">@color/teal_700</item>
1111
<item name="colorOnSecondary">@color/black</item>
1212
<!-- Status bar color. -->
13-
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
13+
<item name="android:statusBarColor">@color/black</item>
1414
<!-- Customize your theme here. -->
1515
</style>
1616
</resources>

buildSrc/src/main/java/Dependencies.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ object Dependencies {
1111
object Module {
1212
const val core_networking = ":core-networking"
1313
const val feature_list_streams = ":feature-list-streams"
14+
const val core_ui = ":core-ui"
1415
}
1516

1617
val modules: List<String> by lazy {

core-ui/.gitignore

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

core-ui/build.gradle.kts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
@file:Suppress("UnstableApiUsage")
2+
android {
3+
namespace = "${Config.packageName}core_ui"
4+
5+
buildFeatures {
6+
compose = true
7+
}
8+
9+
composeOptions {
10+
kotlinCompilerExtensionVersion = Versions.composeCompilerVersion
11+
}
12+
}
13+
14+
dependencies {
15+
Dependencies.Kotlin.list.forEach { implementation(it) }
16+
Dependencies.Compose.list.forEach { implementation(it) }
17+
implementation("androidx.compose.ui:ui-tooling-preview:1.4.3")
18+
debugImplementation("androidx.compose.ui:ui-tooling:1.4.3")
19+
}
20+

core-ui/consumer-rules.pro

Whitespace-only changes.

core-ui/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: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
3+
4+
</manifest>

0 commit comments

Comments
 (0)