Skip to content

Commit 132c50c

Browse files
add property detail navigation df module nav graphs for home module
1 parent be10180 commit 132c50c

11 files changed

Lines changed: 119 additions & 73 deletions

File tree

app/src/main/res/navigation/nav_graph_main.xml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,17 @@
1111
android:label="MainFragment"
1212
tools:layout="@layout/fragment_main" />
1313

14+
15+
<!-- Property Detail dynamic feature module -->
16+
<include-dynamic
17+
android:id="@+id/nav_graph_property_detail"
18+
android:name="com.smarttoolfactory.property_detail"
19+
app:graphResName="nav_graph_property_detail"
20+
app:moduleName="property_detail">
21+
22+
<argument
23+
android:name="property"
24+
app:argType="com.smarttoolfactory.domain.model.PropertyItem" />
25+
26+
</include-dynamic>
1427
</navigation>

features/home/src/main/java/com/smarttoolfactory/home/propertylist/flow/PropertyListFlowFragment.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package com.smarttoolfactory.home.propertylist.flow
33
import android.os.Bundle
44
import androidx.core.os.bundleOf
55
import androidx.fragment.app.activityViewModels
6+
import androidx.navigation.fragment.findNavController
67
import androidx.recyclerview.widget.LinearLayoutManager
78
import com.smarttoolfactory.core.di.CoreModuleDependencies
89
import com.smarttoolfactory.core.ui.fragment.DynamicNavigationFragment
@@ -93,6 +94,10 @@ class PropertyListFlowFragment : DynamicNavigationFragment<FragmentPropertyListB
9394

9495
it.getContentIfNotHandled()?.let { propertyItem ->
9596
val bundle = bundleOf("property" to propertyItem)
97+
findNavController().navigate(
98+
R.id.action_propertyListFragment_to_nav_graph_property_detail,
99+
bundle
100+
)
96101
}
97102
}
98103
)

features/home/src/main/java/com/smarttoolfactory/home/propertylist/paged/PagedPropertyListFragment.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package com.smarttoolfactory.home.propertylist.paged
33
import android.os.Bundle
44
import androidx.core.os.bundleOf
55
import androidx.fragment.app.activityViewModels
6+
import androidx.navigation.fragment.findNavController
67
import androidx.recyclerview.widget.LinearLayoutManager
78
import com.smarttoolfactory.core.di.CoreModuleDependencies
89
import com.smarttoolfactory.core.ui.fragment.DynamicNavigationFragment
@@ -110,6 +111,10 @@ class PagedPropertyListFragment :
110111

111112
it.getContentIfNotHandled()?.let { propertyItem ->
112113
val bundle = bundleOf("property" to propertyItem)
114+
findNavController().navigate(
115+
R.id.action_propertyListFragment_to_nav_graph_property_detail,
116+
bundle
117+
)
113118
}
114119
}
115120
)

features/home/src/main/java/com/smarttoolfactory/home/propertylist/rxjava/PropertyListRxjava3Fragment.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package com.smarttoolfactory.home.propertylist.rxjava
33
import android.os.Bundle
44
import androidx.core.os.bundleOf
55
import androidx.fragment.app.activityViewModels
6+
import androidx.navigation.fragment.findNavController
67
import androidx.recyclerview.widget.LinearLayoutManager
78
import com.smarttoolfactory.core.di.CoreModuleDependencies
89
import com.smarttoolfactory.core.ui.fragment.DynamicNavigationFragment
@@ -93,6 +94,10 @@ class PropertyListRxjava3Fragment : DynamicNavigationFragment<FragmentPropertyLi
9394

9495
it.getContentIfNotHandled()?.let { propertyItem ->
9596
val bundle = bundleOf("property" to propertyItem)
97+
findNavController().navigate(
98+
R.id.action_propertyListFragment_to_nav_graph_property_detail,
99+
bundle
100+
)
96101
}
97102
}
98103
)

features/home/src/main/res/navigation/nav_graph_property_list_flow.xml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,22 @@
1010
android:name="com.smarttoolfactory.home.propertylist.flow.PropertyListFlowFragment"
1111
android:label="Properties with Flow"
1212
tools:layout="@layout/fragment_property_list">
13+
14+
<action
15+
android:id="@+id/action_propertyListFragment_to_nav_graph_property_detail"
16+
app:destination="@id/nav_graph_property_detail" />
1317
</fragment>
1418

19+
<include-dynamic
20+
android:id="@id/nav_graph_property_detail"
21+
android:name="com.smarttoolfactory.property_detail"
22+
app:graphResName="nav_graph_property_detail"
23+
app:moduleName="property_detail">
24+
25+
<argument
26+
android:name="property"
27+
app:argType="com.smarttoolfactory.domain.model.PropertyItem" />
28+
29+
</include-dynamic>
30+
1531
</navigation>

features/home/src/main/res/navigation/nav_graph_property_list_paged.xml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,23 @@
99
android:id="@+id/propertyListFragment"
1010
android:name="com.smarttoolfactory.home.propertylist.paged.PagedPropertyListFragment"
1111
android:label="Flow + Pagination"
12-
tools:layout="@layout/fragment_property_list_paged" />
12+
tools:layout="@layout/fragment_property_list_paged">
13+
14+
<action
15+
android:id="@+id/action_propertyListFragment_to_nav_graph_property_detail"
16+
app:destination="@id/nav_graph_property_detail" />
17+
</fragment>
18+
19+
<include-dynamic
20+
android:id="@id/nav_graph_property_detail"
21+
android:name="com.smarttoolfactory.property_detail"
22+
app:graphResName="nav_graph_property_detail"
23+
app:moduleName="property_detail">
24+
25+
<argument
26+
android:name="property"
27+
app:argType="com.smarttoolfactory.domain.model.PropertyItem" />
28+
29+
</include-dynamic>
1330

1431
</navigation>

features/home/src/main/res/navigation/nav_graph_property_list_rxjava3.xml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,24 @@
1010
android:name="com.smarttoolfactory.home.propertylist.rxjava.PropertyListRxjava3Fragment"
1111
android:label="Properties with RxJava3"
1212
tools:layout="@layout/fragment_property_list">
13+
14+
<action
15+
android:id="@+id/action_propertyListFragment_to_nav_graph_property_detail"
16+
app:destination="@id/nav_graph_property_detail" />
17+
1318
</fragment>
1419

20+
<include-dynamic
21+
android:id="@id/nav_graph_property_detail"
22+
android:name="com.smarttoolfactory.property_detail"
23+
app:graphResName="nav_graph_property_detail"
24+
app:moduleName="property_detail">
25+
26+
<argument
27+
android:name="property"
28+
app:argType="com.smarttoolfactory.domain.model.PropertyItem" />
29+
30+
</include-dynamic>
31+
32+
1533
</navigation>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package com.smarttoolfactory.property_detail
2+
3+
import android.os.Bundle
4+
import android.view.View
5+
import android.widget.Toast
6+
import com.smarttoolfactory.core.ui.fragment.DynamicNavigationFragment
7+
import com.smarttoolfactory.property_detail.databinding.FragmentPropertyDetailBinding
8+
9+
class PropertyDetailFragment : DynamicNavigationFragment<FragmentPropertyDetailBinding>() {
10+
11+
override fun getLayoutRes(): Int = R.layout.fragment_property_detail
12+
13+
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
14+
super.onViewCreated(view, savedInstanceState)
15+
16+
Toast.makeText(requireContext(), "Property DFM Module Fragment", Toast.LENGTH_SHORT).show()
17+
}
18+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<layout>
3+
<androidx.constraintlayout.widget.ConstraintLayout
4+
xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
5+
android:layout_height="match_parent">
6+
7+
</androidx.constraintlayout.widget.ConstraintLayout>
8+
</layout>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:app="http://schemas.android.com/apk/res-auto"
4+
android:id="@id/nav_graph_property_detail"
5+
app:moduleName="property_detail"
6+
app:startDestination="@id/propertyDetailFragment">
7+
8+
<fragment
9+
android:id="@+id/propertyDetailFragment"
10+
android:name="com.smarttoolfactory.property_detail.PropertyDetailFragment"
11+
android:label="Property Detail Fragment">
12+
</fragment>
13+
</navigation>

0 commit comments

Comments
 (0)