修改页面
This commit is contained in:
parent
e7ed854f2d
commit
261be09fb9
@ -96,6 +96,7 @@ class MainActivity : BaseActivity() {
|
||||
val appBarConfiguration = AppBarConfiguration(
|
||||
setOf(
|
||||
R.id.navigation_home, R.id.navigation_dashboard, R.id.navigation_notifications,
|
||||
R.id.navigation_setting,
|
||||
)
|
||||
)
|
||||
setupActionBarWithNavController(navController, appBarConfiguration)
|
||||
@ -115,10 +116,18 @@ class MainActivity : BaseActivity() {
|
||||
}
|
||||
|
||||
navController.addOnDestinationChangedListener { _, destination, _ ->
|
||||
if (supportActionBar != null) {
|
||||
if (destination.id == R.id.navigation_login) {
|
||||
supportActionBar!!.hide()
|
||||
} else if (!supportActionBar!!.isShowing) {
|
||||
supportActionBar!!.show()
|
||||
}
|
||||
}
|
||||
|
||||
if (destination.id == R.id.navigation_home || destination.id == R.id.navigation_dashboard || destination.id == R.id.navigation_notifications) {
|
||||
runOnUiThread {
|
||||
val transition: Transition = Slide(Gravity.BOTTOM)
|
||||
transition.duration = 300;
|
||||
transition.duration = 500;
|
||||
TransitionManager.beginDelayedTransition(binding.root, transition);
|
||||
navView.visibility = View.VISIBLE
|
||||
newMessageView.visibility = View.VISIBLE
|
||||
@ -126,7 +135,7 @@ class MainActivity : BaseActivity() {
|
||||
} else {
|
||||
runOnUiThread {
|
||||
val transition: Transition = Slide(Gravity.BOTTOM)
|
||||
transition.duration = 300;
|
||||
transition.duration = 500;
|
||||
TransitionManager.beginDelayedTransition(binding.root, transition);
|
||||
navView.visibility = View.GONE
|
||||
newMessageView.visibility = View.GONE
|
||||
|
||||
@ -23,10 +23,7 @@ import kotlinx.coroutines.launch
|
||||
@AndroidEntryPoint
|
||||
class LoginFragment : BaseFragment() {
|
||||
|
||||
// private var loginViewModel:LoginViewModel by viewModel(get())
|
||||
private lateinit var viewBinding: FragmentLoginBinding
|
||||
|
||||
|
||||
private val viewModel by viewModels<LoginViewModel>()
|
||||
|
||||
override fun onCreateView(
|
||||
@ -34,6 +31,7 @@ class LoginFragment : BaseFragment() {
|
||||
container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
|
||||
viewBinding = DataBindingUtil.inflate(inflater, R.layout.fragment_login, container, false)
|
||||
viewBinding.lifecycleOwner = this
|
||||
initView()
|
||||
|
||||
@ -0,0 +1,38 @@
|
||||
package com.navinfo.volvo.ui.fragments.setting
|
||||
|
||||
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
|
||||
import com.navinfo.volvo.databinding.FragmentSettingBinding
|
||||
import com.navinfo.volvo.ui.fragments.BaseFragment
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
|
||||
@AndroidEntryPoint
|
||||
class SettingFragment : BaseFragment() {
|
||||
|
||||
private lateinit var viewBinding: FragmentSettingBinding
|
||||
private val viewModel by viewModels<SettingModel>()
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
viewBinding = DataBindingUtil.inflate(inflater, R.layout.fragment_setting, container, false)
|
||||
viewBinding.lifecycleOwner = this
|
||||
initView()
|
||||
return viewBinding.root
|
||||
}
|
||||
|
||||
private fun initView() {
|
||||
//退出登录
|
||||
viewBinding.loginFragmentLoginButton.setOnClickListener {
|
||||
findNavController().navigate(R.id.action_setting_to_login)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
package com.navinfo.volvo.ui.fragments.setting
|
||||
|
||||
import androidx.lifecycle.ViewModel
|
||||
import javax.inject.Inject
|
||||
|
||||
class SettingModel @Inject constructor() : ViewModel() {
|
||||
|
||||
}
|
||||
5
app/src/main/res/drawable/ic_baseline_settings_24.xml
Normal file
5
app/src/main/res/drawable/ic_baseline_settings_24.xml
Normal 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="M19.14,12.94c0.04,-0.3 0.06,-0.61 0.06,-0.94c0,-0.32 -0.02,-0.64 -0.07,-0.94l2.03,-1.58c0.18,-0.14 0.23,-0.41 0.12,-0.61l-1.92,-3.32c-0.12,-0.22 -0.37,-0.29 -0.59,-0.22l-2.39,0.96c-0.5,-0.38 -1.03,-0.7 -1.62,-0.94L14.4,2.81c-0.04,-0.24 -0.24,-0.41 -0.48,-0.41h-3.84c-0.24,0 -0.43,0.17 -0.47,0.41L9.25,5.35C8.66,5.59 8.12,5.92 7.63,6.29L5.24,5.33c-0.22,-0.08 -0.47,0 -0.59,0.22L2.74,8.87C2.62,9.08 2.66,9.34 2.86,9.48l2.03,1.58C4.84,11.36 4.8,11.69 4.8,12s0.02,0.64 0.07,0.94l-2.03,1.58c-0.18,0.14 -0.23,0.41 -0.12,0.61l1.92,3.32c0.12,0.22 0.37,0.29 0.59,0.22l2.39,-0.96c0.5,0.38 1.03,0.7 1.62,0.94l0.36,2.54c0.05,0.24 0.24,0.41 0.48,0.41h3.84c0.24,0 0.44,-0.17 0.47,-0.41l0.36,-2.54c0.59,-0.24 1.13,-0.56 1.62,-0.94l2.39,0.96c0.22,0.08 0.47,0 0.59,-0.22l1.92,-3.32c0.12,-0.22 0.07,-0.47 -0.12,-0.61L19.14,12.94zM12,15.6c-1.98,0 -3.6,-1.62 -3.6,-3.6s1.62,-3.6 3.6,-3.6s3.6,1.62 3.6,3.6S13.98,15.6 12,15.6z"/>
|
||||
</vector>
|
||||
6
app/src/main/res/drawable/shape_radius.xml
Normal file
6
app/src/main/res/drawable/shape_radius.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners android:radius="8dp" />
|
||||
<stroke
|
||||
android:width="2px"
|
||||
android:color="@color/black" />
|
||||
</shape>
|
||||
23
app/src/main/res/drawable/shape_radius_bg_white.xml
Normal file
23
app/src/main/res/drawable/shape_radius_bg_white.xml
Normal file
@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<!-- 灰色阴影 -->
|
||||
<item
|
||||
android:left="2dp"
|
||||
android:top="2dp">
|
||||
<shape>
|
||||
<solid android:color="@android:color/darker_gray" />
|
||||
<corners android:radius="4dp" />
|
||||
</shape>
|
||||
</item>
|
||||
<!-- 白色前景 -->
|
||||
<item
|
||||
android:bottom="1dp"
|
||||
android:left="1dp"
|
||||
android:right="1dp"
|
||||
android:top="1dp">
|
||||
<shape>
|
||||
<solid android:color="#FFFFFF" />
|
||||
<corners android:radius="4dp" />
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
||||
@ -29,6 +29,68 @@
|
||||
android:hint="请输入查询内容" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<!-- <androidx.constraintlayout.helper.widget.Layer-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="match_parent"-->
|
||||
<!-- android:background="@drawable/shape_radius_bg_white"-->
|
||||
<!-- android:padding="5dp"-->
|
||||
<!-- android:layout_marginLeft="4dp"-->
|
||||
<!-- android:layout_marginRight="4dp"-->
|
||||
<!-- app:constraint_referenced_ids="home_title_icon,home_title_who,home_title_content,home_title_time,home_title_status" />-->
|
||||
|
||||
<!-- <TextView-->
|
||||
<!-- android:id="@+id/home_title_icon"-->
|
||||
<!-- android:layout_width="60dp"-->
|
||||
<!-- android:layout_height="60dp"-->
|
||||
<!-- android:layout_margin="13dp"-->
|
||||
<!-- android:background="@drawable/shape_radius"-->
|
||||
<!-- android:gravity="center"-->
|
||||
<!-- android:maxLines="2"-->
|
||||
<!-- android:paddingLeft="15dp"-->
|
||||
<!-- android:paddingRight="15dp"-->
|
||||
<!-- android:text="上传图片"-->
|
||||
<!-- app:layout_constraintLeft_toLeftOf="parent"-->
|
||||
<!-- app:layout_constraintTop_toBottomOf="@id/home_search" />-->
|
||||
|
||||
<!-- <TextView-->
|
||||
<!-- android:id="@+id/home_title_who"-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:layout_marginLeft="10dp"-->
|
||||
<!-- android:text="发给谁"-->
|
||||
<!-- android:textSize="17sp"-->
|
||||
<!-- android:textStyle="bold"-->
|
||||
<!-- app:layout_constraintLeft_toRightOf="@id/home_title_icon"-->
|
||||
<!-- app:layout_constraintTop_toTopOf="@id/home_title_icon" />-->
|
||||
|
||||
<!-- <TextView-->
|
||||
<!-- android:id="@+id/home_title_content"-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:layout_marginLeft="10dp"-->
|
||||
<!-- android:text="问候名称"-->
|
||||
<!-- app:layout_constraintBottom_toBottomOf="@id/home_title_icon"-->
|
||||
<!-- app:layout_constraintLeft_toRightOf="@id/home_title_icon" />-->
|
||||
|
||||
<!-- <TextView-->
|
||||
<!-- android:id="@+id/home_title_status"-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:layout_marginRight="10dp"-->
|
||||
<!-- android:text="发送状态"-->
|
||||
<!-- app:layout_constraintBottom_toBottomOf="@id/home_title_icon"-->
|
||||
<!-- app:layout_constraintRight_toRightOf="parent" />-->
|
||||
|
||||
<!-- <TextView-->
|
||||
<!-- android:id="@+id/home_title_time"-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:layout_marginRight="10dp"-->
|
||||
<!-- android:text="发送时间"-->
|
||||
<!-- app:layout_constraintRight_toRightOf="parent"-->
|
||||
<!-- app:layout_constraintTop_toTopOf="@id/home_title_icon" />-->
|
||||
|
||||
|
||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
android:id="@+id/home_SwipeRefreshLayout"
|
||||
android:layout_width="0dp"
|
||||
|
||||
25
app/src/main/res/layout/fragment_setting.xml
Normal file
25
app/src/main/res/layout/fragment_setting.xml
Normal file
@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<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">
|
||||
|
||||
<data>
|
||||
|
||||
</data>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".ui.fragments.setting.SettingFragment">
|
||||
|
||||
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
|
||||
android:id="@+id/login_fragment_login_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="退出登录"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</layout>
|
||||
@ -3,7 +3,7 @@
|
||||
|
||||
<item
|
||||
android:id="@+id/navigation_home"
|
||||
android:icon="@drawable/ic_home_black_24dp"
|
||||
android:icon="@drawable/ic_baseline_mail_24"
|
||||
android:title="@string/title_home" />
|
||||
<item
|
||||
android:id="@+id/navigation_dashboard"
|
||||
@ -17,14 +17,10 @@
|
||||
android:id="@+id/navigation_notifications"
|
||||
android:icon="@drawable/ic_notifications_black_24dp"
|
||||
android:title="@string/title_notifications" />
|
||||
<!-- <item-->
|
||||
<!-- android:id="@+id/navigation_my"-->
|
||||
<!-- android:icon="@drawable/ic_baseline_person_24"-->
|
||||
<!-- android:title="@string/my" />-->
|
||||
|
||||
<item
|
||||
android:id="@+id/navigation_obtain_message"
|
||||
android:icon="@drawable/ic_baseline_mail_24"
|
||||
android:title="我的" />
|
||||
android:id="@+id/navigation_setting"
|
||||
android:icon="@drawable/ic_baseline_settings_24"
|
||||
android:title="@string/my" />
|
||||
|
||||
</menu>
|
||||
@ -47,6 +47,19 @@
|
||||
android:id="@+id/navigation_obtain_message"
|
||||
android:name="com.navinfo.volvo.ui.fragments.message.ObtainMessageFragment"
|
||||
android:label="问候编辑"
|
||||
tools:layout="@layout/fragment_obtain_message"></fragment>
|
||||
tools:layout="@layout/fragment_setting"></fragment>
|
||||
|
||||
<fragment
|
||||
android:id="@+id/navigation_setting"
|
||||
android:name="com.navinfo.volvo.ui.fragments.setting.SettingFragment"
|
||||
android:label="@string/setting"
|
||||
tools:layout="@layout/fragment_obtain_message">
|
||||
<action
|
||||
android:id="@+id/action_setting_to_login"
|
||||
app:destination="@id/navigation_login"
|
||||
app:popUpTo="@id/navigation_setting"
|
||||
app:popUpToInclusive="true"/>
|
||||
|
||||
</fragment>
|
||||
|
||||
</navigation>
|
||||
@ -6,6 +6,7 @@
|
||||
<string name="delete">删除</string>
|
||||
<string name="share">分享</string>
|
||||
<string name="my">我的</string>
|
||||
<string name="setting">设置</string>
|
||||
<string name="title_activity_second">SecondActivity</string>
|
||||
<!-- Strings used for fragments for navigation -->
|
||||
<string name="first_fragment_label">First Fragment</string>
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
<string name="share">Share</string>
|
||||
<string name="preview">Preview</string>
|
||||
<string name="my">My</string>
|
||||
<string name="setting">setting</string>
|
||||
<string name="title_activity_second">SecondActivity</string>
|
||||
<!-- Strings used for fragments for navigation -->
|
||||
<string name="first_fragment_label">First Fragment</string>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user