动态主题切换
This commit is contained in:
@@ -5,6 +5,9 @@ import android.content.Intent
|
||||
import android.icu.util.Calendar
|
||||
import android.icu.util.TimeZone
|
||||
import android.util.Log
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.setValue
|
||||
import com.aiosman.riderpro.data.AccountProfile
|
||||
import com.aiosman.riderpro.data.AccountService
|
||||
import com.aiosman.riderpro.data.AccountServiceImpl
|
||||
@@ -35,6 +38,7 @@ object AppState {
|
||||
var UserId: Int? = null
|
||||
var profile :AccountProfileEntity? = null
|
||||
var darkMode = false
|
||||
var appTheme by mutableStateOf<AppThemeData>(LightThemeColors())
|
||||
suspend fun initWithAccount(scope: CoroutineScope, context: Context) {
|
||||
val accountService: AccountService = AccountServiceImpl()
|
||||
// 获取用户认证信息
|
||||
@@ -116,6 +120,16 @@ object AppState {
|
||||
}
|
||||
}
|
||||
|
||||
fun switchTheme() {
|
||||
darkMode = !darkMode
|
||||
appTheme = if (darkMode) {
|
||||
DarkThemeColors()
|
||||
} else {
|
||||
LightThemeColors()
|
||||
}
|
||||
AppStore.saveDarkMode(darkMode)
|
||||
}
|
||||
|
||||
fun ReloadAppState(context: Context) {
|
||||
// 重置动态列表页面
|
||||
TimelineMomentViewModel.ResetModel()
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.aiosman.riderpro
|
||||
import androidx.compose.ui.graphics.Color
|
||||
|
||||
//var AppColors = LightThemeColors()
|
||||
var AppColors = if (AppState.darkMode) DarkThemeColors() else LightThemeColors()
|
||||
//var AppColors = if (AppState.darkMode) DarkThemeColors() else LightThemeColors()
|
||||
|
||||
open class AppThemeData(
|
||||
var main: Color,
|
||||
|
||||
@@ -1,18 +1,14 @@
|
||||
package com.aiosman.riderpro
|
||||
|
||||
import android.Manifest
|
||||
import android.app.AlertDialog
|
||||
import android.app.DownloadManager
|
||||
import android.app.NotificationChannel
|
||||
import android.app.NotificationManager
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.IntentFilter
|
||||
import android.content.pm.PackageManager
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.os.Environment
|
||||
import android.util.Log
|
||||
import androidx.activity.ComponentActivity
|
||||
import androidx.activity.compose.setContent
|
||||
@@ -22,20 +18,12 @@ import androidx.annotation.RequiresApi
|
||||
import androidx.compose.animation.AnimatedContentScope
|
||||
import androidx.compose.animation.ExperimentalSharedTransitionApi
|
||||
import androidx.compose.animation.SharedTransitionScope
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material3.AlertDialog
|
||||
import androidx.compose.material3.BasicAlertDialog
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.CompositionLocalProvider
|
||||
import androidx.compose.runtime.compositionLocalOf
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.view.WindowCompat
|
||||
import androidx.lifecycle.ProcessLifecycleOwner
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.navigation.NavHostController
|
||||
import cn.jiguang.api.utils.JCollectionAuth
|
||||
import cn.jpush.android.api.JPushInterface
|
||||
@@ -44,21 +32,15 @@ import com.aiosman.riderpro.data.AccountServiceImpl
|
||||
import com.aiosman.riderpro.data.UserService
|
||||
import com.aiosman.riderpro.data.UserServiceImpl
|
||||
import com.aiosman.riderpro.model.ApkInstallReceiver
|
||||
import com.aiosman.riderpro.model.UpdateInfo
|
||||
import com.aiosman.riderpro.ui.Navigation
|
||||
import com.aiosman.riderpro.ui.NavigationRoute
|
||||
import com.aiosman.riderpro.ui.dialogs.CheckUpdateDialog
|
||||
import com.aiosman.riderpro.ui.navigateToPost
|
||||
import com.aiosman.riderpro.ui.post.NewPostViewModel
|
||||
import com.google.accompanist.systemuicontroller.rememberSystemUiController
|
||||
import com.google.firebase.analytics.FirebaseAnalytics
|
||||
import com.google.gson.Gson
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
import okhttp3.OkHttpClient
|
||||
import okhttp3.Request
|
||||
|
||||
|
||||
class MainActivity : ComponentActivity() {
|
||||
@@ -79,77 +61,6 @@ class MainActivity : ComponentActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.P)
|
||||
fun getVersionCode(context: Context): Int {
|
||||
val packageManager = context.packageManager
|
||||
val packageInfo = packageManager.getPackageInfo(context.packageName,0)
|
||||
return packageInfo.longVersionCode.toInt()
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.P)
|
||||
private fun checkUpdate() {
|
||||
lifecycleScope.launch(Dispatchers.IO) {
|
||||
try {
|
||||
val client = OkHttpClient()
|
||||
val request = Request.Builder()
|
||||
.url("${ConstVars.BASE_SERVER}/static/update/beta/version.json")
|
||||
.build()
|
||||
val response = client.newCall(request).execute()
|
||||
|
||||
if (response.isSuccessful) {
|
||||
val responseBody = response.body?.string()
|
||||
val updateInfo = Gson().fromJson(responseBody, UpdateInfo::class.java)
|
||||
|
||||
val versionCode = getVersionCode(context)
|
||||
// 检查是否有新版本
|
||||
Log.d("MainActivity", "Current version code: $versionCode")
|
||||
Log.d("MainActivity", "Server version code: ${updateInfo.versionCode}")
|
||||
if (updateInfo.versionCode > versionCode || true) {
|
||||
withContext(Dispatchers.Main) {
|
||||
showUpdateDialog(updateInfo)
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
// 处理网络请求失败
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private fun showUpdateDialog(updateInfo: UpdateInfo) {
|
||||
val builder = AlertDialog.Builder(this)
|
||||
|
||||
builder.setTitle("🔴 ${getString(R.string.update_find_new_version)} v${updateInfo.versionName}")
|
||||
builder.setMessage(updateInfo.updateContent)
|
||||
builder.setPositiveButton(R.string.update_update_now) { dialog, _ ->
|
||||
|
||||
downloadApk(updateInfo.downloadUrl,updateInfo.versionName)
|
||||
dialog.dismiss()
|
||||
}
|
||||
if (!updateInfo.forceUpdate) {
|
||||
builder.setNegativeButton(R.string.update_later) { dialog, _ ->
|
||||
dialog.dismiss()
|
||||
}
|
||||
} else {
|
||||
builder.setCancelable(false)
|
||||
}
|
||||
builder.show()
|
||||
}
|
||||
|
||||
private fun downloadApk(downloadUrl: String,versionName: String) {
|
||||
// 使用 DownloadManager 下载 APK 文件
|
||||
val downloadManager = getSystemService(Context.DOWNLOAD_SERVICE) as DownloadManager
|
||||
val request = DownloadManager.Request(Uri.parse(downloadUrl))
|
||||
val apkFileName = "RiderPro_v${versionName.replace(".","_")}.apk"
|
||||
request.setMimeType("application/vnd.android.package-archive") // 添加这行代码
|
||||
request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, apkFileName)
|
||||
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED)
|
||||
val downloadId = downloadManager.enqueue(request)
|
||||
Log.d("MainActivity", "Download enqueued with ID: $downloadId")
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取账号信息
|
||||
*/
|
||||
@@ -194,15 +105,6 @@ class MainActivity : ComponentActivity() {
|
||||
}
|
||||
enableEdgeToEdge()
|
||||
|
||||
// // 注册广播接收器
|
||||
// val intentFilter = IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE)
|
||||
// registerReceiver(apkInstallReceiver, intentFilter, RECEIVER_NOT_EXPORTED)
|
||||
//
|
||||
// checkUpdate()
|
||||
|
||||
// 初始化腾讯云通信 SDK
|
||||
|
||||
|
||||
scope.launch {
|
||||
// 检查是否有登录态
|
||||
val isAccountValidate = getAccount()
|
||||
@@ -214,64 +116,69 @@ class MainActivity : ComponentActivity() {
|
||||
}
|
||||
|
||||
setContent {
|
||||
CheckUpdateDialog()
|
||||
Navigation(startDestination) { navController ->
|
||||
// 处理带有 postId 的通知点击
|
||||
val postId = intent.getStringExtra("POST_ID")
|
||||
var commentId = intent.getStringExtra("COMMENT_ID")
|
||||
val action = intent.getStringExtra("ACTION")
|
||||
if (action == "newFollow") {
|
||||
navController.navigate(NavigationRoute.Followers.route)
|
||||
return@Navigation
|
||||
}
|
||||
if (action == "followCount") {
|
||||
navController.navigate(NavigationRoute.Followers.route)
|
||||
return@Navigation
|
||||
}
|
||||
if (action == "TRTC_NEW_MESSAGE") {
|
||||
val userService:UserService = UserServiceImpl()
|
||||
val sender = intent.getStringExtra("SENDER")
|
||||
sender?.let {
|
||||
scope.launch {
|
||||
try {
|
||||
val profile = userService.getUserProfileByTrtcUserId(it)
|
||||
navController.navigate(NavigationRoute.Chat.route.replace(
|
||||
"{id}",
|
||||
profile.id.toString()
|
||||
))
|
||||
}catch (e:Exception){
|
||||
e.printStackTrace()
|
||||
CompositionLocalProvider(
|
||||
LocalAppTheme provides AppState.appTheme
|
||||
) {
|
||||
CheckUpdateDialog()
|
||||
Navigation(startDestination) { navController ->
|
||||
// 处理带有 postId 的通知点击
|
||||
val postId = intent.getStringExtra("POST_ID")
|
||||
var commentId = intent.getStringExtra("COMMENT_ID")
|
||||
val action = intent.getStringExtra("ACTION")
|
||||
if (action == "newFollow") {
|
||||
navController.navigate(NavigationRoute.Followers.route)
|
||||
return@Navigation
|
||||
}
|
||||
if (action == "followCount") {
|
||||
navController.navigate(NavigationRoute.Followers.route)
|
||||
return@Navigation
|
||||
}
|
||||
if (action == "TRTC_NEW_MESSAGE") {
|
||||
val userService:UserService = UserServiceImpl()
|
||||
val sender = intent.getStringExtra("SENDER")
|
||||
sender?.let {
|
||||
scope.launch {
|
||||
try {
|
||||
val profile = userService.getUserProfileByTrtcUserId(it)
|
||||
navController.navigate(NavigationRoute.Chat.route.replace(
|
||||
"{id}",
|
||||
profile.id.toString()
|
||||
))
|
||||
}catch (e:Exception){
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
}
|
||||
return@Navigation
|
||||
}
|
||||
return@Navigation
|
||||
}
|
||||
|
||||
if (commentId == null) {
|
||||
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)
|
||||
if (commentId == null) {
|
||||
commentId = "0"
|
||||
}
|
||||
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)
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -332,4 +239,6 @@ val LocalAnimatedContentScope = compositionLocalOf<AnimatedContentScope> {
|
||||
}
|
||||
|
||||
|
||||
|
||||
val LocalAppTheme = compositionLocalOf<AppThemeData> {
|
||||
error("AppThemeData not provided")
|
||||
}
|
||||
|
||||
@@ -26,12 +26,9 @@ object AppStore {
|
||||
// apply dark mode
|
||||
if (sharedPreferences.getBoolean("darkMode", false)) {
|
||||
AppState.darkMode = true
|
||||
AppState.appTheme = DarkThemeColors()
|
||||
}
|
||||
AppColors = if (AppState.darkMode) {
|
||||
DarkThemeColors()
|
||||
}else{
|
||||
LightThemeColors()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
suspend fun saveData() {
|
||||
|
||||
@@ -25,9 +25,9 @@ import androidx.compose.ui.text.TextStyle
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import com.aiosman.riderpro.AppColors
|
||||
import com.aiosman.riderpro.ConstVars
|
||||
import com.aiosman.riderpro.ErrorCode
|
||||
import com.aiosman.riderpro.LocalAppTheme
|
||||
import com.aiosman.riderpro.LocalNavController
|
||||
import com.aiosman.riderpro.R
|
||||
import com.aiosman.riderpro.data.AccountService
|
||||
@@ -55,6 +55,7 @@ fun ResetPasswordScreen() {
|
||||
var usernameError by remember { mutableStateOf<String?>(null) }
|
||||
var countDown by remember { mutableStateOf<Int?>(null) }
|
||||
var countDownMax by remember { mutableStateOf(60) }
|
||||
val appColors = LocalAppTheme.current
|
||||
fun validate(): Boolean {
|
||||
if (username.isEmpty()) {
|
||||
usernameError = context.getString(R.string.text_error_email_required)
|
||||
@@ -147,7 +148,7 @@ fun ResetPasswordScreen() {
|
||||
Text(
|
||||
text = stringResource(R.string.reset_mail_send_success),
|
||||
style = TextStyle(
|
||||
color = AppColors.text,
|
||||
color = appColors.text,
|
||||
fontSize = 14.sp,
|
||||
fontWeight = FontWeight.Bold
|
||||
),
|
||||
@@ -157,7 +158,7 @@ fun ResetPasswordScreen() {
|
||||
Text(
|
||||
text = stringResource(R.string.reset_mail_send_failed),
|
||||
style = TextStyle(
|
||||
color = AppColors.text,
|
||||
color = appColors.text,
|
||||
fontSize = 14.sp,
|
||||
fontWeight = FontWeight.Bold
|
||||
),
|
||||
@@ -176,8 +177,8 @@ fun ResetPasswordScreen() {
|
||||
} else {
|
||||
stringResource(R.string.recover)
|
||||
},
|
||||
backgroundColor = AppColors.main,
|
||||
color = AppColors.mainText,
|
||||
backgroundColor = appColors.main,
|
||||
color = appColors.mainText,
|
||||
isLoading = isLoading,
|
||||
contentPadding = PaddingValues(0.dp),
|
||||
enabled = countDown == null,
|
||||
|
||||
@@ -17,7 +17,7 @@ import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.aiosman.riderpro.AppColors
|
||||
import com.aiosman.riderpro.LocalAppTheme
|
||||
import com.aiosman.riderpro.LocalNavController
|
||||
import com.aiosman.riderpro.R
|
||||
import com.aiosman.riderpro.data.AccountService
|
||||
@@ -59,6 +59,7 @@ fun ChangePasswordScreen() {
|
||||
var oldPasswordError by remember { mutableStateOf<String?>(null) }
|
||||
var confirmPasswordError by remember { mutableStateOf<String?>(null) }
|
||||
var passwordError by remember { mutableStateOf<String?>(null) }
|
||||
val AppColors = LocalAppTheme.current
|
||||
fun validate(): Boolean {
|
||||
oldPasswordError =
|
||||
if (currentPassword.isEmpty()) "Please enter your current password" else null
|
||||
|
||||
@@ -30,7 +30,7 @@ import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import com.aiosman.riderpro.AppColors
|
||||
import com.aiosman.riderpro.LocalAppTheme
|
||||
import com.aiosman.riderpro.LocalNavController
|
||||
import com.aiosman.riderpro.R
|
||||
import com.aiosman.riderpro.ui.NavigationRoute
|
||||
@@ -60,6 +60,7 @@ fun AccountEditScreen2() {
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
val appColors = LocalAppTheme.current
|
||||
|
||||
fun onBioChange(value: String) {
|
||||
model.bio = value
|
||||
@@ -82,7 +83,7 @@ fun AccountEditScreen2() {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.background(color = AppColors.background),
|
||||
.background(color = appColors.background),
|
||||
horizontalAlignment = Alignment.CenterHorizontally
|
||||
) {
|
||||
StatusBarSpacer()
|
||||
@@ -130,7 +131,7 @@ fun AccountEditScreen2() {
|
||||
modifier = Modifier
|
||||
.size(32.dp)
|
||||
.clip(CircleShape)
|
||||
.background(AppColors.main)
|
||||
.background(appColors.main)
|
||||
.align(Alignment.BottomEnd)
|
||||
.noRippleClickable {
|
||||
navController.navigate(NavigationRoute.ImageCrop.route)
|
||||
|
||||
@@ -71,7 +71,7 @@ import androidx.lifecycle.ViewModel
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import androidx.lifecycle.viewmodel.compose.viewModel
|
||||
import com.aiosman.riderpro.AppColors
|
||||
import com.aiosman.riderpro.LocalAppTheme
|
||||
import com.aiosman.riderpro.LocalNavController
|
||||
import com.aiosman.riderpro.R
|
||||
import com.aiosman.riderpro.entity.ChatItem
|
||||
@@ -90,6 +90,7 @@ fun ChatScreen(userId: String) {
|
||||
var isMenuExpanded by remember { mutableStateOf(false) }
|
||||
val navController = LocalNavController.current
|
||||
val context = LocalNavController.current.context
|
||||
val AppColors = LocalAppTheme.current
|
||||
var goToNewCount by remember { mutableStateOf(0) }
|
||||
val viewModel = viewModel<ChatViewModel>(
|
||||
key = "ChatViewModel_$userId",
|
||||
@@ -407,6 +408,8 @@ fun ChatSelfItem(item: ChatItem) {
|
||||
|
||||
@Composable
|
||||
fun ChatOtherItem(item: ChatItem) {
|
||||
val AppColors = LocalAppTheme.current
|
||||
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
@@ -502,6 +505,7 @@ fun ChatInput(
|
||||
var keyboardController by remember { mutableStateOf<SoftwareKeyboardController?>(null) }
|
||||
var isKeyboardOpen by remember { mutableStateOf(false) }
|
||||
var text by remember { mutableStateOf("") }
|
||||
val appColors = LocalAppTheme.current
|
||||
val inputBarHeight by animateDpAsState(
|
||||
targetValue = if (isKeyboardOpen) 8.dp else (navigationBarHeight + 8.dp),
|
||||
animationSpec = tween(
|
||||
@@ -545,7 +549,7 @@ fun ChatInput(
|
||||
modifier = Modifier
|
||||
.weight(1f)
|
||||
.clip(RoundedCornerShape(16.dp))
|
||||
.background(AppColors.background)
|
||||
.background(appColors.background)
|
||||
.padding(horizontal = 16.dp),
|
||||
contentAlignment = Alignment.CenterStart,
|
||||
) {
|
||||
@@ -555,10 +559,10 @@ fun ChatInput(
|
||||
text = it
|
||||
},
|
||||
textStyle = TextStyle(
|
||||
color = AppColors.text,
|
||||
color = appColors.text,
|
||||
fontSize = 16.sp
|
||||
),
|
||||
cursorBrush = SolidColor(AppColors.text),
|
||||
cursorBrush = SolidColor(appColors.text),
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(vertical = 8.dp)
|
||||
@@ -597,7 +601,7 @@ fun ChatInput(
|
||||
)
|
||||
)
|
||||
},
|
||||
tint = AppColors.chatActionColor
|
||||
tint = appColors.chatActionColor
|
||||
)
|
||||
Spacer(modifier = Modifier.width(8.dp))
|
||||
Crossfade(
|
||||
@@ -615,7 +619,7 @@ fun ChatInput(
|
||||
text = ""
|
||||
}
|
||||
},
|
||||
tint = if (isNotEmpty) AppColors.main else AppColors.chatActionColor
|
||||
tint = if (isNotEmpty) appColors.main else appColors.chatActionColor
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import com.aiosman.riderpro.AppColors
|
||||
import com.aiosman.riderpro.LocalAppTheme
|
||||
import com.aiosman.riderpro.LocalNavController
|
||||
import com.aiosman.riderpro.R
|
||||
import com.aiosman.riderpro.ui.composables.StatusBarMaskLayout
|
||||
@@ -69,6 +69,7 @@ fun NoticeScreenHeader(
|
||||
rightIcon: @Composable (() -> Unit)? = null
|
||||
) {
|
||||
val nav = LocalNavController.current
|
||||
val AppColors = LocalAppTheme.current
|
||||
Row(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
|
||||
@@ -33,7 +33,7 @@ import androidx.lifecycle.viewModelScope
|
||||
import androidx.lifecycle.viewmodel.compose.viewModel
|
||||
import androidx.paging.LoadState
|
||||
import androidx.paging.compose.collectAsLazyPagingItems
|
||||
import com.aiosman.riderpro.AppColors
|
||||
import com.aiosman.riderpro.LocalAppTheme
|
||||
import com.aiosman.riderpro.LocalNavController
|
||||
import com.aiosman.riderpro.R
|
||||
import com.aiosman.riderpro.entity.CommentEntity
|
||||
@@ -63,6 +63,8 @@ fun CommentNoticeScreen() {
|
||||
var dataFlow = viewModel.commentItemsFlow
|
||||
var comments = dataFlow.collectAsLazyPagingItems()
|
||||
val navController = LocalNavController.current
|
||||
val AppColors = LocalAppTheme.current
|
||||
|
||||
Column(
|
||||
modifier = Modifier.fillMaxSize().background(color = AppColors.background)
|
||||
) {
|
||||
@@ -150,6 +152,8 @@ fun CommentNoticeItem(
|
||||
) {
|
||||
val navController = LocalNavController.current
|
||||
val context = LocalContext.current
|
||||
val AppColors = LocalAppTheme.current
|
||||
|
||||
Row(
|
||||
modifier = Modifier.padding(vertical = 20.dp, horizontal = 16.dp)
|
||||
) {
|
||||
|
||||
@@ -20,28 +20,26 @@ import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.unit.Dp
|
||||
import androidx.compose.ui.unit.TextUnit
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import cn.jpush.android.cache.Sp
|
||||
import com.aiosman.riderpro.AppColors
|
||||
import com.aiosman.riderpro.LocalAppTheme
|
||||
import com.aiosman.riderpro.ui.modifiers.noRippleClickable
|
||||
|
||||
@Composable
|
||||
fun ActionButton(
|
||||
modifier: Modifier = Modifier,
|
||||
text: String,
|
||||
color: Color = AppColors.text,
|
||||
backgroundColor: Color = AppColors.basicMain,
|
||||
color: Color? = null,
|
||||
backgroundColor: Color? = null,
|
||||
leading: @Composable (() -> Unit)? = null,
|
||||
expandText: Boolean = false,
|
||||
contentPadding: PaddingValues = PaddingValues(vertical = 16.dp),
|
||||
isLoading: Boolean = false,
|
||||
loadingTextColor: Color = AppColors.loadingText,
|
||||
loadingTextColor: Color? = null,
|
||||
loadingText: String = "Loading",
|
||||
loadingBackgroundColor: Color = AppColors.loadingMain,
|
||||
disabledBackgroundColor: Color = AppColors.disabledBackground,
|
||||
loadingBackgroundColor: Color? = null,
|
||||
disabledBackgroundColor: Color? = null,
|
||||
enabled: Boolean = true,
|
||||
fullWidth: Boolean = false,
|
||||
roundCorner: Float = 24f,
|
||||
@@ -49,16 +47,17 @@ fun ActionButton(
|
||||
fontWeight: FontWeight = FontWeight.W900,
|
||||
click: () -> Unit = {}
|
||||
) {
|
||||
val AppColors = LocalAppTheme.current
|
||||
val animatedBackgroundColor by animateColorAsState(
|
||||
targetValue = run {
|
||||
if (enabled) {
|
||||
if (isLoading) {
|
||||
loadingBackgroundColor
|
||||
loadingBackgroundColor ?: AppColors.loadingMain
|
||||
} else {
|
||||
backgroundColor
|
||||
backgroundColor ?: AppColors.basicMain
|
||||
}
|
||||
} else {
|
||||
disabledBackgroundColor
|
||||
disabledBackgroundColor ?: AppColors.disabledBackground
|
||||
}
|
||||
},
|
||||
animationSpec = tween(300), label = ""
|
||||
@@ -101,7 +100,7 @@ fun ActionButton(
|
||||
Text(
|
||||
text,
|
||||
fontSize = fontSize,
|
||||
color = color,
|
||||
color = color ?: AppColors.text,
|
||||
fontWeight = fontWeight,
|
||||
textAlign = if (expandText) TextAlign.Center else TextAlign.Start
|
||||
)
|
||||
@@ -131,7 +130,7 @@ fun ActionButton(
|
||||
loadingText,
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
textAlign = TextAlign.Center,
|
||||
color = loadingTextColor
|
||||
color = loadingTextColor ?: AppColors.loadingText,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,23 +1,22 @@
|
||||
package com.aiosman.riderpro.ui.composables
|
||||
|
||||
import androidx.compose.animation.AnimatedContent
|
||||
import androidx.compose.animation.ExperimentalAnimationApi
|
||||
import androidx.compose.animation.SizeTransform
|
||||
import androidx.compose.animation.fadeIn
|
||||
import androidx.compose.animation.fadeOut
|
||||
import androidx.compose.animation.slideInVertically
|
||||
import androidx.compose.animation.slideOutVertically
|
||||
import androidx.compose.animation.togetherWith
|
||||
import androidx.compose.animation.with
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.unit.sp
|
||||
import com.aiosman.riderpro.AppColors
|
||||
import com.aiosman.riderpro.LocalAppTheme
|
||||
|
||||
@OptIn(ExperimentalAnimationApi::class)
|
||||
@Composable
|
||||
fun AnimatedCounter(count: Int, modifier: Modifier = Modifier, fontSize: Int = 24) {
|
||||
val AppColors = LocalAppTheme.current
|
||||
|
||||
AnimatedContent(
|
||||
targetState = count,
|
||||
transitionSpec = {
|
||||
|
||||
@@ -1,21 +1,18 @@
|
||||
package com.aiosman.riderpro.ui.composables
|
||||
|
||||
import androidx.compose.animation.animateColorAsState
|
||||
import androidx.compose.animation.core.Animatable
|
||||
import androidx.compose.animation.core.tween
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.rememberCoroutineScope
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.ColorFilter
|
||||
import androidx.compose.ui.graphics.graphicsLayer
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import com.aiosman.riderpro.AppColors
|
||||
import com.aiosman.riderpro.LocalAppTheme
|
||||
import com.aiosman.riderpro.R
|
||||
import com.aiosman.riderpro.ui.modifiers.noRippleClickable
|
||||
import kotlinx.coroutines.launch
|
||||
@@ -26,6 +23,7 @@ fun AnimatedFavouriteIcon(
|
||||
isFavourite: Boolean = false,
|
||||
onClick: (() -> Unit)? = null
|
||||
) {
|
||||
val AppColors = LocalAppTheme.current
|
||||
val animatableRotation = remember { Animatable(0f) }
|
||||
val scope = rememberCoroutineScope()
|
||||
suspend fun shake() {
|
||||
|
||||
@@ -1,24 +1,18 @@
|
||||
package com.aiosman.riderpro.ui.composables
|
||||
|
||||
import androidx.compose.animation.animateColorAsState
|
||||
import androidx.compose.animation.core.Animatable
|
||||
import androidx.compose.animation.core.tween
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.rememberCoroutineScope
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.ColorFilter
|
||||
import androidx.compose.ui.graphics.graphicsLayer
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import com.aiosman.riderpro.AppColors
|
||||
import com.aiosman.riderpro.LocalAppTheme
|
||||
import com.aiosman.riderpro.R
|
||||
import com.aiosman.riderpro.ui.modifiers.noRippleClickable
|
||||
import kotlinx.coroutines.launch
|
||||
@@ -29,6 +23,8 @@ fun AnimatedLikeIcon(
|
||||
liked: Boolean = false,
|
||||
onClick: (() -> Unit)? = null
|
||||
) {
|
||||
val AppColors = LocalAppTheme.current
|
||||
|
||||
val animatableRotation = remember { Animatable(0f) }
|
||||
val scope = rememberCoroutineScope()
|
||||
suspend fun shake() {
|
||||
|
||||
@@ -17,7 +17,7 @@ import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.aiosman.riderpro.AppColors
|
||||
import com.aiosman.riderpro.LocalAppTheme
|
||||
import com.aiosman.riderpro.ui.modifiers.noRippleClickable
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ fun Checkbox(
|
||||
checked: Boolean = false,
|
||||
onCheckedChange: (Boolean) -> Unit = {}
|
||||
) {
|
||||
val AppColors = LocalAppTheme.current
|
||||
val backgroundColor by animateColorAsState(if (checked) AppColors.checkedBackground else Color.Transparent)
|
||||
val borderColor by animateColorAsState(if (checked) Color.Transparent else AppColors.secondaryText)
|
||||
val borderWidth by animateDpAsState(if (checked) 0.dp else 2.dp)
|
||||
|
||||
@@ -5,11 +5,10 @@ import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.text.TextStyle
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import com.aiosman.riderpro.AppColors
|
||||
import com.aiosman.riderpro.LocalAppTheme
|
||||
|
||||
@Composable
|
||||
fun CheckboxWithLabel(
|
||||
@@ -20,6 +19,7 @@ fun CheckboxWithLabel(
|
||||
error: Boolean = false,
|
||||
onCheckedChange: (Boolean) -> Unit,
|
||||
) {
|
||||
val AppColors = LocalAppTheme.current
|
||||
Row(
|
||||
) {
|
||||
Checkbox(
|
||||
|
||||
@@ -14,17 +14,11 @@ import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.font.FontVariation.width
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.aiosman.riderpro.AppColors
|
||||
import com.aiosman.riderpro.R
|
||||
import com.aiosman.riderpro.ui.NavigationRoute
|
||||
import com.aiosman.riderpro.LocalAppTheme
|
||||
import com.aiosman.riderpro.ui.modifiers.noRippleClickable
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
data class MenuItem(
|
||||
val title: String,
|
||||
@@ -40,6 +34,8 @@ fun DropdownMenu(
|
||||
width: Int? = null,
|
||||
onDismissRequest: () -> Unit = {},
|
||||
) {
|
||||
val AppColors = LocalAppTheme.current
|
||||
|
||||
MaterialTheme(
|
||||
shapes = MaterialTheme.shapes.copy(
|
||||
extraSmall = RoundedCornerShape(
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.aiosman.riderpro.ui.composables
|
||||
|
||||
import androidx.compose.animation.Crossfade
|
||||
import androidx.compose.animation.core.tween
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
@@ -27,14 +26,12 @@ import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.rememberUpdatedState
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.focus.FocusRequester
|
||||
import androidx.compose.ui.focus.focusRequester
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.SolidColor
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.painterResource
|
||||
@@ -44,7 +41,7 @@ import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import com.aiosman.riderpro.AppColors
|
||||
import com.aiosman.riderpro.LocalAppTheme
|
||||
import com.aiosman.riderpro.R
|
||||
import com.aiosman.riderpro.entity.CommentEntity
|
||||
import com.aiosman.riderpro.ui.modifiers.noRippleClickable
|
||||
@@ -54,6 +51,7 @@ fun EditCommentBottomModal(
|
||||
replyComment: CommentEntity? = null,
|
||||
onSend: (String) -> Unit = {}
|
||||
) {
|
||||
val AppColors = LocalAppTheme.current
|
||||
var text by remember { mutableStateOf("") }
|
||||
var navBarHeight = WindowInsets.navigationBars.asPaddingValues().calculateBottomPadding()
|
||||
val focusRequester = remember { FocusRequester() }
|
||||
|
||||
@@ -16,7 +16,7 @@ import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.unit.TextUnit
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import com.aiosman.riderpro.AppColors
|
||||
import com.aiosman.riderpro.LocalAppTheme
|
||||
import com.aiosman.riderpro.R
|
||||
import com.aiosman.riderpro.ui.modifiers.noRippleClickable
|
||||
|
||||
@@ -26,6 +26,7 @@ fun FollowButton(
|
||||
fontSize: TextUnit = 12.sp,
|
||||
onFollowClick: () -> Unit,
|
||||
){
|
||||
val AppColors = LocalAppTheme.current
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.wrapContentWidth()
|
||||
|
||||
@@ -13,7 +13,6 @@ import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.WindowInsets
|
||||
import androidx.compose.foundation.layout.aspectRatio
|
||||
import androidx.compose.foundation.layout.defaultMinSize
|
||||
import androidx.compose.foundation.layout.fillMaxHeight
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
@@ -53,8 +52,8 @@ import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import com.aiosman.riderpro.AppColors
|
||||
import com.aiosman.riderpro.AppState
|
||||
import com.aiosman.riderpro.LocalAppTheme
|
||||
import com.aiosman.riderpro.LocalNavController
|
||||
import com.aiosman.riderpro.R
|
||||
import com.aiosman.riderpro.entity.MomentEntity
|
||||
@@ -74,6 +73,7 @@ fun MomentCard(
|
||||
onFollowClick: () -> Unit = {},
|
||||
hideAction: Boolean = false
|
||||
) {
|
||||
val AppColors = LocalAppTheme.current
|
||||
var imageIndex by remember { mutableStateOf(0) }
|
||||
val navController = LocalNavController.current
|
||||
Column(
|
||||
@@ -168,6 +168,7 @@ fun ModificationListHeader() {
|
||||
|
||||
@Composable
|
||||
fun MomentName(name: String, modifier: Modifier = Modifier) {
|
||||
val AppColors = LocalAppTheme.current
|
||||
Text(
|
||||
modifier = modifier,
|
||||
textAlign = TextAlign.Start,
|
||||
@@ -201,6 +202,7 @@ fun MomentFollowBtn() {
|
||||
|
||||
@Composable
|
||||
fun MomentPostLocation(location: String) {
|
||||
val AppColors = LocalAppTheme.current
|
||||
Text(
|
||||
text = location,
|
||||
color = AppColors.secondaryText,
|
||||
@@ -210,6 +212,7 @@ fun MomentPostLocation(location: String) {
|
||||
|
||||
@Composable
|
||||
fun MomentPostTime(time: String) {
|
||||
val AppColors = LocalAppTheme.current
|
||||
Text(
|
||||
modifier = Modifier,
|
||||
text = time, color = AppColors.text,
|
||||
@@ -329,6 +332,7 @@ fun MomentContentGroup(
|
||||
momentEntity: MomentEntity,
|
||||
onPageChange: (Int) -> Unit = {}
|
||||
) {
|
||||
val AppColors = LocalAppTheme.current
|
||||
if (momentEntity.momentTextContent.isNotEmpty()) {
|
||||
Text(
|
||||
text = momentEntity.momentTextContent,
|
||||
@@ -359,6 +363,7 @@ fun MomentContentGroup(
|
||||
|
||||
@Composable
|
||||
fun MomentOperateBtn(@DrawableRes icon: Int, count: String) {
|
||||
val AppColors = LocalAppTheme.current
|
||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||
Image(
|
||||
modifier = Modifier
|
||||
|
||||
@@ -17,7 +17,7 @@ import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.aiosman.riderpro.AppColors
|
||||
import com.aiosman.riderpro.LocalAppTheme
|
||||
import com.google.accompanist.systemuicontroller.rememberSystemUiController
|
||||
|
||||
@Composable
|
||||
@@ -39,6 +39,7 @@ fun StatusBarMaskLayout(
|
||||
maskBoxBackgroundColor: Color = Color.Transparent,
|
||||
content: @Composable ColumnScope.() -> Unit
|
||||
) {
|
||||
val AppColors = LocalAppTheme.current
|
||||
val paddingValues = WindowInsets.systemBars.asPaddingValues()
|
||||
val systemUiController = rememberSystemUiController()
|
||||
val navigationBarPaddings =
|
||||
|
||||
@@ -42,7 +42,7 @@ import androidx.compose.ui.text.input.VisualTransformation
|
||||
import androidx.compose.ui.text.style.TextIndent
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import com.aiosman.riderpro.AppColors
|
||||
import com.aiosman.riderpro.LocalAppTheme
|
||||
import com.aiosman.riderpro.R
|
||||
import com.aiosman.riderpro.ui.modifiers.noRippleClickable
|
||||
|
||||
@@ -57,6 +57,7 @@ fun TextInputField(
|
||||
error: String? = null,
|
||||
enabled: Boolean = true
|
||||
) {
|
||||
val AppColors = LocalAppTheme.current
|
||||
var showPassword by remember { mutableStateOf(!password) }
|
||||
var isFocused by remember { mutableStateOf(false) }
|
||||
Column(modifier = modifier) {
|
||||
|
||||
@@ -23,14 +23,13 @@ import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.SolidColor
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.text.TextStyle
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import com.aiosman.riderpro.AppColors
|
||||
import com.aiosman.riderpro.LocalAppTheme
|
||||
import com.aiosman.riderpro.R
|
||||
|
||||
@Composable
|
||||
@@ -42,6 +41,7 @@ fun FormTextInput(
|
||||
hint: String? = null,
|
||||
onValueChange: (String) -> Unit
|
||||
) {
|
||||
val AppColors = LocalAppTheme.current
|
||||
Column(
|
||||
modifier = modifier
|
||||
) {
|
||||
|
||||
@@ -33,8 +33,8 @@ import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.core.content.FileProvider
|
||||
import com.aiosman.riderpro.AppColors
|
||||
import com.aiosman.riderpro.ConstVars
|
||||
import com.aiosman.riderpro.LocalAppTheme
|
||||
import com.aiosman.riderpro.R
|
||||
import com.aiosman.riderpro.model.UpdateInfo
|
||||
import com.aiosman.riderpro.ui.composables.ActionButton
|
||||
@@ -50,6 +50,7 @@ import java.io.File
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
fun CheckUpdateDialog() {
|
||||
val AppColors = LocalAppTheme.current
|
||||
val context = LocalContext.current
|
||||
val scope = rememberCoroutineScope()
|
||||
var showDialog by remember { mutableStateOf(false) }
|
||||
|
||||
@@ -26,10 +26,9 @@ import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.paging.compose.collectAsLazyPagingItems
|
||||
import com.aiosman.riderpro.AppColors
|
||||
import com.aiosman.riderpro.LocalAppTheme
|
||||
import com.aiosman.riderpro.LocalNavController
|
||||
import com.aiosman.riderpro.R
|
||||
import com.aiosman.riderpro.ui.NavigationRoute
|
||||
import com.aiosman.riderpro.ui.comment.NoticeScreenHeader
|
||||
import com.aiosman.riderpro.ui.composables.CustomAsyncImage
|
||||
import com.aiosman.riderpro.ui.composables.StatusBarSpacer
|
||||
@@ -40,6 +39,7 @@ import com.aiosman.riderpro.ui.navigateToPost
|
||||
@OptIn(ExperimentalMaterialApi::class)
|
||||
@Composable
|
||||
fun FavouriteListPage() {
|
||||
val AppColors = LocalAppTheme.current
|
||||
val model = FavouriteListViewModel
|
||||
var dataFlow = model.favouriteMomentsFlow
|
||||
var moments = dataFlow.collectAsLazyPagingItems()
|
||||
|
||||
@@ -14,7 +14,6 @@ import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.paging.compose.collectAsLazyPagingItems
|
||||
import com.aiosman.riderpro.AppColors
|
||||
import com.aiosman.riderpro.AppState
|
||||
import com.aiosman.riderpro.R
|
||||
import com.aiosman.riderpro.ui.comment.NoticeScreenHeader
|
||||
@@ -27,6 +26,7 @@ import com.aiosman.riderpro.ui.like.ActionPostNoticeItem
|
||||
*/
|
||||
@Composable
|
||||
fun FavouriteNoticeScreen() {
|
||||
|
||||
val model = FavouriteNoticeViewModel
|
||||
val listState = rememberLazyListState()
|
||||
var dataFlow = model.favouriteItemsFlow
|
||||
|
||||
@@ -10,28 +10,24 @@ import androidx.compose.material.ExperimentalMaterialApi
|
||||
import androidx.compose.material.pullrefresh.PullRefreshIndicator
|
||||
import androidx.compose.material.pullrefresh.pullRefresh
|
||||
import androidx.compose.material.pullrefresh.rememberPullRefreshState
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.CompositionLocalProvider
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.rememberCoroutineScope
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.tooling.preview.UiMode
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.paging.compose.collectAsLazyPagingItems
|
||||
import com.aiosman.riderpro.AppColors
|
||||
import com.aiosman.riderpro.LocalAppTheme
|
||||
import com.aiosman.riderpro.R
|
||||
import com.aiosman.riderpro.ui.comment.NoticeScreenHeader
|
||||
import com.aiosman.riderpro.ui.composables.StatusBarMaskLayout
|
||||
import com.google.ar.sceneform.rendering.Light
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
@OptIn(ExperimentalMaterialApi::class)
|
||||
@Composable
|
||||
fun FollowerListScreen(userId: Int) {
|
||||
val AppColors = LocalAppTheme.current
|
||||
val model = FollowerListViewModel
|
||||
val scope = rememberCoroutineScope()
|
||||
val refreshState = rememberPullRefreshState(model.isLoading, onRefresh = {
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
package com.aiosman.riderpro.ui.follower
|
||||
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.layout.width
|
||||
@@ -20,23 +18,20 @@ import androidx.compose.runtime.rememberCoroutineScope
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.paging.compose.collectAsLazyPagingItems
|
||||
import com.aiosman.riderpro.AppColors
|
||||
import com.aiosman.riderpro.AppState
|
||||
import com.aiosman.riderpro.LocalAppTheme
|
||||
import com.aiosman.riderpro.LocalNavController
|
||||
import com.aiosman.riderpro.R
|
||||
import com.aiosman.riderpro.ui.NavigationRoute
|
||||
import com.aiosman.riderpro.ui.composables.StatusBarMaskLayout
|
||||
import com.aiosman.riderpro.ui.comment.NoticeScreenHeader
|
||||
import com.aiosman.riderpro.ui.composables.CustomAsyncImage
|
||||
import com.aiosman.riderpro.ui.composables.FollowButton
|
||||
import com.aiosman.riderpro.ui.composables.StatusBarMaskLayout
|
||||
import com.aiosman.riderpro.ui.modifiers.noRippleClickable
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
@@ -46,6 +41,7 @@ import kotlinx.coroutines.launch
|
||||
@Composable
|
||||
fun FollowerNoticeScreen() {
|
||||
val scope = rememberCoroutineScope()
|
||||
val AppColors = LocalAppTheme.current
|
||||
StatusBarMaskLayout(
|
||||
modifier = Modifier.background(color = AppColors.background).padding(horizontal = 16.dp),
|
||||
darkIcons = !AppState.darkMode,
|
||||
@@ -97,6 +93,7 @@ fun FollowItem(
|
||||
isFollowing: Boolean,
|
||||
onFollow: () -> Unit = {}
|
||||
) {
|
||||
val AppColors = LocalAppTheme.current
|
||||
val context = LocalContext.current
|
||||
val navController = LocalNavController.current
|
||||
Box(
|
||||
|
||||
@@ -15,11 +15,10 @@ import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.rememberCoroutineScope
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.paging.compose.collectAsLazyPagingItems
|
||||
import com.aiosman.riderpro.AppColors
|
||||
import com.aiosman.riderpro.LocalAppTheme
|
||||
import com.aiosman.riderpro.R
|
||||
import com.aiosman.riderpro.ui.comment.NoticeScreenHeader
|
||||
import com.aiosman.riderpro.ui.composables.StatusBarMaskLayout
|
||||
@@ -28,6 +27,7 @@ import kotlinx.coroutines.launch
|
||||
@OptIn(ExperimentalMaterialApi::class)
|
||||
@Composable
|
||||
fun FollowingListScreen(userId: Int) {
|
||||
val AppColors = LocalAppTheme.current
|
||||
val model = FollowingListViewModel
|
||||
val scope = rememberCoroutineScope()
|
||||
val refreshState = rememberPullRefreshState(model.isLoading, onRefresh = {
|
||||
|
||||
@@ -28,8 +28,8 @@ import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.platform.LocalDensity
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.aiosman.riderpro.AppColors
|
||||
import com.aiosman.riderpro.AppState
|
||||
import com.aiosman.riderpro.LocalAppTheme
|
||||
import com.aiosman.riderpro.LocalNavController
|
||||
import com.aiosman.riderpro.ui.NavigationRoute
|
||||
import com.aiosman.riderpro.ui.index.tabs.add.AddPage
|
||||
@@ -46,6 +46,7 @@ import kotlinx.coroutines.launch
|
||||
@OptIn(ExperimentalFoundationApi::class)
|
||||
@Composable
|
||||
fun IndexScreen() {
|
||||
val AppColors = LocalAppTheme.current
|
||||
val model = IndexViewModel
|
||||
val navigationBarHeight = with(LocalDensity.current) {
|
||||
WindowInsets.navigationBars.getBottom(this).toDp()
|
||||
|
||||
@@ -42,9 +42,9 @@ import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import com.aiosman.riderpro.AppColors
|
||||
import com.aiosman.riderpro.AppState
|
||||
import com.aiosman.riderpro.AppStore
|
||||
import com.aiosman.riderpro.LocalAppTheme
|
||||
import com.aiosman.riderpro.LocalNavController
|
||||
import com.aiosman.riderpro.R
|
||||
import com.aiosman.riderpro.ui.NavigationRoute
|
||||
@@ -63,6 +63,7 @@ import kotlinx.coroutines.launch
|
||||
@OptIn(ExperimentalMaterialApi::class)
|
||||
@Composable
|
||||
fun NotificationsScreen() {
|
||||
val AppColors = LocalAppTheme.current
|
||||
val navController = LocalNavController.current
|
||||
val systemUiController = rememberSystemUiController()
|
||||
val context = LocalContext.current
|
||||
@@ -161,6 +162,7 @@ fun NotificationIndicator(
|
||||
label: String,
|
||||
onClick: () -> Unit
|
||||
) {
|
||||
val AppColors = LocalAppTheme.current
|
||||
Box(
|
||||
modifier = Modifier
|
||||
) {
|
||||
@@ -215,6 +217,7 @@ fun NotificationIndicator(
|
||||
|
||||
@Composable
|
||||
fun NotificationCounterItem(count: Int) {
|
||||
val AppColors = LocalAppTheme.current
|
||||
val context = LocalContext.current
|
||||
var clickCount by remember { mutableStateOf(0) }
|
||||
Row(
|
||||
@@ -262,6 +265,7 @@ fun ChatMessageList(
|
||||
onUserAvatarClick: (Conversation) -> Unit = {},
|
||||
onChatClick: (Conversation) -> Unit = {}
|
||||
) {
|
||||
val AppColors = LocalAppTheme.current
|
||||
LazyColumn(
|
||||
modifier = Modifier.fillMaxSize()
|
||||
) {
|
||||
|
||||
@@ -29,7 +29,7 @@ import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import com.aiosman.riderpro.AppColors
|
||||
import com.aiosman.riderpro.LocalAppTheme
|
||||
import com.aiosman.riderpro.ui.index.tabs.moment.tabs.expolre.ExploreMomentsList
|
||||
import com.aiosman.riderpro.ui.index.tabs.moment.tabs.timeline.TimelineMomentsList
|
||||
import com.aiosman.riderpro.ui.modifiers.noRippleClickable
|
||||
@@ -41,6 +41,7 @@ import kotlinx.coroutines.launch
|
||||
@OptIn(ExperimentalMaterialApi::class, ExperimentalFoundationApi::class)
|
||||
@Composable
|
||||
fun MomentsList() {
|
||||
val AppColors = LocalAppTheme.current
|
||||
val model = MomentViewModel
|
||||
val navigationBarPaddings =
|
||||
WindowInsets.navigationBars.asPaddingValues().calculateBottomPadding() + 48.dp
|
||||
|
||||
@@ -34,7 +34,6 @@ import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.material.ExperimentalMaterialApi
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.Add
|
||||
import androidx.compose.material.icons.filled.Refresh
|
||||
import androidx.compose.material.pullrefresh.PullRefreshIndicator
|
||||
import androidx.compose.material.pullrefresh.pullRefresh
|
||||
import androidx.compose.material.pullrefresh.rememberPullRefreshState
|
||||
@@ -49,6 +48,7 @@ import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.draw.shadow
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.graphicsLayer
|
||||
import androidx.compose.ui.layout.ContentScale
|
||||
import androidx.compose.ui.layout.onGloballyPositioned
|
||||
@@ -61,10 +61,12 @@ import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.paging.PagingData
|
||||
import androidx.paging.compose.collectAsLazyPagingItems
|
||||
import com.aiosman.riderpro.AppColors
|
||||
import com.aiosman.riderpro.AppState
|
||||
import com.aiosman.riderpro.AppStore
|
||||
import com.aiosman.riderpro.ConstVars
|
||||
import com.aiosman.riderpro.DarkThemeColors
|
||||
import com.aiosman.riderpro.LightThemeColors
|
||||
import com.aiosman.riderpro.LocalAppTheme
|
||||
import com.aiosman.riderpro.LocalNavController
|
||||
import com.aiosman.riderpro.R
|
||||
import com.aiosman.riderpro.entity.AccountProfileEntity
|
||||
@@ -87,6 +89,7 @@ import com.aiosman.riderpro.ui.index.tabs.profile.composable.UserContentPageIndi
|
||||
import com.aiosman.riderpro.ui.index.tabs.profile.composable.UserItem
|
||||
import com.aiosman.riderpro.ui.modifiers.noRippleClickable
|
||||
import com.aiosman.riderpro.ui.post.NewPostViewModel
|
||||
import com.google.accompanist.systemuicontroller.rememberSystemUiController
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.SharedFlow
|
||||
import kotlinx.coroutines.flow.asStateFlow
|
||||
@@ -131,6 +134,13 @@ fun ProfileV3(
|
||||
})
|
||||
var miniToolbarHeight by remember { mutableStateOf(0) }
|
||||
val density = LocalDensity.current
|
||||
var appTheme = LocalAppTheme.current
|
||||
var AppColors = appTheme
|
||||
var systemUiController = rememberSystemUiController()
|
||||
fun switchTheme(){
|
||||
AppState.switchTheme()
|
||||
systemUiController.setStatusBarColor(Color.Transparent, darkIcons = !AppState.darkMode)
|
||||
}
|
||||
Box(
|
||||
modifier = Modifier.pullRefresh(refreshState)
|
||||
) {
|
||||
@@ -291,10 +301,7 @@ fun ProfileV3(
|
||||
R.drawable.rider_pro_theme_mode_light
|
||||
) {
|
||||
expanded = false
|
||||
scope.launch {
|
||||
AppStore.saveDarkMode(!AppState.darkMode)
|
||||
Toast.makeText(context, "Theme mode changed,please restart app", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
switchTheme()
|
||||
}
|
||||
)
|
||||
)
|
||||
@@ -408,7 +415,8 @@ fun ProfileV3(
|
||||
tint = AppColors.text
|
||||
)
|
||||
}
|
||||
val themeModeString = if (AppState.darkMode) R.string.light_mode else R.string.dark_mode
|
||||
val themeModeString =
|
||||
if (AppState.darkMode) R.string.light_mode else R.string.dark_mode
|
||||
DropdownMenu(
|
||||
expanded = minibarExpanded,
|
||||
onDismissRequest = { minibarExpanded = false },
|
||||
@@ -451,10 +459,7 @@ fun ProfileV3(
|
||||
R.drawable.rider_pro_theme_mode_light
|
||||
) {
|
||||
minibarExpanded = false
|
||||
scope.launch {
|
||||
AppStore.saveDarkMode(!AppState.darkMode)
|
||||
Toast.makeText(context, "Theme mode changed,please restart app", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
switchTheme()
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
@@ -41,7 +41,7 @@ import androidx.compose.ui.text.TextStyle
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import com.aiosman.riderpro.AppColors
|
||||
import com.aiosman.riderpro.LocalAppTheme
|
||||
import com.aiosman.riderpro.LocalNavController
|
||||
import com.aiosman.riderpro.R
|
||||
import com.aiosman.riderpro.entity.MomentEntity
|
||||
@@ -62,6 +62,7 @@ fun EmptyMomentPostUnit() {
|
||||
fun ProfileEmptyMomentCard(
|
||||
|
||||
) {
|
||||
val AppColors = LocalAppTheme.current
|
||||
var columnHeight by remember { mutableStateOf(0) }
|
||||
val navController = LocalNavController.current
|
||||
|
||||
@@ -142,6 +143,7 @@ fun MomentPostUnit(momentEntity: MomentEntity) {
|
||||
|
||||
@Composable
|
||||
fun TimeGroup(time: String = "2024.06.08 12:23") {
|
||||
val AppColors = LocalAppTheme.current
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
@@ -175,7 +177,7 @@ fun ProfileMomentCard(
|
||||
momentEntity: MomentEntity
|
||||
) {
|
||||
var columnHeight by remember { mutableStateOf(0) }
|
||||
|
||||
val AppColors = LocalAppTheme.current
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
@@ -220,6 +222,7 @@ fun ProfileMomentCard(
|
||||
|
||||
@Composable
|
||||
fun MomentCardTopContent(content: String) {
|
||||
val AppColors = LocalAppTheme.current
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth(),
|
||||
@@ -282,6 +285,7 @@ fun MomentCardOperation(like: String, comment: String) {
|
||||
|
||||
@Composable
|
||||
fun MomentCardOperationItem(@DrawableRes drawable: Int, number: String, modifier: Modifier) {
|
||||
val AppColors = LocalAppTheme.current
|
||||
Row(
|
||||
modifier = modifier,
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
|
||||
@@ -18,14 +18,13 @@ import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.ColorFilter
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import com.aiosman.riderpro.AppColors
|
||||
import com.aiosman.riderpro.LocalAppTheme
|
||||
import com.aiosman.riderpro.R
|
||||
import com.aiosman.riderpro.entity.AccountProfileEntity
|
||||
import com.aiosman.riderpro.ui.modifiers.noRippleClickable
|
||||
@@ -36,6 +35,7 @@ fun OtherProfileAction(
|
||||
onFollow: (() -> Unit)? = null,
|
||||
onChat: (() -> Unit)? = null
|
||||
) {
|
||||
val AppColors = LocalAppTheme.current
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
horizontalArrangement = Arrangement.Center,
|
||||
|
||||
@@ -16,12 +16,11 @@ import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import com.aiosman.riderpro.AppColors
|
||||
import com.aiosman.riderpro.LocalAppTheme
|
||||
import com.aiosman.riderpro.R
|
||||
import com.aiosman.riderpro.ui.modifiers.noRippleClickable
|
||||
|
||||
@@ -29,6 +28,7 @@ import com.aiosman.riderpro.ui.modifiers.noRippleClickable
|
||||
fun SelfProfileAction(
|
||||
onEditProfile: () -> Unit
|
||||
) {
|
||||
val AppColors = LocalAppTheme.current
|
||||
// 按钮
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
|
||||
@@ -23,7 +23,7 @@ import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import com.aiosman.riderpro.AppColors
|
||||
import com.aiosman.riderpro.LocalAppTheme
|
||||
import com.aiosman.riderpro.R
|
||||
import com.aiosman.riderpro.ui.modifiers.noRippleClickable
|
||||
import kotlinx.coroutines.launch
|
||||
@@ -34,6 +34,7 @@ fun UserContentPageIndicator(
|
||||
pagerState: PagerState
|
||||
){
|
||||
val scope = rememberCoroutineScope()
|
||||
val AppColors = LocalAppTheme.current
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.verticalScroll(rememberScrollState())
|
||||
|
||||
@@ -14,14 +14,13 @@ import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.layout.ContentScale
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import com.aiosman.riderpro.AppColors
|
||||
import com.aiosman.riderpro.LocalAppTheme
|
||||
import com.aiosman.riderpro.LocalNavController
|
||||
import com.aiosman.riderpro.R
|
||||
import com.aiosman.riderpro.entity.AccountProfileEntity
|
||||
@@ -32,6 +31,8 @@ import com.aiosman.riderpro.ui.modifiers.noRippleClickable
|
||||
@Composable
|
||||
fun UserItem(accountProfileEntity: AccountProfileEntity) {
|
||||
val navController = LocalNavController.current
|
||||
val AppColors = LocalAppTheme.current
|
||||
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
|
||||
@@ -4,7 +4,6 @@ import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.PaddingValues
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.WindowInsets
|
||||
import androidx.compose.foundation.layout.asPaddingValues
|
||||
@@ -34,14 +33,13 @@ import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.paging.compose.collectAsLazyPagingItems
|
||||
import com.aiosman.riderpro.AppColors
|
||||
import com.aiosman.riderpro.LocalAppTheme
|
||||
import com.aiosman.riderpro.LocalNavController
|
||||
import com.aiosman.riderpro.R
|
||||
import com.aiosman.riderpro.ui.NavigationRoute
|
||||
@@ -56,6 +54,7 @@ import com.aiosman.riderpro.ui.navigateToPost
|
||||
@Composable
|
||||
fun DiscoverScreen() {
|
||||
val model = DiscoverViewModel
|
||||
val AppColors = LocalAppTheme.current
|
||||
val navController = LocalNavController.current
|
||||
val navigationBarPaddings =
|
||||
WindowInsets.navigationBars.asPaddingValues().calculateBottomPadding() + 48.dp
|
||||
@@ -104,6 +103,7 @@ fun SearchButton(
|
||||
modifier: Modifier = Modifier,
|
||||
clickAction: () -> Unit = {}
|
||||
) {
|
||||
val AppColors = LocalAppTheme.current
|
||||
val context = LocalContext.current
|
||||
Box(
|
||||
modifier = modifier
|
||||
|
||||
@@ -53,8 +53,8 @@ import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.paging.compose.collectAsLazyPagingItems
|
||||
import com.aiosman.riderpro.AppColors
|
||||
import com.aiosman.riderpro.AppState
|
||||
import com.aiosman.riderpro.LocalAppTheme
|
||||
import com.aiosman.riderpro.LocalNavController
|
||||
import com.aiosman.riderpro.R
|
||||
import com.aiosman.riderpro.entity.AccountProfileEntity
|
||||
@@ -69,6 +69,7 @@ import kotlinx.coroutines.launch
|
||||
@Preview
|
||||
@Composable
|
||||
fun SearchScreen() {
|
||||
val AppColors = LocalAppTheme.current
|
||||
val context = LocalContext.current
|
||||
val model = SearchViewModel
|
||||
val categories = listOf(context.getString(R.string.moment), context.getString(R.string.users))
|
||||
@@ -171,6 +172,7 @@ fun SearchInput(
|
||||
onSearch: () -> Unit = {},
|
||||
focusRequester: FocusRequester = remember { FocusRequester() }
|
||||
) {
|
||||
val AppColors = LocalAppTheme.current
|
||||
val context = LocalContext.current
|
||||
Box(
|
||||
modifier = modifier
|
||||
@@ -233,6 +235,7 @@ fun SearchInput(
|
||||
fun SearchPager(
|
||||
pagerState: PagerState,
|
||||
) {
|
||||
val AppColors = LocalAppTheme.current
|
||||
HorizontalPager(
|
||||
state = pagerState,
|
||||
modifier = Modifier.fillMaxSize().background(AppColors.background),
|
||||
@@ -250,6 +253,7 @@ fun MomentResultTab() {
|
||||
val model = SearchViewModel
|
||||
var dataFlow = model.momentsFlow
|
||||
var moments = dataFlow.collectAsLazyPagingItems()
|
||||
val AppColors = LocalAppTheme.current
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
@@ -313,6 +317,7 @@ fun UserItem(
|
||||
) {
|
||||
val context = LocalContext.current
|
||||
val navController = LocalNavController.current
|
||||
val AppColors = LocalAppTheme.current
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
|
||||
@@ -14,7 +14,6 @@ import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.rememberLazyListState
|
||||
import androidx.compose.foundation.shape.CircleShape
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.foundation.text.ClickableText
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
@@ -25,24 +24,19 @@ import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.layout.ContentScale
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.SpanStyle
|
||||
import androidx.compose.ui.text.TextStyle
|
||||
import androidx.compose.ui.text.buildAnnotatedString
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.withStyle
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.paging.compose.collectAsLazyPagingItems
|
||||
import com.aiosman.riderpro.AppColors
|
||||
import com.aiosman.riderpro.AppState
|
||||
import com.aiosman.riderpro.LocalAppTheme
|
||||
import com.aiosman.riderpro.LocalNavController
|
||||
import com.aiosman.riderpro.R
|
||||
import com.aiosman.riderpro.entity.AccountLikeEntity
|
||||
import com.aiosman.riderpro.exp.timeAgo
|
||||
import com.aiosman.riderpro.ui.NavigationRoute
|
||||
import com.aiosman.riderpro.ui.comment.NoticeScreenHeader
|
||||
import com.aiosman.riderpro.ui.composables.AnimatedLikeIcon
|
||||
import com.aiosman.riderpro.ui.composables.BottomNavigationPlaceholder
|
||||
import com.aiosman.riderpro.ui.composables.CustomAsyncImage
|
||||
import com.aiosman.riderpro.ui.composables.StatusBarMaskLayout
|
||||
@@ -58,6 +52,8 @@ fun LikeNoticeScreen() {
|
||||
val listState = rememberLazyListState()
|
||||
var dataFlow = model.likeItemsFlow
|
||||
var likes = dataFlow.collectAsLazyPagingItems()
|
||||
val AppColors = LocalAppTheme.current
|
||||
|
||||
LaunchedEffect(Unit) {
|
||||
model.reload()
|
||||
model.updateNotice()
|
||||
@@ -128,6 +124,8 @@ fun ActionPostNoticeItem(
|
||||
) {
|
||||
val context = LocalContext.current
|
||||
val navController = LocalNavController.current
|
||||
val AppColors = LocalAppTheme.current
|
||||
|
||||
Box(
|
||||
modifier = Modifier.padding(vertical = 16.dp)
|
||||
) {
|
||||
@@ -192,6 +190,8 @@ fun LikeCommentNoticeItem(
|
||||
) {
|
||||
val navController = LocalNavController.current
|
||||
val context = LocalContext.current
|
||||
val AppColors = LocalAppTheme.current
|
||||
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.padding(vertical = 16.dp)
|
||||
|
||||
@@ -48,9 +48,9 @@ import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import com.aiosman.riderpro.AppColors
|
||||
import com.aiosman.riderpro.AppState
|
||||
import com.aiosman.riderpro.AppStore
|
||||
import com.aiosman.riderpro.LocalAppTheme
|
||||
import com.aiosman.riderpro.LocalNavController
|
||||
import com.aiosman.riderpro.R
|
||||
import com.aiosman.riderpro.data.AccountServiceImpl
|
||||
@@ -71,6 +71,7 @@ fun LoginPage() {
|
||||
val coroutineScope = rememberCoroutineScope()
|
||||
val accountService = AccountServiceImpl()
|
||||
val statusBarController = rememberSystemUiController()
|
||||
val AppColors = LocalAppTheme.current
|
||||
LaunchedEffect(Unit) {
|
||||
statusBarController.setStatusBarColor(Color.Transparent, darkIcons = !AppState.darkMode)
|
||||
}
|
||||
@@ -220,6 +221,7 @@ fun LoginPage() {
|
||||
|
||||
@Composable
|
||||
fun MovingImageWall(resources: Resources) {
|
||||
val AppColors = LocalAppTheme.current
|
||||
val imageList1 = remember {
|
||||
mutableStateListOf(
|
||||
R.drawable.wall_1_1,
|
||||
|
||||
@@ -13,7 +13,6 @@ import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
@@ -23,7 +22,6 @@ import androidx.compose.runtime.rememberCoroutineScope
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
@@ -31,10 +29,10 @@ import androidx.compose.ui.text.TextStyle
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import com.aiosman.riderpro.AppColors
|
||||
import com.aiosman.riderpro.AppState
|
||||
import com.aiosman.riderpro.AppStore
|
||||
import com.aiosman.riderpro.ErrorCode
|
||||
import com.aiosman.riderpro.LocalAppTheme
|
||||
import com.aiosman.riderpro.LocalNavController
|
||||
import com.aiosman.riderpro.R
|
||||
import com.aiosman.riderpro.data.AccountService
|
||||
@@ -58,6 +56,7 @@ import kotlinx.coroutines.launch
|
||||
|
||||
@Composable
|
||||
fun UserAuthScreen() {
|
||||
val AppColors = LocalAppTheme.current
|
||||
var email by remember { mutableStateOf("") }
|
||||
var password by remember { mutableStateOf("") }
|
||||
var rememberMe by remember { mutableStateOf(false) }
|
||||
|
||||
@@ -59,8 +59,8 @@ import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.core.content.FileProvider
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import com.aiosman.riderpro.AppColors
|
||||
import com.aiosman.riderpro.AppState
|
||||
import com.aiosman.riderpro.LocalAppTheme
|
||||
import com.aiosman.riderpro.LocalNavController
|
||||
import com.aiosman.riderpro.R
|
||||
import com.aiosman.riderpro.ui.NavigationRoute
|
||||
@@ -77,6 +77,8 @@ import java.io.File
|
||||
@Preview
|
||||
@Composable
|
||||
fun NewPostScreen() {
|
||||
val AppColors = LocalAppTheme.current
|
||||
|
||||
val model = NewPostViewModel
|
||||
val systemUiController = rememberSystemUiController()
|
||||
LaunchedEffect(Unit) {
|
||||
@@ -134,6 +136,8 @@ fun NewPostScreen() {
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
fun NewPostTopBar(onSendClick: () -> Unit = {}) {
|
||||
val AppColors = LocalAppTheme.current
|
||||
|
||||
var uploading by remember { mutableStateOf(false) }
|
||||
// 上传进度
|
||||
if (uploading) {
|
||||
@@ -216,6 +220,7 @@ fun NewPostTopBar(onSendClick: () -> Unit = {}) {
|
||||
|
||||
@Composable
|
||||
fun NewPostTextField(hint: String, value: String, onValueChange: (String) -> Unit) {
|
||||
val AppColors = LocalAppTheme.current
|
||||
|
||||
Box(modifier = Modifier.fillMaxWidth()) {
|
||||
BasicTextField(
|
||||
|
||||
@@ -73,9 +73,9 @@ import androidx.lifecycle.viewModelScope
|
||||
import androidx.lifecycle.viewmodel.compose.viewModel
|
||||
import androidx.paging.LoadState
|
||||
import androidx.paging.compose.collectAsLazyPagingItems
|
||||
import com.aiosman.riderpro.AppColors
|
||||
import com.aiosman.riderpro.AppState
|
||||
import com.aiosman.riderpro.LocalAnimatedContentScope
|
||||
import com.aiosman.riderpro.LocalAppTheme
|
||||
import com.aiosman.riderpro.LocalNavController
|
||||
import com.aiosman.riderpro.LocalSharedTransitionScope
|
||||
import com.aiosman.riderpro.R
|
||||
@@ -124,6 +124,8 @@ fun PostScreen(
|
||||
var editCommentModalState = rememberModalBottomSheetState(
|
||||
skipPartiallyExpanded = true
|
||||
)
|
||||
val AppColors = LocalAppTheme.current
|
||||
|
||||
LaunchedEffect(Unit) {
|
||||
viewModel.initData(
|
||||
highlightCommentId = highlightCommentId.let {
|
||||
@@ -409,6 +411,8 @@ fun CommentContent(
|
||||
onLongClick: (CommentEntity) -> Unit,
|
||||
onReply: (CommentEntity, Long?, String?, String?) -> Unit
|
||||
) {
|
||||
val AppColors = LocalAppTheme.current
|
||||
|
||||
val commentsPagging = viewModel.commentsFlow.collectAsLazyPagingItems()
|
||||
val addedTopLevelComment = viewModel.addedCommentList.filter {
|
||||
it.parentCommentId == null
|
||||
@@ -624,6 +628,7 @@ fun Header(
|
||||
onFollowClick: () -> Unit,
|
||||
onDeleteClick: () -> Unit = {}
|
||||
) {
|
||||
val AppColors = LocalAppTheme.current
|
||||
val navController = LocalNavController.current
|
||||
val context = LocalContext.current
|
||||
var expanded by remember { mutableStateOf(false) }
|
||||
@@ -803,7 +808,7 @@ fun PostImageView(
|
||||
fun PostDetails(
|
||||
momentEntity: MomentEntity?
|
||||
) {
|
||||
|
||||
val AppColors = LocalAppTheme.current
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.padding(start = 16.dp, end = 16.dp, top = 12.dp)
|
||||
@@ -838,6 +843,7 @@ fun CommentItem(
|
||||
onLongClick: (CommentEntity) -> Unit = {},
|
||||
addedCommentList: List<CommentEntity> = emptyList()
|
||||
) {
|
||||
val AppColors = LocalAppTheme.current
|
||||
val context = LocalContext.current
|
||||
val navController = LocalNavController.current
|
||||
Column(
|
||||
@@ -1040,6 +1046,7 @@ fun PostBottomBar(
|
||||
onFavoriteClick: () -> Unit = {},
|
||||
momentEntity: MomentEntity?
|
||||
) {
|
||||
val AppColors = LocalAppTheme.current
|
||||
|
||||
Column(
|
||||
modifier = Modifier.background(
|
||||
@@ -1117,6 +1124,8 @@ fun PostBottomBar(
|
||||
fun PostMenuModal(
|
||||
onDeleteClick: () -> Unit = {}
|
||||
) {
|
||||
val AppColors = LocalAppTheme.current
|
||||
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
@@ -1170,6 +1179,8 @@ fun MenuActionItem(
|
||||
content: @Composable() (() -> Unit)? = null,
|
||||
onClick: () -> Unit
|
||||
) {
|
||||
val AppColors = LocalAppTheme.current
|
||||
|
||||
Column(
|
||||
modifier = Modifier,
|
||||
verticalArrangement = Arrangement.Center,
|
||||
@@ -1216,6 +1227,7 @@ fun CommentMenuModal(
|
||||
isSelf: Boolean = false
|
||||
) {
|
||||
val clipboard = LocalClipboardManager.current
|
||||
val AppColors = LocalAppTheme.current
|
||||
|
||||
fun copyToClipboard() {
|
||||
commentEntity?.let {
|
||||
@@ -1335,6 +1347,8 @@ fun CommentMenuModal(
|
||||
fun OrderSelectionComponent(
|
||||
onSelected: (String) -> Unit = {}
|
||||
) {
|
||||
val AppColors = LocalAppTheme.current
|
||||
|
||||
var selectedOrder by remember { mutableStateOf("like") }
|
||||
val orders = listOf(
|
||||
"like" to stringResource(R.string.order_comment_default),
|
||||
|
||||
Reference in New Issue
Block a user