Skip to content

Commit 0d5bad2

Browse files
committed
Integrated initial project setup
0 parents  commit 0d5bad2

File tree

170 files changed

+6429
-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.

170 files changed

+6429
-0
lines changed

.editorconfig

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# https://editorconfig.org
2+
root = true
3+
4+
[*]
5+
indent_style = space
6+
indent_size = 2
7+
8+
end_of_line = lf
9+
charset = utf-8
10+
trim_trailing_whitespace = true
11+
insert_final_newline = true
12+
13+
[*.{java,kt,kts,scala,rs,xml,kt.spec,kts.spec}]
14+
indent_size = 4
15+
disabled_rules=no-wildcard-imports
16+
17+
[*.{kt,kts}]
18+
ktlint_code_style = ktlint_official
19+
ktlint_ignore_back_ticked_identifier = true
20+
21+
ktlint_standard = enabled
22+
23+
# Experimental rules run by default run on the ktlint code base itself. Experimental rules should not be released if
24+
# we are not pleased ourselves with the results on the ktlint code base.
25+
ktlint_experimental = enabled
26+
27+
[*.md]
28+
trim_trailing_whitespace = false

.gitignore

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
*.iml
2+
.gradle
3+
/local.properties
4+
/.idea/caches
5+
/.idea/libraries
6+
/.idea/modules.xml
7+
/.idea/workspace.xml
8+
/.idea/navEditor.xml
9+
/.idea/assetWizardSettings.xml
10+
.DS_Store
11+
/build
12+
/captures
13+
.externalNativeBuild
14+
.cxx
15+
local.properties
16+
.idea
17+
# Unit test reports
18+
TEST*.xml
19+
20+
# Generated by MacOS
21+
.DS_Store
22+
23+
# Generated by Windows
24+
Thumbs.db
25+
26+
# Applications
27+
*.app
28+
*.exe
29+
*.war
30+
31+
# Large media files
32+
*.mp4
33+
*.tiff
34+
*.avi
35+
*.flv
36+
*.mov
37+
*.wmv
38+
39+

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
YCoreUI
2+
==================
3+
4+
### How to generate test report
5+
- Generating jacoco test report
6+
- Gradle command `clean build createMergedJacocoReport`
7+
- From android studio
8+
- Open gradle menu bar from android studio right side panel
9+
- Click on the gradle icon and
10+
- In command popup window type `clean build createMergedJacocoReport` and press enter
11+
- Wait for the execution completion,
12+
- After successful execution each module level execution report will be stored in 'module\build\reports\jacoco\html\index.html'.
13+
14+
### How to generate dokka report
15+
- Gradle command single module `clean build dokkaHtml` for multi module `clean build dokkaHtmlMultiModule`
16+
- From android studio
17+
- Open gradle menu bar from android studio right side panel
18+
- Click on the gradle icon and
19+
- In command popup window type `dokkaHtml` for multi module `dokkaHtmlMultiModule`
20+
21+
### How to check KTLint
22+
- Gradle command for checking lint error `ktlintCheck`
23+
- Gradle command for formatting code `ktlintFormat`

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: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
@Suppress("DSL_SCOPE_VIOLATION") // scope violation issue: work around suggested from: https://github.com/gradle/gradle/issues/22797
2+
plugins {
3+
id("co.yml.coreui.application")
4+
id("co.yml.coreui.application.jacoco")
5+
id("co.yml.coreui.application.compose")
6+
id("co.yml.coreui.hilt")
7+
}
8+
9+
android {
10+
namespace = "co.yml.coreui"
11+
defaultConfig {
12+
applicationId = "co.yml.coreui"
13+
versionCode = 1
14+
versionName = "1.0"
15+
}
16+
}
17+
18+
dependencies {
19+
implementation(versionCatalogLibs.hilt.nav.compose)
20+
implementation(versionCatalogLibs.androidx.lifecycle.viewModelCompose)
21+
22+
implementation(project(mapOf("path" to ":core:ui")))
23+
implementation(project(mapOf("path" to ":feature:post")))
24+
25+
androidTestImplementation(versionCatalogLibs.androidx.test.core)
26+
androidTestImplementation(versionCatalogLibs.androidx.test.core.ktx)
27+
androidTestImplementation(versionCatalogLibs.androidx.test.ext)
28+
androidTestImplementation(versionCatalogLibs.androidx.test.runner)
29+
androidTestImplementation(versionCatalogLibs.androidx.test.rules)
30+
31+
debugImplementation("androidx.compose.ui:ui-test-manifest:${versionCatalogLibs.versions.compose}")
32+
androidTestImplementation(project(mapOf("path" to ":core:test")))
33+
}

