Meshtastic-Android/app/src/main/java/com/geeksville/mesh/ui/ModuleSettingsFragment.kt

42 lines
1.4 KiB
Kotlin
Raw Normal View History

package com.geeksville.mesh.ui
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.compose.ui.platform.ViewCompositionStrategy
import androidx.fragment.app.activityViewModels
2022-09-04 22:52:40 -03:00
import com.geeksville.mesh.android.Logging
2022-11-22 22:01:37 -03:00
import com.geeksville.mesh.databinding.ComposeViewBinding
import com.geeksville.mesh.model.UIViewModel
import com.google.android.material.composethemeadapter.MdcTheme
import dagger.hilt.android.AndroidEntryPoint
@AndroidEntryPoint
2022-11-22 22:01:37 -03:00
class ModuleSettingsFragment : ScreenFragment("Module Settings"), Logging {
2022-11-22 22:01:37 -03:00
private var _binding: ComposeViewBinding? = null
private val binding get() = _binding!!
private val model: UIViewModel by activityViewModels()
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View {
2022-11-22 22:01:37 -03:00
_binding = ComposeViewBinding.inflate(inflater, container, false)
.apply {
2022-11-22 22:01:37 -03:00
composeView.apply {
setViewCompositionStrategy(
ViewCompositionStrategy.DisposeOnViewTreeLifecycleDestroyed
)
setContent {
MdcTheme {
2022-11-22 22:01:37 -03:00
ModuleSettingsItemList(model)
}
}
2021-02-14 16:07:49 +08:00
}
}
return binding.root
}
}