Skip to content

Commit

Permalink
Add base & settings modules to Feature Delivery module
Browse files Browse the repository at this point in the history
  • Loading branch information
AsemLab committed Oct 1, 2024
1 parent b1061ac commit a1c0519
Show file tree
Hide file tree
Showing 52 changed files with 164 additions and 3 deletions.
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ plugins {
// TODO Add the dependency for the Google services
alias(libs.plugins.google.services) apply false
alias(libs.plugins.androidTest) apply false
alias(libs.plugins.android.dynamic.feature) apply false

}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,12 @@ android {
viewBinding = true
dataBinding = true
}
dynamicFeatures += setOf(":feature_delivery:settings")
}

dependencies {

implementation(project(":feature_delivery:settings"))
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.appcompat)
implementation(libs.androidx.activity)
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,7 @@ class MainActivity : AppCompatActivity() {
val navView: BottomNavigationView = binding.navView
val navController = findNavController(R.id.navHost)
navView.setupWithNavController(navController)


}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.fragment.app.Fragment
import androidx.fragment.app.viewModels
import androidx.lifecycle.ViewModelProvider
import com.asemlab.samples.feature_delivery.databinding.FragmentDashboardBinding

class DashboardFragment : Fragment() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
<string name="title_home">Home</string>
<string name="title_dashboard">Dashboard</string>
<string name="title_notifications">Notifications</string>
<string name="title_settings">Settings Module</string>
</resources>
1 change: 1 addition & 0 deletions feature_delivery/settings/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
42 changes: 42 additions & 0 deletions feature_delivery/settings/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import com.asemlab.samples.Configuration

plugins {
alias(libs.plugins.android.dynamic.feature)
alias(libs.plugins.kotlin)
}
android {
namespace = "com.asemlab.samples.feature_delivery.settings"
compileSdk = Configuration.compileSdk

defaultConfig {
minSdk = Configuration.minSdk
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
release {
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
}

dependencies {
implementation(project(":feature_delivery:base"))
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.constraintlayout)
testImplementation(libs.junit)
androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.espresso.core)
implementation(libs.androidx.navigation.fragment.ktx)

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.asemlab.samples.feature_delivery.settings

import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4

import org.junit.Test
import org.junit.runner.RunWith

import org.junit.Assert.*

/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.asemlab.samples.feature_delivery.settings", appContext.packageName)
}
}
14 changes: 14 additions & 0 deletions feature_delivery/settings/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:dist="http://schemas.android.com/apk/distribution">

<dist:module
dist:instant="false"
dist:title="@string/title_settings">
<dist:delivery>
<dist:install-time>
<dist:removable dist:value="true" /> <!-- Enable the ability to uninstall later -->
</dist:install-time>
</dist:delivery>
<dist:fusing dist:include="false" />
</dist:module>
</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.asemlab.samples.feature_delivery.settings

import android.content.Context
import android.widget.Toast

fun showToast(context: Context, msg: String){
Toast.makeText(context, "$msg from Settings!", Toast.LENGTH_SHORT).show()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.asemlab.samples.feature_delivery.settings.ui

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import com.asemlab.samples.feature_delivery.settings.R


class BlankFragment : Fragment() {

override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_blank, container, false)
}

companion object {

fun newInstance() = BlankFragment()
}
}
20 changes: 20 additions & 0 deletions feature_delivery/settings/src/main/res/layout/fragment_blank.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.BlankFragment">

<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_blank_fragment"
android:textSize="24sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>
4 changes: 4 additions & 0 deletions feature_delivery/settings/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<resources>
<!-- TODO: Remove or change this placeholder text -->
<string name="hello_blank_fragment">Hello blank fragment</string>
</resources>
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.asemlab.samples.feature_delivery.settings

import org.junit.Test

import org.junit.Assert.*

/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
}
1 change: 1 addition & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ ktlint = { id = "org.jlleitschuh.gradle.ktlint", version.ref = "ktlint" }
detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" }
androidTest = { id = "com.android.test", version.ref = "android-application" }
apollo = { id = "com.apollographql.apollo", version.ref = "apollo" }
android-dynamic-feature = { id = "com.android.dynamic-feature", version.ref = "android-application" }


[bundles]
Expand Down
3 changes: 2 additions & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,5 @@ include(":graphql")
include(":app_distribution")
include(":media_player")
include(":autofill")
include(":feature_delivery")
include(":feature_delivery:base")
include(":feature_delivery:settings")

0 comments on commit a1c0519

Please sign in to comment.