Skip to content

Commit 8b8530e

Browse files
committed
ref: organize infra and extra clean up in android-sample project
1 parent cca4b9c commit 8b8530e

File tree

12 files changed

+80
-245
lines changed

12 files changed

+80
-245
lines changed

android-sample/app/build.gradle.kts

Lines changed: 34 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,31 @@
11
@file:Suppress("UnstableApiUsage")
22

3+
class AppConfig {
4+
val id = "com.fernandocejas.sample"
5+
val javaVersion = JavaVersion.VERSION_17
6+
7+
val compileSdk = libs.versions.compileSdk.get().toInt()
8+
val minSdk = libs.versions.minSdk.get().toInt()
9+
val targetSdk = libs.versions.targetSdk.get().toInt()
10+
}
11+
12+
313
plugins {
4-
id("com.android.application")
5-
id("org.jetbrains.kotlin.android")
14+
alias(libs.plugins.android.application)
15+
alias(libs.plugins.kotlin.android)
616
}
717

818
android {
9-
namespace = "com.fernandocejas.sample"
10-
compileSdk = 33
19+
val appConfig = AppConfig()
20+
21+
namespace = appConfig.id
22+
compileSdk = appConfig.compileSdk
1123

1224
defaultConfig {
13-
applicationId = "com.fernandocejas.sample"
25+
applicationId = appConfig.id
1426

15-
minSdk = 29
16-
targetSdk = 33
27+
minSdk = appConfig.minSdk
28+
targetSdk = appConfig.targetSdk
1729
versionCode = 1
1830
versionName = "1.0"
1931

@@ -36,12 +48,12 @@ android {
3648
}
3749

3850
compileOptions {
39-
sourceCompatibility = JavaVersion.VERSION_17
40-
targetCompatibility = JavaVersion.VERSION_17
51+
sourceCompatibility = appConfig.javaVersion
52+
targetCompatibility = appConfig.javaVersion
4153
}
4254

4355
kotlinOptions {
44-
jvmTarget = JavaVersion.VERSION_17.toString()
56+
jvmTarget = appConfig.javaVersion.toString()
4557
}
4658

4759
buildFeatures {
@@ -59,42 +71,32 @@ android {
5971
isMinifyEnabled = false
6072
}
6173
getByName("release") {
62-
isMinifyEnabled = false
74+
isMinifyEnabled = true
6375
}
6476
}
6577
}
6678

6779
dependencies {
68-
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.22")
69-
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.2")
70-
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.2")
71-
implementation("androidx.core:core-ktx:1.10.1")
72-
implementation("androidx.appcompat:appcompat:1.6.1")
80+
implementation(libs.kotlin.stdlib.jdk8)
81+
implementation(libs.kotlinx.coroutines.core)
82+
implementation(libs.kotlinx.coroutines.android)
83+
implementation(libs.android.core.ktx)
84+
implementation(libs.android.appcompat)
7385

7486
// Jetpack Compose
7587
// https://developer.android.com/jetpack/compose/setup#kotlin_1
76-
val composeBom = platform("androidx.compose:compose-bom:2023.05.01")
88+
val composeBom = platform(libs.androidx.compose.bom)
7789
implementation(composeBom)
7890
androidTestImplementation(composeBom)
7991

8092
// Material Design 3
81-
implementation("androidx.compose.material3:material3:1.1.1")
82-
implementation("androidx.compose.material3:material3-window-size-class:1.1.1")
83-
93+
implementation(libs.androidx.compose.material3)
94+
implementation(libs.androidx.compose.material3.window.size)
8495

8596
// Compose Activity Integration
86-
implementation("androidx.activity:activity-compose:1.7.2")
97+
implementation(libs.androidx.activty.compose)
8798

8899
// Android Studio Preview support
89-
implementation("androidx.compose.ui:ui-tooling-preview")
90-
debugImplementation("androidx.compose.ui:ui-tooling")
91-
92-
// UI Tests
93-
androidTestImplementation("androidx.compose.ui:ui-test-junit4")
94-
debugImplementation("androidx.compose.ui:ui-test-manifest")
95-
96-
97-
implementation("androidx.fragment:fragment-ktx:1.6.0")
98-
implementation("com.google.android.material:material:1.9.0")
99-
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
100+
implementation(libs.androidx.compose.ui.tooling.preview)
101+
implementation(libs.androidx.compose.ui.tooling)
100102
}

android-sample/app/src/main/AndroidManifest.xml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3-
package="com.fernandocejas.sample">
3+
xmlns:tools="http://schemas.android.com/tools"
4+
package="com.fernandocejas.sample">
45

56
<application
67
android:allowBackup="true"
78
android:name=".AndroidApplication"
89
android:icon="@mipmap/ic_launcher"
910
android:label="@string/app_name"
1011
android:roundIcon="@mipmap/ic_launcher_round"
11-
android:theme="@style/Theme.Main">
12+
android:theme="@style/Theme.AppCompat.NoActionBar">
1213

1314
<activity
1415
android:name="com.fernandocejas.sample.MainActivity"
15-
android:exported="true">
16+
android:screenOrientation="portrait"
17+
android:exported="true"
18+
tools:ignore="LockedOrientationActivity">
1619
<intent-filter>
1720
<action android:name="android.intent.action.MAIN" />
1821
<category android:name="android.intent.category.LAUNCHER" />

android-sample/app/src/main/kotlin/com/fernandocejas/sample/MainFragment.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@
1515
*/
1616
package com.fernandocejas.sample
1717

18-
import androidx.fragment.app.Fragment
19-
20-
class MainFragment : Fragment() {
18+
class MainFragment {
2119
//
2220
// private var _binding: FragmentMainBinding? = null
2321
// private val binding get() = _binding!!

android-sample/app/src/main/res/values-night/themes.xml

Lines changed: 0 additions & 16 deletions
This file was deleted.

android-sample/app/src/main/res/values/colors.xml

Lines changed: 0 additions & 10 deletions
This file was deleted.

android-sample/app/src/main/res/values/themes.xml

Lines changed: 0 additions & 42 deletions
This file was deleted.

android-sample/app/src/test/kotlin/com/fernandocejas/sample/AndroidAssertions.kt

Lines changed: 0 additions & 33 deletions
This file was deleted.

android-sample/app/src/test/kotlin/com/fernandocejas/sample/AndroidTest.kt

Lines changed: 0 additions & 45 deletions
This file was deleted.

android-sample/app/src/test/kotlin/com/fernandocejas/sample/InjectMocksRule.kt

Lines changed: 0 additions & 26 deletions
This file was deleted.

android-sample/app/src/test/kotlin/com/fernandocejas/sample/UnitTest.kt

Lines changed: 0 additions & 32 deletions
This file was deleted.

0 commit comments

Comments
 (0)