加入短视频

This commit is contained in:
2024-07-12 01:36:59 +08:00
parent e7d81dc827
commit 37a16dd683
9 changed files with 617 additions and 8 deletions

View File

@@ -1,5 +1,6 @@
package com.aiosman.riderpro
import android.app.Activity
import android.app.StatusBarManager
import android.os.Bundle
import android.widget.HorizontalScrollView
@@ -8,6 +9,9 @@ import androidx.activity.ComponentActivity
import androidx.activity.SystemBarStyle
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.compose.animation.core.tween
import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut
import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
@@ -60,6 +64,7 @@ import androidx.navigation.compose.composable
import androidx.navigation.compose.currentBackStackEntryAsState
import androidx.navigation.compose.rememberNavController
import com.aiosman.riderpro.ui.theme.RiderProTheme
import com.google.accompanist.systemuicontroller.rememberSystemUiController
import com.google.android.gms.maps.model.CameraPosition
import com.google.android.gms.maps.model.LatLng
import com.google.maps.android.compose.GoogleMap
@@ -82,7 +87,14 @@ class MainActivity : ComponentActivity() {
@Composable
fun NavigationController(navController: NavHostController){
NavHost(
navController = navController, startDestination = NavigationItem.Home.route){
navController = navController,
startDestination = NavigationItem.Home.route,
enterTransition = {
fadeIn(animationSpec = tween(300))
},
exitTransition = {
fadeOut(animationSpec = tween(300))
}){
composable(route = NavigationItem.Home.route){
Home()
}
@@ -93,7 +105,7 @@ fun NavigationController(navController: NavHostController){
Add()
}
composable(route = NavigationItem.Message.route){
Message()
Video()
}
composable(route = NavigationItem.Profile.route){
Profile()
@@ -124,13 +136,31 @@ fun Navigation(){
){
val navBackStackEntry by navController.currentBackStackEntryAsState()
val currentRoute = navBackStackEntry?.destination?.route
val systemUiController = rememberSystemUiController()
item.forEach{ it ->
NavigationBarItem(
selected = currentRoute == it.route ,
onClick = {
if(currentRoute != it.route){
navController.navigate(it.route)
}
if(currentRoute != it.route){
navController.navigate(it.route)
}
when (it.route) {
NavigationItem.Add.route -> {
systemUiController.setSystemBarsColor(
color = Color.Black
)
}
NavigationItem.Message.route -> {
systemUiController.setSystemBarsColor(
color = Color.Black
)
}
else -> {
systemUiController.setSystemBarsColor(
color = Color.Transparent
)
}
}
},
colors = NavigationBarItemColors(
selectedIconColor = Color.Red,
@@ -193,6 +223,17 @@ fun Add(){
}
}
@Composable
fun Video(){
Column (
modifier = Modifier.fillMaxSize(),
verticalArrangement = Arrangement.Top,
horizontalAlignment = Alignment.CenterHorizontally,
){
ShortVideo()
}
}
@Composable
fun Message(){
Column (