我的智能体
This commit is contained in:
@@ -40,6 +40,7 @@
|
||||
android:exported="true"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/Theme.App.Starting"
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="adjustResize">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
@@ -5,6 +5,7 @@ import android.app.NotificationChannel
|
||||
import android.app.NotificationManager
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.pm.ActivityInfo
|
||||
import android.content.pm.PackageManager
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
@@ -78,6 +79,10 @@ class MainActivity : ComponentActivity() {
|
||||
@RequiresApi(Build.VERSION_CODES.P)
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
// 设置屏幕方向为竖屏
|
||||
requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
|
||||
|
||||
// 监听应用生命周期
|
||||
ProcessLifecycleOwner.get().lifecycle.addObserver(MainActivityLifecycleObserver())
|
||||
// 创建通知渠道
|
||||
|
||||
@@ -55,7 +55,7 @@ fun AccountEditScreen2() {
|
||||
fun onNicknameChange(value: String) {
|
||||
model.name = value
|
||||
usernameError = when {
|
||||
value.isEmpty() -> "昵称不能为空"
|
||||
value.trim().isEmpty() -> "昵称不能为空"
|
||||
value.length < 3 -> "昵称长度不能小于3"
|
||||
value.length > 20 -> "昵称长度不能大于20"
|
||||
else -> null
|
||||
|
||||
@@ -487,9 +487,7 @@ fun MomentBottomOperateRowGroup(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.fillMaxHeight()
|
||||
.noRippleClickable {
|
||||
onFavoriteClick()
|
||||
},
|
||||
,
|
||||
contentAlignment = Alignment.CenterEnd
|
||||
) {
|
||||
MomentOperateBtn(count = momentEntity.favoriteCount.toString()) {
|
||||
|
||||
@@ -19,6 +19,7 @@ import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.lifecycle.viewmodel.compose.viewModel
|
||||
import androidx.paging.compose.collectAsLazyPagingItems
|
||||
import com.aiosman.ravenow.AppState
|
||||
import com.aiosman.ravenow.LocalAppTheme
|
||||
import com.aiosman.ravenow.R
|
||||
import com.aiosman.ravenow.exp.viewModelFactory
|
||||
@@ -41,9 +42,9 @@ fun FollowerListScreen(userId: Int) {
|
||||
model.loadData(userId)
|
||||
}
|
||||
StatusBarMaskLayout(
|
||||
modifier = Modifier
|
||||
.background(color = appColors.background)
|
||||
.padding(horizontal = 16.dp),
|
||||
modifier = Modifier.background(color = appColors.background).padding(horizontal = 16.dp),
|
||||
darkIcons = !AppState.darkMode,
|
||||
maskBoxBackgroundColor = appColors.background
|
||||
) {
|
||||
var dataFlow = model.usersFlow
|
||||
var users = dataFlow.collectAsLazyPagingItems()
|
||||
|
||||
@@ -26,6 +26,7 @@ import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.lifecycle.viewmodel.compose.viewModel
|
||||
import androidx.paging.compose.collectAsLazyPagingItems
|
||||
import com.aiosman.ravenow.AppState
|
||||
import com.aiosman.ravenow.LocalAppTheme
|
||||
import com.aiosman.ravenow.R
|
||||
import com.aiosman.ravenow.exp.viewModelFactory
|
||||
@@ -48,9 +49,9 @@ fun FollowingListScreen(userId: Int) {
|
||||
model.loadData(userId)
|
||||
}
|
||||
StatusBarMaskLayout(
|
||||
modifier = Modifier
|
||||
.background(color = appColors.background)
|
||||
.padding(horizontal = 16.dp),
|
||||
modifier = Modifier.background(color = appColors.background).padding(horizontal = 16.dp),
|
||||
darkIcons = !AppState.darkMode,
|
||||
maskBoxBackgroundColor = appColors.background
|
||||
) {
|
||||
var dataFlow = model.usersFlow
|
||||
var users = dataFlow.collectAsLazyPagingItems()
|
||||
|
||||
@@ -107,6 +107,7 @@ fun ProfileV3(
|
||||
onChatClick: () -> Unit = {},
|
||||
moments: List<MomentEntity>,
|
||||
isSelf: Boolean = true,
|
||||
isMain:Boolean = false,
|
||||
onLoadMore: () -> Unit = {},
|
||||
onLike: (MomentEntity) -> Unit = {},
|
||||
onComment: (MomentEntity) -> Unit = {},
|
||||
@@ -274,7 +275,7 @@ fun ProfileV3(
|
||||
)
|
||||
}
|
||||
}
|
||||
if (isSelf) {
|
||||
if (isSelf&&isMain) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.align(Alignment.TopEnd)
|
||||
@@ -386,6 +387,7 @@ fun ProfileV3(
|
||||
),
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
if (!isMain) {
|
||||
Image(
|
||||
painter = painterResource(id = R.drawable.rider_pro_back_icon), // Replace with your image resource
|
||||
contentDescription = "Back",
|
||||
@@ -413,8 +415,10 @@ fun ProfileV3(
|
||||
fontWeight = FontWeight.W600,
|
||||
color = AppColors.text
|
||||
)
|
||||
|
||||
}
|
||||
Spacer(modifier = Modifier.weight(1f))
|
||||
if (isSelf) {
|
||||
if (isSelf&&isMain) {
|
||||
Box(
|
||||
modifier = Modifier.noRippleClickable {
|
||||
IndexViewModel.openDrawer = true
|
||||
|
||||
@@ -16,6 +16,7 @@ fun ProfileWrap(
|
||||
MyProfileViewModel.loadProfile()
|
||||
}
|
||||
ProfileV3(
|
||||
isMain = true,
|
||||
onUpdateBanner = { uri, file, context ->
|
||||
MyProfileViewModel.updateUserProfileBanner(uri, file, context)
|
||||
},
|
||||
|
||||
@@ -85,7 +85,9 @@ import com.google.accompanist.systemuicontroller.rememberSystemUiController
|
||||
import kotlinx.coroutines.launch
|
||||
import java.io.File
|
||||
|
||||
|
||||
/**
|
||||
* 发布动态
|
||||
*/
|
||||
@Preview
|
||||
@Composable
|
||||
fun NewPostScreen() {
|
||||
|
||||
@@ -123,6 +123,9 @@ import kotlinx.coroutines.launch
|
||||
import net.engawapg.lib.zoomable.rememberZoomState
|
||||
import net.engawapg.lib.zoomable.zoomable
|
||||
|
||||
/**
|
||||
* 动态详情
|
||||
*/
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
fun PostScreen(
|
||||
@@ -689,6 +692,7 @@ fun Header(
|
||||
windowInsets = WindowInsets(0)
|
||||
) {
|
||||
PostMenuModal(
|
||||
|
||||
onDeleteClick = {
|
||||
onDeleteClick()
|
||||
expanded = false
|
||||
@@ -696,7 +700,8 @@ fun Header(
|
||||
onReportClick = {
|
||||
onReportClick()
|
||||
expanded = false
|
||||
}
|
||||
},
|
||||
userId = userId
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -1214,7 +1219,7 @@ fun CommentItem(
|
||||
color = AppColors.nonActiveText,
|
||||
)
|
||||
Spacer(modifier = Modifier.width(27.dp))
|
||||
if (AppState.UserId?.toLong() != commentEntity.author) {
|
||||
|
||||
Icon(
|
||||
painter = painterResource(id = R.drawable.rider_pro_comment),
|
||||
contentDescription = "",
|
||||
@@ -1236,7 +1241,7 @@ fun CommentItem(
|
||||
)
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1375,11 +1380,11 @@ fun PostBottomBar(
|
||||
fun PostMenuModal(
|
||||
onDeleteClick: () -> Unit = {},
|
||||
onReportClick: () -> Unit = {},
|
||||
momentEntity: MomentEntity? = null
|
||||
userId: Int? = 0
|
||||
) {
|
||||
val AppColors = LocalAppTheme.current
|
||||
|
||||
Column(
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.height(160.dp)
|
||||
@@ -1388,10 +1393,10 @@ fun PostMenuModal(
|
||||
) {
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth(),
|
||||
.size(60.dp),
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
momentEntity?.let {
|
||||
if(AppState.UserId == userId){
|
||||
Column(
|
||||
modifier = Modifier.padding(end = 16.dp),
|
||||
verticalArrangement = Arrangement.Center,
|
||||
@@ -1417,13 +1422,20 @@ fun PostMenuModal(
|
||||
Spacer(modifier = Modifier.height(8.dp))
|
||||
Text(
|
||||
text = stringResource(R.string.delete),
|
||||
fontSize = 11.sp,
|
||||
fontSize = 12.sp,
|
||||
fontWeight = FontWeight.Bold,
|
||||
color = AppColors.text
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.size(60.dp),
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
if(AppState.UserId == userId){
|
||||
Column(
|
||||
modifier = Modifier.padding(end = 16.dp),
|
||||
verticalArrangement = Arrangement.Center,
|
||||
@@ -1437,11 +1449,11 @@ fun PostMenuModal(
|
||||
}
|
||||
) {
|
||||
Image(
|
||||
painter = painterResource(id = R.drawable.rider_pro_moment_delete),
|
||||
painter = painterResource(id = R.drawable.rider_pro_moment_report),
|
||||
contentDescription = "",
|
||||
modifier = Modifier.size(24.dp),
|
||||
colorFilter = ColorFilter.tint(
|
||||
AppColors.text
|
||||
AppColors.error
|
||||
)
|
||||
)
|
||||
}
|
||||
@@ -1449,12 +1461,13 @@ fun PostMenuModal(
|
||||
Spacer(modifier = Modifier.height(8.dp))
|
||||
Text(
|
||||
text = stringResource(R.string.report),
|
||||
fontSize = 11.sp,
|
||||
fontSize = 12.sp,
|
||||
fontWeight = FontWeight.Bold,
|
||||
color = AppColors.text
|
||||
color = AppColors.error
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1621,7 +1634,7 @@ fun CommentMenuModal(
|
||||
onCloseClick()
|
||||
}
|
||||
}
|
||||
if (!isSelf) {
|
||||
//自己也可以回复自己
|
||||
Spacer(modifier = Modifier.width(48.dp))
|
||||
MenuActionItem(
|
||||
icon = R.drawable.rider_pro_comment,
|
||||
@@ -1629,7 +1642,7 @@ fun CommentMenuModal(
|
||||
) {
|
||||
onReplyClick()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Spacer(modifier = Modifier.height(48.dp))
|
||||
}
|
||||
|
||||
@@ -42,7 +42,12 @@ class AccountProfileViewModel : ViewModel() {
|
||||
if (profileId == profile?.id) {
|
||||
return@launch
|
||||
}
|
||||
try {
|
||||
profile = userService.getUserProfile(id)
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
|
||||
refreshing = false
|
||||
profile?.let {
|
||||
try {
|
||||
|
||||
51
app/src/main/res/drawable/rider_pro_moment_report.xml
Normal file
51
app/src/main/res/drawable/rider_pro_moment_report.xml
Normal file
@@ -0,0 +1,51 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
|
||||
<group
|
||||
android:translateX="-337"
|
||||
android:translateY="-702">
|
||||
<group
|
||||
android:translateX="159"
|
||||
android:translateY="686">
|
||||
<group
|
||||
android:translateY="16">
|
||||
<group
|
||||
android:translateX="178">
|
||||
<path
|
||||
android:fillType="evenOdd"
|
||||
android:strokeWidth="1"
|
||||
android:pathData="M 0 0 L 24 0 L 24 24 L 0 24 Z" />
|
||||
<path
|
||||
android:fillType="evenOdd"
|
||||
android:strokeColor="#ED1C24"
|
||||
android:strokeWidth="2"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeLineCap="round"
|
||||
android:pathData="M5,19 L19,19 C19.6625348,18.9953523 20.2797678,18.6628968 20.6482087,18.1122378 C21.0166496,17.5615789 21.088473,16.8641947 20.84,16.25 L13.74,4 C13.3877623,3.36336836 12.717579,2.96824584 11.99,2.96824584 C11.262421,2.96824584 10.5922377,3.36336836 10.24,4 L3.14,16.25 C2.89639597,16.8497348 2.95812047,17.5302837 3.30565137,18.0764037 C3.65318227,18.6225237 4.24353735,18.9666713 4.89,19" />
|
||||
<path
|
||||
android:fillType="evenOdd"
|
||||
android:strokeWidth="1"
|
||||
android:pathData="M 0 0 L 24 0 L 24 24 L 0 24 Z" />
|
||||
<path
|
||||
android:fillType="evenOdd"
|
||||
android:strokeColor="#ED1C24"
|
||||
android:strokeWidth="2"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeLineCap="round"
|
||||
android:pathData="M 12 8 L 12 12" />
|
||||
<path
|
||||
android:fillType="evenOdd"
|
||||
android:strokeColor="#ED1C24"
|
||||
android:strokeWidth="2"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeLineCap="round"
|
||||
android:pathData="M 12 16 L 12.01 16" />
|
||||
</group>
|
||||
</group>
|
||||
</group>
|
||||
</group>
|
||||
</vector>
|
||||
Reference in New Issue
Block a user