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