feat: 初始化项目结构和基本功能

- 创建项目根目录和主要子模块
- 添加基本的 Activity 和布局文件
- 实现简单的导航和电话拨打功能
- 添加相机和图像处理相关代码
- 创建网络请求和数据加密工具类
- 设置 AndroidManifest 文件和权限
This commit is contained in:
songzhiling
2025-04-11 11:52:07 +08:00
parent 74ce8fc526
commit 91305ab9d1
386 changed files with 36517 additions and 34 deletions

View File

@ -0,0 +1,113 @@
package com.za.common
import android.app.Application
import com.amap.api.location.AMapLocation
import com.tencent.mmkv.MMKV
import com.za.bean.DriverInfo
import com.za.bean.VehicleInfo
import com.za.bean.db.order.OrderInfo
import com.za.room.RoomHelper
object GlobalData {
lateinit var application : Application
var activityCount : Int = 0
var token : String? = null
get() {
return MMKV.defaultMMKV().decodeString("TOKEN", null)
}
set(value) {
MMKV.defaultMMKV().encode("TOKEN", value)
field = value
}
//记录上次登录的手机号
var lastLoginPhone : String? = null
get() {
return MMKV.defaultMMKV().decodeString("lastLoginPhone", null)
}
set(value) {
MMKV.defaultMMKV().encode("lastLoginPhone", value)
field = value
}
var aesKey : String? = null
get() {
return MMKV.defaultMMKV().decodeString("AES_KEY", null)
}
set(value) {
MMKV.defaultMMKV().encode("AES_KEY", value)
field = value
}
var driverInfo : DriverInfo? = null
get() {
return MMKV.defaultMMKV().decodeParcelable("driverInfo", DriverInfo::class.java)
}
set(value) {
MMKV.defaultMMKV().encode("driverInfo", value)
field = value
}
var vehicleInfo : VehicleInfo? = null
get() {
return MMKV.defaultMMKV().decodeParcelable("vehicleInfo", VehicleInfo::class.java)
}
set(value) {
MMKV.defaultMMKV().encode("vehicleInfo", value)
field = value
}
var currentOrder : OrderInfo? = null
get() {
return MMKV.defaultMMKV().decodeParcelable("currentOrder", OrderInfo::class.java)
}
set(value) {
MMKV.defaultMMKV().encode("currentOrder", value)
if (RoomHelper.db?.orderDao()?.getCurrentOrder() == null && value != null) {
RoomHelper.db?.orderDao()?.insertOrder(value)
} else if (value != null) {
RoomHelper.db?.orderDao()?.update(value)
}
field = value
}
var currentLocation : AMapLocation? = null
get() {
return MMKV.defaultMMKV().decodeParcelable("currentLocation", AMapLocation::class.java)
}
set(value) {
value?.time = System.currentTimeMillis()
MMKV.defaultMMKV().encode("currentLocation", value)
field = value
}
var loginTime : Long? = null
get() {
return MMKV.defaultMMKV().decodeLong("loginTime", System.currentTimeMillis())
}
set(value) {
MMKV.defaultMMKV().encode("loginTime", value ?: System.currentTimeMillis())
field = value
}
fun clearUserCache() {
token = null
aesKey = null
driverInfo = null
vehicleInfo = null
currentLocation = null
loginTime = null
}
fun clearAllOrderCache() {
currentOrder = null
RoomHelper.clearAll()
}
fun clearOrderCache(taskId : Int) {
RoomHelper.clearOrderFromTaskCode(taskId = taskId)
}
}