File tree Expand file tree Collapse file tree 4 files changed +33
-8
lines changed
java/com/whyranoid/presentation Expand file tree Collapse file tree 4 files changed +33
-8
lines changed Original file line number Diff line number Diff line change @@ -10,12 +10,18 @@ internal abstract class BaseActivity<VDB : ViewDataBinding>(
10
10
@LayoutRes val layoutRes : Int
11
11
) : AppCompatActivity() {
12
12
13
- protected lateinit var binding: VDB
13
+ private var _binding : VDB ? = null
14
+ protected val binding get() = requireNotNull(_binding )
14
15
15
16
override fun onCreate (savedInstanceState : Bundle ? ) {
16
17
super .onCreate(savedInstanceState)
17
18
18
- binding = DataBindingUtil .setContentView(this , layoutRes)
19
+ _binding = DataBindingUtil .setContentView(this , layoutRes)
19
20
binding.lifecycleOwner = this
20
21
}
22
+
23
+ override fun onDestroy () {
24
+ _binding = null
25
+ super .onDestroy()
26
+ }
21
27
}
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ internal abstract class BaseFragment<VDB : ViewDataBinding>(
28
28
}
29
29
30
30
override fun onDestroyView () {
31
- super .onDestroyView()
32
31
_binding = null
32
+ super .onDestroyView()
33
33
}
34
34
}
Original file line number Diff line number Diff line change 1
1
package com.whyranoid.presentation.community.runningpost
2
2
3
+ import android.os.Bundle
4
+ import android.view.View
5
+ import androidx.navigation.fragment.navArgs
3
6
import com.whyranoid.presentation.R
4
7
import com.whyranoid.presentation.base.BaseFragment
5
8
import com.whyranoid.presentation.databinding.FragmentCreateRunningPostBinding
6
9
7
10
internal class CreateRunningPostFragment :
8
- BaseFragment <FragmentCreateRunningPostBinding >(R .layout.fragment_create_running_post)
11
+ BaseFragment <FragmentCreateRunningPostBinding >(R .layout.fragment_create_running_post) {
12
+
13
+ private val args: CreateRunningPostFragmentArgs by navArgs()
14
+
15
+ override fun onViewCreated (view : View , savedInstanceState : Bundle ? ) {
16
+ super .onViewCreated(view, savedInstanceState)
17
+
18
+ initViews()
19
+ }
20
+
21
+ private fun initViews () {
22
+ binding.selectedRunningHistory = args.selectedRunningHistory
23
+ }
24
+ }
Original file line number Diff line number Diff line change 1
1
<?xml version =" 1.0" encoding =" utf-8" ?>
2
- <layout
3
- android : id =" @+id/layout_root"
2
+ <layout android : id =" @+id/layout_root"
4
3
xmlns : android =" http://schemas.android.com/apk/res/android"
5
- xmlns : app =" http://schemas.android.com/apk/res-auto" >
4
+ xmlns : app =" http://schemas.android.com/apk/res-auto"
5
+ xmlns : binds =" http://schemas.android.com/tools" >
6
6
7
7
<data >
8
-
8
+ <variable
9
+ name =" selectedRunningHistory"
10
+ type =" com.whyranoid.presentation.model.RunningHistoryUiModel" />
9
11
</data >
10
12
11
13
<androidx .constraintlayout.widget.ConstraintLayout
45
47
android : layout_width =" 0dp"
46
48
android : layout_height =" wrap_content"
47
49
android : layout_marginTop =" 12dp"
50
+ binds : runningHistory =" @{selectedRunningHistory}"
48
51
app : layout_constraintStart_toStartOf =" parent"
49
52
app : layout_constraintEnd_toEndOf =" parent"
50
53
app : layout_constraintTop_toBottomOf =" @id/tv_label_running_history" />
You can’t perform that action at this time.
0 commit comments