Commit eb4097d7 authored by zhaopengxiang's avatar zhaopengxiang

添加设置界面

parent e279fc5c
......@@ -2,9 +2,9 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.miya.fastcashier">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:name=".BaseApplication"
......@@ -12,6 +12,7 @@
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:theme="@style/Theme.MiYaFastCashier.Dark"
android:supportsRtl="true">
<activity
android:name=".ui.LoginActivity"
......@@ -20,7 +21,6 @@
android:theme="@style/Theme.MiYaFastCashier.Light">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
......@@ -52,6 +52,9 @@
<activity
android:name=".ui.SearchOrderActivity"
android:theme="@style/Theme.MiYaFastCashier.Dark" />
<activity
android:name=".ui.SettingActivity"
android:exported="true" />
</application>
</manifest>
\ No newline at end of file
......@@ -27,7 +27,6 @@ import java.util.*
class MainActivity : BaseActivity() {
//退出登录 二次确认弹窗
private var alertDialog: CommonDialog? = null
private lateinit var binding: ActivityMainBinding
private lateinit var viewModel: MainViewModel
private var dateSelectHelper: DateSelectHelper? = null
......@@ -41,7 +40,7 @@ class MainActivity : BaseActivity() {
val llPay = binding.llPay
val llRefund = binding.llRefund
val tvPrintLast = binding.tvPrintLast
val ivLoginOut = binding.ivLoginOut
val ivSetting = binding.ivSetting
val tvStoreName = binding.tvStoreName
val tvSlog = binding.tvSlog
......@@ -66,8 +65,8 @@ class MainActivity : BaseActivity() {
startActivity(intent)
}
ivLoginOut.clickWithTrigger {
loginOut()
ivSetting.clickWithTrigger {
SettingActivity.start(this@MainActivity)
}
binding.llStatistic.clickWithTrigger {
......@@ -135,39 +134,6 @@ class MainActivity : BaseActivity() {
})
}
private fun loginOut() {
if (alertDialog == null || !alertDialog!!.isShowing) {
alertDialog = CommonDialog(this)
alertDialog!!.setCustomMessage(getString(R.string.app_text_login_out))
.setNegativeStr(getString(R.string.cancel))
.setPositiveStr(getString(R.string.text_login_out_sure))
.setMessageGravity(Gravity.CENTER_HORIZONTAL)
.setOnClickListener(object : CommonDialog.OnDialogClickListener {
override fun onNegativeClick() {
alertDialog!!.dismiss()
alertDialog = null
}
override fun onPositiveClick() {
alertDialog!!.dismiss()
alertDialog = null
run {
MMKV.defaultMMKV().clearAll()
AccountService.clear()
val intent = Intent()
intent.setClass(
this@MainActivity,
LoginActivity::class.java
)
startActivity(intent)
finish()
}
}
})
.show()
}
}
override fun onDestroy() {
dateSelectHelper?.dismiss()
super.onDestroy()
......
package com.miya.fastcashier.ui
import android.content.Context
import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.Gravity
import com.blankj.utilcode.util.ToastUtils
import com.miya.fastcashier.R
import com.miya.fastcashier.databinding.ActivitySettingBinding
import com.miya.fastcashier.service.AccountService
import com.miya.fastcashier.ui.dialog.CommonDialog
import com.miya.fastcashier.utils.clickWithTrigger
import com.tencent.mmkv.MMKV
class SettingActivity : BaseActivity() {
private lateinit var viewBinding:ActivitySettingBinding
private var alertDialog: CommonDialog? = null
companion object{
@JvmStatic
fun start(context: Context) {
val intent = Intent(context, SettingActivity::class.java)
context.startActivity(intent)
}
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
viewBinding = ActivitySettingBinding.inflate(layoutInflater)
setContentView(viewBinding.root)
init()
}
private fun init(){
viewBinding.llBack.clickWithTrigger { finish() }
viewBinding.vLoginOut.clickWithTrigger { loginOut() }
viewBinding.vUpdatePassword.clickWithTrigger { ToastUtils.showLong("点击修改密码") }
}
private fun loginOut() {
if (alertDialog == null || !alertDialog!!.isShowing) {
alertDialog = CommonDialog(this)
alertDialog!!.setCustomMessage(getString(R.string.app_text_login_out))
.setNegativeStr(getString(R.string.cancel))
.setPositiveStr(getString(R.string.text_login_out_sure))
.setMessageGravity(Gravity.CENTER_HORIZONTAL)
.setOnClickListener(object : CommonDialog.OnDialogClickListener {
override fun onNegativeClick() {
alertDialog!!.dismiss()
alertDialog = null
}
override fun onPositiveClick() {
alertDialog!!.dismiss()
alertDialog = null
run {
MMKV.defaultMMKV().clearAll()
AccountService.clear()
val intent = Intent(this@SettingActivity, LoginActivity::class.java)
startActivity(intent)
finish()
}
}
})
.show()
}
}
}
\ No newline at end of file
......@@ -50,15 +50,17 @@
<TextView
android:id="@+id/tvStoreName"
android:layout_width="360dp"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="23dp"
android:layout_marginLeft="26dp"
android:layout_marginTop="23dp"
android:ellipsize="end"
android:maxLines="1"
android:text="匡威-杭州滨江店!"
android:textColor="@color/white"
android:textSize="48sp"
android:textSize="36sp"
app:layout_constraintEnd_toStartOf="@+id/ivSetting"
app:layout_constraintStart_toEndOf="@+id/ivLogo"
app:layout_constraintTop_toTopOf="@+id/ivLogo" />
......@@ -70,8 +72,9 @@
android:layout_marginLeft="26dp"
android:text="ID1274911047"
android:textColor="@color/white"
android:textSize="28sp"
app:layout_constraintBottom_toBottomOf="@+id/ivLogo"
android:textSize="24sp"
app:layout_constraintTop_toBottomOf="@id/tvStoreName"
android:layout_marginTop="8dp"
app:layout_constraintStart_toEndOf="@+id/ivLogo" />
<androidx.appcompat.widget.LinearLayoutCompat
......@@ -223,7 +226,6 @@
</androidx.appcompat.widget.LinearLayoutCompat>
<TextView
android:id="@+id/tvPrintLast"
android:layout_width="624dp"
......@@ -249,15 +251,17 @@
app:layout_constraintStart_toStartOf="parent" />
<ImageView
android:id="@+id/ivLoginOut"
android:id="@+id/ivSetting"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginStart="12dp"
android:layout_marginLeft="12dp"
android:padding="7dp"
android:src="@mipmap/app_main_login_out"
app:layout_constraintBottom_toBottomOf="@+id/tvStoreName"
app:layout_constraintStart_toEndOf="@+id/tvStoreName"
app:layout_constraintTop_toTopOf="@+id/tvStoreName" />
android:layout_marginEnd="41dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:scaleType="centerCrop"
android:src="@mipmap/app_main_setting"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@id/tvStoreName" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<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:background="@color/color_E5E5E5"
tools:context=".ui.SettingActivity">
<View
android:id="@+id/v_top"
android:layout_width="match_parent"
android:layout_height="87dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:background="@color/colorPrimary"/>
<androidx.appcompat.widget.LinearLayoutCompat
android:id="@+id/ll_back"
android:layout_width="200dp"
android:layout_height="87dp"
android:orientation="horizontal"
android:gravity="center_vertical"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@+id/tvBack"
app:layout_constraintTop_toTopOf="@+id/tvBack"
app:layout_constraintBottom_toBottomOf="@+id/tvBack"
android:layout_width="24dp"
android:layout_height="48dp"
android:layout_marginLeft="32dp"
android:padding="6dp"
android:src="@mipmap/ic_left_arrow"
android:contentDescription="@string/back" />
<TextView
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginLeft="16dp"
android:textColor="@color/white"
android:text="@string/back"
android:textSize="24sp"/>
</androidx.appcompat.widget.LinearLayoutCompat>
<ImageView
android:layout_width="195dp"
android:layout_height="20dp"
android:layout_marginEnd="32dp"
android:layout_marginRight="32dp"
android:src="@mipmap/ic_logo_white"
app:layout_constraintBottom_toBottomOf="@+id/ll_back"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/ll_back" />
<View
android:id="@+id/v_update_password"
android:layout_width="match_parent"
android:layout_height="103dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/v_top"
android:background="@color/white"/>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="32dp"
android:layout_marginStart="32dp"
android:layout_marginEnd="32dp"
android:layout_marginRight="32dp"
android:textSize="28sp"
android:textColor="@color/color_333333"
app:layout_constraintStart_toStartOf="@id/v_update_password"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@id/v_update_password"
app:layout_constraintBottom_toBottomOf="@id/v_update_password"
android:drawableRight="@mipmap/app_icon_arrow_right_grey"
android:text="@string/text_update_account_password"/>
<View
android:layout_width="match_parent"
android:layout_height="1px"
android:background="@color/color_E9E9E9"
android:layout_marginStart="25dp"
android:layout_marginRight="25dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="@id/v_update_password"/>
<View
android:id="@+id/v_login_out"
android:layout_width="match_parent"
android:layout_height="103dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/v_update_password"
android:background="@color/white"/>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="32dp"
android:layout_marginStart="32dp"
android:layout_marginEnd="32dp"
android:layout_marginRight="32dp"
android:textSize="28sp"
android:textColor="@color/color_333333"
app:layout_constraintStart_toStartOf="@id/v_login_out"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@id/v_login_out"
app:layout_constraintBottom_toBottomOf="@id/v_login_out"
android:drawableRight="@mipmap/app_icon_arrow_right_grey"
android:text="@string/app_login_out"/>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
......@@ -16,5 +16,6 @@
<color name="color_ECECEC">#ECECEC</color>
<color name="color_F8F8F8">#F8F8F8</color>
<color name="color_E5E5E5">#E5E5E5</color>
<color name="color_E9E9E9">#E9E9E9</color>
<color name="color_D83773">#D83773</color>
</resources>
\ No newline at end of file
......@@ -23,6 +23,8 @@
<string name="search_order_prompt_text">还没有明细哦~</string>
<string name="app_text_login_out">是否确认退出登录账号</string>
<string name="text_login_out_sure">确认退出</string>
<string name="app_login_out">退出登录</string>
<string name="text_refund_amount">退款金额¥%s,是否确认退款</string>
<string name="text_update_account_password">修改授权密码</string>
</resources>
\ No newline at end of file
......@@ -7,7 +7,7 @@ buildscript {
}
dependencies {
classpath "com.android.tools.build:gradle:4.2.1"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.31"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment