添加启动界面
@@ -43,7 +43,12 @@ import com.google.firebase.analytics.analytics
|
|||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
import androidx.compose.runtime.remember
|
||||||
|
import androidx.compose.runtime.mutableStateOf
|
||||||
|
import androidx.compose.runtime.LaunchedEffect
|
||||||
|
import androidx.compose.runtime.getValue
|
||||||
|
import androidx.compose.runtime.setValue
|
||||||
|
import com.aiosman.ravenow.ui.splash.SplashScreen
|
||||||
|
|
||||||
class MainActivity : ComponentActivity() {
|
class MainActivity : ComponentActivity() {
|
||||||
// Firebase Analytics
|
// Firebase Analytics
|
||||||
@@ -122,75 +127,84 @@ class MainActivity : ComponentActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setContent {
|
setContent {
|
||||||
CompositionLocalProvider(
|
var showSplash by remember { mutableStateOf(true) }
|
||||||
LocalAppTheme provides AppState.appTheme
|
|
||||||
) {
|
LaunchedEffect(Unit) {
|
||||||
CheckUpdateDialog()
|
kotlinx.coroutines.delay(2000)
|
||||||
Navigation(startDestination) { navController ->
|
showSplash = false
|
||||||
// 处理带有 postId 的通知点击
|
}
|
||||||
val postId = intent.getStringExtra("POST_ID")
|
|
||||||
var commentId = intent.getStringExtra("COMMENT_ID")
|
if (showSplash) {
|
||||||
val action = intent.getStringExtra("ACTION")
|
SplashScreen()
|
||||||
if (action == "newFollow") {
|
} else {
|
||||||
navController.navigate(NavigationRoute.Followers.route)
|
CompositionLocalProvider(
|
||||||
return@Navigation
|
LocalAppTheme provides AppState.appTheme
|
||||||
}
|
) {
|
||||||
if (action == "followCount") {
|
CheckUpdateDialog()
|
||||||
navController.navigate(NavigationRoute.Followers.route)
|
Navigation(startDestination) { navController ->
|
||||||
return@Navigation
|
|
||||||
}
|
// 处理带有 postId 的通知点击
|
||||||
if (action == "TRTC_NEW_MESSAGE") {
|
val postId = intent.getStringExtra("POST_ID")
|
||||||
val userService:UserService = UserServiceImpl()
|
var commentId = intent.getStringExtra("COMMENT_ID")
|
||||||
val sender = intent.getStringExtra("SENDER")
|
val action = intent.getStringExtra("ACTION")
|
||||||
sender?.let {
|
if (action == "newFollow") {
|
||||||
scope.launch {
|
navController.navigate(NavigationRoute.Followers.route)
|
||||||
try {
|
return@Navigation
|
||||||
val profile = userService.getUserProfileByTrtcUserId(it,0)
|
}
|
||||||
navController.navigate(NavigationRoute.Chat.route.replace(
|
if (action == "followCount") {
|
||||||
"{id}",
|
navController.navigate(NavigationRoute.Followers.route)
|
||||||
profile.id.toString()
|
return@Navigation
|
||||||
))
|
}
|
||||||
}catch (e:Exception){
|
if (action == "TRTC_NEW_MESSAGE") {
|
||||||
e.printStackTrace()
|
val userService:UserService = UserServiceImpl()
|
||||||
|
val sender = intent.getStringExtra("SENDER")
|
||||||
|
sender?.let {
|
||||||
|
scope.launch {
|
||||||
|
try {
|
||||||
|
val profile = userService.getUserProfileByTrtcUserId(it,0)
|
||||||
|
navController.navigate(NavigationRoute.Chat.route.replace(
|
||||||
|
"{id}",
|
||||||
|
profile.id.toString()
|
||||||
|
))
|
||||||
|
}catch (e:Exception){
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return@Navigation
|
||||||
}
|
}
|
||||||
return@Navigation
|
|
||||||
}
|
|
||||||
|
|
||||||
if (commentId == null) {
|
if (commentId == null) {
|
||||||
commentId = "0"
|
commentId = "0"
|
||||||
}
|
|
||||||
|
|
||||||
if (postId != null) {
|
|
||||||
Log.d("MainActivity", "Navigation to Post$postId")
|
|
||||||
navController.navigateToPost(
|
|
||||||
id = postId.toInt(),
|
|
||||||
highlightCommentId = commentId.toInt(),
|
|
||||||
initImagePagerIndex = 0
|
|
||||||
)
|
|
||||||
}
|
|
||||||
// 处理分享过来的图片
|
|
||||||
if (intent?.action == Intent.ACTION_SEND || intent?.action == Intent.ACTION_SEND_MULTIPLE) {
|
|
||||||
val imageUris: List<Uri>? = if (intent.action == Intent.ACTION_SEND) {
|
|
||||||
listOf(intent.getParcelableExtra(Intent.EXTRA_STREAM)!!)
|
|
||||||
} else {
|
|
||||||
intent.getParcelableArrayListExtra(Intent.EXTRA_STREAM)
|
|
||||||
}
|
}
|
||||||
NewPostViewModel.asNewPostWithImageUris(imageUris!!.map { it.toString() })
|
|
||||||
navController.navigate(NavigationRoute.NewPost.route)
|
|
||||||
|
|
||||||
|
if (postId != null) {
|
||||||
|
Log.d("MainActivity", "Navigation to Post$postId")
|
||||||
|
navController.navigateToPost(
|
||||||
|
id = postId.toInt(),
|
||||||
|
highlightCommentId = commentId.toInt(),
|
||||||
|
initImagePagerIndex = 0
|
||||||
|
)
|
||||||
|
}
|
||||||
|
// 处理分享过来的图片
|
||||||
|
if (intent?.action == Intent.ACTION_SEND || intent?.action == Intent.ACTION_SEND_MULTIPLE) {
|
||||||
|
val imageUris: List<Uri>? = if (intent.action == Intent.ACTION_SEND) {
|
||||||
|
listOf(intent.getParcelableExtra(Intent.EXTRA_STREAM)!!)
|
||||||
|
} else {
|
||||||
|
intent.getParcelableArrayListExtra(Intent.EXTRA_STREAM)
|
||||||
|
}
|
||||||
|
NewPostViewModel.asNewPostWithImageUris(imageUris!!.map { it.toString() })
|
||||||
|
navController.navigate(NavigationRoute.NewPost.route)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 请求通知权限
|
* 请求通知权限
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,20 +1,19 @@
|
|||||||
package com.aiosman.ravenow.ui.splash
|
package com.aiosman.ravenow.ui.splash
|
||||||
|
|
||||||
import androidx.compose.foundation.Image
|
import androidx.compose.foundation.Image
|
||||||
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.Spacer
|
import androidx.compose.foundation.layout.Spacer
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
|
||||||
import androidx.compose.foundation.layout.height
|
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.layout.width
|
import androidx.compose.foundation.layout.size
|
||||||
import androidx.compose.material.Scaffold
|
|
||||||
import androidx.compose.material.Text
|
import androidx.compose.material.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.res.painterResource
|
import androidx.compose.ui.res.painterResource
|
||||||
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.unit.sp
|
import androidx.compose.ui.unit.sp
|
||||||
@@ -22,38 +21,36 @@ import com.aiosman.ravenow.R
|
|||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun SplashScreen() {
|
fun SplashScreen() {
|
||||||
Scaffold {
|
Box(
|
||||||
it
|
modifier = Modifier.fillMaxSize()
|
||||||
Box(
|
) {
|
||||||
modifier = Modifier.fillMaxSize()
|
// 居中的图标
|
||||||
|
Image(
|
||||||
|
painter = painterResource(id = R.mipmap.invalid_name),
|
||||||
|
contentDescription = "App Logo",
|
||||||
|
modifier = Modifier
|
||||||
|
.align(Alignment.Center)
|
||||||
|
.size(120.dp)
|
||||||
|
)
|
||||||
|
|
||||||
|
// 底部文字
|
||||||
|
Column(
|
||||||
|
horizontalAlignment = Alignment.CenterHorizontally,
|
||||||
|
verticalArrangement = Arrangement.Bottom,
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxSize()
|
||||||
|
.padding(bottom = 80.dp)
|
||||||
) {
|
) {
|
||||||
// to bottom
|
Image(
|
||||||
Box(
|
painterResource(id = R.mipmap.kp_p_img),
|
||||||
contentAlignment = Alignment.TopCenter,
|
contentDescription = "",
|
||||||
modifier = Modifier.padding(top = 211.dp)
|
modifier = Modifier.size(85.dp, 25.dp)
|
||||||
) {
|
)
|
||||||
Column(
|
Spacer(modifier = Modifier.padding(top = 16.dp))
|
||||||
horizontalAlignment = Alignment.CenterHorizontally,
|
Text(
|
||||||
modifier = Modifier.fillMaxWidth()
|
stringResource(R.string.splash_title),
|
||||||
) {
|
fontSize = 13.sp
|
||||||
Image(
|
)
|
||||||
painter = painterResource(id = R.mipmap.rider_pro_logo),
|
|
||||||
contentDescription = "Rave Now",
|
|
||||||
modifier = Modifier
|
|
||||||
.width(108.dp)
|
|
||||||
.height(45.dp)
|
|
||||||
)
|
|
||||||
Spacer(modifier = Modifier.height(32.dp))
|
|
||||||
Text(
|
|
||||||
"Rave Now".uppercase(),
|
|
||||||
fontSize = 28.sp,
|
|
||||||
fontWeight = FontWeight.Bold
|
|
||||||
)
|
|
||||||
Text("Your Night Starts Here".uppercase(), fontSize = 20.sp, fontWeight = FontWeight.W700)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BIN
app/src/main/res/mipmap-hdpi/kp_bj_img.png
Normal file
|
After Width: | Height: | Size: 96 KiB |
BIN
app/src/main/res/mipmap-hdpi/kp_logo_img.png
Normal file
|
After Width: | Height: | Size: 4.6 KiB |
BIN
app/src/main/res/mipmap-hdpi/kp_p_img.png
Normal file
|
After Width: | Height: | Size: 852 B |
BIN
app/src/main/res/mipmap-mdpi/kp_bj_img.png
Normal file
|
After Width: | Height: | Size: 44 KiB |
BIN
app/src/main/res/mipmap-mdpi/kp_logo_img.png
Normal file
|
After Width: | Height: | Size: 2.9 KiB |
BIN
app/src/main/res/mipmap-mdpi/kp_p_img.png
Normal file
|
After Width: | Height: | Size: 599 B |
BIN
app/src/main/res/mipmap-xhdpi/kp_bj_img.png
Normal file
|
After Width: | Height: | Size: 169 KiB |
BIN
app/src/main/res/mipmap-xhdpi/kp_logo_img.png
Normal file
|
After Width: | Height: | Size: 6.7 KiB |
BIN
app/src/main/res/mipmap-xhdpi/kp_p_img.png
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/kp_bj_img.png
Normal file
|
After Width: | Height: | Size: 374 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/kp_logo_img.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/kp_p_img.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/kp_bj_img.png
Normal file
|
After Width: | Height: | Size: 652 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/kp_logo_img.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/kp_p_img.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
@@ -18,4 +18,7 @@
|
|||||||
<string name="create_agent_auto">一言でAIを作成</string>
|
<string name="create_agent_auto">一言でAIを作成</string>
|
||||||
<string name="agent_name_hint_1">名前を付けて、あなただけの特別な存在にしましょう</string>
|
<string name="agent_name_hint_1">名前を付けて、あなただけの特別な存在にしましょう</string>
|
||||||
<string name="create_success">スマートボディの作成が完了しました!</string>
|
<string name="create_success">スマートボディの作成が完了しました!</string>
|
||||||
|
|
||||||
|
<!-- splash Page -->
|
||||||
|
<string name="splash_title">社交はA Iと人間に属する</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -210,4 +210,7 @@
|
|||||||
<string name="create_agent_auto">一句话创造Ai</string>
|
<string name="create_agent_auto">一句话创造Ai</string>
|
||||||
<string name="agent_name_hint_1">给它取个名字,让它成为独一无二的你</string>
|
<string name="agent_name_hint_1">给它取个名字,让它成为独一无二的你</string>
|
||||||
<string name="create_success">智能体创建完成!</string>
|
<string name="create_success">智能体创建完成!</string>
|
||||||
|
|
||||||
|
<!-- splash Page -->
|
||||||
|
<string name="splash_title">社 交 属 于 A I 和 人 类</string>
|
||||||
</resources>
|
</resources>
|
||||||
@@ -206,4 +206,7 @@
|
|||||||
<string name="create_agent_auto">Create AI with One Sentence</string>
|
<string name="create_agent_auto">Create AI with One Sentence</string>
|
||||||
<string name="agent_name_hint_1">Give it a name to make it uniquely yours</string>
|
<string name="agent_name_hint_1">Give it a name to make it uniquely yours</string>
|
||||||
<string name="create_success">Agent creation completed!</string>
|
<string name="create_success">Agent creation completed!</string>
|
||||||
|
|
||||||
|
<!-- splash Page -->
|
||||||
|
<string name="splash_title">Social interaction belongs to AI and humans</string>
|
||||||
</resources>
|
</resources>
|
||||||