fix: 详情界面新增

This commit is contained in:
xiaoyan 2022-12-27 16:04:30 +08:00
parent bbc778fb12
commit ea692d190b
42 changed files with 582 additions and 125 deletions

1
.idea/.name generated
View File

@ -1 +0,0 @@
NavinfoVivo

View File

@ -6,11 +6,11 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
//apply plugin: 'realm-android'
android {
namespace 'com.navinfo.vivo'
namespace 'com.navinfo.volvo'
compileSdk 32
defaultConfig {
applicationId "com.navinfo.vivo"
applicationId "com.navinfo.volvo"
minSdk 24
targetSdk 32
versionCode 1
@ -44,6 +44,7 @@ android {
}
buildFeatures {
viewBinding true
dataBinding true
}
}
@ -58,6 +59,7 @@ dependencies {
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.1'
implementation 'androidx.navigation:navigation-fragment-ktx:2.4.1'
implementation 'androidx.navigation:navigation-ui-ktx:2.4.1'
implementation 'com.google.code.gson:gson:2.10'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0'
@ -75,4 +77,8 @@ dependencies {
// implementation "android.arch.lifecycle:extensions:1.1.1"
// annotationProcessor "android.arch.lifecycle:compiler:1.1.1"
implementation 'com.tencent.wcdb:wcdb-android:1.1-19'
// https://github.com/rosuH/AndroidFilePicker/blob/master/README_CN.md
implementation 'me.rosuh:AndroidFilePicker:0.8.2'
// https://github.com/Gredicer/datetimepicker
implementation 'com.github.Gredicer:datetimepicker:V1.0.0'
}

View File

@ -1,4 +1,4 @@
package com.navinfo.vivo
package com.navinfo.volvo
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4
@ -19,6 +19,6 @@ class ExampleInstrumentedTest {
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.navinfo.vivo", appContext.packageName)
assertEquals("com.navinfo.volvo", appContext.packageName)
}
}

View File

@ -10,7 +10,7 @@
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.NavinfoVivo"
android:theme="@style/Theme.NavinfoVolvo"
tools:targetApi="31">
<activity
android:name=".MainActivity"

View File

@ -1,4 +0,0 @@
package com.navinfo.vivo.db.dao.entity
class Attachment {
}

View File

@ -1,15 +0,0 @@
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.
}
}
}

View File

@ -1,43 +0,0 @@
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
}
}

View File

@ -1,6 +0,0 @@
package com.navinfo.vivo.ui.message
import androidx.lifecycle.ViewModel
class ObtainMessageViewModel: ViewModel() {
}

View File

@ -1,13 +1,12 @@
package com.navinfo.vivo
package com.navinfo.volvo
import android.os.Bundle
import com.google.android.material.bottomnavigation.BottomNavigationView
import androidx.appcompat.app.AppCompatActivity
import androidx.navigation.findNavController
import androidx.navigation.ui.AppBarConfiguration
import androidx.navigation.ui.setupActionBarWithNavController
import androidx.navigation.ui.setupWithNavController
import com.navinfo.vivo.databinding.ActivityMainBinding
import com.navinfo.volvo.databinding.ActivityMainBinding
class MainActivity : AppCompatActivity() {
@ -29,7 +28,7 @@ class MainActivity : AppCompatActivity() {
R.id.navigation_home, R.id.navigation_dashboard, R.id.navigation_notifications
)
)
setupActionBarWithNavController(navController, appBarConfiguration)
// setupActionBarWithNavController(navController, appBarConfiguration)
navView.setupWithNavController(navController)
}
}

View File

@ -1,4 +1,4 @@
package com.navinfo.vivo.db.dao;
package com.navinfo.volvo.db.dao;
import android.content.Context;
@ -10,7 +10,7 @@ import androidx.room.RoomDatabase;
import androidx.sqlite.db.SupportSQLiteDatabase;
import androidx.sqlite.db.SupportSQLiteOpenHelper;
import com.navinfo.vivo.db.dao.entity.Message;
import com.navinfo.volvo.db.dao.entity.Message;
import com.tencent.wcdb.database.SQLiteCipherSpec;
import com.tencent.wcdb.database.SQLiteDatabase;

