1、添加配置模拟起是否展示
This commit is contained in:
shenzuqiang 2026-03-11 11:22:57 +08:00
parent 31834b320d
commit 7cdbf8f613
5 changed files with 320 additions and 326 deletions

View File

@ -39,8 +39,8 @@ android {
applicationId = "com.img.rabbit" applicationId = "com.img.rabbit"
minSdk = 24 minSdk = 24
targetSdk = 36 targetSdk = 36
versionCode = 1 versionCode = 3
versionName = "1.0.0" versionName = "1.0.3"
multiDexEnabled = true multiDexEnabled = true
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"

View File

@ -95,10 +95,8 @@ class MainActivity : ComponentActivity(), LoadingCallback {
@OptIn(DelicateCoroutinesApi::class, ExperimentalPermissionsApi::class) @OptIn(DelicateCoroutinesApi::class, ExperimentalPermissionsApi::class)
@SuppressLint("UnrememberedMutableState", "CoroutineCreationDuringComposition") @SuppressLint("UnrememberedMutableState", "CoroutineCreationDuringComposition")
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
// 必须在 super.onCreate 之前调用
val splashScreen = installSplashScreen() val splashScreen = installSplashScreen()
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
// 启用Edge-to-Edge模式沉浸模式 // 启用Edge-to-Edge模式沉浸模式
enableEdgeToEdge() enableEdgeToEdge()

View File

@ -13,6 +13,10 @@ class ConfigEntity {
var homeIconEntity: List<UniIconEntity>? = emptyList() var homeIconEntity: List<UniIconEntity>? = emptyList()
@SerializedName("client.wgt.password") //WGT解压密码 @SerializedName("client.wgt.password") //WGT解压密码
var wgtPassword: String? = null var wgtPassword: String? = null
@SerializedName("client.uni.open") //是否开启小程序模拟器
var isUniMpOpen: Boolean? = null
@SerializedName("client.popup.display") //显示开关控制 @SerializedName("client.popup.display") //显示开关控制

View File

@ -78,9 +78,8 @@ fun HomeScreen(
val TAG = "Rabbit_HomeScreen" val TAG = "Rabbit_HomeScreen"
val context = LocalContext.current val context = LocalContext.current
val scope: CoroutineScope = rememberCoroutineScope() val scope: CoroutineScope = rememberCoroutineScope()
val progressPair = mutableStateMapOf<String, Float>()
val reportViewModel = viewModel<ReportViewModel>() val reportViewModel = viewModel<ReportViewModel>()
val progressPair = mutableStateMapOf<String, Float>()
// 获取当前路由状态 // 获取当前路由状态
val navBackStackEntry by navController.currentBackStackEntryAsState() val navBackStackEntry by navController.currentBackStackEntryAsState()
@ -139,10 +138,7 @@ fun HomeScreen(
shape = RoundedCornerShape(topStart = 18.dp, topEnd = 18.dp) shape = RoundedCornerShape(topStart = 18.dp, topEnd = 18.dp)
) )
){ ){
val homeIconConfig = homeIconConfig // 顶部mask
//大于9时每排展示3个否则每排展示4个
val columnsCount = if((homeIconConfig?.size?:0) >= 9){ 3 }else{ 4 }
val rows = homeIconConfig?.chunked(columnsCount)?:emptyList()
item { item {
Image( Image(
painter = painterResource(id = R.mipmap.ic_home_top_mask), painter = painterResource(id = R.mipmap.ic_home_top_mask),
@ -163,6 +159,12 @@ fun HomeScreen(
} }
} }
// 当配置开启模拟器时,展示模拟器部分
if(PreferenceUtil.getUserConfig()?.config?.isUniMpOpen?:false){
//模拟器部分大于9时每排展示3个否则每排展示4个
val columnsCount = if((homeIconConfig?.size?:0) >= 9){ 3 }else{ 4 }
val rows = homeIconConfig?.chunked(columnsCount)?:emptyList()
//模拟器
item { item {
Column( Column(
) { ) {
@ -454,6 +456,7 @@ fun HomeScreen(
} }
} }
//模拟器指定页
items(rows) {rowItems -> items(rows) {rowItems ->
//通过配置展示-AD2 //通过配置展示-AD2
Row( Row(
@ -523,6 +526,8 @@ fun HomeScreen(
} }
} }
} }
}
//选尺寸制作
item { item {
Column( Column(
modifier = Modifier modifier = Modifier
@ -794,6 +799,7 @@ fun HomeScreen(
} }
} }
} }
//选证件制作
item { item {
//选证件制作 //选证件制作
Column( Column(
@ -1272,6 +1278,7 @@ fun HomeScreen(
} }
} }
} }
//其他
item { item {
//其他 //其他
Column( Column(

View File

@ -53,8 +53,12 @@ class GeneralViewModel: BaseViewModel(){
} }
} }
private val _agreementStatus = MutableLiveData<Boolean>() private val _agreementStatus = MutableLiveData(PreferenceUtil.getAgreement())
val agreementStatus: LiveData<Boolean> = _agreementStatus val agreementStatus: LiveData<Boolean> = _agreementStatus
fun setIsAgreement(agreement: Boolean){
PreferenceUtil.saveAgreement(agreement)
_agreementStatus.value = agreement
}
init { init {
// 注册网络监听 // 注册网络监听
@ -66,14 +70,12 @@ class GeneralViewModel: BaseViewModel(){
.build() .build()
connectivityManager.registerNetworkCallback(request, networkCallback) connectivityManager.registerNetworkCallback(request, networkCallback)
} }
// 初始化状态 // 初始化状态
_networkStatus.value = isNetworkAvailable() _networkStatus.value = isNetworkAvailable()
// 初始化隐私政策状态
_agreementStatus.value = PreferenceUtil.getAgreement()
// 初始化微信API // 初始化微信API
HeadParamUtils.applicationContext?.let { initWXApi(it) } HeadParamUtils.applicationContext?.let { initWXApi(it) }
// 隐私政策状态
_agreementStatus.value = PreferenceUtil.getAgreement()
} }
private fun isNetworkAvailable(): Boolean { private fun isNetworkAvailable(): Boolean {
@ -92,11 +94,6 @@ class GeneralViewModel: BaseViewModel(){
_isNavigationBarVisible.value = visible _isNavigationBarVisible.value = visible
} }
fun setIsAgreement(agreement: Boolean){
PreferenceUtil.saveAgreement(agreement)
_agreementStatus.value = agreement
}
private fun initWXApi(context: Context) { private fun initWXApi(context: Context) {
api = WXAPIFactory.createWXAPI(context, Constants.WxAppId, true) api = WXAPIFactory.createWXAPI(context, Constants.WxAppId, true)
api.registerApp(Constants.WxAppId) api.registerApp(Constants.WxAppId)
@ -116,18 +113,6 @@ class GeneralViewModel: BaseViewModel(){
} }
} }
// private fun wxPay(api: IWXAPI){
// val request = PayReq()
// request.appId = "wx7d1a7d1507482cef"
// request.partnerId = "1511850511";
// request.prepayId= "wx06112039579543463f9116a0527ce30001"
// request.packageValue = "Sign=WXPay"
// request.nonceStr= "QjlkDdZY54eKmvfKrtawJD9Cws7pvUh0"
// request.timeStamp= "1772767239"
// request.sign= "DOhyV8QBng20nrZxgV8l8+4DD1foi7XKRfPnhHbzf63qWvL2f3miKTqAVtoS1U9syO38ENXrS18XzWHRMNnoyWgTGLp/SxbZjRjqHvrLJKIa1pH0svdv/uPXK1GlvjqsMXgeoTEXn73aHBNlcctNaZ8GCWbxpg77kdcCJfM+qWOSQOMJOpKh8lTx4dQzhWqdOSzABkQJTg6TThNUN3/00yeN7K9wZ4JOpN+Tmtaliztp0wQ3iAHgAqZmhxwv7ZyRev2izpoukdJ2aBn/+xPK/Hs5kI2KM67x6quvrWiQV31GixU2i84ddI3uxn1DwR90f5iEyA10NOylPA+D9rOEUQ=="
// api.sendReq(request)
// }
override fun onCleared() { override fun onCleared() {
super.onCleared() super.onCleared()
connectivityManager.unregisterNetworkCallback(networkCallback) connectivityManager.unregisterNetworkCallback(networkCallback)