mirror of
https://github.com/melihaksoy/Android-Kotlin-Modulerized-CleanArchitecture.git
synced 2026-03-23 18:01:25 +01:00
Single activity approach (#30)
* CircleCI config fixes * Implicit deeplinking via navController navigate * Removed jacoco.exec files. Closes # 32
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
apply plugin: 'com.android.library'
|
||||
apply plugin: 'kotlin-android'
|
||||
apply plugin: 'kotlin-kapt'
|
||||
apply plugin: "androidx.navigation.safeargs"
|
||||
|
||||
apply from: "$rootProject.projectDir/scripts/feature_module.gradle"
|
||||
|
||||
|
||||
Binary file not shown.
@@ -1,14 +1 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.melih.detail">
|
||||
|
||||
<application>
|
||||
<activity
|
||||
android:name="com.melih.detail.ui.DetailActivity"
|
||||
android:theme="@style/AppTheme">
|
||||
<intent-filter>
|
||||
<action android:name="action.dashboard.open" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
</manifest>
|
||||
<manifest package="com.melih.detail" />
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
package com.melih.detail.di
|
||||
|
||||
import com.melih.detail.ui.DetailActivity
|
||||
import com.melih.list.di.scopes.DetailScope
|
||||
import dagger.Module
|
||||
import dagger.android.ContributesAndroidInjector
|
||||
|
||||
/**
|
||||
* Contributes fragments & view models in this module
|
||||
*/
|
||||
@Module
|
||||
abstract class DetailFeatureModule {
|
||||
|
||||
// region Contributes
|
||||
|
||||
@ContributesAndroidInjector(
|
||||
modules = [
|
||||
DetailContributor::class
|
||||
]
|
||||
)
|
||||
@DetailScope
|
||||
abstract fun detailActivity(): DetailActivity
|
||||
// endregion
|
||||
}
|
||||
@@ -32,7 +32,7 @@ abstract class DetailFragmentModule {
|
||||
@Provides
|
||||
@JvmStatic
|
||||
fun provideGetLaunchDetailParams(fragment: DetailFragment): GetLaunchDetails.Params {
|
||||
val args: DetailFragmentArgs by fragment.navArgs()
|
||||
val args by fragment.navArgs<DetailFragmentArgs>()
|
||||
return GetLaunchDetails.Params(args.launchId)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
package com.melih.detail.ui
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.navigation.fragment.NavHostFragment
|
||||
import com.melih.core.actions.EXTRA_LAUNCH_ID
|
||||
import com.melih.core.base.lifecycle.BaseActivity
|
||||
import com.melih.detail.R
|
||||
import com.melih.detail.databinding.DetailActivityBinding
|
||||
|
||||
const val INVALID_LAUNCH_ID = -1L
|
||||
|
||||
class DetailActivity : BaseActivity<DetailActivityBinding>() {
|
||||
|
||||
// region Functions
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
setSupportActionBar(binding.toolbar)
|
||||
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
||||
supportActionBar?.setDisplayShowHomeEnabled(true)
|
||||
}
|
||||
|
||||
override fun getLayoutId(): Int = R.layout.activity_detail
|
||||
|
||||
override fun createNavHostFragment() =
|
||||
NavHostFragment.create(
|
||||
R.navigation.nav_detail,
|
||||
DetailFragmentArgs.Builder()
|
||||
.setLaunchId(intent?.extras?.getLong(EXTRA_LAUNCH_ID) ?: INVALID_LAUNCH_ID)
|
||||
.build()
|
||||
.toBundle()
|
||||
)
|
||||
|
||||
override fun addNavHostTo(): Int = R.id.container
|
||||
// endregion
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<data class="DetailActivityBinding" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?android:actionBarSize"
|
||||
android:background="@color/colorPrimary" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
</LinearLayout>
|
||||
</layout>
|
||||
@@ -1,18 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<navigation 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:id="@+id/nav_detail"
|
||||
app:startDestination="@id/detailFragment">
|
||||
<navigation
|
||||
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:id="@+id/nav_detail"
|
||||
app:startDestination="@id/detailFragment">
|
||||
|
||||
<fragment
|
||||
android:id="@+id/detailFragment"
|
||||
android:name="com.melih.detail.ui.DetailFragment"
|
||||
android:label="DetailFragment"
|
||||
tools:layout="@layout/fragment_detail">
|
||||
<argument
|
||||
android:name="launchId"
|
||||
android:defaultValue="-1L"
|
||||
app:argType="long" />
|
||||
</fragment>
|
||||
<fragment
|
||||
android:id="@+id/detailFragment"
|
||||
android:name="com.melih.detail.ui.DetailFragment"
|
||||
android:label="DetailFragment"
|
||||
tools:layout="@layout/fragment_detail">
|
||||
<argument
|
||||
android:name="launch-id"
|
||||
android:defaultValue="0L"
|
||||
app:argType="long" />
|
||||
<deepLink
|
||||
android:id="@+id/detailDeepLink"
|
||||
app:uri="@string/detail_deeplink" />
|
||||
</fragment>
|
||||
</navigation>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="cd_rocket_image">Image of the rocket</string>
|
||||
<string name="cd_rocket_image">Image of the rocket</string>
|
||||
</resources>
|
||||
|
||||
Reference in New Issue
Block a user