View File

@ -1,10 +1,10 @@
package com.navinfo.vivo.db.dao
package com.navinfo.volvo.db.dao
import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import com.navinfo.vivo.db.dao.entity.Message
import com.navinfo.volvo.db.dao.entity.Message
@Dao
interface MessageDao {

View File

@ -0,0 +1,30 @@
package com.navinfo.volvo.db.dao.entity
import androidx.room.TypeConverter
import com.google.gson.Gson
import com.google.gson.reflect.TypeToken
import java.lang.reflect.Type
class Attachment {
lateinit var path:String
lateinit var attachmentType: attachmentType
}
enum class attachmentType {
PIC, AUDIO
}
class AttachmentConvert {
private val gson = Gson()
@TypeConverter
fun objectToString(list: List<Attachment>): String {
return gson.toJson(list)
}
@TypeConverter
fun stringToObject(json: String?): List<Attachment> {
val listType: Type = object : TypeToken<List<Attachment>>() {}.type
return gson.fromJson(json, listType)
}
}

View File

@ -1,8 +1,10 @@
package com.navinfo.vivo.db.dao.entity
package com.navinfo.volvo.db.dao.entity
import androidx.room.Entity
import androidx.room.PrimaryKey
import androidx.room.TypeConverters
@TypeConverters(AttachmentConvert::class)
@Entity(tableName = "message")
class Message(
@PrimaryKey(autoGenerate = true)

View File

@ -1,7 +1,6 @@
package com.navinfo.vivo.db.dao.entity
package com.navinfo.volvo.db.dao.entity
import androidx.room.PrimaryKey
import java.net.IDN
class User(
@PrimaryKey()

View File

@ -0,0 +1,13 @@
package com.navinfo.volvo.ui
import android.graphics.Color
import androidx.core.text.buildSpannedString
import androidx.core.text.color
import com.google.android.material.textfield.TextInputLayout
fun TextInputLayout.markRequiredInRed() {
hint = buildSpannedString {
append(hint)// Mind the space prefix.
color(Color.RED) { append(" *") }
}
}

View File

@ -1,4 +1,4 @@
package com.navinfo.vivo.ui.dashboard
package com.navinfo.volvo.ui.dashboard
import android.os.Bundle
import android.view.LayoutInflater
@ -7,7 +7,7 @@ import android.view.ViewGroup
import android.widget.TextView
import androidx.fragment.app.Fragment
import androidx.lifecycle.ViewModelProvider
import com.navinfo.vivo.databinding.FragmentDashboardBinding
import com.navinfo.volvo.databinding.FragmentDashboardBinding
class DashboardFragment : Fragment() {

View File

@ -1,4 +1,4 @@
package com.navinfo.vivo.ui.dashboard
package com.navinfo.volvo.ui.dashboard
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData

View File

@ -1,4 +1,4 @@
package com.navinfo.vivo.ui.home
package com.navinfo.volvo.ui.home
import android.os.Bundle
import android.view.LayoutInflater
@ -7,7 +7,11 @@ import android.view.ViewGroup
import android.widget.TextView
import androidx.fragment.app.Fragment
import androidx.lifecycle.ViewModelProvider
import com.navinfo.vivo.databinding.FragmentHomeBinding
import androidx.navigation.Navigation
import com.navinfo.volvo.R
import com.navinfo.volvo.databinding.FragmentHomeBinding
import com.navinfo.volvo.db.dao.entity.Message
import com.navinfo.volvo.ui.message.ObtainMessageViewModel
class HomeFragment : Fragment() {
@ -24,13 +28,20 @@ class HomeFragment : Fragment() {
): View {
val homeViewModel =
ViewModelProvider(this).get(HomeViewModel::class.java)
val obtainMessageViewModel = ViewModelProvider(requireActivity()).get(ObtainMessageViewModel::class.java)
_binding = FragmentHomeBinding.inflate(inflater, container, false)
val root: View = binding.root
val textView: TextView = binding.textHome
val textView: TextView = binding.tvNewMessage
textView.setOnClickListener {
val message = Message(1, "新建标题", "", "", "", 0, "1", "2", mutableListOf())
obtainMessageViewModel.setCurrentMessage(message)
// 跳转到新建Message的Fragment
Navigation.findNavController(it).navigate(R.id.home_2_obtain_message)
}
homeViewModel.text.observe(viewLifecycleOwner) {
textView.text = it
}
return root
}

View File

@ -1,4 +1,4 @@
package com.navinfo.vivo.ui.home
package com.navinfo.volvo.ui.home
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData

View File

@ -0,0 +1,68 @@
package com.navinfo.volvo.ui.message
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProvider
import com.gredicer.datetimepicker.DateTimePickerFragment
import com.navinfo.volvo.databinding.FragmentObtainMessageBinding
import com.navinfo.volvo.ui.markRequiredInRed
class ObtainMessageFragment: Fragment() {
private var _binding: FragmentObtainMessageBinding? = null
private val obtainMessageViewModel by lazy {
ViewModelProvider(requireActivity()).get(ObtainMessageViewModel::class.java)
}
// This property is only valid between onCreateView and
// onDestroyView.
private val binding get() = _binding!!
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View {
_binding = FragmentObtainMessageBinding.inflate(inflater, container, false)
val root: View = binding.root
obtainMessageViewModel?.getMessageLiveData()?.observe(
viewLifecycleOwner, Observer {
// 初始化界面显示内容
if(it.title!=null)
binding.tvMessageTitle?.setText(it.title)
if (it.sendDate!=null) {
binding.btnSendTime.setText(it.sendDate)
}
}
)
initView()
return root
}
fun initView() {
// 设置问候信息提示的红色星号
binding.tiLayoutTitle.markRequiredInRed()
// 设置点击按钮选择发送时间
binding.btnSendTime.setOnClickListener {
val dialog = DateTimePickerFragment.newInstance().mode(0)
dialog.listener = object : DateTimePickerFragment.OnClickListener {
override fun onClickListener(selectTime: String) {
obtainMessageViewModel.updateMessageSendTime(selectTime)
}
}
dialog.show(parentFragmentManager, "SelectSendTime")
}
// 点击按钮选择拍照
}
override fun onDestroyView() {
super.onDestroyView()
_binding = null
}
}

View File

@ -0,0 +1,66 @@
package com.navinfo.volvo.ui.message
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.liveData
import com.navinfo.volvo.db.dao.entity.Message
import com.navinfo.volvo.db.dao.entity.attachmentType
class ObtainMessageViewModel: ViewModel() {
private val msgLiveData: MutableLiveData<Message> by lazy {
MutableLiveData<Message>()
}
fun setCurrentMessage(msg: Message) {
msgLiveData.postValue(msg)
}
fun getMessageLiveData(): MutableLiveData<Message> {
return msgLiveData
}
// 更新消息标题
fun updateMessageTitle(title: String) {
this.msgLiveData.value?.title = title
this.msgLiveData.postValue(this.msgLiveData.value)
}
// 更新消息附件中的照片文件
fun updateMessagePic(picUrl: String) {
for (attachment in this.msgLiveData.value!!.attachment) {
if (attachment.attachmentType == attachmentType.PIC) {
attachment.path = picUrl
}
}
this.msgLiveData.postValue(this.msgLiveData.value)
}
// 更新消息附件中的录音文件
fun updateMessageAudio(audioUrl: String) {
for (attachment in this.msgLiveData.value!!.attachment) {
if (attachment.attachmentType == attachmentType.AUDIO) {
attachment.path = audioUrl
}
}
this.msgLiveData.postValue(this.msgLiveData.value)
}
// 更新发送人
fun updateMessageSendFrom(sendFrom: String) {
this.msgLiveData.value?.fromId = sendFrom
this.msgLiveData.postValue(this.msgLiveData.value)
}
// 更新接收人
fun updateMessageSendTo(sendTo: String) {
this.msgLiveData.value?.toId = sendTo
this.msgLiveData.postValue(this.msgLiveData.value)
}
// 更新发件时间
fun updateMessageSendTime(sendTime: String) {
this.msgLiveData.value?.sendDate = sendTime
this.msgLiveData.postValue(this.msgLiveData.value)
}
}

View File

@ -1,4 +1,4 @@
package com.navinfo.vivo.ui.notifications
package com.navinfo.volvo.ui.notifications
import android.os.Bundle
import android.view.LayoutInflater
@ -7,7 +7,7 @@ import android.view.ViewGroup
import android.widget.TextView
import androidx.fragment.app.Fragment
import androidx.lifecycle.ViewModelProvider
import com.navinfo.vivo.databinding.FragmentNotificationsBinding
import com.navinfo.volvo.databinding.FragmentNotificationsBinding
class NotificationsFragment : Fragment() {

View File

@ -1,4 +1,4 @@
package com.navinfo.vivo.ui.notifications
package com.navinfo.volvo.ui.notifications
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData

View File

@ -0,0 +1,6 @@
<vector android:height="24dp" android:tint="#000000"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M11.99,2C6.47,2 2,6.48 2,12s4.47,10 9.99,10C17.52,22 22,17.52 22,12S17.52,2 11.99,2zM12,20c-4.42,0 -8,-3.58 -8,-8s3.58,-8 8,-8 8,3.58 8,8 -3.58,8 -8,8z"/>
<path android:fillColor="@android:color/white" android:pathData="M12.5,7H11v6l5.25,3.15 0.75,-1.23 -4.5,-2.67z"/>
</vector>

View File

@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#000000"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M14,2H6C4.9,2 4.01,2.9 4.01,4L4,20c0,1.1 0.89,2 1.99,2H18c1.1,0 2,-0.9 2,-2V8L14,2zM16,13h-3v3.75c0,1.24 -1.01,2.25 -2.25,2.25S8.5,17.99 8.5,16.75c0,-1.24 1.01,-2.25 2.25,-2.25c0.46,0 0.89,0.14 1.25,0.38V11h4V13zM13,9V3.5L18.5,9H13z"/>
</vector>

View File

@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#000000"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M9.4,10.5l4.77,-8.26C13.47,2.09 12.75,2 12,2c-2.4,0 -4.6,0.85 -6.32,2.25l3.66,6.35 0.06,-0.1zM21.54,9c-0.92,-2.92 -3.15,-5.26 -6,-6.34L11.88,9h9.66zM21.8,10h-7.49l0.29,0.5 4.76,8.25C21,16.97 22,14.61 22,12c0,-0.69 -0.07,-1.35 -0.2,-2zM8.54,12l-3.9,-6.75C3.01,7.03 2,9.39 2,12c0,0.69 0.07,1.35 0.2,2h7.49l-1.15,-2zM2.46,15c0.92,2.92 3.15,5.26 6,6.34L12.12,15L2.46,15zM13.73,15l-3.9,6.76c0.7,0.15 1.42,0.24 2.17,0.24 2.4,0 4.6,-0.85 6.32,-2.25l-3.66,-6.35 -0.93,1.6z"/>
</vector>

View File

@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#000000"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M12,12m-8,0a8,8 0,1 1,16 0a8,8 0,1 1,-16 0"/>
</vector>

View File

@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#000000"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M18,13v7L4,20L4,6h5.02c0.05,-0.71 0.22,-1.38 0.48,-2L4,4c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2v-5l-2,-2zM16.5,18h-11l2.75,-3.53 1.96,2.36 2.75,-3.54zM19.3,8.89c0.44,-0.7 0.7,-1.51 0.7,-2.39C20,4.01 17.99,2 15.5,2S11,4.01 11,6.5s2.01,4.5 4.49,4.5c0.88,0 1.7,-0.26 2.39,-0.7L21,13.42 22.42,12 19.3,8.89zM15.5,9C14.12,9 13,7.88 13,6.5S14.12,4 15.5,4 18,5.12 18,6.5 16.88,9 15.5,9z"/>
</vector>

View File

@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#000000"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M20,4L4,4c-1.1,0 -1.99,0.9 -1.99,2L2,18c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2L22,6c0,-1.1 -0.9,-2 -2,-2zM20,8l-8,5 -8,-5L4,6l8,5 8,-5v2z"/>
</vector>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/shape_bg_4_round_corner" android:state_pressed="true"></item>
<item android:drawable="@drawable/shape_bg_4_round_corner" android:state_selected="true"></item>
<item android:drawable="@drawable/shape_bg_4_round_corner" android:state_pressed="true"></item>
<item android:drawable="@drawable/shape_bg_4_round_corner" android:state_checked="true"></item>
<item android:drawable="@drawable/shape_bg_4_round_corner_default" ></item>
</selector>

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<!--设置圆角-->
<!-- 按顺序分别对应:左下角的角度、右下角的角度、左上角的角度、右上角的角度-->
<corners
android:bottomLeftRadius="@dimen/default_widget_padding"
android:bottomRightRadius="@dimen/default_widget_padding"
android:topLeftRadius="@dimen/default_widget_padding"
android:topRightRadius="@dimen/default_widget_padding" />
<!--设置圆角背景色-->
<!-- <solid android:color="@color/white" />-->
<!-- 设置边框大小与背景色-->
<stroke
android:width="1px"
android:color="@color/purple_200" />
<padding android:bottom="@dimen/default_widget_padding"
android:left="@dimen/default_widget_padding"
android:right="@dimen/default_widget_padding"
android:top="@dimen/default_widget_padding">
</padding>
</shape>

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<!--设置圆角-->
<!-- 按顺序分别对应:左下角的角度、右下角的角度、左上角的角度、右上角的角度-->
<corners
android:bottomLeftRadius="@dimen/default_widget_padding"
android:bottomRightRadius="@dimen/default_widget_padding"
android:topLeftRadius="@dimen/default_widget_padding"
android:topRightRadius="@dimen/default_widget_padding" />
<!--设置圆角背景色-->
<!-- <solid android:color="@color/white" />-->
<!-- 设置边框大小与背景色-->
<stroke
android:width="1px"
android:color="@color/black" />
<padding android:bottom="@dimen/default_widget_padding"
android:left="@dimen/default_widget_padding"
android:right="@dimen/default_widget_padding"
android:top="@dimen/default_widget_padding">
</padding>
</shape>

View File

@ -3,8 +3,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="?attr/actionBarSize">
android:layout_height="match_parent">
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/nav_view"
@ -22,7 +21,7 @@
android:id="@+id/nav_host_fragment_activity_main"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_height="0dp"
app:defaultNavHost="true"
app:layout_constraintBottom_toTopOf="@id/nav_view"
app:layout_constraintLeft_toLeftOf="parent"

View File

@ -7,7 +7,7 @@
tools:context=".ui.home.HomeFragment">
<TextView
android:id="@+id/text_home"
android:id="@+id/tv_new_message"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"

View File

@ -1,36 +1,271 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
<androidx.constraintlayout.widget.ConstraintLayout
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:layout_width="match_parent"
android:layout_height="match_parent"
android:overScrollMode="never"
android:scrollbars="none">
<androidx.constraintlayout.widget.ConstraintLayout
android:padding="@dimen/activity_default_padding"
tools:context=".ui.message.ObtainMessageFragment">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="@dimen/activity_default_padding"
tools:context=".ui.message.ObtainMessageFragment">
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:overScrollMode="never"
android:scrollbars="none">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/ti_layout_title"
style="@style/Widget.Material3.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:hint="问候名称:"
app:errorEnabled="true"
android:layout_margin="@dimen/default_widget_padding"
app:counterEnabled="true"
app:counterMaxLength="10"
app:startIconDrawable="@drawable/ic_home_black_24dp"
app:layout_constraintRight_toRightOf="parent"
app:errorEnabled="true"
android:hint="问候信息"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent">
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:startIconDrawable="@drawable/ic_baseline_mail_24">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/tv_message_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="问候名称"/>
android:layout_height="wrap_content" />
</com.google.android.material.textfield.TextInputLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>
<com.google.android.material.textview.MaterialTextView
android:id="@+id/label_message_subtitle"
style="@style/TextAppearance.AppCompat.Subhead"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="问候信息"
app:layout_constraintTop_toBottomOf="@id/ti_layout_title"></com.google.android.material.textview.MaterialTextView>
<com.google.android.material.divider.MaterialDivider
android:id="@+id/div_message"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginVertical="@dimen/default_widget_padding"
app:layout_constraintTop_toBottomOf="@id/label_message_subtitle"></com.google.android.material.divider.MaterialDivider>
<LinearLayout
android:id="@+id/layer_message_info"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="@dimen/default_widget_padding"
app:layout_constraintTop_toBottomOf="@id/div_message">
<LinearLayout
style="@style/default_line"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="*"
android:textColor="@color/red"></TextView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="上传图片:"></TextView>
<com.google.android.material.button.MaterialButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/Widget.Material3.Button.ElevatedButton"
app:icon="@drawable/ic_baseline_camera_24"
android:text="点击拍照"
android:padding="@dimen/default_widget_padding"></com.google.android.material.button.MaterialButton>
<Space
android:layout_width="@dimen/default_widget_padding"
android:layout_height="wrap_content"></Space>
<com.google.android.material.button.MaterialButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/Widget.Material3.Button.ElevatedButton"
app:icon="@drawable/ic_baseline_image_search_24"
android:text="相册选择"
android:padding="@dimen/default_widget_padding"></com.google.android.material.button.MaterialButton>
</LinearLayout>
<LinearLayout
style="@style/default_line"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="*"
android:textColor="@color/red"></TextView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="上传音频:"></TextView>
<com.google.android.material.button.MaterialButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/Widget.Material3.Button.ElevatedButton"
app:icon="@drawable/ic_baseline_fiber_manual_record_24"
android:text="长按录音"
android:padding="@dimen/default_widget_padding"></com.google.android.material.button.MaterialButton>
<Space
android:layout_width="@dimen/default_widget_padding"
android:layout_height="wrap_content"></Space>
<com.google.android.material.button.MaterialButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/Widget.Material3.Button.ElevatedButton"
app:icon="@drawable/ic_baseline_audio_file_24"
android:text="音频选择"
android:padding="@dimen/default_widget_padding"></com.google.android.material.button.MaterialButton>
</LinearLayout>
</LinearLayout>
<com.google.android.material.textview.MaterialTextView
android:id="@+id/label_send_info"
style="@style/TextAppearance.AppCompat.Subhead"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="发送信息"
app:layout_constraintTop_toBottomOf="@id/layer_message_info"></com.google.android.material.textview.MaterialTextView>
<com.google.android.material.divider.MaterialDivider
android:id="@+id/div_send_info"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginVertical="@dimen/default_widget_padding"
app:layout_constraintTop_toBottomOf="@id/label_send_info"></com.google.android.material.divider.MaterialDivider>
<LinearLayout
android:id="@+id/layer_send_info"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="@dimen/default_widget_padding"
app:layout_constraintTop_toBottomOf="@id/div_send_info">
<LinearLayout
style="@style/default_line"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="*"
android:textColor="@color/red"></TextView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="我是谁:"></TextView>
<androidx.appcompat.widget.AppCompatEditText
android:id="@+id/edt_send_from"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/selector_bg_4_round_corner">
</androidx.appcompat.widget.AppCompatEditText>
</LinearLayout>
<LinearLayout
style="@style/default_line"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="*"
android:textColor="@color/red"></TextView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="发给谁:"></TextView>
<androidx.appcompat.widget.AppCompatEditText
android:id="@+id/edt_send_to"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/selector_bg_4_round_corner">
</androidx.appcompat.widget.AppCompatEditText>
</LinearLayout>
<LinearLayout
style="@style/default_line"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="*"
android:textColor="@color/red"></TextView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="发送时间:"></TextView>
<com.google.android.material.button.MaterialButton
android:id="@+id/btn_send_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/Widget.Material3.Button.ElevatedButton"
app:icon="@drawable/ic_baseline_access_time_24"
android:text="现在"
android:padding="@dimen/default_widget_padding"></com.google.android.material.button.MaterialButton>
</LinearLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="parent">
<com.google.android.material.button.MaterialButton
style="@style/Widget.Material3.Button.ElevatedButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="取消"></com.google.android.material.button.MaterialButton>
<Space
android:layout_width="@dimen/default_widget_padding"
android:layout_height="wrap_content"></Space>
<com.google.android.material.button.MaterialButton
style="@style/Widget.Material3.Button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="确认提交"></com.google.android.material.button.MaterialButton>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -7,19 +7,30 @@
<fragment
android:id="@+id/navigation_home"
android:name="com.navinfo.vivo.ui.home.HomeFragment"
android:name="com.navinfo.volvo.ui.home.HomeFragment"
android:label="@string/title_home"
tools:layout="@layout/fragment_home" />
tools:layout="@layout/fragment_home" >
<action android:id="@+id/home_2_obtain_message"
app:destination="@id/navigation_obtain_message">
</action>
</fragment>
<fragment
android:id="@+id/navigation_dashboard"
android:name="com.navinfo.vivo.ui.dashboard.DashboardFragment"
android:name="com.navinfo.volvo.ui.dashboard.DashboardFragment"
android:label="@string/title_dashboard"
tools:layout="@layout/fragment_dashboard" />
<fragment
android:id="@+id/navigation_notifications"
android:name="com.navinfo.vivo.ui.notifications.NotificationsFragment"
android:name="com.navinfo.volvo.ui.notifications.NotificationsFragment"
android:label="@string/title_notifications"
tools:layout="@layout/fragment_notifications" />
<fragment
android:id="@+id/navigation_obtain_message"
android:name="com.navinfo.volvo.ui.message.ObtainMessageFragment"
android:label="问候编辑"
tools:layout="@layout/fragment_obtain_message" />
</navigation>

View File

@ -1,6 +1,6 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.NavinfoVivo" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<style name="Theme.NavinfoVolvo" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_200</item>
<item name="colorPrimaryVariant">@color/purple_700</item>

View File

@ -1,5 +1,5 @@
<resources>
<string name="app_name">NavinfoVivo</string>
<string name="app_name">NavinfoVolvo</string>
<string name="title_home">Home</string>
<string name="title_dashboard">Dashboard</string>
<string name="title_notifications">Notifications</string>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="default_line">
<item name="android:padding">@dimen/default_widget_padding</item>
</style>
</resources>

View File

@ -1,6 +1,6 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.NavinfoVivo" parent="Theme.Material3.DayNight.NoActionBar">
<style name="Theme.NavinfoVolvo" parent="Theme.Material3.DayNight.NoActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_500</item>
<item name="colorPrimaryVariant">@color/purple_700</item>

View File

@ -1,4 +1,4 @@
package com.navinfo.vivo
package com.navinfo.volvo
import org.junit.Test

View File

@ -24,5 +24,5 @@ dependencyResolutionManagement {
mavenCentral()
}
}
rootProject.name = "NavinfoVivo"
rootProject.name = "NavinfoVolvo"
include ':app'