app/proguard-rules.pro

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Keep `Companion` object fields of serializable classes.
2+
# This avoids serializer lookup through `getDeclaredClasses` as done for named companion objects.
3+
-if @kotlinx.serialization.Serializable class **
4+
-keepclassmembers class <1> {
5+
static <1>$Companion Companion;
6+
}
7+
8+
# Keep `serializer()` on companion objects (both default and named) of serializable classes.
9+
-if @kotlinx.serialization.Serializable class ** {
10+
static **$* *;
11+
}
12+
-keepclassmembers class <2>$<3> {
13+
kotlinx.serialization.KSerializer serializer(...);
14+
}
15+
16+
# Keep `INSTANCE.serializer()` of serializable objects.
17+
-if @kotlinx.serialization.Serializable class ** {
18+
public static ** INSTANCE;
19+
}
20+
-keepclassmembers class <1> {
21+
public static <1> INSTANCE;
22+
kotlinx.serialization.KSerializer serializer(...);
23+
}
24+
25+
# @Serializable and @Polymorphic are used at runtime for polymorphic serialization.
26+
-keepattributes RuntimeVisibleAnnotations,AnnotationDefault
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package co.yml.coreui
2+
3+
import androidx.test.ext.junit.runners.AndroidJUnit4
4+
import androidx.test.platform.app.InstrumentationRegistry
5+
import org.junit.Assert.assertTrue
6+
import org.junit.Test
7+
import org.junit.runner.RunWith
8+
9+
/**
10+
* Application test
11+
*
12+
* @constructor Create empty Application test
13+
*/
14+
@RunWith(AndroidJUnit4::class)
15+
class ApplicationTest {
16+
/**
17+
* Test app context
18+
*
19+
*/
20+
@Test
21+
fun testAppContext() {
22+
// Context of the app under test.
23+
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
24+
assertTrue(appContext.packageName.contains("co.yml.coreui"))
25+
}
26+
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
package co.yml.coreui
2+
3+
import androidx.compose.ui.test.junit4.createAndroidComposeRule
4+
import androidx.lifecycle.Lifecycle
5+
import androidx.test.core.app.launchActivity
6+
import androidx.test.ext.junit.rules.activityScenarioRule
7+
import androidx.test.ext.junit.runners.AndroidJUnit4
8+
import androidx.test.platform.app.InstrumentationRegistry
9+
import dagger.hilt.android.testing.HiltAndroidRule
10+
import dagger.hilt.android.testing.HiltAndroidTest
11+
import org.junit.Assert
12+
import org.junit.Rule
13+
import org.junit.Test
14+
import org.junit.runner.RunWith
15+
16+
/**
17+
* Main activity test
18+
*
19+
* @constructor Create empty Main activity test
20+
*/
21+
@HiltAndroidTest
22+
@RunWith(AndroidJUnit4::class)
23+
class MainActivityTest {
24+
@get:Rule(order = 0)
25+
var hiltRule = HiltAndroidRule(this)
26+
27+
@get:Rule(order = 1)
28+
var activityScenarioRule = activityScenarioRule<MainActivity>()
29+
30+
@get:Rule(order = 2)
31+
val composeTestRule = createAndroidComposeRule<MainActivity>()
32+
33+
/**
34+
* Use app context
35+
*
36+
*/
37+
@Test
38+
fun useAppContext() {
39+
// Context of the app under test.
40+
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
41+
Assert.assertTrue(appContext.packageName.contains("co.yml.coreui"))
42+
}
43+
44+
/**
45+
* Check launched
46+
*
47+
*/
48+
@Test
49+
fun checkLaunched() {
50+
launchActivity<MainActivity>().use { scenario ->
51+
Assert.assertEquals(Lifecycle.State.RESUMED, scenario.state)
52+
scenario.moveToState(Lifecycle.State.CREATED)
53+
scenario.close()
54+
}
55+
}
56+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package co.yml.coreui.ui
2+
3+
import androidx.compose.ui.test.assertIsDisplayed
4+
import androidx.compose.ui.test.junit4.createAndroidComposeRule
5+
import androidx.compose.ui.test.onNodeWithTag
6+
import dagger.hilt.android.testing.HiltAndroidRule
7+
import dagger.hilt.android.testing.HiltAndroidTest
8+
import org.junit.Rule
9+
import org.junit.Test
10+
import co.yml.coreui.MainActivity
11+
12+
/**
13+
* Main navigation kt test
14+
*
15+
* @constructor Creates empty Main navigation kt test
16+
*/
17+
@HiltAndroidTest
18+
class MainNavigationKtTest {
19+
@get:Rule(order = 0)
20+
var hiltRule = HiltAndroidRule(this)
21+
22+
@get:Rule(order = 1)
23+
val composeTestRule = createAndroidComposeRule<MainActivity>()
24+
25+
/**
26+
* Test navigation launched
27+
*
28+
*/
29+
@Test
30+
fun testNavigationLaunched() {
31+
composeTestRule.onNodeWithTag("show_new_post_button").assertIsDisplayed()
32+
}
33+
}

app/src/main/AndroidManifest.xml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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+
5+
<uses-permission android:name="android.permission.INTERNET" />
6+
7+
<application
8+
android:name="co.yml.coreui.CoreUICatalog"
9+
tools:replace="android:allowBackup"
10+
android:allowBackup="false"
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.CoreUICatalog"
18+
tools:targetApi="31">
19+
<activity
20+
android:name="co.yml.coreui.MainActivity"
21+
android:exported="true"
22+
android:theme="@style/Theme.CoreUICatalog">
23+
<intent-filter>
24+
<action android:name="android.intent.action.MAIN" />
25+
26+
<category android:name="android.intent.category.LAUNCHER" />
27+
</intent-filter>
28+
29+
</activity>
30+
</application>
31+
32+
</manifest>

0 commit comments

Comments
 (0)