更新代码

This commit is contained in:
2024-09-16 01:34:32 +08:00
parent 51e3b07346
commit d0079c5a44
2 changed files with 0 additions and 55 deletions

View File

@@ -101,6 +101,5 @@ dependencies {
implementation("com.google.firebase:firebase-analytics") implementation("com.google.firebase:firebase-analytics")
implementation("com.google.firebase:firebase-perf") implementation("com.google.firebase:firebase-perf")
implementation("com.google.firebase:firebase-messaging-ktx") implementation("com.google.firebase:firebase-messaging-ktx")
} }

View File

@@ -6,7 +6,6 @@ import androidx.activity.compose.rememberLauncherForActivityResult
import androidx.activity.result.contract.ActivityResultContracts import androidx.activity.result.contract.ActivityResultContracts
import androidx.compose.animation.AnimatedVisibility import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.core.animateDpAsState import androidx.compose.animation.core.animateDpAsState
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.Image import androidx.compose.foundation.Image
import androidx.compose.foundation.background import androidx.compose.foundation.background
import androidx.compose.foundation.clickable import androidx.compose.foundation.clickable
@@ -39,7 +38,6 @@ import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.runtime.setValue import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
@@ -68,11 +66,6 @@ import com.aiosman.riderpro.ui.composables.StatusBarMaskLayout
import com.aiosman.riderpro.ui.modifiers.noRippleClickable import com.aiosman.riderpro.ui.modifiers.noRippleClickable
import com.google.accompanist.systemuicontroller.rememberSystemUiController import com.google.accompanist.systemuicontroller.rememberSystemUiController
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import org.burnoutcrew.reorderable.NoDragCancelledAnimation
import org.burnoutcrew.reorderable.ReorderableItem
import org.burnoutcrew.reorderable.detectReorderAfterLongPress
import org.burnoutcrew.reorderable.rememberReorderableLazyGridState
import org.burnoutcrew.reorderable.reorderable
import java.io.File import java.io.File
@@ -232,46 +225,6 @@ fun NewPostTextField(hint: String, value: String, onValueChange: (String) -> Uni
} }
} }
@Composable
private fun VerticalGrid(
modifier: Modifier = Modifier,
) {
var data by remember { mutableStateOf((0 until 20).toList()) }
val state = rememberReorderableLazyGridState(onMove = { from, to ->
data = data.toMutableList().apply {
add(to.index, removeAt(from.index))
}
})
LazyVerticalGrid(
columns = GridCells.Fixed(4),
state = state.gridState,
contentPadding = PaddingValues(horizontal = 8.dp),
verticalArrangement = Arrangement.spacedBy(4.dp),
horizontalArrangement = Arrangement.spacedBy(4.dp),
modifier = modifier.reorderable(state)
) {
items(data.size, { it }) { item ->
val imageItem = data[item]
ReorderableItem(state, item) { isDragging ->
val elevation = animateDpAsState(if (isDragging) 8.dp else 0.dp)
Box(
contentAlignment = Alignment.Center,
modifier = Modifier
.detectReorderAfterLongPress(state)
.shadow(elevation.value)
.aspectRatio(1f)
.background(MaterialTheme.colors.primary)
) {
Text(
text = imageItem.toString(),
color = Color.White
)
}
}
}
}
}
@Composable @Composable
@@ -295,13 +248,6 @@ fun AddImageGrid() {
model.imageUriList += model.currentPhotoUri.toString() model.imageUriList += model.currentPhotoUri.toString()
} }
} }
val state =
rememberReorderableLazyGridState(
onMove = { from, to ->
model.imageUriList = model.imageUriList.toMutableList().apply {
add(to.index, removeAt(from.index))
}
})
val stroke = Stroke( val stroke = Stroke(
width = 2f, width = 2f,