Skip to content

Commit 1fa5918

Browse files
committed
Create profile feature module
1 parent daeade4 commit 1fa5918

File tree

19 files changed

+352
-27
lines changed

19 files changed

+352
-27
lines changed

.idea/inspectionProfiles/Project_Default.xml

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/build.gradle.kts

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ import java.io.ByteArrayOutputStream
33

44
plugins {
55
alias(libs.plugins.android.application)
6-
alias(libs.plugins.jetbrains.kotlin.android)
6+
alias(libs.plugins.kotlin.android)
7+
alias(libs.plugins.ksp)
78
alias(libs.plugins.kotlin.kapt)
89
alias(libs.plugins.kotlin.parcelize)
10+
alias(libs.plugins.compose)
911
}
1012

1113
apply(from = "$rootDir/jacoco.gradle")
@@ -182,9 +184,7 @@ android {
182184
compose = true
183185
}
184186
buildToolsVersion = buildToolsVersion
185-
composeOptions {
186-
kotlinCompilerExtensionVersion = "1.5.8"
187-
}
187+
188188
packaging {
189189
jniLibs {
190190
excludes += listOf("META-INF/androidx.*")
@@ -214,7 +214,14 @@ android {
214214
}
215215
}
216216

217+
composeCompiler {
218+
enableStrongSkippingMode = true
219+
}
220+
217221
dependencies {
222+
// Feature Modules
223+
implementation(project(":feature-profile"))
224+
218225
// Utils
219226
implementation(libs.gson)
220227
implementation(libs.okhttp)
@@ -335,7 +342,7 @@ dependencies {
335342
implementation(libs.androidx.room.runtime)
336343
implementation(libs.androidx.room.ktx)
337344
implementation(libs.androidx.room.rxjava)
338-
kapt(libs.androidx.room.compiler)
345+
ksp(libs.androidx.room.compiler)
339346

340347
// Preferences
341348
implementation(libs.androidx.preference)
@@ -354,8 +361,8 @@ dependencies {
354361
//Glide
355362
implementation(libs.glide)
356363
annotationProcessor(libs.glide.compiler)
357-
kaptTest(libs.androidx.databinding.compiler)
358-
kaptAndroidTest(libs.androidx.databinding.compiler)
364+
ksp(libs.androidx.databinding.compiler)
365+
kspAndroidTest(libs.androidx.databinding.compiler)
359366

360367
implementation(libs.coordinates2country.android) {
361368
exclude(group = "com.google.android", module = "android")

build.gradle.kts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
// Top-level build file where you can add configuration options common to all sub-projects/modules.
22
plugins {
33
alias(libs.plugins.android.application) apply false
4-
alias(libs.plugins.jetbrains.kotlin.android) apply false
4+
alias(libs.plugins.kotlin.android) apply false
5+
alias(libs.plugins.ksp) apply false
56
alias(libs.plugins.github.triplet.play) apply false
67
alias(libs.plugins.getkeepsafe.dexcount)
8+
alias(libs.plugins.android.library) apply false
9+
alias(libs.plugins.kotlin.parcelize) apply false
10+
alias(libs.plugins.compose) apply false
711
}
812

913
subprojects{

feature-profile/.gitignore

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

feature-profile/build.gradle.kts

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
plugins {
2+
alias(libs.plugins.android.library)
3+
alias(libs.plugins.kotlin.android)
4+
alias(libs.plugins.kotlin.parcelize)
5+
alias(libs.plugins.compose)
6+
}
7+
8+
android {
9+
namespace = "fr.free.nrw.commons.profile"
10+
compileSdk = 35
11+
12+
defaultConfig {
13+
minSdk = 21
14+
15+
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
16+
consumerProguardFiles("consumer-rules.pro")
17+
}
18+
19+
flavorDimensions += "tier"
20+
productFlavors {
21+
create("beta") {
22+
dimension = "tier"
23+
}
24+
create("prod") {
25+
dimension = "tier"
26+
}
27+
}
28+
29+
buildTypes {
30+
release {
31+
isMinifyEnabled = false
32+
proguardFiles(
33+
getDefaultProguardFile("proguard-android-optimize.txt"),
34+
"proguard-rules.pro"
35+
)
36+
}
37+
}
38+
compileOptions {
39+
sourceCompatibility = JavaVersion.VERSION_17
40+
targetCompatibility = JavaVersion.VERSION_17
41+
}
42+
kotlinOptions {
43+
jvmTarget = "17"
44+
}
45+
buildFeatures {
46+
compose = true
47+
}
48+
}
49+
50+
dependencies {
51+
implementation(libs.androidx.core.ktx)
52+
implementation(libs.androidx.appcompat)
53+
implementation(libs.android.material)
54+
implementation(libs.androidx.lifecycle.runtime.ktx)
55+
implementation(libs.androidx.activity.compose)
56+
implementation(platform(libs.androidx.compose.bom))
57+
implementation(libs.androidx.ui)
58+
implementation(libs.androidx.ui.graphics)
59+
implementation(libs.androidx.ui.tooling.preview)
60+
implementation(libs.androidx.material3)
61+
testImplementation(libs.junit)
62+
androidTestImplementation(libs.androidx.test.ext.junit)
63+
androidTestImplementation(libs.androidx.espresso.core)
64+
androidTestImplementation(platform(libs.androidx.compose.bom))
65+
androidTestImplementation(libs.androidx.ui.test.junit4)
66+
debugImplementation(libs.androidx.ui.tooling)
67+
debugImplementation(libs.androidx.ui.test.manifest)
68+
}

feature-profile/consumer-rules.pro

Whitespace-only changes.

feature-profile/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 fr.free.nrw.commons.feature.profile
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("fr.free.nrw.commons.feature.profile.test", appContext.packageName)
23+
}
24+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
3+
4+
<application>
5+
<activity
6+
android:name="fr.free.nrw.commons.feature.profile.ProfileActivity"
7+
android:exported="false"
8+
android:label="@string/title_activity_profile"
9+
android:theme="@style/Theme.Appsandroidcommons" />
10+
</application>
11+
12+
</manifest>
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
package fr.free.nrw.commons.feature.profile
2+
3+
import android.os.Bundle
4+
import androidx.activity.ComponentActivity
5+
import androidx.activity.compose.setContent
6+
import androidx.activity.enableEdgeToEdge
7+
import androidx.compose.foundation.layout.fillMaxSize
8+
import androidx.compose.foundation.layout.padding
9+
import androidx.compose.material3.Scaffold
10+
import androidx.compose.material3.Text
11+
import androidx.compose.runtime.Composable
12+
import androidx.compose.ui.Modifier
13+
import androidx.compose.ui.tooling.preview.Preview
14+
import fr.free.nrw.commons.feature.profile.ui.theme.AppsandroidcommonsTheme
15+
16+
class ProfileActivity : ComponentActivity() {
17+
override fun onCreate(savedInstanceState: Bundle?) {
18+
super.onCreate(savedInstanceState)
19+
enableEdgeToEdge()
20+
setContent {
21+
AppsandroidcommonsTheme {
22+
Scaffold(modifier = Modifier.fillMaxSize()) { innerPadding ->
23+
Greeting(
24+
name = "Android",
25+
modifier = Modifier.padding(innerPadding)
26+
)
27+
}
28+
}
29+
}
30+
}
31+
}
32+
33+
@Composable
34+
fun Greeting(name: String, modifier: Modifier = Modifier) {
35+
Text(
36+
text = "Hello $name!",
37+
modifier = modifier
38+
)
39+
}
40+
41+
@Preview(showBackground = true)
42+
@Composable
43+
fun GreetingPreview() {
44+
AppsandroidcommonsTheme {
45+
Greeting("Android")
46+
}
47+
}

0 commit comments

Comments
 (0)