修改竖屏
This commit is contained in:
parent
3dc49ad764
commit
64972c3c88
@ -34,6 +34,7 @@
|
||||
android:name=".ui.message.MessageActivity"
|
||||
android:exported="false"
|
||||
android:label="@string/title_activity_second"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Theme.NavinfoVolvo.NoActionBar">
|
||||
<meta-data
|
||||
android:name="android.app.lib_name"
|
||||
|
@ -21,7 +21,7 @@ interface GreetingMessageDao {
|
||||
/**
|
||||
* 分页查询
|
||||
*/
|
||||
@Query("SELECT * FROM GreetingMessage")
|
||||
@Query("SELECT * FROM GreetingMessage order by sendDate DESC")
|
||||
fun findAllByDataSource(): PagingSource<Int, GreetingMessage>
|
||||
|
||||
/**
|
||||
|
9
app/src/main/java/com/navinfo/volvo/model/LoginUser.kt
Normal file
9
app/src/main/java/com/navinfo/volvo/model/LoginUser.kt
Normal file
@ -0,0 +1,9 @@
|
||||
package com.navinfo.volvo.model
|
||||
|
||||
/**
|
||||
* 登录用户信息
|
||||
*/
|
||||
data class LoginUser(
|
||||
var name: String,
|
||||
var password: String
|
||||
)
|
@ -4,6 +4,7 @@ import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.databinding.DataBindingUtil
|
||||
import androidx.fragment.app.viewModels
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import com.navinfo.volvo.R
|
||||
@ -16,11 +17,8 @@ import dagger.hilt.android.AndroidEntryPoint
|
||||
class LoginFragment : BaseFragment() {
|
||||
|
||||
// private var loginViewModel:LoginViewModel by viewModel(get())
|
||||
private var viewBinding: FragmentLoginBinding? = null
|
||||
private lateinit var viewBinding: FragmentLoginBinding
|
||||
|
||||
// This property is only valid between onCreateView and
|
||||
// onDestroyView.
|
||||
private val binding get() = viewBinding!!
|
||||
|
||||
private val viewModel by viewModels<LoginViewModel> { viewModelFactoryProvider }
|
||||
|
||||
@ -29,19 +27,21 @@ class LoginFragment : BaseFragment() {
|
||||
container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
viewBinding = FragmentLoginBinding.inflate(inflater, container, false)
|
||||
val root: View = binding.root
|
||||
binding.loginFragmentRegisterButton.setOnClickListener {
|
||||
viewBinding = DataBindingUtil.inflate(inflater, R.layout.fragment_login, container, false)
|
||||
viewBinding.lifecycleOwner = this
|
||||
initView()
|
||||
return viewBinding.root
|
||||
}
|
||||
|
||||
private fun initView() {
|
||||
viewBinding.loginFragmentRegisterButton.setOnClickListener {
|
||||
|
||||
}
|
||||
binding.loginFragmentLoginButton.setOnClickListener {
|
||||
viewBinding.loginFragmentLoginButton.setOnClickListener {
|
||||
// viewModel.login(viewBinding.loginFragmentUserLayout)
|
||||
findNavController().navigate(R.id.action_login_to_home)
|
||||
}
|
||||
return root
|
||||
}
|
||||
|
||||
|
||||
override fun onDestroyView() {
|
||||
viewBinding = null
|
||||
super.onDestroyView()
|
||||
}
|
||||
}
|
@ -6,14 +6,12 @@ import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.ViewModel
|
||||
import com.navinfo.volvo.database.AppDatabase
|
||||
import com.navinfo.volvo.database.entity.User
|
||||
import com.navinfo.volvo.util.SharedPreferenceHelper
|
||||
import javax.inject.Inject
|
||||
|
||||
class LoginViewModel @Inject constructor(private val dataBase: AppDatabase) : ViewModel() {
|
||||
class LoginViewModel @Inject constructor(private val sharedPreferenceHelper: SharedPreferenceHelper) : ViewModel() {
|
||||
|
||||
private val _user = MutableLiveData<User>().apply {
|
||||
|
||||
}
|
||||
val user: LiveData<User> = _user
|
||||
// val user: LiveData<User> = _user
|
||||
|
||||
fun liveDataOnclick(view: View) {
|
||||
|
||||
|
@ -2,7 +2,6 @@ package com.navinfo.volvo.ui.fragments.message
|
||||
|
||||
import android.content.DialogInterface
|
||||
import android.graphics.Paint
|
||||
import android.net.Uri
|
||||
import android.os.Bundle
|
||||
import android.text.TextUtils
|
||||
import android.view.LayoutInflater
|
||||
@ -16,18 +15,13 @@ import android.widget.ArrayAdapter
|
||||
import android.widget.Toast
|
||||
import androidx.core.widget.addTextChangedListener
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.viewModels
|
||||
import androidx.lifecycle.Observer
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.navigation.Navigation
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import com.bumptech.glide.Glide
|
||||
import com.bumptech.glide.load.engine.DiskCacheStrategy
|
||||
import com.easytools.tools.DateUtils
|
||||
import com.easytools.tools.DeviceUtils
|
||||
import com.easytools.tools.DisplayUtils
|
||||
import com.easytools.tools.FileIOUtils
|
||||
import com.easytools.tools.FileUtils
|
||||
import com.easytools.tools.ResourceUtils
|
||||
import com.easytools.tools.ToastUtils
|
||||
import com.elvishew.xlog.XLog
|
||||
@ -54,7 +48,6 @@ import top.zibin.luban.Luban
|
||||
import top.zibin.luban.OnCompressListener
|
||||
import java.io.File
|
||||
import java.io.FileInputStream
|
||||
import java.io.FileOutputStream
|
||||
import java.util.*
|
||||
|
||||
|
||||
@ -177,7 +170,7 @@ class ObtainMessageFragment: Fragment() {
|
||||
obtainMessageViewModel.updateMessageAudio("")
|
||||
}
|
||||
|
||||
val sendToArray = mutableListOf<String>("绑定车辆1(LYVXFEFEXNL754427)")
|
||||
val sendToArray = mutableListOf<String>("LYVXFEFEXNL754427")
|
||||
binding.edtSendTo.adapter = ArrayAdapter<String>(context!!,
|
||||
android.R.layout.simple_dropdown_item_1line, android.R.id.text1, sendToArray)
|
||||
binding.edtSendTo.onItemSelectedListener = object: OnItemSelectedListener {
|
||||
@ -535,7 +528,7 @@ class ObtainMessageFragment: Fragment() {
|
||||
|
||||
val confirmCallback = object: ObtainMessageViewModel.MyConfirmCallback {
|
||||
override fun onSucess() {
|
||||
findNavController().navigate(R.id.navi)
|
||||
findNavController().navigate(R.id.navigation_home)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,78 +1,90 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<layout 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"
|
||||
tools:context="com.navinfo.volvo.ui.fragments.login.LoginFragment">
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<data>
|
||||
<variable
|
||||
name="loginUser"
|
||||
type="com.navinfo.volvo.model.LoginUser" />
|
||||
</data>
|
||||
|
||||
<androidx.constraintlayout.utils.widget.ImageFilterView
|
||||
android:id="@+id/login_fragment_logo"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@mipmap/volvo_logo_small"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.2"
|
||||
app:roundPercent="0.2" />
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/login_fragment_user_layout"
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_marginRight="20dp"
|
||||
android:scrollbarAlwaysDrawHorizontalTrack="true"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.4">
|
||||
android:layout_height="match_parent"
|
||||
tools:context="com.navinfo.volvo.ui.fragments.login.LoginFragment">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
|
||||
<androidx.constraintlayout.utils.widget.ImageFilterView
|
||||
android:id="@+id/login_fragment_logo"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@mipmap/volvo_logo_small"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.2"
|
||||
app:roundPercent="0.2" />
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/login_fragment_user_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="用户名" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_marginRight="20dp"
|
||||
android:scrollbarAlwaysDrawHorizontalTrack="true"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.4">
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_marginRight="20dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/login_fragment_user_layout">
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{loginUser.name}"
|
||||
android:hint="请输入用户名" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="密码" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_marginRight="20dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/login_fragment_user_layout">
|
||||
|
||||
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
|
||||
android:id="@+id/login_fragment_register_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:text="注册"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintHorizontal_chainStyle="spread"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toLeftOf="@id/login_fragment_login_button"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.7" />
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="textPassword"
|
||||
android:text="@{loginUser.password}"
|
||||
android:hint="请输入密码" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
|
||||
android:id="@+id/login_fragment_login_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:text="登录"
|
||||
app:layout_constraintBaseline_toBaselineOf="@id/login_fragment_register_button"
|
||||
app:layout_constraintLeft_toRightOf="@id/login_fragment_register_button"
|
||||
app:layout_constraintRight_toRightOf="parent" />
|
||||
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
|
||||
android:id="@+id/login_fragment_register_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:text="注册"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintHorizontal_chainStyle="spread"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toLeftOf="@id/login_fragment_login_button"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.7" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
|
||||
android:id="@+id/login_fragment_login_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:text="登录"
|
||||
app:layout_constraintBaseline_toBaselineOf="@id/login_fragment_register_button"
|
||||
app:layout_constraintLeft_toRightOf="@id/login_fragment_register_button"
|
||||
app:layout_constraintRight_toRightOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</layout>
|
@ -48,5 +48,16 @@
|
||||
android:id="@+id/navigation_obtain_message"
|
||||
android:name="com.navinfo.volvo.ui.fragments.message.ObtainMessageFragment"
|
||||
android:label="问候编辑"
|
||||
tools:layout="@layout/fragment_obtain_message" />
|
||||
tools:layout="@layout/fragment_obtain_message" >
|
||||
<action
|
||||
android:id="@+id/action_login_to_home"
|
||||
app:destination="@id/navigation_home"
|
||||
app:enterAnim="@anim/from_left"
|
||||
app:exitAnim="@anim/to_right"
|
||||
app:popEnterAnim="@anim/from_right"
|
||||
app:popExitAnim="@anim/to_left"
|
||||
app:popUpTo="@id/navigation_obtain_message"
|
||||
app:popUpToInclusive="true" />
|
||||
</fragment>
|
||||
|
||||
</navigation>
|
Loading…
x
Reference in New Issue
Block a user