fix: 增加详情界面
This commit is contained in:
15
app/src/main/java/com/navinfo/vivo/ui/ViewExtend.kt
Normal file
15
app/src/main/java/com/navinfo/vivo/ui/ViewExtend.kt
Normal file
@@ -0,0 +1,15 @@
|
||||
package com.navinfo.vivo.ui
|
||||
|
||||
import android.graphics.Color
|
||||
import androidx.core.text.buildSpannedString
|
||||
import androidx.core.text.color
|
||||
import com.google.android.material.textfield.TextInputLayout
|
||||
|
||||
class ViewExtend {
|
||||
fun TextInputLayout.markRequiredInRed() {
|
||||
hint = buildSpannedString {
|
||||
append(hint)
|
||||
color(Color.RED) { append(" *") } // Mind the space prefix.
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.navinfo.vivo.ui.message
|
||||
|
||||
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.lifecycle.ViewModelProvider
|
||||
import com.navinfo.vivo.databinding.FragmentHomeBinding
|
||||
import com.navinfo.vivo.databinding.FragmentObtainMessageBinding
|
||||
import com.navinfo.vivo.ui.home.HomeViewModel
|
||||
|
||||
class ObtainMessageFragment: Fragment() {
|
||||
private var _binding: FragmentObtainMessageBinding? = null
|
||||
|
||||
// This property is only valid between onCreateView and
|
||||
// onDestroyView.
|
||||
private val binding get() = _binding!!
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
val obtainMessageViewModel =
|
||||
ViewModelProvider(this).get(ObtainMessageViewModel::class.java)
|
||||
|
||||
_binding = FragmentObtainMessageBinding.inflate(inflater, container, false)
|
||||
val root: View = binding.root
|
||||
|
||||
val textView: TextView = binding.textHome
|
||||
obtainMessageViewModel.text.observe(viewLifecycleOwner) {
|
||||
textView.text = it
|
||||
}
|
||||
return root
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
super.onDestroyView()
|
||||
_binding = null
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package com.navinfo.vivo.ui.message
|
||||
|
||||
import androidx.lifecycle.ViewModel
|
||||
|
||||
class ObtainMessageViewModel: ViewModel() {
|
||||
}
|
||||
Reference in New Issue
Block a user