Skip to content

Commit

Permalink
?
Browse files Browse the repository at this point in the history
  • Loading branch information
SkyDynamic committed Nov 30, 2024
1 parent b15b41e commit f340ac2
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package io.github.skydynamic.maiproberplus.ui.compose.scores
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateListOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
Expand All @@ -23,6 +24,9 @@ object ScoreManagerViewModel : ViewModel() {
val chuniSearchScores = mutableStateListOf<ChuniScoreEntity>()
val chuniSearchText = mutableStateOf("")

var openMaimaiCreateScoreDialog by mutableStateOf(false)
var openChuniCreateScoreDialog by mutableStateOf(false)

var maimaiScoreSelection: MaimaiScoreEntity? by mutableStateOf(null)
var chuniScoreSelection: ChuniScoreEntity? by mutableStateOf(null)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ import io.github.skydynamic.maiproberplus.GlobalViewModel
import io.github.skydynamic.maiproberplus.core.data.chuni.ChuniData
import io.github.skydynamic.maiproberplus.core.data.chuni.ChuniEnums
import io.github.skydynamic.maiproberplus.core.data.chuni.ChuniScoreManager.createChuniScore
import io.github.skydynamic.maiproberplus.core.data.maimai.MaimaiScoreManager.createMaimaiScore
import io.github.skydynamic.maiproberplus.core.database.entity.ChuniScoreEntity
import io.github.skydynamic.maiproberplus.core.prober.sendMessageToUi
import io.github.skydynamic.maiproberplus.core.utils.calcChuniRating
Expand Down Expand Up @@ -110,7 +109,7 @@ fun ChuniCreateScoreDialog(
onDismissRequest = onDismissRequest,
modifier = Modifier
.fillMaxWidth()
.height(630.dp)
.height(480.dp)
.padding(start = 16.dp, end = 16.dp),
) {

Expand Down Expand Up @@ -402,7 +401,7 @@ fun ChuniCreateScoreDialog(
modifier = Modifier
.padding(start = 12.dp, end = 12.dp, top = 12.dp)
.fillMaxWidth()
.height(110.dp)
.height(60.dp)
) {
Text("Full Chain", fontSize = 12.sp)
SingleChoiceSegmentedButtonRow(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ fun ChuniScoreList(
coroutineScope: CoroutineScope
) {
var openDeleteConfirmDialog by remember { mutableStateOf(false) }
var openCreateScoreDialog by remember { mutableStateOf(false) }

val gridState = rememberLazyGridState()

when {
Expand All @@ -67,10 +67,10 @@ fun ChuniScoreList(
}
)
}
openCreateScoreDialog -> {
ScoreManagerViewModel.openChuniCreateScoreDialog -> {
ChuniCreateScoreDialog(
onDismissRequest = {
openCreateScoreDialog = false
ScoreManagerViewModel.openChuniCreateScoreDialog = false
}
)
}
Expand Down Expand Up @@ -165,7 +165,7 @@ fun ChuniScoreList(
Button(
modifier = Modifier.weight(1f),
onClick = {
openCreateScoreDialog = true
ScoreManagerViewModel.openChuniCreateScoreDialog = true
}
) {
Icon(Icons.Default.Add, null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,15 +271,28 @@ fun MaimaiScoreDetailDialog(
}
}

Button(
modifier = Modifier.padding(8.dp).align(Alignment.CenterHorizontally),
onClick = {
openDeleteConfirmDialog = true
},
colors = ButtonDefaults.buttonColors(Color.Red)
Row(
modifier = Modifier
.padding(8.dp)
.fillMaxWidth()
) {
Icon(Icons.Default.Delete, null, tint = Color.White)
Text("删除该成绩", color = Color.White)
Button(
modifier = Modifier.padding(4.dp).weight(1f),
onClick = {

}
) { }

Button(
modifier = Modifier.padding(4.dp).weight(1f),
onClick = {
openDeleteConfirmDialog = true
},
colors = ButtonDefaults.buttonColors(Color.Red)
) {
Icon(Icons.Default.Delete, null, tint = Color.White)
Text("删除该成绩", color = Color.White)
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ fun MaimaiScoreList(
coroutineScope: CoroutineScope
) {
var openDeleteConfirmDialog by remember { mutableStateOf(false) }
var openCreateScoreDialog by remember { mutableStateOf(false) }
val gridState = rememberLazyGridState()

when {
Expand All @@ -68,10 +67,10 @@ fun MaimaiScoreList(
}
)
}
openCreateScoreDialog -> {
ScoreManagerViewModel.openMaimaiCreateScoreDialog -> {
MaimaiCreateScoreDialog(
onDismissRequest = {
openCreateScoreDialog = false
ScoreManagerViewModel.openMaimaiCreateScoreDialog = false
}
)
}
Expand Down Expand Up @@ -166,7 +165,7 @@ fun MaimaiScoreList(
Button(
modifier = Modifier.weight(1f),
onClick = {
openCreateScoreDialog = true
ScoreManagerViewModel.openMaimaiCreateScoreDialog = true
}
) {
Icon(Icons.Default.Add, null)
Expand Down

0 comments on commit f340ac2

Please sign in to comment.