Compare commits
37 Commits
revert-48-
...
feat/pr-20
| Author | SHA1 | Date | |
|---|---|---|---|
| 4a19d4c60e | |||
| a057f7f7fd | |||
| f95c0204ee | |||
| c5156a5f6c | |||
| 6590b09300 | |||
| 30563a75f3 | |||
| aac3220a69 | |||
| de85f35c45 | |||
| e2de134180 | |||
| 7f1be94896 | |||
| 1c048fd9c0 | |||
| 2613d2e801 | |||
| c100a8ceef | |||
| f86b5e1d39 | |||
| 75eb38b188 | |||
| 4f588483c0 | |||
| 0bc442762d | |||
| 397ac6a9ee | |||
| 784f87dc39 | |||
| e714f567b9 | |||
| 703beb8d43 | |||
| 2b30beb367 | |||
| 6fffa0447e | |||
| 2a9d6a2f6b | |||
| cc12a08472 | |||
| 513897499d | |||
| baa6f284bd | |||
| 2ba4c2ec02 | |||
| 28061617da | |||
| c9e411c4ad | |||
| 995e061b6f | |||
| 9c9eb66b71 | |||
| f90bfbfa0f | |||
| 9ea03cee34 | |||
| 1de8bb825c | |||
| 4a1c15747c | |||
| cff6b78c30 |
4
.idea/deploymentTargetSelector.xml
generated
@@ -4,10 +4,10 @@
|
|||||||
<selectionStates>
|
<selectionStates>
|
||||||
<SelectionState runConfigName="app">
|
<SelectionState runConfigName="app">
|
||||||
<option name="selectionMode" value="DROPDOWN" />
|
<option name="selectionMode" value="DROPDOWN" />
|
||||||
<DropdownSelection timestamp="2025-09-17T06:25:35.585100400Z">
|
<DropdownSelection timestamp="2025-11-05T12:24:27.034893100Z">
|
||||||
<Target type="DEFAULT_BOOT">
|
<Target type="DEFAULT_BOOT">
|
||||||
<handle>
|
<handle>
|
||||||
<DeviceId pluginId="Default" identifier="serial=192.168.0.216:5555;connection=698a7727" />
|
<DeviceId pluginId="PhysicalDevice" identifier="serial=c328a150" />
|
||||||
</handle>
|
</handle>
|
||||||
</Target>
|
</Target>
|
||||||
</DropdownSelection>
|
</DropdownSelection>
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/Theme.RaveNow"
|
android:theme="@style/Theme.RaveNow"
|
||||||
android:usesCleartextTraffic="true"
|
android:usesCleartextTraffic="true"
|
||||||
|
android:networkSecurityConfig="@xml/network_security_config"
|
||||||
tools:targetApi="31">
|
tools:targetApi="31">
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="com.google.android.geo.API_KEY"
|
android:name="com.google.android.geo.API_KEY"
|
||||||
|
|||||||
@@ -2,8 +2,16 @@ package com.aiosman.ravenow.data
|
|||||||
|
|
||||||
import com.aiosman.ravenow.AppStore
|
import com.aiosman.ravenow.AppStore
|
||||||
import com.aiosman.ravenow.data.api.ApiClient
|
import com.aiosman.ravenow.data.api.ApiClient
|
||||||
|
import com.aiosman.ravenow.data.api.AgentRule
|
||||||
|
import com.aiosman.ravenow.data.api.AgentRuleListResponse
|
||||||
|
import com.aiosman.ravenow.data.api.AgentRuleQuota
|
||||||
|
import com.aiosman.ravenow.data.api.AgentRuleAgent
|
||||||
|
import com.aiosman.ravenow.data.api.CreateAgentRuleRequestBody
|
||||||
|
import com.aiosman.ravenow.data.api.InsufficientBalanceError
|
||||||
|
import com.aiosman.ravenow.data.api.UpdateAgentRuleRequestBody
|
||||||
import com.aiosman.ravenow.entity.AgentEntity
|
import com.aiosman.ravenow.entity.AgentEntity
|
||||||
import com.aiosman.ravenow.entity.ProfileEntity
|
import com.aiosman.ravenow.entity.ProfileEntity
|
||||||
|
import com.google.gson.Gson
|
||||||
import com.google.gson.annotations.SerializedName
|
import com.google.gson.annotations.SerializedName
|
||||||
|
|
||||||
data class Agent(
|
data class Agent(
|
||||||
@@ -83,9 +91,16 @@ data class Profile(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 智能体服务
|
||||||
|
*/
|
||||||
interface AgentService {
|
interface AgentService {
|
||||||
/**
|
/**
|
||||||
* 获取智能体列表
|
* 获取智能体列表
|
||||||
|
* @param pageNumber 页码
|
||||||
|
* @param pageSize 每页数量,默认 20
|
||||||
|
* @param authorId 作者ID,可选参数,用于筛选特定作者的智能体
|
||||||
|
* @return 智能体列表容器,包含分页信息和智能体列表,失败时返回 null
|
||||||
*/
|
*/
|
||||||
suspend fun getAgent(
|
suspend fun getAgent(
|
||||||
pageNumber: Int,
|
pageNumber: Int,
|
||||||
@@ -96,3 +111,206 @@ interface AgentService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ========== Agent 规则 - 领域实体 ==========
|
||||||
|
|
||||||
|
data class AgentRuleAgentInfo(
|
||||||
|
val id: Int,
|
||||||
|
val title: String,
|
||||||
|
val avatar: String,
|
||||||
|
)
|
||||||
|
|
||||||
|
data class AgentRuleEntity(
|
||||||
|
val id: Int,
|
||||||
|
val rule: String,
|
||||||
|
val creator: String,
|
||||||
|
val creatorType: String,
|
||||||
|
val scope: String,
|
||||||
|
val agent: AgentRuleAgentInfo,
|
||||||
|
val createdAt: String,
|
||||||
|
val updatedAt: String,
|
||||||
|
)
|
||||||
|
|
||||||
|
data class AgentRuleListResult(
|
||||||
|
val page: Int,
|
||||||
|
val pageSize: Int,
|
||||||
|
val total: Int,
|
||||||
|
val list: List<AgentRuleEntity>,
|
||||||
|
)
|
||||||
|
|
||||||
|
data class AgentRuleQuotaEntity(
|
||||||
|
val agentId: Int,
|
||||||
|
val agentTitle: String,
|
||||||
|
val baseMaxCount: Int,
|
||||||
|
val purchasedCount: Int,
|
||||||
|
val totalMaxCount: Int,
|
||||||
|
val currentCount: Int,
|
||||||
|
val remainingCount: Int,
|
||||||
|
val usagePercent: Double,
|
||||||
|
)
|
||||||
|
|
||||||
|
// ========== Agent 规则 - Service 接口 ==========
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Agent 规则服务
|
||||||
|
*/
|
||||||
|
interface AgentRuleService {
|
||||||
|
/**
|
||||||
|
* 根据 OpenId 创建 Agent 规则
|
||||||
|
* @param openId Agent 的 OpenId
|
||||||
|
* @param rule 规则内容,不能为空
|
||||||
|
* @throws ServiceException 创建失败时抛出异常(包括余额不足等情况)
|
||||||
|
*/
|
||||||
|
suspend fun createAgentRuleByOpenId(openId: String, rule: String)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改 Agent 规则
|
||||||
|
* @param id 规则ID
|
||||||
|
* @param rule 新的规则内容,不能为空
|
||||||
|
* @param openId Agent 的 OpenId,可选参数
|
||||||
|
* @throws ServiceException 修改失败时抛出异常(包括余额不足等情况)
|
||||||
|
*/
|
||||||
|
suspend fun updateAgentRule(id: Int, rule: String, openId: String? = null)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除 Agent 规则
|
||||||
|
* @param id 规则ID
|
||||||
|
* @throws ServiceException 删除失败时抛出异常
|
||||||
|
*/
|
||||||
|
suspend fun deleteAgentRule(id: Int)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询 Agent 规则列表
|
||||||
|
* @param openId Agent 的 OpenId
|
||||||
|
* @param keyword 关键词搜索,可选参数
|
||||||
|
* @param page 页码,默认 1
|
||||||
|
* @param pageSize 每页数量,默认 10
|
||||||
|
* @return 规则列表响应,包含分页信息和规则列表
|
||||||
|
* @throws ServiceException 查询失败时抛出异常
|
||||||
|
*/
|
||||||
|
suspend fun getAgentRuleList(
|
||||||
|
openId: String,
|
||||||
|
keyword: String? = null,
|
||||||
|
page: Int = 1,
|
||||||
|
pageSize: Int = 10
|
||||||
|
): AgentRuleListResult
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询 Agent 规则配额使用情况
|
||||||
|
* @param openId Agent 的 OpenId
|
||||||
|
* @return 规则配额信息,包含基础配额、已购买配额、当前使用量等
|
||||||
|
* @throws ServiceException 查询失败时抛出异常
|
||||||
|
*/
|
||||||
|
suspend fun getAgentRuleQuota(openId: String): AgentRuleQuotaEntity
|
||||||
|
}
|
||||||
|
|
||||||
|
class AgentRuleServiceImpl : AgentRuleService {
|
||||||
|
private val gson = Gson()
|
||||||
|
|
||||||
|
override suspend fun createAgentRuleByOpenId(openId: String, rule: String) {
|
||||||
|
val body = CreateAgentRuleRequestBody(
|
||||||
|
rule = rule,
|
||||||
|
promptId = null,
|
||||||
|
openId = openId
|
||||||
|
)
|
||||||
|
val resp = ApiClient.api.createAgentRule(body)
|
||||||
|
if (!resp.isSuccessful) {
|
||||||
|
val errorText = resp.errorBody()?.string()
|
||||||
|
try {
|
||||||
|
val err = gson.fromJson(errorText, InsufficientBalanceError::class.java)
|
||||||
|
if (err != null && err.code == 35600) {
|
||||||
|
throw ServiceException(err.message)
|
||||||
|
}
|
||||||
|
} catch (_: Exception) {
|
||||||
|
// ignore parse error
|
||||||
|
}
|
||||||
|
throw ServiceException("创建 Agent 规则失败: HTTP ${resp.code()}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override suspend fun updateAgentRule(id: Int, rule: String, openId: String?) {
|
||||||
|
val body = UpdateAgentRuleRequestBody(
|
||||||
|
id = id,
|
||||||
|
rule = rule,
|
||||||
|
promptId = null,
|
||||||
|
openId = openId
|
||||||
|
)
|
||||||
|
val resp = ApiClient.api.updateAgentRule(body)
|
||||||
|
if (!resp.isSuccessful) {
|
||||||
|
val errorText = resp.errorBody()?.string()
|
||||||
|
try {
|
||||||
|
val err = gson.fromJson(errorText, InsufficientBalanceError::class.java)
|
||||||
|
if (err != null && err.code == 35600) {
|
||||||
|
throw ServiceException(err.message)
|
||||||
|
}
|
||||||
|
} catch (_: Exception) {
|
||||||
|
// ignore parse error
|
||||||
|
}
|
||||||
|
throw ServiceException("更新 Agent 规则失败: HTTP ${resp.code()}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override suspend fun deleteAgentRule(id: Int) {
|
||||||
|
val resp = ApiClient.api.deleteAgentRule(id)
|
||||||
|
if (!resp.isSuccessful) {
|
||||||
|
throw ServiceException("删除 Agent 规则失败: HTTP ${resp.code()}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override suspend fun getAgentRuleList(
|
||||||
|
openId: String,
|
||||||
|
keyword: String?,
|
||||||
|
page: Int,
|
||||||
|
pageSize: Int
|
||||||
|
): AgentRuleListResult {
|
||||||
|
val resp = ApiClient.api.getAgentRuleList(
|
||||||
|
promptId = openId,
|
||||||
|
rule = keyword,
|
||||||
|
page = page,
|
||||||
|
pageSize = pageSize
|
||||||
|
)
|
||||||
|
val data = resp.body()?.data ?: throw ServiceException("获取 Agent 规则列表失败")
|
||||||
|
return data.toEntity()
|
||||||
|
}
|
||||||
|
|
||||||
|
override suspend fun getAgentRuleQuota(openId: String): AgentRuleQuotaEntity {
|
||||||
|
val resp = ApiClient.api.getAgentRuleQuota(openId)
|
||||||
|
val data = resp.body()?.data ?: throw ServiceException("获取 Agent 规则配额失败")
|
||||||
|
return data.toEntity()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun AgentRuleListResponse.toEntity(): AgentRuleListResult = AgentRuleListResult(
|
||||||
|
page = page,
|
||||||
|
pageSize = pageSize,
|
||||||
|
total = total,
|
||||||
|
list = list.map { it.toEntity() }
|
||||||
|
)
|
||||||
|
|
||||||
|
private fun AgentRule.toEntity(): AgentRuleEntity = AgentRuleEntity(
|
||||||
|
id = id,
|
||||||
|
rule = rule,
|
||||||
|
creator = creator,
|
||||||
|
creatorType = creatorType,
|
||||||
|
scope = scope,
|
||||||
|
agent = prompt.toEntity(),
|
||||||
|
createdAt = createdAt,
|
||||||
|
updatedAt = updatedAt,
|
||||||
|
)
|
||||||
|
|
||||||
|
private fun AgentRuleAgent.toEntity(): AgentRuleAgentInfo = AgentRuleAgentInfo(
|
||||||
|
id = id,
|
||||||
|
title = title,
|
||||||
|
avatar = avatar,
|
||||||
|
)
|
||||||
|
|
||||||
|
private fun AgentRuleQuota.toEntity(): AgentRuleQuotaEntity = AgentRuleQuotaEntity(
|
||||||
|
agentId = promptId,
|
||||||
|
agentTitle = promptTitle,
|
||||||
|
baseMaxCount = baseMaxCount,
|
||||||
|
purchasedCount = purchasedCount,
|
||||||
|
totalMaxCount = totalMaxCount,
|
||||||
|
currentCount = currentCount,
|
||||||
|
remainingCount = remainingCount,
|
||||||
|
usagePercent = usagePercent,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import com.google.gson.annotations.SerializedName
|
|||||||
data class ListContainer<T>(
|
data class ListContainer<T>(
|
||||||
// 总数
|
// 总数
|
||||||
@SerializedName("total")
|
@SerializedName("total")
|
||||||
val total: Int,
|
val total: Long,
|
||||||
// 当前页
|
// 当前页
|
||||||
@SerializedName("page")
|
@SerializedName("page")
|
||||||
val page: Int,
|
val page: Int,
|
||||||
|
|||||||
@@ -1,11 +1,16 @@
|
|||||||
package com.aiosman.ravenow.data
|
package com.aiosman.ravenow.data
|
||||||
|
|
||||||
import com.aiosman.ravenow.AppStore
|
|
||||||
import com.aiosman.ravenow.data.api.ApiClient
|
import com.aiosman.ravenow.data.api.ApiClient
|
||||||
import com.aiosman.ravenow.entity.AgentEntity
|
import com.aiosman.ravenow.data.api.CreateRoomRuleRequestBody
|
||||||
|
import com.aiosman.ravenow.data.api.UpdateRoomRuleRequestBody
|
||||||
|
import com.aiosman.ravenow.data.api.RoomRuleQuota
|
||||||
|
import com.aiosman.ravenow.data.api.RoomRule
|
||||||
|
import com.aiosman.ravenow.data.api.RoomRuleCreator
|
||||||
import com.aiosman.ravenow.entity.CreatorEntity
|
import com.aiosman.ravenow.entity.CreatorEntity
|
||||||
import com.aiosman.ravenow.entity.ProfileEntity
|
|
||||||
import com.aiosman.ravenow.entity.RoomEntity
|
import com.aiosman.ravenow.entity.RoomEntity
|
||||||
|
import com.aiosman.ravenow.entity.RoomRuleEntity
|
||||||
|
import com.aiosman.ravenow.entity.RoomRuleCreatorEntity
|
||||||
|
import com.aiosman.ravenow.entity.RoomRuleQuotaEntity
|
||||||
import com.aiosman.ravenow.entity.UsersEntity
|
import com.aiosman.ravenow.entity.UsersEntity
|
||||||
import com.google.gson.annotations.SerializedName
|
import com.google.gson.annotations.SerializedName
|
||||||
|
|
||||||
@@ -106,6 +111,190 @@ data class Users(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 房间规则相关服务
|
||||||
|
*/
|
||||||
|
interface RoomService {
|
||||||
|
/**
|
||||||
|
* 创建房间规则
|
||||||
|
* @param rule 规则内容,不能为空
|
||||||
|
* @param roomId 房间ID,与 trtcId 二选一
|
||||||
|
* @param trtcId TRTC房间ID,与 roomId 二选一
|
||||||
|
* @throws ServiceException 创建失败时抛出异常
|
||||||
|
*/
|
||||||
|
suspend fun createRoomRule(
|
||||||
|
rule: String,
|
||||||
|
roomId: Int? = null,
|
||||||
|
trtcId: String? = null
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改房间规则
|
||||||
|
* @param id 规则ID
|
||||||
|
* @param rule 新的规则内容,不能为空
|
||||||
|
* @throws ServiceException 修改失败时抛出异常
|
||||||
|
*/
|
||||||
|
suspend fun updateRoomRule(
|
||||||
|
id: Int,
|
||||||
|
rule: String
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除房间规则
|
||||||
|
* @param id 规则ID
|
||||||
|
* @throws ServiceException 删除失败时抛出异常
|
||||||
|
*/
|
||||||
|
suspend fun deleteRoomRule(id: Int)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询房间规则列表
|
||||||
|
* @param roomId 房间ID,与 trtcId 二选一
|
||||||
|
* @param trtcId TRTC房间ID,与 roomId 二选一
|
||||||
|
* @param page 页码,默认 1
|
||||||
|
* @param pageSize 每页数量,默认 10
|
||||||
|
* @return 规则列表响应,包含分页信息和规则列表
|
||||||
|
* @throws ServiceException 查询失败时抛出异常
|
||||||
|
*/
|
||||||
|
suspend fun getRoomRuleList(
|
||||||
|
roomId: Int? = null,
|
||||||
|
trtcId: String? = null,
|
||||||
|
page: Int = 1,
|
||||||
|
pageSize: Int = 10
|
||||||
|
): ListContainer<RoomRuleEntity>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询规则配额使用情况
|
||||||
|
* @param roomId 房间ID,与 trtcId 二选一
|
||||||
|
* @param trtcId TRTC房间ID,与 roomId 二选一
|
||||||
|
* @return 规则配额信息
|
||||||
|
* @throws ServiceException 查询失败时抛出异常
|
||||||
|
*/
|
||||||
|
suspend fun getRoomRuleQuota(
|
||||||
|
roomId: Int? = null,
|
||||||
|
trtcId: String? = null
|
||||||
|
): RoomRuleQuotaEntity
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 房间规则服务实现类
|
||||||
|
*/
|
||||||
|
class RoomServiceImpl : RoomService {
|
||||||
|
override suspend fun createRoomRule(
|
||||||
|
rule: String,
|
||||||
|
roomId: Int?,
|
||||||
|
trtcId: String?
|
||||||
|
) {
|
||||||
|
val resp = ApiClient.api.createRoomRule(
|
||||||
|
CreateRoomRuleRequestBody(
|
||||||
|
rule = rule,
|
||||||
|
roomId = roomId,
|
||||||
|
trtcId = trtcId
|
||||||
|
)
|
||||||
|
)
|
||||||
|
if (!resp.isSuccessful) {
|
||||||
|
throw ServiceException("创建房间规则失败")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override suspend fun updateRoomRule(
|
||||||
|
id: Int,
|
||||||
|
rule: String
|
||||||
|
) {
|
||||||
|
val resp = ApiClient.api.updateRoomRule(
|
||||||
|
UpdateRoomRuleRequestBody(
|
||||||
|
id = id,
|
||||||
|
rule = rule
|
||||||
|
)
|
||||||
|
)
|
||||||
|
if (!resp.isSuccessful) {
|
||||||
|
throw ServiceException("修改房间规则失败")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override suspend fun deleteRoomRule(id: Int) {
|
||||||
|
val resp = ApiClient.api.deleteRoomRule(id)
|
||||||
|
if (!resp.isSuccessful) {
|
||||||
|
throw ServiceException("删除房间规则失败")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override suspend fun getRoomRuleList(
|
||||||
|
roomId: Int?,
|
||||||
|
trtcId: String?,
|
||||||
|
page: Int,
|
||||||
|
pageSize: Int
|
||||||
|
): ListContainer<RoomRuleEntity> {
|
||||||
|
val resp = ApiClient.api.getRoomRuleList(
|
||||||
|
roomId = roomId,
|
||||||
|
trtcId = trtcId,
|
||||||
|
page = page,
|
||||||
|
pageSize = pageSize
|
||||||
|
)
|
||||||
|
val body = resp.body() ?: throw ServiceException("获取房间规则列表失败")
|
||||||
|
|
||||||
|
return ListContainer(
|
||||||
|
list = body.list.map { it.toRoomRuleEntity() },
|
||||||
|
page = body.page,
|
||||||
|
total = body.total,
|
||||||
|
pageSize = body.pageSize
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
override suspend fun getRoomRuleQuota(
|
||||||
|
roomId: Int?,
|
||||||
|
trtcId: String?
|
||||||
|
): RoomRuleQuotaEntity {
|
||||||
|
val resp = ApiClient.api.getRoomRuleQuota(
|
||||||
|
roomId = roomId,
|
||||||
|
trtcId = trtcId
|
||||||
|
)
|
||||||
|
val body = resp.body() ?: throw ServiceException("获取规则配额信息失败")
|
||||||
|
val data = body.data ?: throw ServiceException("规则配额数据为空")
|
||||||
|
|
||||||
|
return data.toRoomRuleQuotaEntity()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RoomRule 扩展函数,转换为 RoomRuleEntity
|
||||||
|
*/
|
||||||
|
fun RoomRule.toRoomRuleEntity(): RoomRuleEntity {
|
||||||
|
return RoomRuleEntity(
|
||||||
|
id = id,
|
||||||
|
rule = rule,
|
||||||
|
creator = creator?.toRoomRuleCreatorEntity(),
|
||||||
|
creatorType = creatorType,
|
||||||
|
roomId = roomId,
|
||||||
|
createdAt = createdAt,
|
||||||
|
updatedAt = updatedAt
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RoomRuleCreator 扩展函数,转换为 RoomRuleCreatorEntity
|
||||||
|
*/
|
||||||
|
fun RoomRuleCreator.toRoomRuleCreatorEntity(): RoomRuleCreatorEntity {
|
||||||
|
return RoomRuleCreatorEntity(
|
||||||
|
id = id,
|
||||||
|
nickname = nickname,
|
||||||
|
avatar = avatar
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RoomRuleQuota 扩展函数,转换为 RoomRuleQuotaEntity
|
||||||
|
*/
|
||||||
|
fun RoomRuleQuota.toRoomRuleQuotaEntity(): RoomRuleQuotaEntity {
|
||||||
|
return RoomRuleQuotaEntity(
|
||||||
|
baseMaxCount = baseMaxCount,
|
||||||
|
purchasedCount = purchasedCount,
|
||||||
|
totalMaxCount = totalMaxCount,
|
||||||
|
currentCount = currentCount,
|
||||||
|
remainingCount = remainingCount,
|
||||||
|
usagePercent = usagePercent
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -97,7 +97,8 @@ class UserServiceImpl : UserService {
|
|||||||
pageSize = pageSize,
|
pageSize = pageSize,
|
||||||
search = nickname,
|
search = nickname,
|
||||||
followerId = followerId,
|
followerId = followerId,
|
||||||
followingId = followingId
|
followingId = followingId,
|
||||||
|
includeAI = true
|
||||||
)
|
)
|
||||||
val body = resp.body() ?: throw ServiceException("Failed to get account")
|
val body = resp.body() ?: throw ServiceException("Failed to get account")
|
||||||
return ListContainer<AccountProfileEntity>(
|
return ListContainer<AccountProfileEntity>(
|
||||||
|
|||||||
@@ -489,7 +489,7 @@ data class CategoryListResponse(
|
|||||||
val list: List<CategoryTemplate>
|
val list: List<CategoryTemplate>
|
||||||
)
|
)
|
||||||
|
|
||||||
// ========== Prompt Rule 相关数据类 ==========
|
// ========== Agent Rule 相关数据类 ==========
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建规则请求体
|
* 创建规则请求体
|
||||||
@@ -497,7 +497,7 @@ data class CategoryListResponse(
|
|||||||
* @param promptId 智能体ID,与 openId 二选一,promptId 优先
|
* @param promptId 智能体ID,与 openId 二选一,promptId 优先
|
||||||
* @param openId 智能体的 OpenID(UUID格式),与 promptId 二选一
|
* @param openId 智能体的 OpenID(UUID格式),与 promptId 二选一
|
||||||
*/
|
*/
|
||||||
data class CreatePromptRuleRequestBody(
|
data class CreateAgentRuleRequestBody(
|
||||||
@SerializedName("rule")
|
@SerializedName("rule")
|
||||||
val rule: String,
|
val rule: String,
|
||||||
@SerializedName("promptId")
|
@SerializedName("promptId")
|
||||||
@@ -513,7 +513,7 @@ data class CreatePromptRuleRequestBody(
|
|||||||
* @param promptId 要更改关联的智能体ID(可选)
|
* @param promptId 要更改关联的智能体ID(可选)
|
||||||
* @param openId 要更改关联的智能体 OpenID(可选)
|
* @param openId 要更改关联的智能体 OpenID(可选)
|
||||||
*/
|
*/
|
||||||
data class UpdatePromptRuleRequestBody(
|
data class UpdateAgentRuleRequestBody(
|
||||||
@SerializedName("id")
|
@SerializedName("id")
|
||||||
val id: Int,
|
val id: Int,
|
||||||
@SerializedName("rule")
|
@SerializedName("rule")
|
||||||
@@ -530,7 +530,7 @@ data class UpdatePromptRuleRequestBody(
|
|||||||
* @param title 智能体标题
|
* @param title 智能体标题
|
||||||
* @param avatar 智能体头像URL
|
* @param avatar 智能体头像URL
|
||||||
*/
|
*/
|
||||||
data class PromptRuleAgent(
|
data class AgentRuleAgent(
|
||||||
@SerializedName("id")
|
@SerializedName("id")
|
||||||
val id: Int,
|
val id: Int,
|
||||||
@SerializedName("title")
|
@SerializedName("title")
|
||||||
@@ -550,7 +550,7 @@ data class PromptRuleAgent(
|
|||||||
* @param createdAt 创建时间(ISO 8601 格式)
|
* @param createdAt 创建时间(ISO 8601 格式)
|
||||||
* @param updatedAt 更新时间(ISO 8601 格式)
|
* @param updatedAt 更新时间(ISO 8601 格式)
|
||||||
*/
|
*/
|
||||||
data class PromptRule(
|
data class AgentRule(
|
||||||
@SerializedName("id")
|
@SerializedName("id")
|
||||||
val id: Int,
|
val id: Int,
|
||||||
@SerializedName("rule")
|
@SerializedName("rule")
|
||||||
@@ -562,7 +562,7 @@ data class PromptRule(
|
|||||||
@SerializedName("scope")
|
@SerializedName("scope")
|
||||||
val scope: String,
|
val scope: String,
|
||||||
@SerializedName("prompt")
|
@SerializedName("prompt")
|
||||||
val prompt: PromptRuleAgent,
|
val prompt: AgentRuleAgent,
|
||||||
@SerializedName("created_at")
|
@SerializedName("created_at")
|
||||||
val createdAt: String,
|
val createdAt: String,
|
||||||
@SerializedName("updated_at")
|
@SerializedName("updated_at")
|
||||||
@@ -576,7 +576,7 @@ data class PromptRule(
|
|||||||
* @param total 总记录数
|
* @param total 总记录数
|
||||||
* @param list 规则列表
|
* @param list 规则列表
|
||||||
*/
|
*/
|
||||||
data class PromptRuleListResponse(
|
data class AgentRuleListResponse(
|
||||||
@SerializedName("page")
|
@SerializedName("page")
|
||||||
val page: Int,
|
val page: Int,
|
||||||
@SerializedName("pageSize")
|
@SerializedName("pageSize")
|
||||||
@@ -584,7 +584,7 @@ data class PromptRuleListResponse(
|
|||||||
@SerializedName("total")
|
@SerializedName("total")
|
||||||
val total: Int,
|
val total: Int,
|
||||||
@SerializedName("list")
|
@SerializedName("list")
|
||||||
val list: List<PromptRule>
|
val list: List<AgentRule>
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -598,7 +598,7 @@ data class PromptRuleListResponse(
|
|||||||
* @param remainingCount 剩余可用条数
|
* @param remainingCount 剩余可用条数
|
||||||
* @param usagePercent 使用百分比(0-100)
|
* @param usagePercent 使用百分比(0-100)
|
||||||
*/
|
*/
|
||||||
data class PromptRuleQuota(
|
data class AgentRuleQuota(
|
||||||
@SerializedName("promptId")
|
@SerializedName("promptId")
|
||||||
val promptId: Int,
|
val promptId: Int,
|
||||||
@SerializedName("promptTitle")
|
@SerializedName("promptTitle")
|
||||||
@@ -617,6 +617,150 @@ data class PromptRuleQuota(
|
|||||||
val usagePercent: Double
|
val usagePercent: Double
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// ========== Room Rule 相关数据类 ==========
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建房间规则请求体
|
||||||
|
* @param rule 规则内容,不能为空
|
||||||
|
* @param roomId 房间ID,与 trtcId 二选一
|
||||||
|
* @param trtcId TRTC房间ID(字符串格式),与 roomId 二选一
|
||||||
|
*/
|
||||||
|
data class CreateRoomRuleRequestBody(
|
||||||
|
@SerializedName("rule")
|
||||||
|
val rule: String,
|
||||||
|
@SerializedName("roomId")
|
||||||
|
val roomId: Int? = null,
|
||||||
|
@SerializedName("trtcId")
|
||||||
|
val trtcId: String? = null
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改房间规则请求体
|
||||||
|
* @param id 规则ID,必填
|
||||||
|
* @param rule 新的规则内容,不能为空
|
||||||
|
*/
|
||||||
|
data class UpdateRoomRuleRequestBody(
|
||||||
|
@SerializedName("id")
|
||||||
|
val id: Int,
|
||||||
|
@SerializedName("rule")
|
||||||
|
val rule: String
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 房间规则创建者信息
|
||||||
|
* @param id 创建者ID
|
||||||
|
* @param nickname 创建者昵称
|
||||||
|
* @param avatar 创建者头像文件名
|
||||||
|
*/
|
||||||
|
data class RoomRuleCreator(
|
||||||
|
@SerializedName("id")
|
||||||
|
val id: Int,
|
||||||
|
@SerializedName("nickname")
|
||||||
|
val nickname: String,
|
||||||
|
@SerializedName("avatar")
|
||||||
|
val avatar: String
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 房间规则详情
|
||||||
|
* @param id 规则ID
|
||||||
|
* @param rule 规则内容
|
||||||
|
* @param creator 创建者信息(可能为 null)
|
||||||
|
* @param creatorType 创建者类型(如 "user")
|
||||||
|
* @param roomId 所属房间ID
|
||||||
|
* @param createdAt 创建时间(ISO 8601 格式)
|
||||||
|
* @param updatedAt 更新时间(ISO 8601 格式)
|
||||||
|
*/
|
||||||
|
data class RoomRule(
|
||||||
|
@SerializedName("id")
|
||||||
|
val id: Int,
|
||||||
|
@SerializedName("rule")
|
||||||
|
val rule: String,
|
||||||
|
@SerializedName("creator")
|
||||||
|
val creator: RoomRuleCreator?,
|
||||||
|
@SerializedName("creatorType")
|
||||||
|
val creatorType: String,
|
||||||
|
@SerializedName("roomId")
|
||||||
|
val roomId: Int,
|
||||||
|
@SerializedName("createdAt")
|
||||||
|
val createdAt: String,
|
||||||
|
@SerializedName("updatedAt")
|
||||||
|
val updatedAt: String
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 房间规则列表响应
|
||||||
|
* @param page 当前页码
|
||||||
|
* @param pageSize 每页数量
|
||||||
|
* @param total 总记录数
|
||||||
|
* @param list 规则列表
|
||||||
|
*/
|
||||||
|
data class RoomRuleListResponse(
|
||||||
|
@SerializedName("page")
|
||||||
|
val page: Int,
|
||||||
|
@SerializedName("pageSize")
|
||||||
|
val pageSize: Int,
|
||||||
|
@SerializedName("total")
|
||||||
|
val total: Long,
|
||||||
|
@SerializedName("list")
|
||||||
|
val list: List<RoomRule>
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 房间规则配额信息
|
||||||
|
* @param baseMaxCount 基础条数限制(系统配置的免费配额)
|
||||||
|
* @param purchasedCount 用户购买的额外条数(通过自动扩容机制)
|
||||||
|
* @param totalMaxCount 总可用条数(baseMaxCount + purchasedCount)
|
||||||
|
* @param currentCount 当前已创建的规则条数(该用户在该房间)
|
||||||
|
* @param remainingCount 剩余可用条数(totalMaxCount - currentCount)
|
||||||
|
* @param usagePercent 使用百分比(0-100)
|
||||||
|
*/
|
||||||
|
data class RoomRuleQuota(
|
||||||
|
@SerializedName("baseMaxCount")
|
||||||
|
val baseMaxCount: Int,
|
||||||
|
@SerializedName("purchasedCount")
|
||||||
|
val purchasedCount: Int,
|
||||||
|
@SerializedName("totalMaxCount")
|
||||||
|
val totalMaxCount: Int,
|
||||||
|
@SerializedName("currentCount")
|
||||||
|
val currentCount: Int,
|
||||||
|
@SerializedName("remainingCount")
|
||||||
|
val remainingCount: Int,
|
||||||
|
@SerializedName("usagePercent")
|
||||||
|
val usagePercent: Double
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 积分不足错误响应
|
||||||
|
*
|
||||||
|
* 当创建房间规则时积分不足,服务器会返回此特殊错误格式。
|
||||||
|
* 包含当前余额和所需金额信息,便于客户端提示用户。
|
||||||
|
*
|
||||||
|
* @param success 是否成功,固定为 false
|
||||||
|
* @param code 错误码,固定为 35600(积分不足)
|
||||||
|
* @param message 错误消息,包含所需积分和当前余额的详细说明
|
||||||
|
* @param err 错误类型,固定为 "InsufficientBalance"
|
||||||
|
* @param currentBalance 当前积分余额
|
||||||
|
* @param requiredAmount 所需积分数量
|
||||||
|
* @param traceId 追踪ID(可选)
|
||||||
|
*/
|
||||||
|
data class InsufficientBalanceError(
|
||||||
|
@SerializedName("success")
|
||||||
|
val success: Boolean,
|
||||||
|
@SerializedName("code")
|
||||||
|
val code: Int,
|
||||||
|
@SerializedName("message")
|
||||||
|
val message: String,
|
||||||
|
@SerializedName("err")
|
||||||
|
val err: String,
|
||||||
|
@SerializedName("currentBalance")
|
||||||
|
val currentBalance: Int,
|
||||||
|
@SerializedName("requiredAmount")
|
||||||
|
val requiredAmount: Int,
|
||||||
|
@SerializedName("traceId")
|
||||||
|
val traceId: String?
|
||||||
|
)
|
||||||
|
|
||||||
interface RaveNowAPI {
|
interface RaveNowAPI {
|
||||||
@GET("membership/config")
|
@GET("membership/config")
|
||||||
@retrofit2.http.Headers("X-Requires-Auth: true")
|
@retrofit2.http.Headers("X-Requires-Auth: true")
|
||||||
@@ -810,7 +954,7 @@ interface RaveNowAPI {
|
|||||||
@Query("nickname") search: String? = null,
|
@Query("nickname") search: String? = null,
|
||||||
@Query("followerId") followerId: Int? = null,
|
@Query("followerId") followerId: Int? = null,
|
||||||
@Query("followingId") followingId: Int? = null,
|
@Query("followingId") followingId: Int? = null,
|
||||||
@Query("includeAI") includeAI: Boolean? = false,
|
@Query("includeAI") includeAI: Boolean? = true,
|
||||||
@Query("chatSessionIdNotNull") chatSessionIdNotNull: Boolean? = true,
|
@Query("chatSessionIdNotNull") chatSessionIdNotNull: Boolean? = true,
|
||||||
): Response<ListContainer<AccountProfile>>
|
): Response<ListContainer<AccountProfile>>
|
||||||
|
|
||||||
@@ -992,7 +1136,7 @@ interface RaveNowAPI {
|
|||||||
@Query("pageSize") pageSize: Int? = null
|
@Query("pageSize") pageSize: Int? = null
|
||||||
): Response<ListContainer<Agent>>
|
): Response<ListContainer<Agent>>
|
||||||
|
|
||||||
// ========== Prompt Rule API ==========
|
// ========== Agent Rule API ==========
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建智能体规则
|
* 创建智能体规则
|
||||||
@@ -1020,8 +1164,8 @@ interface RaveNowAPI {
|
|||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
@POST("outside/prompt/rule")
|
@POST("outside/prompt/rule")
|
||||||
suspend fun createPromptRule(
|
suspend fun createAgentRule(
|
||||||
@Body body: CreatePromptRuleRequestBody
|
@Body body: CreateAgentRuleRequestBody
|
||||||
): Response<Unit>
|
): Response<Unit>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1054,8 +1198,8 @@ interface RaveNowAPI {
|
|||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
@retrofit2.http.PUT("outside/prompt/rule")
|
@retrofit2.http.PUT("outside/prompt/rule")
|
||||||
suspend fun updatePromptRule(
|
suspend fun updateAgentRule(
|
||||||
@Body body: UpdatePromptRuleRequestBody
|
@Body body: UpdateAgentRuleRequestBody
|
||||||
): Response<Unit>
|
): Response<Unit>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1079,7 +1223,7 @@ interface RaveNowAPI {
|
|||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
@DELETE("outside/prompt/rule/{id}")
|
@DELETE("outside/prompt/rule/{id}")
|
||||||
suspend fun deletePromptRule(
|
suspend fun deleteAgentRule(
|
||||||
@Path("id") id: Int
|
@Path("id") id: Int
|
||||||
): Response<Unit>
|
): Response<Unit>
|
||||||
|
|
||||||
@@ -1134,12 +1278,12 @@ interface RaveNowAPI {
|
|||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
@GET("outside/prompt/{promptId}/rule/list")
|
@GET("outside/prompt/{promptId}/rule/list")
|
||||||
suspend fun getPromptRuleList(
|
suspend fun getAgentRuleList(
|
||||||
@Path("promptId") promptId: String,
|
@Path("promptId") promptId: String,
|
||||||
@Query("rule") rule: String? = null,
|
@Query("rule") rule: String? = null,
|
||||||
@Query("page") page: Int = 1,
|
@Query("page") page: Int = 1,
|
||||||
@Query("pageSize") pageSize: Int = 10
|
@Query("pageSize") pageSize: Int = 10
|
||||||
): Response<DataContainer<PromptRuleListResponse>>
|
): Response<DataContainer<AgentRuleListResponse>>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询智能体规则配额信息
|
* 查询智能体规则配额信息
|
||||||
@@ -1189,9 +1333,264 @@ interface RaveNowAPI {
|
|||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
@GET("outside/prompt/{promptId}/rule/count")
|
@GET("outside/prompt/{promptId}/rule/count")
|
||||||
suspend fun getPromptRuleQuota(
|
suspend fun getAgentRuleQuota(
|
||||||
@Path("promptId") promptId: String
|
@Path("promptId") promptId: String
|
||||||
): Response<DataContainer<PromptRuleQuota>>
|
): Response<DataContainer<AgentRuleQuota>>
|
||||||
|
|
||||||
|
// ========== Room Rule API ==========
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建房间规则
|
||||||
|
*
|
||||||
|
* 功能说明:
|
||||||
|
* - 为指定的房间创建一条新规则
|
||||||
|
* - 规则会被添加到AI对话上下文中,用于约束房间内的行为和交互方式
|
||||||
|
* - 必须是房间成员或房间创建者才能创建规则
|
||||||
|
* - 每个用户在每个房间有基础条数限制,达到限制后会自动扣费扩容
|
||||||
|
* - 如果积分不足,会返回特殊的错误响应(错误码 35600)
|
||||||
|
*
|
||||||
|
* @param body 创建规则请求体
|
||||||
|
* - rule: 规则内容,不能为空
|
||||||
|
* - roomId: 房间ID(与 trtcId 二选一)
|
||||||
|
* - trtcId: TRTC房间ID(与 roomId 二选一)
|
||||||
|
*
|
||||||
|
* @return 成功时返回空 Unit,失败时返回错误信息
|
||||||
|
*
|
||||||
|
* 错误响应说明:
|
||||||
|
* - 400 (40001): 缺少房间标识(必须提供 roomId 或 trtcId)
|
||||||
|
* - 400 (40002): 规则内容为空
|
||||||
|
* - 400 (40003): 规则内容超出字数限制
|
||||||
|
* - 400 (35600): 积分不足(自动扩容失败),返回 InsufficientBalanceError 格式
|
||||||
|
* - 401 (40101): 未登录
|
||||||
|
* - 403 (40301): 无权限为该房间创建规则
|
||||||
|
* - 400 (40005): 房间不存在
|
||||||
|
*
|
||||||
|
* 示例:
|
||||||
|
* ```kotlin
|
||||||
|
* // 使用 roomId 创建规则
|
||||||
|
* val request1 = CreateRoomRuleRequestBody(
|
||||||
|
* rule = "禁止在房间内讨论政治话题",
|
||||||
|
* roomId = 123
|
||||||
|
* )
|
||||||
|
* val response1 = api.createRoomRule(request1)
|
||||||
|
*
|
||||||
|
* // 使用 trtcId 创建规则
|
||||||
|
* val request2 = CreateRoomRuleRequestBody(
|
||||||
|
* rule = "请使用文明用语",
|
||||||
|
* trtcId = "room_trtc_123"
|
||||||
|
* )
|
||||||
|
* val response2 = api.createRoomRule(request2)
|
||||||
|
*
|
||||||
|
* // 处理积分不足错误
|
||||||
|
* if (!response1.isSuccessful && response1.code() == 400) {
|
||||||
|
* val errorBody = response1.errorBody()?.string()
|
||||||
|
* // 解析为 InsufficientBalanceError 获取余额信息
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
*/
|
||||||
|
@POST("outside/room/rule")
|
||||||
|
suspend fun createRoomRule(
|
||||||
|
@Body body: CreateRoomRuleRequestBody
|
||||||
|
): Response<Unit>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改房间规则
|
||||||
|
*
|
||||||
|
* 功能说明:
|
||||||
|
* - 修改指定的房间规则内容
|
||||||
|
* - 只能修改自己创建的规则(creator_type 为 "user")
|
||||||
|
* - 修改不会增加规则条数,因此不会触发扣费
|
||||||
|
*
|
||||||
|
* @param body 修改规则请求体
|
||||||
|
* - id: 规则ID,必填
|
||||||
|
* - rule: 新的规则内容,不能为空
|
||||||
|
*
|
||||||
|
* @return 成功时返回空 Unit,失败时返回错误信息
|
||||||
|
*
|
||||||
|
* 权限要求:
|
||||||
|
* - 必须是规则的创建者
|
||||||
|
* - 规则必须是用户类型(creator_type = "user")
|
||||||
|
*
|
||||||
|
* 错误响应说明:
|
||||||
|
* - 400 (40002): 规则内容为空
|
||||||
|
* - 400 (40003): 规则内容超出字数限制
|
||||||
|
* - 401 (40101): 未登录
|
||||||
|
* - 403 (40301): 无权限修改该规则
|
||||||
|
* - 404 (40401): 规则不存在
|
||||||
|
*
|
||||||
|
* 示例:
|
||||||
|
* ```kotlin
|
||||||
|
* val request = UpdateRoomRuleRequestBody(
|
||||||
|
* id = 456,
|
||||||
|
* rule = "请保持友善交流"
|
||||||
|
* )
|
||||||
|
* val response = api.updateRoomRule(request)
|
||||||
|
* ```
|
||||||
|
*/
|
||||||
|
@retrofit2.http.PUT("outside/room/rule")
|
||||||
|
suspend fun updateRoomRule(
|
||||||
|
@Body body: UpdateRoomRuleRequestBody
|
||||||
|
): Response<Unit>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除房间规则
|
||||||
|
*
|
||||||
|
* 功能说明:
|
||||||
|
* - 删除指定的房间规则
|
||||||
|
* - 只能删除自己创建的规则(creator_type 为 "user")
|
||||||
|
* - 删除操作不可恢复,请谨慎操作
|
||||||
|
* - 删除规则不会退还已扣除的积分
|
||||||
|
*
|
||||||
|
* @param id 规则ID
|
||||||
|
*
|
||||||
|
* @return 成功时返回空 Unit,失败时返回错误信息
|
||||||
|
*
|
||||||
|
* 权限要求:
|
||||||
|
* - 必须是规则的创建者
|
||||||
|
* - 规则必须是用户类型(creator_type = "user")
|
||||||
|
*
|
||||||
|
* 错误响应说明:
|
||||||
|
* - 400 (40006): 无效的规则ID
|
||||||
|
* - 401 (40101): 未登录
|
||||||
|
* - 403 (40301): 无权限删除该规则
|
||||||
|
*
|
||||||
|
* 示例:
|
||||||
|
* ```kotlin
|
||||||
|
* val response = api.deleteRoomRule(456)
|
||||||
|
* ```
|
||||||
|
*/
|
||||||
|
@DELETE("outside/room/rule/{id}")
|
||||||
|
suspend fun deleteRoomRule(
|
||||||
|
@Path("id") id: Int
|
||||||
|
): Response<Unit>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询房间规则列表
|
||||||
|
*
|
||||||
|
* 功能说明:
|
||||||
|
* - 查询指定房间的规则列表,支持分页
|
||||||
|
* - 返回该房间所有用户创建的规则,包含创建者信息
|
||||||
|
* - 必须是房间成员或房间创建者才能查询
|
||||||
|
*
|
||||||
|
* @param roomId 房间ID,与 trtcId 二选一
|
||||||
|
* @param trtcId TRTC房间ID,与 roomId 二选一
|
||||||
|
* @param page 页码,默认 1
|
||||||
|
* @param pageSize 每页数量,默认 10
|
||||||
|
*
|
||||||
|
* @return 返回分页的规则列表,包含规则详情和创建者信息
|
||||||
|
*
|
||||||
|
* 响应数据说明:
|
||||||
|
* - page: 当前页码
|
||||||
|
* - pageSize: 每页数量
|
||||||
|
* - total: 总记录数
|
||||||
|
* - list: 规则列表
|
||||||
|
* - id: 规则ID
|
||||||
|
* - rule: 规则内容
|
||||||
|
* - creator: 创建者信息(id, nickname, avatar)
|
||||||
|
* - creatorType: 创建者类型("user" 等)
|
||||||
|
* - roomId: 所属房间ID
|
||||||
|
* - createdAt: 创建时间(ISO 8601格式)
|
||||||
|
* - updatedAt: 更新时间(ISO 8601格式)
|
||||||
|
*
|
||||||
|
* 错误响应说明:
|
||||||
|
* - 400 (40001): 缺少房间标识(必须提供 roomId 或 trtcId)
|
||||||
|
* - 401 (40101): 未登录
|
||||||
|
* - 403 (40301): 无权限查看该房间的规则
|
||||||
|
*
|
||||||
|
* 示例:
|
||||||
|
* ```kotlin
|
||||||
|
* // 使用 roomId 查询
|
||||||
|
* val response1 = api.getRoomRuleList(
|
||||||
|
* roomId = 123,
|
||||||
|
* page = 1,
|
||||||
|
* pageSize = 10
|
||||||
|
* )
|
||||||
|
*
|
||||||
|
* // 使用 trtcId 查询
|
||||||
|
* val response2 = api.getRoomRuleList(
|
||||||
|
* trtcId = "room_trtc_123",
|
||||||
|
* page = 1,
|
||||||
|
* pageSize = 10
|
||||||
|
* )
|
||||||
|
*
|
||||||
|
* // 处理响应
|
||||||
|
* response1.body()?.let { result ->
|
||||||
|
* println("共 ${result.total} 条规则,当前第 ${result.page} 页")
|
||||||
|
* result.list.forEach { rule ->
|
||||||
|
* println("规则: ${rule.rule}, 创建者: ${rule.creator?.nickname}")
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
*/
|
||||||
|
@GET("outside/room/rule")
|
||||||
|
suspend fun getRoomRuleList(
|
||||||
|
@Query("roomId") roomId: Int? = null,
|
||||||
|
@Query("trtcId") trtcId: String? = null,
|
||||||
|
@Query("page") page: Int = 1,
|
||||||
|
@Query("pageSize") pageSize: Int = 10
|
||||||
|
): Response<RoomRuleListResponse>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询规则额度使用情况
|
||||||
|
*
|
||||||
|
* 功能说明:
|
||||||
|
* - 查询当前用户在指定房间的规则额度使用情况
|
||||||
|
* - 包括基础条数、已购买条数、当前使用数等完整信息
|
||||||
|
* - 用于判断用户是否还能创建新规则
|
||||||
|
* - 必须是房间成员或房间创建者才能查询
|
||||||
|
*
|
||||||
|
* @param roomId 房间ID,与 trtcId 二选一
|
||||||
|
* @param trtcId TRTC房间ID,与 roomId 二选一
|
||||||
|
*
|
||||||
|
* @return 返回配额详细信息
|
||||||
|
*
|
||||||
|
* 响应数据说明:
|
||||||
|
* - baseMaxCount: 基础条数限制(系统配置的免费配额)
|
||||||
|
* - purchasedCount: 用户购买的额外条数(通过自动扩容机制)
|
||||||
|
* - totalMaxCount: 总可用条数(baseMaxCount + purchasedCount)
|
||||||
|
* - currentCount: 当前已创建的规则条数(该用户在该房间)
|
||||||
|
* - remainingCount: 剩余可用条数(totalMaxCount - currentCount)
|
||||||
|
* - usagePercent: 使用百分比,0-100(currentCount / totalMaxCount * 100)
|
||||||
|
*
|
||||||
|
* 使用场景:
|
||||||
|
* 1. 创建规则前检查是否有足够配额
|
||||||
|
* 2. 展示规则使用情况统计
|
||||||
|
* 3. 提示用户即将达到配额上限
|
||||||
|
*
|
||||||
|
* 错误响应说明:
|
||||||
|
* - 400 (40001): 缺少房间标识(必须提供 roomId 或 trtcId)
|
||||||
|
* - 401 (40101): 未登录
|
||||||
|
* - 403 (40301): 无权限查看该房间的规则条数信息
|
||||||
|
*
|
||||||
|
* 示例:
|
||||||
|
* ```kotlin
|
||||||
|
* // 使用 roomId 查询
|
||||||
|
* val response1 = api.getRoomRuleQuota(roomId = 123)
|
||||||
|
*
|
||||||
|
* // 使用 trtcId 查询
|
||||||
|
* val response2 = api.getRoomRuleQuota(trtcId = "room_trtc_123")
|
||||||
|
*
|
||||||
|
* // 处理响应
|
||||||
|
* response1.body()?.data?.let { quota ->
|
||||||
|
* if (quota.remainingCount > 0) {
|
||||||
|
* // 可以创建新规则
|
||||||
|
* println("还可以创建 ${quota.remainingCount} 条规则")
|
||||||
|
* println("使用率: ${quota.usagePercent}%")
|
||||||
|
* } else {
|
||||||
|
* // 配额已用完,需要扩容
|
||||||
|
* println("规则配额已用完,已使用 ${quota.currentCount}/${quota.totalMaxCount}")
|
||||||
|
* println("创建新规则将自动扣除积分进行扩容")
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
*/
|
||||||
|
@GET("outside/room/rule/length-info")
|
||||||
|
suspend fun getRoomRuleQuota(
|
||||||
|
@Query("roomId") roomId: Int? = null,
|
||||||
|
@Query("trtcId") trtcId: String? = null
|
||||||
|
): Response<DataContainer<RoomRuleQuota>>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,18 +7,13 @@ import com.aiosman.ravenow.data.Agent
|
|||||||
import com.aiosman.ravenow.data.ListContainer
|
import com.aiosman.ravenow.data.ListContainer
|
||||||
import com.aiosman.ravenow.data.AgentService
|
import com.aiosman.ravenow.data.AgentService
|
||||||
import com.aiosman.ravenow.data.DataContainer
|
import com.aiosman.ravenow.data.DataContainer
|
||||||
import com.aiosman.ravenow.data.MomentService
|
|
||||||
import com.aiosman.ravenow.data.ServiceException
|
import com.aiosman.ravenow.data.ServiceException
|
||||||
import com.aiosman.ravenow.data.UploadImage
|
import com.aiosman.ravenow.data.UploadImage
|
||||||
import com.aiosman.ravenow.data.UserService
|
|
||||||
import com.aiosman.ravenow.data.api.ApiClient
|
import com.aiosman.ravenow.data.api.ApiClient
|
||||||
import okhttp3.MediaType
|
|
||||||
import okhttp3.MediaType.Companion.toMediaTypeOrNull
|
import okhttp3.MediaType.Companion.toMediaTypeOrNull
|
||||||
import okhttp3.MultipartBody
|
import okhttp3.MultipartBody
|
||||||
import okhttp3.RequestBody
|
|
||||||
import okhttp3.RequestBody.Companion.asRequestBody
|
import okhttp3.RequestBody.Companion.asRequestBody
|
||||||
import okhttp3.RequestBody.Companion.toRequestBody
|
import okhttp3.RequestBody.Companion.toRequestBody
|
||||||
import retrofit2.http.Part
|
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
|
|
||||||
@@ -160,7 +155,7 @@ class AgentBackend {
|
|||||||
return if (authorId != null) {
|
return if (authorId != null) {
|
||||||
// getAgent 返回 DataContainer<ListContainer<Agent>>
|
// getAgent 返回 DataContainer<ListContainer<Agent>>
|
||||||
val dataContainer =
|
val dataContainer =
|
||||||
body as com.aiosman.ravenow.data.DataContainer<com.aiosman.ravenow.data.ListContainer<com.aiosman.ravenow.data.Agent>>
|
body as DataContainer<ListContainer<Agent>>
|
||||||
val listContainer = dataContainer.data
|
val listContainer = dataContainer.data
|
||||||
ListContainer(
|
ListContainer(
|
||||||
total = listContainer.total,
|
total = listContainer.total,
|
||||||
@@ -171,7 +166,7 @@ class AgentBackend {
|
|||||||
} else {
|
} else {
|
||||||
// getMyAgent 返回 ListContainer<Agent>
|
// getMyAgent 返回 ListContainer<Agent>
|
||||||
val listContainer =
|
val listContainer =
|
||||||
body as com.aiosman.ravenow.data.ListContainer<com.aiosman.ravenow.data.Agent>
|
body as ListContainer<Agent>
|
||||||
ListContainer(
|
ListContainer(
|
||||||
total = listContainer.total,
|
total = listContainer.total,
|
||||||
page = pageNumber,
|
page = pageNumber,
|
||||||
@@ -251,7 +246,7 @@ class AgentLoader : DataLoader<AgentEntity, AgentLoaderExtraArgs>() {
|
|||||||
} else {
|
} else {
|
||||||
// getMyAgent 返回 ListContainer<Agent>
|
// getMyAgent 返回 ListContainer<Agent>
|
||||||
val listContainer =
|
val listContainer =
|
||||||
body as com.aiosman.ravenow.data.ListContainer<com.aiosman.ravenow.data.Agent>
|
body as ListContainer<Agent>
|
||||||
ListContainer(
|
ListContainer(
|
||||||
list = listContainer.list.map { it.toAgentEntity() },
|
list = listContainer.list.map { it.toAgentEntity() },
|
||||||
total = listContainer.total,
|
total = listContainer.total,
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import com.aiosman.ravenow.data.ListContainer
|
|||||||
abstract class DataLoader<T,ET> {
|
abstract class DataLoader<T,ET> {
|
||||||
var list: MutableList<T> = mutableListOf()
|
var list: MutableList<T> = mutableListOf()
|
||||||
var page by mutableStateOf(1)
|
var page by mutableStateOf(1)
|
||||||
var total by mutableStateOf(0)
|
var total by mutableStateOf(0L)
|
||||||
var pageSize by mutableStateOf(10)
|
var pageSize by mutableStateOf(10)
|
||||||
var hasNext by mutableStateOf(true)
|
var hasNext by mutableStateOf(true)
|
||||||
var isLoading by mutableStateOf(false)
|
var isLoading by mutableStateOf(false)
|
||||||
|
|||||||
@@ -3,10 +3,6 @@ package com.aiosman.ravenow.entity
|
|||||||
import com.aiosman.ravenow.data.ListContainer
|
import com.aiosman.ravenow.data.ListContainer
|
||||||
import com.aiosman.ravenow.data.ServiceException
|
import com.aiosman.ravenow.data.ServiceException
|
||||||
import com.aiosman.ravenow.data.api.ApiClient
|
import com.aiosman.ravenow.data.api.ApiClient
|
||||||
import okhttp3.MediaType.Companion.toMediaTypeOrNull
|
|
||||||
import okhttp3.MultipartBody
|
|
||||||
import okhttp3.RequestBody.Companion.asRequestBody
|
|
||||||
import java.io.File
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 群聊房间
|
* 群聊房间
|
||||||
@@ -56,6 +52,40 @@ data class ProfileEntity(
|
|||||||
val aiAccount: Boolean,
|
val aiAccount: Boolean,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 房间规则创建者信息
|
||||||
|
*/
|
||||||
|
data class RoomRuleCreatorEntity(
|
||||||
|
val id: Int,
|
||||||
|
val nickname: String,
|
||||||
|
val avatar: String
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 房间规则详情
|
||||||
|
*/
|
||||||
|
data class RoomRuleEntity(
|
||||||
|
val id: Int,
|
||||||
|
val rule: String,
|
||||||
|
val creator: RoomRuleCreatorEntity?,
|
||||||
|
val creatorType: String,
|
||||||
|
val roomId: Int,
|
||||||
|
val createdAt: String,
|
||||||
|
val updatedAt: String
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 房间规则配额信息
|
||||||
|
*/
|
||||||
|
data class RoomRuleQuotaEntity(
|
||||||
|
val baseMaxCount: Int,
|
||||||
|
val purchasedCount: Int,
|
||||||
|
val totalMaxCount: Int,
|
||||||
|
val currentCount: Int,
|
||||||
|
val remainingCount: Int,
|
||||||
|
val usagePercent: Double
|
||||||
|
)
|
||||||
|
|
||||||
class RoomLoader : DataLoader<AgentEntity,AgentLoaderExtraArgs>() {
|
class RoomLoader : DataLoader<AgentEntity,AgentLoaderExtraArgs>() {
|
||||||
override suspend fun fetchData(
|
override suspend fun fetchData(
|
||||||
page: Int,
|
page: Int,
|
||||||
|
|||||||
@@ -71,4 +71,29 @@ object AppStore {
|
|||||||
AppState.chatBackgroundUrl = url
|
AppState.chatBackgroundUrl = url
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ===================== 用户本地扩展信息 =====================
|
||||||
|
// 后端暂未提供 MBTI 与星座字段,使用本地持久化按用户维度进行存储
|
||||||
|
private fun mbtiKey(userId: Int) = "mbti_user_$userId"
|
||||||
|
private fun zodiacKey(userId: Int) = "zodiac_user_$userId"
|
||||||
|
|
||||||
|
fun getUserMbti(userId: Int): String? {
|
||||||
|
return sharedPreferences.getString(mbtiKey(userId), null)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setUserMbti(userId: Int, mbti: String?) {
|
||||||
|
sharedPreferences.edit().apply {
|
||||||
|
if (mbti.isNullOrEmpty()) remove(mbtiKey(userId)) else putString(mbtiKey(userId), mbti)
|
||||||
|
}.apply()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getUserZodiac(userId: Int): String? {
|
||||||
|
return sharedPreferences.getString(zodiacKey(userId), null)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setUserZodiac(userId: Int, zodiac: String?) {
|
||||||
|
sharedPreferences.edit().apply {
|
||||||
|
if (zodiac.isNullOrEmpty()) remove(zodiacKey(userId)) else putString(zodiacKey(userId), zodiac)
|
||||||
|
}.apply()
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -35,8 +35,10 @@ import com.aiosman.ravenow.LocalSharedTransitionScope
|
|||||||
import com.aiosman.ravenow.ui.about.AboutScreen
|
import com.aiosman.ravenow.ui.about.AboutScreen
|
||||||
import com.aiosman.ravenow.ui.account.AccountEditScreen2
|
import com.aiosman.ravenow.ui.account.AccountEditScreen2
|
||||||
import com.aiosman.ravenow.ui.account.AccountSetting
|
import com.aiosman.ravenow.ui.account.AccountSetting
|
||||||
|
import com.aiosman.ravenow.ui.account.MbtiSelectScreen
|
||||||
import com.aiosman.ravenow.ui.account.RemoveAccountScreen
|
import com.aiosman.ravenow.ui.account.RemoveAccountScreen
|
||||||
import com.aiosman.ravenow.ui.account.ResetPasswordScreen
|
import com.aiosman.ravenow.ui.account.ResetPasswordScreen
|
||||||
|
import com.aiosman.ravenow.ui.account.ZodiacSelectScreen
|
||||||
import com.aiosman.ravenow.ui.agent.AddAgentScreen
|
import com.aiosman.ravenow.ui.agent.AddAgentScreen
|
||||||
import com.aiosman.ravenow.ui.agent.AgentImageCropScreen
|
import com.aiosman.ravenow.ui.agent.AgentImageCropScreen
|
||||||
import com.aiosman.ravenow.ui.group.CreateGroupChatScreen
|
import com.aiosman.ravenow.ui.group.CreateGroupChatScreen
|
||||||
@@ -120,6 +122,8 @@ sealed class NavigationRoute(
|
|||||||
data object VipSelPage : NavigationRoute("VipSelPage")
|
data object VipSelPage : NavigationRoute("VipSelPage")
|
||||||
data object RemoveAccountScreen: NavigationRoute("RemoveAccount")
|
data object RemoveAccountScreen: NavigationRoute("RemoveAccount")
|
||||||
data object NotificationScreen : NavigationRoute("NotificationScreen")
|
data object NotificationScreen : NavigationRoute("NotificationScreen")
|
||||||
|
data object MbtiSelect : NavigationRoute("MbtiSelect")
|
||||||
|
data object ZodiacSelect : NavigationRoute("ZodiacSelect")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -421,6 +425,12 @@ fun NavigationController(
|
|||||||
composable(route = NavigationRoute.RemoveAccountScreen.route) {
|
composable(route = NavigationRoute.RemoveAccountScreen.route) {
|
||||||
RemoveAccountScreen()
|
RemoveAccountScreen()
|
||||||
}
|
}
|
||||||
|
composable(route = NavigationRoute.MbtiSelect.route) {
|
||||||
|
MbtiSelectScreen()
|
||||||
|
}
|
||||||
|
composable(route = NavigationRoute.ZodiacSelect.route) {
|
||||||
|
ZodiacSelectScreen()
|
||||||
|
}
|
||||||
composable(route = NavigationRoute.VipSelPage.route) {
|
composable(route = NavigationRoute.VipSelPage.route) {
|
||||||
VipSelPage()
|
VipSelPage()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,9 @@ object AccountEditViewModel : ViewModel() {
|
|||||||
var croppedBitmap by mutableStateOf<Bitmap?>(null)
|
var croppedBitmap by mutableStateOf<Bitmap?>(null)
|
||||||
var isUpdating by mutableStateOf(false)
|
var isUpdating by mutableStateOf(false)
|
||||||
var isLoading by mutableStateOf(false)
|
var isLoading by mutableStateOf(false)
|
||||||
|
// 本地扩展字段
|
||||||
|
var mbti by mutableStateOf<String?>(null)
|
||||||
|
var zodiac by mutableStateOf<String?>(null)
|
||||||
suspend fun reloadProfile(updateTrtcProfile:Boolean = false) {
|
suspend fun reloadProfile(updateTrtcProfile:Boolean = false) {
|
||||||
Log.d("AccountEditViewModel", "reloadProfile: 开始加载用户资料")
|
Log.d("AccountEditViewModel", "reloadProfile: 开始加载用户资料")
|
||||||
isLoading = true
|
isLoading = true
|
||||||
@@ -38,6 +41,12 @@ object AccountEditViewModel : ViewModel() {
|
|||||||
bio = it.bio
|
bio = it.bio
|
||||||
// 清除之前裁剪的图片
|
// 清除之前裁剪的图片
|
||||||
croppedBitmap = null
|
croppedBitmap = null
|
||||||
|
// 读取本地扩展字段
|
||||||
|
try {
|
||||||
|
val uid = it.id // 使用 profile 的 id,确保非空
|
||||||
|
mbti = com.aiosman.ravenow.AppStore.getUserMbti(uid)
|
||||||
|
zodiac = com.aiosman.ravenow.AppStore.getUserZodiac(uid)
|
||||||
|
} catch (_: Exception) { }
|
||||||
if (updateTrtcProfile) {
|
if (updateTrtcProfile) {
|
||||||
TrtcHelper.updateTrtcProfile(
|
TrtcHelper.updateTrtcProfile(
|
||||||
it.nickName,
|
it.nickName,
|
||||||
@@ -84,6 +93,13 @@ object AccountEditViewModel : ViewModel() {
|
|||||||
nickName = newName,
|
nickName = newName,
|
||||||
bio = cleanBio
|
bio = cleanBio
|
||||||
)
|
)
|
||||||
|
// 保存本地扩展字段
|
||||||
|
try {
|
||||||
|
profile?.id?.let { uid ->
|
||||||
|
com.aiosman.ravenow.AppStore.setUserMbti(uid, mbti)
|
||||||
|
com.aiosman.ravenow.AppStore.setUserZodiac(uid, zodiac)
|
||||||
|
}
|
||||||
|
} catch (_: Exception) { }
|
||||||
// 刷新用户资料
|
// 刷新用户资料
|
||||||
reloadProfile()
|
reloadProfile()
|
||||||
// 刷新个人资料页面的用户资料
|
// 刷新个人资料页面的用户资料
|
||||||
|
|||||||
@@ -1,117 +1,177 @@
|
|||||||
package com.aiosman.ravenow.ui.account
|
package com.aiosman.ravenow.ui.account
|
||||||
|
|
||||||
import android.widget.Toast
|
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.Spacer
|
import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.WindowInsets
|
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.height
|
import androidx.compose.foundation.layout.height
|
||||||
|
import androidx.compose.foundation.layout.offset
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
|
import androidx.compose.foundation.layout.size
|
||||||
|
import androidx.compose.foundation.shape.CircleShape
|
||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
import androidx.compose.foundation.text.BasicTextField
|
|
||||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||||
import androidx.compose.material3.ModalBottomSheet
|
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.material3.rememberModalBottomSheetState
|
|
||||||
import androidx.compose.ui.graphics.SolidColor
|
|
||||||
import androidx.compose.ui.text.TextStyle
|
|
||||||
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.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.platform.LocalContext
|
import androidx.compose.ui.graphics.ColorFilter
|
||||||
|
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.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.ravenow.AppState
|
|
||||||
import com.aiosman.ravenow.AppStore
|
|
||||||
import com.aiosman.ravenow.LocalAppTheme
|
import com.aiosman.ravenow.LocalAppTheme
|
||||||
import com.aiosman.ravenow.LocalNavController
|
import com.aiosman.ravenow.LocalNavController
|
||||||
import com.aiosman.ravenow.Messaging
|
|
||||||
import com.aiosman.ravenow.R
|
import com.aiosman.ravenow.R
|
||||||
import com.aiosman.ravenow.data.AccountServiceImpl
|
|
||||||
import com.aiosman.ravenow.ui.NavigationRoute
|
import com.aiosman.ravenow.ui.NavigationRoute
|
||||||
import com.aiosman.ravenow.ui.comment.NoticeScreenHeader
|
|
||||||
import com.aiosman.ravenow.ui.composables.ActionButton
|
|
||||||
import com.aiosman.ravenow.ui.composables.StatusBarSpacer
|
import com.aiosman.ravenow.ui.composables.StatusBarSpacer
|
||||||
import com.aiosman.ravenow.ui.index.NavItem
|
|
||||||
import com.aiosman.ravenow.ui.modifiers.noRippleClickable
|
import com.aiosman.ravenow.ui.modifiers.noRippleClickable
|
||||||
import kotlinx.coroutines.launch
|
|
||||||
|
private object AccountSettingConstants {
|
||||||
|
const val BACK_BUTTON_SIZE = 36
|
||||||
|
const val BACK_BUTTON_ICON_SIZE = 24
|
||||||
|
const val BACK_BUTTON_START_PADDING = 19
|
||||||
|
const val OPTION_ITEM_HEIGHT = 56
|
||||||
|
const val OPTION_ITEM_ICON_SIZE = 24
|
||||||
|
const val OPTION_ITEM_HORIZONTAL_PADDING = 16
|
||||||
|
const val OPTION_ITEM_ICON_TEXT_SPACING = 12
|
||||||
|
const val OPTION_ITEM_TEXT_SIZE = 17
|
||||||
|
const val HEADER_VERTICAL_PADDING = 16
|
||||||
|
const val TITLE_OFFSET_X = 19
|
||||||
|
const val CARD_CORNER_RADIUS = 16
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun CircularBackButton(
|
||||||
|
onClick: () -> Unit,
|
||||||
|
modifier: Modifier = Modifier
|
||||||
|
) {
|
||||||
|
val appColors = LocalAppTheme.current
|
||||||
|
Box(
|
||||||
|
modifier = modifier
|
||||||
|
.size(AccountSettingConstants.BACK_BUTTON_SIZE.dp)
|
||||||
|
.background(
|
||||||
|
color = appColors.secondaryBackground,
|
||||||
|
shape = CircleShape
|
||||||
|
)
|
||||||
|
.noRippleClickable { onClick() },
|
||||||
|
contentAlignment = Alignment.Center
|
||||||
|
) {
|
||||||
|
Image(
|
||||||
|
painter = painterResource(id = R.drawable.rider_pro_back_icon),
|
||||||
|
contentDescription = "返回",
|
||||||
|
modifier = Modifier.size(AccountSettingConstants.BACK_BUTTON_ICON_SIZE.dp),
|
||||||
|
colorFilter = ColorFilter.tint(appColors.text)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun SecurityOptionItem(
|
||||||
|
iconRes: Int,
|
||||||
|
label: String,
|
||||||
|
onClick: () -> Unit,
|
||||||
|
applyColorFilter: Boolean = true
|
||||||
|
) {
|
||||||
|
val appColors = LocalAppTheme.current
|
||||||
|
Row(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.height(AccountSettingConstants.OPTION_ITEM_HEIGHT.dp)
|
||||||
|
.padding(horizontal = AccountSettingConstants.OPTION_ITEM_HORIZONTAL_PADDING.dp)
|
||||||
|
.noRippleClickable { onClick() },
|
||||||
|
verticalAlignment = Alignment.CenterVertically
|
||||||
|
) {
|
||||||
|
Image(
|
||||||
|
painter = painterResource(id = iconRes),
|
||||||
|
contentDescription = null,
|
||||||
|
modifier = Modifier.size(AccountSettingConstants.OPTION_ITEM_ICON_SIZE.dp),
|
||||||
|
colorFilter = if (applyColorFilter) ColorFilter.tint(appColors.text) else null
|
||||||
|
)
|
||||||
|
Text(
|
||||||
|
text = label,
|
||||||
|
modifier = Modifier
|
||||||
|
.padding(start = AccountSettingConstants.OPTION_ITEM_ICON_TEXT_SPACING.dp)
|
||||||
|
.weight(1f),
|
||||||
|
color = appColors.text,
|
||||||
|
fontSize = AccountSettingConstants.OPTION_ITEM_TEXT_SIZE.sp,
|
||||||
|
fontWeight = FontWeight.Medium
|
||||||
|
)
|
||||||
|
Image(
|
||||||
|
painter = painterResource(id = R.drawable.rave_now_nav_right),
|
||||||
|
contentDescription = null,
|
||||||
|
modifier = Modifier.size(AccountSettingConstants.OPTION_ITEM_ICON_SIZE.dp),
|
||||||
|
colorFilter = ColorFilter.tint(appColors.secondaryText)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@OptIn(ExperimentalMaterial3Api::class)
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
@Composable
|
@Composable
|
||||||
fun AccountSetting() {
|
fun AccountSetting() {
|
||||||
val appColors = LocalAppTheme.current
|
val appColors = LocalAppTheme.current
|
||||||
val navController = LocalNavController.current
|
val navController = LocalNavController.current
|
||||||
val scope = rememberCoroutineScope()
|
|
||||||
val context = LocalContext.current
|
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
.background(appColors.background),
|
.background(appColors.background),
|
||||||
) {
|
) {
|
||||||
StatusBarSpacer()
|
StatusBarSpacer()
|
||||||
|
|
||||||
|
// 顶部标题栏
|
||||||
Box(
|
Box(
|
||||||
modifier = Modifier.padding(horizontal = 24.dp, vertical = 16.dp)
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.padding(vertical = AccountSettingConstants.HEADER_VERTICAL_PADDING.dp)
|
||||||
) {
|
) {
|
||||||
NoticeScreenHeader(
|
CircularBackButton(
|
||||||
title = stringResource(R.string.account_and_security),
|
onClick = { navController.navigateUp() },
|
||||||
moreIcon = false
|
modifier = Modifier.padding(start = AccountSettingConstants.BACK_BUTTON_START_PADDING.dp)
|
||||||
|
)
|
||||||
|
Text(
|
||||||
|
text = stringResource(R.string.account_and_security),
|
||||||
|
fontWeight = FontWeight.W800,
|
||||||
|
fontSize = AccountSettingConstants.OPTION_ITEM_TEXT_SIZE.sp,
|
||||||
|
color = appColors.text,
|
||||||
|
modifier = Modifier
|
||||||
|
.align(Alignment.Center)
|
||||||
|
.offset(x = AccountSettingConstants.TITLE_OFFSET_X.dp)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 安全选项卡片
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier.padding(start = 24.dp)
|
|
||||||
) {
|
|
||||||
Box(
|
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(vertical = 8.dp)
|
.background(
|
||||||
|
color = appColors.background,
|
||||||
|
shape = RoundedCornerShape(AccountSettingConstants.CARD_CORNER_RADIUS.dp)
|
||||||
|
)
|
||||||
) {
|
) {
|
||||||
NavItem(
|
SecurityOptionItem(
|
||||||
iconRes = R.mipmap.rider_pro_change_password,
|
iconRes = R.mipmap.icons_padlock,
|
||||||
label = stringResource(R.string.change_password),
|
label = stringResource(R.string.change_password),
|
||||||
modifier = Modifier.noRippleClickable {
|
onClick = { navController.navigate(NavigationRoute.ChangePasswordScreen.route) }
|
||||||
navController.navigate(NavigationRoute.ChangePasswordScreen.route)
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
}
|
|
||||||
|
|
||||||
// 分割线
|
SecurityOptionItem(
|
||||||
Box(
|
iconRes = R.mipmap.icons_block,
|
||||||
modifier = Modifier
|
label = stringResource(R.string.blocked_users),
|
||||||
.fillMaxWidth()
|
onClick = {
|
||||||
.height(1.dp)
|
// TODO: 导航到屏蔽用户页面
|
||||||
.background(appColors.divider)
|
}
|
||||||
)
|
)
|
||||||
Box(
|
|
||||||
modifier = Modifier
|
SecurityOptionItem(
|
||||||
.fillMaxWidth()
|
iconRes = R.mipmap.icons_remove,
|
||||||
.padding(vertical = 8.dp)
|
|
||||||
) {
|
|
||||||
NavItem(
|
|
||||||
iconRes = R.drawable.rider_pro_moment_delete,
|
|
||||||
label = stringResource(R.string.remove_account),
|
label = stringResource(R.string.remove_account),
|
||||||
modifier = Modifier.noRippleClickable {
|
onClick = { navController.navigate(NavigationRoute.RemoveAccountScreen.route) },
|
||||||
navController.navigate(NavigationRoute.RemoveAccountScreen.route)
|
applyColorFilter = false
|
||||||
}
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
Box(
|
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.height(1.dp)
|
|
||||||
.background(appColors.divider)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,141 @@
|
|||||||
|
package com.aiosman.ravenow.ui.account
|
||||||
|
|
||||||
|
import androidx.compose.foundation.background
|
||||||
|
import androidx.compose.foundation.clickable
|
||||||
|
import androidx.compose.foundation.interaction.MutableInteractionSource
|
||||||
|
import androidx.compose.foundation.layout.Box
|
||||||
|
import androidx.compose.foundation.layout.Column
|
||||||
|
import androidx.compose.foundation.layout.Row
|
||||||
|
import androidx.compose.foundation.layout.Spacer
|
||||||
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
|
import androidx.compose.foundation.layout.height
|
||||||
|
import androidx.compose.foundation.layout.padding
|
||||||
|
import androidx.compose.foundation.layout.size
|
||||||
|
import androidx.compose.foundation.layout.width
|
||||||
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
|
import androidx.compose.foundation.lazy.items
|
||||||
|
import androidx.compose.foundation.shape.CircleShape
|
||||||
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
|
import androidx.compose.material3.Icon
|
||||||
|
import androidx.compose.material3.Text
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.runtime.remember
|
||||||
|
import androidx.compose.ui.Alignment
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.draw.clip
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
|
import androidx.compose.ui.graphics.ColorFilter
|
||||||
|
import androidx.compose.ui.res.stringResource
|
||||||
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
|
import androidx.compose.ui.unit.sp
|
||||||
|
import androidx.compose.material.icons.Icons
|
||||||
|
import androidx.compose.material.icons.filled.Check
|
||||||
|
import com.aiosman.ravenow.AppState
|
||||||
|
import com.aiosman.ravenow.LocalAppTheme
|
||||||
|
import com.aiosman.ravenow.LocalNavController
|
||||||
|
import com.aiosman.ravenow.R
|
||||||
|
import com.aiosman.ravenow.ui.comment.NoticeScreenHeader
|
||||||
|
|
||||||
|
// MBTI类型列表
|
||||||
|
val MBTI_TYPES = listOf(
|
||||||
|
"INTJ", "INTP", "ENTJ", "ENTP",
|
||||||
|
"INFJ", "INFP", "ENFJ", "ENFP",
|
||||||
|
"ISTJ", "ISFJ", "ESTJ", "ESFJ",
|
||||||
|
"ISTP", "ISFP", "ESTP", "ESFP"
|
||||||
|
)
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun MbtiSelectScreen() {
|
||||||
|
val navController = LocalNavController.current
|
||||||
|
val appColors = LocalAppTheme.current
|
||||||
|
val model = AccountEditViewModel
|
||||||
|
val currentMbti = model.mbti
|
||||||
|
|
||||||
|
Column(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxSize()
|
||||||
|
.background(appColors.profileBackground)
|
||||||
|
) {
|
||||||
|
// 头部
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.padding(vertical = 16.dp)
|
||||||
|
) {
|
||||||
|
NoticeScreenHeader(
|
||||||
|
title = stringResource(R.string.choose_mbti),
|
||||||
|
moreIcon = false
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 列表
|
||||||
|
LazyColumn(
|
||||||
|
modifier = Modifier.fillMaxSize(),
|
||||||
|
contentPadding = androidx.compose.foundation.layout.PaddingValues(horizontal = 16.dp, vertical = 8.dp)
|
||||||
|
) {
|
||||||
|
items(MBTI_TYPES) { mbti ->
|
||||||
|
MBTIItem(
|
||||||
|
mbti = mbti,
|
||||||
|
isSelected = mbti == currentMbti,
|
||||||
|
onClick = {
|
||||||
|
model.mbti = mbti
|
||||||
|
// 立即保存到本地存储,确保选择后立即生效
|
||||||
|
AppState.UserId?.let { uid ->
|
||||||
|
com.aiosman.ravenow.AppStore.setUserMbti(uid, mbti)
|
||||||
|
}
|
||||||
|
navController.navigateUp()
|
||||||
|
}
|
||||||
|
)
|
||||||
|
Spacer(modifier = Modifier.height(8.dp))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun MBTIItem(
|
||||||
|
mbti: String,
|
||||||
|
isSelected: Boolean,
|
||||||
|
onClick: () -> Unit
|
||||||
|
) {
|
||||||
|
val appColors = LocalAppTheme.current
|
||||||
|
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.clip(RoundedCornerShape(16.dp))
|
||||||
|
.background(if (isSelected) appColors.main.copy(alpha = 0.1f) else Color.White)
|
||||||
|
.clickable(
|
||||||
|
indication = null,
|
||||||
|
interactionSource = remember { MutableInteractionSource() }
|
||||||
|
) {
|
||||||
|
onClick()
|
||||||
|
}
|
||||||
|
.padding(16.dp)
|
||||||
|
) {
|
||||||
|
Row(
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
verticalAlignment = Alignment.CenterVertically
|
||||||
|
) {
|
||||||
|
Text(
|
||||||
|
text = mbti,
|
||||||
|
fontSize = 17.sp,
|
||||||
|
fontWeight = FontWeight.Normal,
|
||||||
|
color = if (isSelected) appColors.main else appColors.text,
|
||||||
|
modifier = Modifier.weight(1f)
|
||||||
|
)
|
||||||
|
|
||||||
|
if (isSelected) {
|
||||||
|
Icon(
|
||||||
|
imageVector = Icons.Default.Check,
|
||||||
|
contentDescription = "Selected",
|
||||||
|
modifier = Modifier.size(20.dp),
|
||||||
|
tint = appColors.main
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,172 @@
|
|||||||
|
package com.aiosman.ravenow.ui.account
|
||||||
|
|
||||||
|
import androidx.compose.foundation.background
|
||||||
|
import androidx.compose.foundation.clickable
|
||||||
|
import androidx.compose.foundation.interaction.MutableInteractionSource
|
||||||
|
import androidx.compose.foundation.layout.Box
|
||||||
|
import androidx.compose.foundation.layout.Column
|
||||||
|
import androidx.compose.foundation.layout.Row
|
||||||
|
import androidx.compose.foundation.layout.Spacer
|
||||||
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
|
import androidx.compose.foundation.layout.height
|
||||||
|
import androidx.compose.foundation.layout.padding
|
||||||
|
import androidx.compose.foundation.layout.size
|
||||||
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
|
import androidx.compose.foundation.lazy.items
|
||||||
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
|
import androidx.compose.material3.Icon
|
||||||
|
import androidx.compose.material3.Text
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.runtime.remember
|
||||||
|
import androidx.compose.ui.Alignment
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.draw.clip
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
|
import androidx.compose.ui.res.stringResource
|
||||||
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
|
import androidx.compose.ui.unit.sp
|
||||||
|
import androidx.compose.material.icons.Icons
|
||||||
|
import androidx.compose.material.icons.filled.Check
|
||||||
|
import com.aiosman.ravenow.AppState
|
||||||
|
import com.aiosman.ravenow.LocalAppTheme
|
||||||
|
import com.aiosman.ravenow.LocalNavController
|
||||||
|
import com.aiosman.ravenow.R
|
||||||
|
import com.aiosman.ravenow.ui.comment.NoticeScreenHeader
|
||||||
|
|
||||||
|
// 星座资源ID列表
|
||||||
|
val ZODIAC_SIGN_RES_IDS = listOf(
|
||||||
|
R.string.zodiac_aries,
|
||||||
|
R.string.zodiac_taurus,
|
||||||
|
R.string.zodiac_gemini,
|
||||||
|
R.string.zodiac_cancer,
|
||||||
|
R.string.zodiac_leo,
|
||||||
|
R.string.zodiac_virgo,
|
||||||
|
R.string.zodiac_libra,
|
||||||
|
R.string.zodiac_scorpio,
|
||||||
|
R.string.zodiac_sagittarius,
|
||||||
|
R.string.zodiac_capricorn,
|
||||||
|
R.string.zodiac_aquarius,
|
||||||
|
R.string.zodiac_pisces
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据存储的星座字符串(可能是任何语言)找到对应的资源ID
|
||||||
|
* 如果找不到,返回null
|
||||||
|
*/
|
||||||
|
@Composable
|
||||||
|
fun findZodiacResId(storedZodiac: String?): Int? {
|
||||||
|
if (storedZodiac.isNullOrEmpty()) return null
|
||||||
|
|
||||||
|
// 尝试在所有语言的资源中查找匹配
|
||||||
|
ZODIAC_SIGN_RES_IDS.forEachIndexed { index, resId ->
|
||||||
|
val zodiacText = stringResource(resId)
|
||||||
|
if (zodiacText == storedZodiac) {
|
||||||
|
return resId
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果找不到精确匹配,尝试通过资源ID索引查找(兼容旧数据)
|
||||||
|
// 这里可以根据需要添加更多兼容逻辑
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun ZodiacSelectScreen() {
|
||||||
|
val navController = LocalNavController.current
|
||||||
|
val appColors = LocalAppTheme.current
|
||||||
|
val model = AccountEditViewModel
|
||||||
|
val currentZodiacResId = findZodiacResId(model.zodiac)
|
||||||
|
|
||||||
|
Column(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxSize()
|
||||||
|
.background(appColors.profileBackground)
|
||||||
|
) {
|
||||||
|
// 头部
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.padding(vertical = 16.dp)
|
||||||
|
) {
|
||||||
|
NoticeScreenHeader(
|
||||||
|
title = stringResource(R.string.choose_zodiac),
|
||||||
|
moreIcon = false
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 列表
|
||||||
|
LazyColumn(
|
||||||
|
modifier = Modifier.fillMaxSize(),
|
||||||
|
contentPadding = androidx.compose.foundation.layout.PaddingValues(horizontal = 16.dp, vertical = 8.dp)
|
||||||
|
) {
|
||||||
|
items(ZODIAC_SIGN_RES_IDS.size) { index ->
|
||||||
|
val zodiacResId = ZODIAC_SIGN_RES_IDS[index]
|
||||||
|
val zodiacText = stringResource(zodiacResId)
|
||||||
|
ZodiacItem(
|
||||||
|
zodiac = zodiacText,
|
||||||
|
zodiacResId = zodiacResId,
|
||||||
|
isSelected = zodiacResId == currentZodiacResId,
|
||||||
|
onClick = {
|
||||||
|
// 保存当前语言的星座文本
|
||||||
|
model.zodiac = zodiacText
|
||||||
|
// 立即保存到本地存储,确保选择后立即生效
|
||||||
|
AppState.UserId?.let { uid ->
|
||||||
|
com.aiosman.ravenow.AppStore.setUserZodiac(uid, zodiacText)
|
||||||
|
}
|
||||||
|
navController.navigateUp()
|
||||||
|
}
|
||||||
|
)
|
||||||
|
Spacer(modifier = Modifier.height(8.dp))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun ZodiacItem(
|
||||||
|
zodiac: String,
|
||||||
|
zodiacResId: Int,
|
||||||
|
isSelected: Boolean,
|
||||||
|
onClick: () -> Unit
|
||||||
|
) {
|
||||||
|
val appColors = LocalAppTheme.current
|
||||||
|
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.clip(RoundedCornerShape(16.dp))
|
||||||
|
.background(if (isSelected) appColors.main.copy(alpha = 0.1f) else Color.White)
|
||||||
|
.clickable(
|
||||||
|
indication = null,
|
||||||
|
interactionSource = remember { MutableInteractionSource() }
|
||||||
|
) {
|
||||||
|
onClick()
|
||||||
|
}
|
||||||
|
.padding(16.dp)
|
||||||
|
) {
|
||||||
|
Row(
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
verticalAlignment = Alignment.CenterVertically
|
||||||
|
) {
|
||||||
|
Text(
|
||||||
|
text = zodiac,
|
||||||
|
fontSize = 17.sp,
|
||||||
|
fontWeight = FontWeight.Normal,
|
||||||
|
color = if (isSelected) appColors.main else appColors.text,
|
||||||
|
modifier = Modifier.weight(1f)
|
||||||
|
)
|
||||||
|
|
||||||
|
if (isSelected) {
|
||||||
|
Icon(
|
||||||
|
imageVector = Icons.Default.Check,
|
||||||
|
contentDescription = "Selected",
|
||||||
|
modifier = Modifier.size(20.dp),
|
||||||
|
tint = appColors.main
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -4,19 +4,26 @@ import android.content.Context
|
|||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import androidx.compose.foundation.background
|
import androidx.compose.foundation.background
|
||||||
|
import androidx.compose.foundation.border
|
||||||
|
import androidx.compose.foundation.clickable
|
||||||
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
|
import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.Spacer
|
import androidx.compose.foundation.layout.Spacer
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.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.foundation.layout.width
|
||||||
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.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.ArrowForward
|
||||||
import androidx.compose.material.icons.filled.Check
|
import androidx.compose.material.icons.filled.Check
|
||||||
|
import androidx.compose.material.icons.filled.Edit as EditIcon
|
||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.LaunchedEffect
|
import androidx.compose.runtime.LaunchedEffect
|
||||||
@@ -28,10 +35,14 @@ 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.Color
|
||||||
|
import androidx.compose.ui.graphics.ColorFilter
|
||||||
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.painterResource
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
|
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.lifecycle.viewModelScope
|
import androidx.lifecycle.viewModelScope
|
||||||
import com.aiosman.ravenow.AppState
|
import com.aiosman.ravenow.AppState
|
||||||
import com.aiosman.ravenow.AppStore
|
import com.aiosman.ravenow.AppStore
|
||||||
@@ -39,26 +50,26 @@ import com.aiosman.ravenow.LocalAppTheme
|
|||||||
import com.aiosman.ravenow.LocalNavController
|
import com.aiosman.ravenow.LocalNavController
|
||||||
import com.aiosman.ravenow.R
|
import com.aiosman.ravenow.R
|
||||||
import com.aiosman.ravenow.ui.NavigationRoute
|
import com.aiosman.ravenow.ui.NavigationRoute
|
||||||
import com.aiosman.ravenow.ui.comment.NoticeScreenHeader
|
|
||||||
import com.aiosman.ravenow.ui.composables.CustomAsyncImage
|
import com.aiosman.ravenow.ui.composables.CustomAsyncImage
|
||||||
import com.aiosman.ravenow.ui.composables.StatusBarMaskLayout
|
import com.aiosman.ravenow.ui.composables.StatusBarMaskLayout
|
||||||
import com.aiosman.ravenow.ui.composables.StatusBarSpacer
|
|
||||||
import com.aiosman.ravenow.ui.composables.form.FormTextInput
|
|
||||||
import com.aiosman.ravenow.ui.composables.debouncedClickable
|
import com.aiosman.ravenow.ui.composables.debouncedClickable
|
||||||
import com.aiosman.ravenow.ui.composables.rememberDebouncedNavigation
|
import com.aiosman.ravenow.ui.composables.rememberDebouncedNavigation
|
||||||
|
import com.google.accompanist.systemuicontroller.rememberSystemUiController
|
||||||
import com.aiosman.ravenow.ui.modifiers.noRippleClickable
|
import com.aiosman.ravenow.ui.modifiers.noRippleClickable
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import androidx.compose.foundation.Image
|
import androidx.compose.foundation.Image
|
||||||
import androidx.compose.foundation.layout.width
|
import androidx.compose.foundation.layout.WindowInsets
|
||||||
|
import androidx.compose.foundation.layout.asPaddingValues
|
||||||
|
import androidx.compose.foundation.layout.offset
|
||||||
|
import androidx.compose.foundation.layout.systemBars
|
||||||
|
import androidx.compose.foundation.text.BasicTextField
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.rememberCoroutineScope
|
import androidx.compose.runtime.rememberCoroutineScope
|
||||||
import androidx.compose.ui.draw.shadow
|
import androidx.compose.ui.draw.shadow
|
||||||
import androidx.compose.ui.graphics.Brush
|
import androidx.compose.ui.graphics.Brush
|
||||||
import androidx.compose.ui.res.painterResource
|
import androidx.compose.ui.graphics.SolidColor
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
|
||||||
import androidx.compose.ui.unit.sp
|
|
||||||
import com.aiosman.ravenow.ConstVars
|
import com.aiosman.ravenow.ConstVars
|
||||||
import com.aiosman.ravenow.ui.composables.pickupAndCompressLauncher
|
import com.aiosman.ravenow.ui.composables.pickupAndCompressLauncher
|
||||||
import java.io.File
|
import java.io.File
|
||||||
@@ -94,9 +105,9 @@ fun AccountEditScreen2(onUpdateBanner: ((Uri, File, Context) -> Unit)? = null,)
|
|||||||
val cleanValue = value.replace("\n", "").replace("\r", "")
|
val cleanValue = value.replace("\n", "").replace("\r", "")
|
||||||
model.name = cleanValue
|
model.name = cleanValue
|
||||||
usernameError = when {
|
usernameError = when {
|
||||||
cleanValue.trim().isEmpty() -> "昵称不能为空"
|
cleanValue.trim().isEmpty() -> context.getString(R.string.error_nickname_empty)
|
||||||
cleanValue.length < 3 -> "昵称长度不能小于3"
|
cleanValue.length < 3 -> context.getString(R.string.error_nickname_too_short)
|
||||||
cleanValue.length > 20 -> "昵称长度不能大于20"
|
cleanValue.length > 20 -> context.getString(R.string.error_nickname_too_long)
|
||||||
else -> null
|
else -> null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -108,7 +119,7 @@ fun AccountEditScreen2(onUpdateBanner: ((Uri, File, Context) -> Unit)? = null,)
|
|||||||
val cleanValue = value.replace("\n", "").replace("\r", "")
|
val cleanValue = value.replace("\n", "").replace("\r", "")
|
||||||
model.bio = cleanValue
|
model.bio = cleanValue
|
||||||
bioError = when {
|
bioError = when {
|
||||||
cleanValue.length > 100 -> "个人简介长度不能大于100"
|
cleanValue.length > 100 -> context.getString(R.string.error_bio_too_long)
|
||||||
else -> null
|
else -> null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -134,29 +145,313 @@ fun AccountEditScreen2(onUpdateBanner: ((Uri, File, Context) -> Unit)? = null,)
|
|||||||
// 确保显示的是当前登录用户的信息,而不是之前用户的缓存数据
|
// 确保显示的是当前登录用户的信息,而不是之前用户的缓存数据
|
||||||
model.reloadProfile()
|
model.reloadProfile()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 设置状态栏为透明,使用浅色图标(因为顶部背景是深色图片)
|
||||||
|
val systemUiController = rememberSystemUiController()
|
||||||
|
LaunchedEffect(Unit) {
|
||||||
|
systemUiController.setStatusBarColor(Color.Transparent, darkIcons = false)
|
||||||
|
}
|
||||||
|
|
||||||
StatusBarMaskLayout(
|
StatusBarMaskLayout(
|
||||||
modifier = Modifier.background(color = appColors.background).padding(horizontal = 16.dp),
|
modifier = Modifier.background(Color(0xFFFAF9FB)),
|
||||||
darkIcons = !AppState.darkMode,
|
darkIcons = false, // 浅色图标(白色),因为顶部背景是深色
|
||||||
maskBoxBackgroundColor = appColors.background
|
maskBoxBackgroundColor = Color.Transparent
|
||||||
) {
|
) {
|
||||||
Column(
|
Box(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
.background(color = appColors.background),
|
.background(Color(0xFFFAF9FB))
|
||||||
horizontalAlignment = Alignment.CenterHorizontally
|
|
||||||
) {
|
) {
|
||||||
//StatusBarSpacer()
|
when {
|
||||||
|
model.isLoading -> {
|
||||||
|
// 加载中状态
|
||||||
Box(
|
Box(
|
||||||
modifier = Modifier.padding(horizontal = 0.dp, vertical = 16.dp)
|
modifier = Modifier.fillMaxSize(),
|
||||||
|
contentAlignment = Alignment.Center
|
||||||
) {
|
) {
|
||||||
NoticeScreenHeader(
|
androidx.compose.material3.CircularProgressIndicator(
|
||||||
title = stringResource(R.string.edit_profile),
|
color = appColors.main
|
||||||
moreIcon = false
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
model.profile != null -> {
|
||||||
|
Column(
|
||||||
|
modifier = Modifier.fillMaxSize()
|
||||||
) {
|
) {
|
||||||
|
// 顶部背景区域(圆角在底部,覆盖状态栏)
|
||||||
Icon(
|
val banner = model.profile?.banner
|
||||||
|
val statusBarPadding = WindowInsets.systemBars.asPaddingValues().calculateTopPadding()
|
||||||
|
Box(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.size(24.dp)
|
.fillMaxWidth()
|
||||||
|
.offset(y = -statusBarPadding)
|
||||||
|
) {
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.width(402.dp)
|
||||||
|
.height(206.dp)
|
||||||
|
.align(Alignment.TopCenter)
|
||||||
|
.clip(RoundedCornerShape(bottomStart = 32.dp, bottomEnd = 32.dp))
|
||||||
|
) {
|
||||||
|
if (banner != null) {
|
||||||
|
CustomAsyncImage(
|
||||||
|
context = context,
|
||||||
|
imageUrl = banner,
|
||||||
|
modifier = Modifier.fillMaxSize(),
|
||||||
|
contentDescription = "Banner",
|
||||||
|
contentScale = ContentScale.Crop
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxSize()
|
||||||
|
.background(Color.Gray.copy(alpha = 0.2f))
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更换封面按钮(位于壁纸右下方)
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.align(Alignment.BottomEnd)
|
||||||
|
.padding(end = 16.dp, bottom = 20.dp)
|
||||||
|
.clip(RoundedCornerShape(12.dp))
|
||||||
|
.background(Color(0x5C7D7C80)) // RGB(125, 120, 128, 0.36)
|
||||||
|
.padding(horizontal = 8.dp, vertical = 4.dp)
|
||||||
|
.noRippleClickable {
|
||||||
|
Intent(Intent.ACTION_PICK).apply {
|
||||||
|
type = "image/*"
|
||||||
|
pickBannerImageLauncher.launch(this)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
Row(
|
||||||
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
|
horizontalArrangement = Arrangement.spacedBy(4.dp)
|
||||||
|
) {
|
||||||
|
// 更换封面图标
|
||||||
|
Icon(
|
||||||
|
painter = painterResource(
|
||||||
|
id = if (AppState.darkMode) {
|
||||||
|
// TODO: 添加更换封面暗色模式图标
|
||||||
|
R.mipmap.frame_4 // 临时占位,需替换为实际图标
|
||||||
|
} else {
|
||||||
|
// TODO: 添加更换封面亮色模式图标
|
||||||
|
R.mipmap.fengm // 临时占位,需替换为实际图标
|
||||||
|
}
|
||||||
|
),
|
||||||
|
contentDescription = null,
|
||||||
|
modifier = Modifier.size(16.dp),
|
||||||
|
tint = Color.White
|
||||||
|
)
|
||||||
|
Text(
|
||||||
|
text = stringResource(R.string.change_cover),
|
||||||
|
fontSize = 12.sp,
|
||||||
|
color = Color.White
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 状态栏区域(时间、信号、电池)
|
||||||
|
// 这里使用系统状态栏,不单独实现
|
||||||
|
|
||||||
|
// 导航栏区域
|
||||||
|
Column(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.padding(horizontal = 16.dp)
|
||||||
|
) {
|
||||||
|
Spacer(modifier = Modifier.height(statusBarPadding + 12.dp))
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.padding(bottom = 12.dp)
|
||||||
|
) {
|
||||||
|
// 返回按钮
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.size(44.dp)
|
||||||
|
.clip(CircleShape)
|
||||||
|
.background(Color.White.copy(alpha = 0.3f))
|
||||||
|
.noRippleClickable {
|
||||||
|
navController.navigateUp()
|
||||||
|
}
|
||||||
|
.align(Alignment.CenterStart),
|
||||||
|
contentAlignment = Alignment.Center
|
||||||
|
) {
|
||||||
|
Image(
|
||||||
|
painter = painterResource(id = R.drawable.rider_pro_back_icon),
|
||||||
|
contentDescription = "Back",
|
||||||
|
modifier = Modifier.size(24.dp),
|
||||||
|
colorFilter = ColorFilter.tint(Color.White)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 标题
|
||||||
|
Text(
|
||||||
|
text = stringResource(R.string.edit_profile_info),
|
||||||
|
fontSize = 17.sp,
|
||||||
|
fontWeight = FontWeight.SemiBold,
|
||||||
|
color = Color.White,
|
||||||
|
modifier = Modifier.align(Alignment.Center)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 用户头像区域(距离顶部-50dp,包含状态栏高度,左右居中)
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.offset(y = (-50).dp - statusBarPadding),
|
||||||
|
contentAlignment = Alignment.Center
|
||||||
|
) {
|
||||||
|
val it = model.profile!!
|
||||||
|
Box(
|
||||||
|
modifier = Modifier.size(96.dp),
|
||||||
|
contentAlignment = Alignment.BottomEnd
|
||||||
|
) {
|
||||||
|
// 头像
|
||||||
|
CustomAsyncImage(
|
||||||
|
context,
|
||||||
|
model.croppedBitmap ?: it.avatar,
|
||||||
|
modifier = Modifier
|
||||||
|
.size(96.dp)
|
||||||
|
.clip(CircleShape)
|
||||||
|
.border(2.4.dp, Color(0xFFFAF9FB), CircleShape),
|
||||||
|
contentDescription = "",
|
||||||
|
contentScale = ContentScale.Crop
|
||||||
|
)
|
||||||
|
|
||||||
|
// 编辑头像按钮
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.size(28.dp)
|
||||||
|
.clip(CircleShape)
|
||||||
|
.background(Color(0xFF110C13))
|
||||||
|
.border(2.dp, Color.White, CircleShape)
|
||||||
|
.debouncedClickable(debounceTime = 800L) {
|
||||||
|
debouncedNavigation {
|
||||||
|
navController.navigate(NavigationRoute.ImageCrop.route)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
contentAlignment = Alignment.Center
|
||||||
|
) {
|
||||||
|
Icon(
|
||||||
|
painter = painterResource(
|
||||||
|
id = if (AppState.darkMode) {
|
||||||
|
// TODO: 添加编辑头像暗色模式图标
|
||||||
|
R.mipmap.frame_4 // 临时占位,需替换为实际图标
|
||||||
|
} else {
|
||||||
|
// TODO: 添加编辑头像亮色模式图标
|
||||||
|
R.mipmap.bi // 临时占位,需替换为实际图标
|
||||||
|
}
|
||||||
|
),
|
||||||
|
contentDescription = "Edit Avatar",
|
||||||
|
modifier = Modifier.size(16.dp),
|
||||||
|
tint = Color.White
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Column(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.weight(1f)
|
||||||
|
.padding(horizontal = 16.dp)
|
||||||
|
.offset(y = (-74).dp)//
|
||||||
|
) {
|
||||||
|
// 昵称输入框
|
||||||
|
ProfileInfoCard(
|
||||||
|
label = stringResource(R.string.nickname),
|
||||||
|
value = model.name,
|
||||||
|
placeholder = "Value",
|
||||||
|
onValueChange = { onNicknameChange(it) },
|
||||||
|
isMultiline = false
|
||||||
|
)
|
||||||
|
|
||||||
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
|
|
||||||
|
// 个人简介输入框
|
||||||
|
ProfileInfoCard(
|
||||||
|
label = stringResource(R.string.personal_intro),
|
||||||
|
value = model.bio,
|
||||||
|
placeholder = "Welcome to my fantiac word i will show you something about magic",
|
||||||
|
onValueChange = { onBioChange(it) },
|
||||||
|
isMultiline = true
|
||||||
|
)
|
||||||
|
|
||||||
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
|
|
||||||
|
// MBTI 类型和星座
|
||||||
|
Column(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.clip(RoundedCornerShape(16.dp))
|
||||||
|
.background(Color.White)
|
||||||
|
) {
|
||||||
|
// MBTI 类型
|
||||||
|
ProfileSelectItem(
|
||||||
|
label = stringResource(R.string.mbti_type),
|
||||||
|
value = model.mbti ?: "ENFP",
|
||||||
|
iconColor = Color(0xFF7C45ED),
|
||||||
|
iconResDark = null, // TODO: 添加MBTI暗色模式图标
|
||||||
|
iconResLight = null, // TODO: 添加MBTI亮色模式图标
|
||||||
|
onClick = {
|
||||||
|
debouncedNavigation {
|
||||||
|
navController.navigate(NavigationRoute.MbtiSelect.route)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
// 分隔线
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.height(0.3.dp)
|
||||||
|
.background(Color(0x41413C43).copy(alpha = 0.2f))
|
||||||
|
.padding(horizontal = 16.dp)
|
||||||
|
)
|
||||||
|
|
||||||
|
// 星座(使用当前图标)
|
||||||
|
ProfileSelectItem(
|
||||||
|
label = stringResource(R.string.zodiac),
|
||||||
|
value = model.zodiac?.let { storedZodiac ->
|
||||||
|
// 尝试找到对应的资源ID并显示当前语言的文本
|
||||||
|
findZodiacResId(storedZodiac)?.let { resId ->
|
||||||
|
stringResource(resId)
|
||||||
|
} ?: storedZodiac // 如果找不到,显示原始存储的值
|
||||||
|
} ?: stringResource(R.string.zodiac_aries),
|
||||||
|
iconColor = Color(0xFFFFCC00),
|
||||||
|
iconResDark = R.mipmap.frame_4, // 星座暗色模式图标
|
||||||
|
iconResLight = R.mipmap.xingzuo, // 星座亮色模式图标
|
||||||
|
onClick = {
|
||||||
|
debouncedNavigation {
|
||||||
|
navController.navigate(NavigationRoute.ZodiacSelect.route)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
Spacer(modifier = Modifier.weight(1f))
|
||||||
|
|
||||||
|
// 保存按钮
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.height(50.dp)
|
||||||
|
.clip(RoundedCornerShape(1000.dp))
|
||||||
|
.background(
|
||||||
|
brush = Brush.horizontalGradient(
|
||||||
|
colors = listOf(
|
||||||
|
Color(0xFF7C45ED), // RGB(124, 69, 237) - 左侧
|
||||||
|
Color(0xFF7C57EE), // RGB(124, 87, 238) - 中间
|
||||||
|
Color(0xFF7BD8F8) // RGB(123, 216, 248) - 右侧
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
.debouncedClickable(
|
.debouncedClickable(
|
||||||
enabled = validate() && !model.isUpdating,
|
enabled = validate() && !model.isUpdating,
|
||||||
debounceTime = 1000L
|
debounceTime = 1000L
|
||||||
@@ -174,177 +469,170 @@ fun AccountEditScreen2(onUpdateBanner: ((Uri, File, Context) -> Unit)? = null,)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
imageVector = Icons.Default.Check,
|
contentAlignment = Alignment.Center
|
||||||
contentDescription = "保存",
|
|
||||||
tint = if (validate() && !model.isUpdating) appColors.text else appColors.nonActiveText
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// 添加横幅图片区域
|
|
||||||
val banner = model.profile?.banner
|
|
||||||
|
|
||||||
Box(
|
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.height(300.dp)
|
|
||||||
.clip(RoundedCornerShape(12.dp))
|
|
||||||
) {
|
|
||||||
if (banner != null) {
|
|
||||||
CustomAsyncImage(
|
|
||||||
context = LocalContext.current,
|
|
||||||
imageUrl = banner,
|
|
||||||
modifier = Modifier.fillMaxSize(),
|
|
||||||
contentDescription = "Banner",
|
|
||||||
contentScale = ContentScale.Crop
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
Box(
|
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxSize()
|
|
||||||
.background(Color.Gray.copy(alpha = 0.1f))
|
|
||||||
)
|
|
||||||
}
|
|
||||||
Box(
|
|
||||||
modifier = Modifier
|
|
||||||
.width(120.dp)
|
|
||||||
.height(42.dp)
|
|
||||||
.align(Alignment.BottomEnd)
|
|
||||||
.padding(end = 12.dp, bottom = 12.dp)
|
|
||||||
.background(
|
|
||||||
color = Color.Black.copy(alpha = 0.4f),
|
|
||||||
shape = RoundedCornerShape(9.dp)
|
|
||||||
)
|
|
||||||
.noRippleClickable {
|
|
||||||
Intent(Intent.ACTION_PICK).apply {
|
|
||||||
type = "image/*"
|
|
||||||
pickBannerImageLauncher.launch(this)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
text = "change",
|
text = stringResource(R.string.save),
|
||||||
fontSize = 14.sp,
|
fontSize = 17.sp,
|
||||||
fontWeight = FontWeight.W600,
|
fontWeight = FontWeight.Normal,
|
||||||
color = Color.White,
|
color = Color.White
|
||||||
modifier = Modifier.align(Alignment.Center)
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Spacer(modifier = Modifier.height(20.dp))
|
|
||||||
|
|
||||||
// 显示内容或加载状态
|
|
||||||
Log.d("AccountEditScreen2", "UI状态 - profile: ${model.profile?.nickName}, isLoading: ${model.isLoading}")
|
|
||||||
when {
|
|
||||||
model.profile != null -> {
|
|
||||||
Log.d("AccountEditScreen2", "显示用户资料内容")
|
|
||||||
// 有数据时显示内容
|
|
||||||
val it = model.profile!!
|
|
||||||
Box(
|
|
||||||
modifier = Modifier.size(88.dp),
|
|
||||||
contentAlignment = Alignment.Center
|
|
||||||
) {
|
|
||||||
CustomAsyncImage(
|
|
||||||
context,
|
|
||||||
model.croppedBitmap ?: it.avatar,
|
|
||||||
modifier = Modifier
|
|
||||||
.size(88.dp)
|
|
||||||
.clip(
|
|
||||||
RoundedCornerShape(88.dp)
|
|
||||||
),
|
|
||||||
contentDescription = "",
|
|
||||||
contentScale = ContentScale.Crop
|
|
||||||
)
|
|
||||||
Box(
|
|
||||||
modifier = Modifier
|
|
||||||
.size(32.dp)
|
|
||||||
.clip(CircleShape)
|
|
||||||
.background(
|
|
||||||
brush = Brush.linearGradient(
|
|
||||||
colors = listOf(
|
|
||||||
Color(0xFF7c45ed),
|
|
||||||
Color(0x997c68ef),
|
|
||||||
Color(0xFF7bd8f8)
|
|
||||||
)
|
|
||||||
),
|
|
||||||
)
|
|
||||||
.align(Alignment.BottomEnd)
|
|
||||||
.debouncedClickable(
|
|
||||||
debounceTime = 800L
|
|
||||||
) {
|
|
||||||
debouncedNavigation {
|
|
||||||
navController.navigate(NavigationRoute.ImageCrop.route)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
contentAlignment = Alignment.Center
|
|
||||||
) {
|
|
||||||
Icon(
|
|
||||||
Icons.Default.Add,
|
|
||||||
contentDescription = "Add",
|
|
||||||
tint = Color.White,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Spacer(modifier = Modifier.height(18.dp))
|
|
||||||
Column(
|
|
||||||
modifier = Modifier
|
|
||||||
.weight(1f)
|
|
||||||
.padding(horizontal = 16.dp)
|
|
||||||
) {
|
|
||||||
FormTextInput(
|
|
||||||
value = model.name,
|
|
||||||
label = stringResource(R.string.nickname),
|
|
||||||
hint = "Input nickname",
|
|
||||||
modifier = Modifier.fillMaxWidth(),
|
|
||||||
error = usernameError
|
|
||||||
) { value ->
|
|
||||||
onNicknameChange(value)
|
|
||||||
}
|
|
||||||
FormTextInput(
|
|
||||||
value = model.bio,
|
|
||||||
label = stringResource(R.string.bio),
|
|
||||||
hint = "Input bio",
|
|
||||||
modifier = Modifier.fillMaxWidth(),
|
|
||||||
error = bioError
|
|
||||||
) { value ->
|
|
||||||
onBioChange(value)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
model.isLoading -> {
|
|
||||||
Log.d("AccountEditScreen2", "显示加载指示器")
|
|
||||||
// 加载中状态
|
|
||||||
Box(
|
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxSize()
|
|
||||||
.padding(16.dp),
|
|
||||||
contentAlignment = Alignment.Center
|
|
||||||
) {
|
|
||||||
androidx.compose.material3.CircularProgressIndicator(
|
|
||||||
color = appColors.main
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
Log.d("AccountEditScreen2", "显示错误信息 - 没有数据且不在加载中")
|
|
||||||
// 没有数据且不在加载中,显示错误信息
|
// 没有数据且不在加载中,显示错误信息
|
||||||
Box(
|
Box(
|
||||||
modifier = Modifier
|
modifier = Modifier.fillMaxSize(),
|
||||||
.fillMaxSize()
|
|
||||||
.padding(16.dp),
|
|
||||||
contentAlignment = Alignment.Center
|
contentAlignment = Alignment.Center
|
||||||
) {
|
) {
|
||||||
androidx.compose.material3.Text(
|
Text(
|
||||||
text = "加载用户资料失败,请重试",
|
text = stringResource(R.string.error_load_profile_failed),
|
||||||
color = appColors.text
|
color = appColors.text
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 信息输入卡片组件
|
||||||
|
*/
|
||||||
|
@Composable
|
||||||
|
fun ProfileInfoCard(
|
||||||
|
label: String,
|
||||||
|
value: String,
|
||||||
|
placeholder: String,
|
||||||
|
onValueChange: (String) -> Unit,
|
||||||
|
isMultiline: Boolean = false
|
||||||
|
) {
|
||||||
|
val appColors = LocalAppTheme.current
|
||||||
|
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.height(if (isMultiline) 66.dp else 56.dp) // 昵称框高度56dp,个人简介66dp
|
||||||
|
.clip(RoundedCornerShape(16.dp))
|
||||||
|
.background(Color.White),
|
||||||
|
contentAlignment = if (isMultiline) Alignment.TopStart else Alignment.CenterStart
|
||||||
|
) {
|
||||||
|
Row(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.padding(horizontal = 16.dp)
|
||||||
|
.padding(vertical = if (isMultiline) 11.dp else 0.dp),
|
||||||
|
verticalAlignment = if (isMultiline) Alignment.Top else Alignment.CenterVertically
|
||||||
|
) {
|
||||||
|
// 标签
|
||||||
|
Text(
|
||||||
|
text = label,
|
||||||
|
fontSize = 17.sp,
|
||||||
|
fontWeight = FontWeight.Normal,
|
||||||
|
color = Color.Black,
|
||||||
|
modifier = Modifier.width(100.dp)
|
||||||
|
)
|
||||||
|
|
||||||
|
Spacer(modifier = Modifier.width(16.dp))
|
||||||
|
|
||||||
|
// 输入框
|
||||||
|
Box(
|
||||||
|
modifier = Modifier.weight(1f)
|
||||||
|
) {
|
||||||
|
if (value.isEmpty()) {
|
||||||
|
Text(
|
||||||
|
text = placeholder,
|
||||||
|
fontSize = if (isMultiline) 15.sp else 17.sp,
|
||||||
|
fontWeight = FontWeight.Normal,
|
||||||
|
color = Color(0x993C3C43),
|
||||||
|
modifier = Modifier.fillMaxWidth()
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
BasicTextField(
|
||||||
|
value = value,
|
||||||
|
onValueChange = onValueChange,
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
textStyle = androidx.compose.ui.text.TextStyle(
|
||||||
|
fontSize = if (isMultiline) 15.sp else 17.sp,
|
||||||
|
fontWeight = FontWeight.Normal,
|
||||||
|
color = Color.Black
|
||||||
|
),
|
||||||
|
cursorBrush = SolidColor(Color.Black),
|
||||||
|
maxLines = if (isMultiline) Int.MAX_VALUE else 1,
|
||||||
|
singleLine = !isMultiline
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 选择项组件(MBTI、星座)
|
||||||
|
*/
|
||||||
|
@Composable
|
||||||
|
fun ProfileSelectItem(
|
||||||
|
label: String,
|
||||||
|
value: String,
|
||||||
|
iconColor: Color,
|
||||||
|
onClick: () -> Unit,
|
||||||
|
iconResDark: Int? = null,
|
||||||
|
iconResLight: Int? = null
|
||||||
|
) {
|
||||||
|
Row(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.height(56.dp)
|
||||||
|
.clickable(onClick = onClick)
|
||||||
|
.padding(horizontal = 16.dp),
|
||||||
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
|
horizontalArrangement = Arrangement.SpaceBetween
|
||||||
|
) {
|
||||||
|
Row(
|
||||||
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
|
horizontalArrangement = Arrangement.spacedBy(8.dp)
|
||||||
|
) {
|
||||||
|
// 自定义图标
|
||||||
|
Icon(
|
||||||
|
painter = painterResource(
|
||||||
|
id = if (AppState.darkMode) {
|
||||||
|
iconResDark ?: R.mipmap.frame_4 // 使用传入的暗色模式图标,或默认占位
|
||||||
|
} else {
|
||||||
|
iconResLight ?: R.mipmap.naoz // 使用传入的亮色模式图标,或默认占位
|
||||||
|
}
|
||||||
|
),
|
||||||
|
contentDescription = null,
|
||||||
|
modifier = Modifier.size(24.dp),
|
||||||
|
tint = iconColor
|
||||||
|
)
|
||||||
|
|
||||||
|
Text(
|
||||||
|
text = label,
|
||||||
|
fontSize = 17.sp,
|
||||||
|
fontWeight = FontWeight.Normal,
|
||||||
|
color = Color.Black
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
Row(
|
||||||
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
|
horizontalArrangement = Arrangement.spacedBy(16.dp)
|
||||||
|
) {
|
||||||
|
Text(
|
||||||
|
text = value,
|
||||||
|
fontSize = 17.sp,
|
||||||
|
fontWeight = FontWeight.Normal,
|
||||||
|
color = Color(0x993C3C43)
|
||||||
|
)
|
||||||
|
|
||||||
|
Icon(
|
||||||
|
imageVector = Icons.Default.ArrowForward,
|
||||||
|
contentDescription = null,
|
||||||
|
modifier = Modifier.size(8.dp),
|
||||||
|
tint = Color(0x4D3C3C43)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -125,12 +125,13 @@ fun CommentNoticeScreen() {
|
|||||||
) {
|
) {
|
||||||
androidx.compose.foundation.Image(
|
androidx.compose.foundation.Image(
|
||||||
painter = painterResource(
|
painter = painterResource(
|
||||||
id =if(AppState.darkMode) R.mipmap.qst_pl_qs_as_img
|
id = if(AppState.darkMode) R.mipmap.tietie_dark
|
||||||
else R.mipmap.invalid_name_11),
|
else R.mipmap.invalid_name_11),
|
||||||
contentDescription = "No Comment",
|
contentDescription = "No Comment",
|
||||||
modifier = Modifier.size(181.dp)
|
modifier = Modifier
|
||||||
|
.size(width = 181.dp, height = 153.dp)
|
||||||
)
|
)
|
||||||
Spacer(modifier = Modifier.size(24.dp))
|
Spacer(modifier = Modifier.height(24.dp))
|
||||||
Text(
|
Text(
|
||||||
text = "等一位旅人~",
|
text = "等一位旅人~",
|
||||||
color = AppColors.text,
|
color = AppColors.text,
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ 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.TextStyle
|
import androidx.compose.ui.text.TextStyle
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
@@ -32,7 +33,7 @@ fun FollowButton(
|
|||||||
.wrapContentWidth()
|
.wrapContentWidth()
|
||||||
.clip(RoundedCornerShape(8.dp))
|
.clip(RoundedCornerShape(8.dp))
|
||||||
.background(
|
.background(
|
||||||
color = if (isFollowing) AppColors.main else AppColors.nonActive
|
color = if (isFollowing) AppColors.nonActive else AppColors.nonActive
|
||||||
)
|
)
|
||||||
.padding(horizontal = 16.dp, vertical = 8.dp)
|
.padding(horizontal = 16.dp, vertical = 8.dp)
|
||||||
.noRippleClickable {
|
.noRippleClickable {
|
||||||
@@ -41,11 +42,9 @@ fun FollowButton(
|
|||||||
contentAlignment = Alignment.Center
|
contentAlignment = Alignment.Center
|
||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
text = if (isFollowing) stringResource(R.string.following_upper) else stringResource(
|
text = if (isFollowing) stringResource(R.string.follow_upper_had) else stringResource(R.string.follow_upper),
|
||||||
R.string.follow_upper
|
|
||||||
),
|
|
||||||
fontSize = fontSize,
|
fontSize = fontSize,
|
||||||
color = if (isFollowing) AppColors.mainText else AppColors.text,
|
color = if (isFollowing) AppColors.text else AppColors.text,
|
||||||
style = TextStyle(fontWeight = FontWeight.Bold)
|
style = TextStyle(fontWeight = FontWeight.Bold)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,6 +43,10 @@ import com.aiosman.ravenow.LocalAppTheme
|
|||||||
import com.aiosman.ravenow.R
|
import com.aiosman.ravenow.R
|
||||||
import com.aiosman.ravenow.ui.modifiers.noRippleClickable
|
import com.aiosman.ravenow.ui.modifiers.noRippleClickable
|
||||||
|
|
||||||
|
private val LabelTextColor = Color(red = 60f / 255f, green = 60f / 255f, blue = 67f / 255f, alpha = 0.6f)
|
||||||
|
private val HintTextColor = Color(red = 60f / 255f, green = 60f / 255f, blue = 67f / 255f, alpha = 0.3f)
|
||||||
|
private val PasswordIconColor = Color(red = 17f / 255f, green = 12f / 255f, blue = 19f / 255f)
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun TextInputField(
|
fun TextInputField(
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
@@ -52,67 +56,94 @@ fun TextInputField(
|
|||||||
label: String? = null,
|
label: String? = null,
|
||||||
hint: String? = null,
|
hint: String? = null,
|
||||||
error: String? = null,
|
error: String? = null,
|
||||||
enabled: Boolean = true
|
enabled: Boolean = true,
|
||||||
|
leadingIcon: @Composable (() -> Unit)? = null,
|
||||||
|
customBackgroundColor: Color? = null,
|
||||||
|
customCornerRadius: Float = 24f
|
||||||
) {
|
) {
|
||||||
val AppColors = LocalAppTheme.current
|
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) }
|
||||||
|
val backgroundColor = customBackgroundColor ?: AppColors.inputBackground
|
||||||
Column(modifier = modifier) {
|
Column(modifier = modifier) {
|
||||||
label?.let {
|
label?.let {
|
||||||
Text(it, color = AppColors.secondaryText)
|
Text(
|
||||||
Spacer(modifier = Modifier.height(16.dp))
|
text = it,
|
||||||
|
color = LabelTextColor,
|
||||||
|
fontSize = 13.sp,
|
||||||
|
modifier = Modifier.padding(start = 8.dp, top = 8.dp, bottom = 8.dp)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
Box(
|
Box(
|
||||||
contentAlignment = Alignment.CenterStart,
|
contentAlignment = Alignment.CenterStart,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.clip(RoundedCornerShape(24.dp))
|
.clip(RoundedCornerShape(customCornerRadius.dp))
|
||||||
.background(AppColors.inputBackground)
|
.background(backgroundColor)
|
||||||
.border(
|
.border(
|
||||||
width = 2.dp,
|
width = 2.dp,
|
||||||
color = if (error == null) Color.Transparent else AppColors.error,
|
color = if (error == null) Color.Transparent else AppColors.error,
|
||||||
shape = RoundedCornerShape(24.dp)
|
shape = RoundedCornerShape(customCornerRadius.dp)
|
||||||
)
|
)
|
||||||
.padding(horizontal = 16.dp, vertical = 16.dp)
|
.padding(horizontal = 16.dp, vertical = 16.dp)
|
||||||
) {
|
) {
|
||||||
Row(verticalAlignment = Alignment.CenterVertically){
|
Row(
|
||||||
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
|
modifier = Modifier.fillMaxWidth()
|
||||||
|
){
|
||||||
|
leadingIcon?.let {
|
||||||
|
Box(modifier = Modifier.size(24.dp)) {
|
||||||
|
it()
|
||||||
|
}
|
||||||
|
Spacer(modifier = Modifier.size(12.dp))
|
||||||
|
}
|
||||||
|
Box(modifier = Modifier.weight(1f)) {
|
||||||
BasicTextField(
|
BasicTextField(
|
||||||
value = text,
|
value = text,
|
||||||
onValueChange = onValueChange,
|
onValueChange = onValueChange,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.weight(1f)
|
.fillMaxWidth()
|
||||||
.onFocusChanged { focusState ->
|
.onFocusChanged { focusState ->
|
||||||
isFocused = focusState.isFocused
|
isFocused = focusState.isFocused
|
||||||
},
|
},
|
||||||
textStyle = TextStyle(
|
textStyle = TextStyle(
|
||||||
fontSize = 16.sp,
|
fontSize = 16.sp,
|
||||||
fontWeight = FontWeight.W500,
|
fontWeight = FontWeight.W400,
|
||||||
color = AppColors.text
|
color = AppColors.text
|
||||||
),
|
),
|
||||||
keyboardOptions = KeyboardOptions(
|
keyboardOptions = KeyboardOptions(
|
||||||
keyboardType = if (password) KeyboardType.Password else KeyboardType.Text
|
keyboardType = if (password) KeyboardType.Password else KeyboardType.Email
|
||||||
),
|
),
|
||||||
visualTransformation = if (showPassword) VisualTransformation.None else PasswordVisualTransformation(),
|
visualTransformation = if (showPassword) VisualTransformation.None else PasswordVisualTransformation(),
|
||||||
singleLine = true,
|
singleLine = true,
|
||||||
enabled = enabled,
|
enabled = enabled,
|
||||||
cursorBrush = SolidColor(AppColors.text),
|
cursorBrush = SolidColor(AppColors.text),
|
||||||
)
|
)
|
||||||
if (password) {
|
if (text.isEmpty() && hint != null) {
|
||||||
Image(
|
Text(
|
||||||
painter = painterResource(id = R.drawable.rider_pro_eye),
|
text = hint,
|
||||||
contentDescription = "Password",
|
color = HintTextColor,
|
||||||
modifier = Modifier
|
fontSize = 16.sp,
|
||||||
.size(18.dp)
|
fontWeight = FontWeight.W400
|
||||||
.noRippleClickable {
|
|
||||||
showPassword = !showPassword
|
|
||||||
},
|
|
||||||
colorFilter = ColorFilter.tint(AppColors.text)
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (password) {
|
||||||
if (text.isEmpty()) {
|
Image(
|
||||||
hint?.let {
|
painter = painterResource(
|
||||||
Text(it, modifier = Modifier.padding(start = 5.dp), color = AppColors.inputHint, fontWeight = FontWeight.W600)
|
id = if (showPassword) {
|
||||||
|
R.drawable.rider_pro_eye
|
||||||
|
} else {
|
||||||
|
R.mipmap.icon_eyes_closed_light
|
||||||
|
}
|
||||||
|
),
|
||||||
|
contentDescription = "Password",
|
||||||
|
modifier = Modifier
|
||||||
|
.size(24.dp)
|
||||||
|
.noRippleClickable {
|
||||||
|
showPassword = !showPassword
|
||||||
|
},
|
||||||
|
colorFilter = ColorFilter.tint(PasswordIconColor)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -137,9 +137,9 @@ fun FavouriteListPage() {
|
|||||||
id = if (com.aiosman.ravenow.AppState.darkMode) R.mipmap.invalid_dark
|
id = if (com.aiosman.ravenow.AppState.darkMode) R.mipmap.invalid_dark
|
||||||
else R.mipmap.invalid_name_1),
|
else R.mipmap.invalid_name_1),
|
||||||
contentDescription = "No favourites",
|
contentDescription = "No favourites",
|
||||||
modifier = Modifier.size(110.dp)
|
modifier = Modifier.size(181.dp, 153.dp)
|
||||||
)
|
)
|
||||||
Spacer(modifier = Modifier.size(24.dp))
|
Spacer(modifier = Modifier.size(9.dp)) // 调整间距为9dp
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(R.string.favourites_null),
|
text = stringResource(R.string.favourites_null),
|
||||||
color = AppColors.text,
|
color = AppColors.text,
|
||||||
|
|||||||
@@ -124,21 +124,21 @@ fun FollowerListScreen(userId: Int) {
|
|||||||
) {
|
) {
|
||||||
Image(
|
Image(
|
||||||
painter = painterResource(
|
painter = painterResource(
|
||||||
id =if(AppState.darkMode) R.mipmap.qst_fs_qs_as_img
|
id = if(AppState.darkMode) R.mipmap.frame_4
|
||||||
else R.mipmap.invalid_name_8),
|
else R.mipmap.invalid_name_8),
|
||||||
contentDescription = null,
|
contentDescription = null,
|
||||||
modifier = Modifier.size(181.dp)
|
modifier = Modifier.size(181.dp, 153.dp)
|
||||||
)
|
)
|
||||||
Spacer(modifier = Modifier.size(24.dp))
|
Spacer(modifier = Modifier.size(9.dp)) // 调整间距为9dp
|
||||||
androidx.compose.material.Text(
|
androidx.compose.material.Text(
|
||||||
text = "还没有人关注哦",
|
text = "还没有人关注你呢",
|
||||||
color = appColors.text,
|
color = appColors.text,
|
||||||
fontSize = 16.sp,
|
fontSize = 16.sp,
|
||||||
fontWeight = FontWeight.W600
|
fontWeight = FontWeight.W600
|
||||||
)
|
)
|
||||||
Spacer(modifier = Modifier.size(8.dp))
|
Spacer(modifier = Modifier.size(8.dp))
|
||||||
androidx.compose.material.Text(
|
androidx.compose.material.Text(
|
||||||
text = "去发布动态,吸引更多粉丝~",
|
text = "试着发信号出来,某人就会被吸引啦~",
|
||||||
color = appColors.text,
|
color = appColors.text,
|
||||||
fontSize = 14.sp,
|
fontSize = 14.sp,
|
||||||
fontWeight = FontWeight.W400
|
fontWeight = FontWeight.W400
|
||||||
|
|||||||
@@ -114,21 +114,22 @@ fun FollowerNoticeScreen() {
|
|||||||
) {
|
) {
|
||||||
Image(
|
Image(
|
||||||
painter = painterResource(
|
painter = painterResource(
|
||||||
id =if(AppState.darkMode) R.mipmap.qst_fs_qs_as_img
|
id = if(AppState.darkMode) R.mipmap.frame_4
|
||||||
else R.mipmap.invalid_name_8),
|
else R.mipmap.invalid_name_8),
|
||||||
contentDescription = "No Followers",
|
contentDescription = "No Followers",
|
||||||
modifier = Modifier.size(181.dp)
|
modifier = Modifier
|
||||||
|
.size(width = 181.dp, height = 153.dp)
|
||||||
)
|
)
|
||||||
Spacer(modifier = Modifier.size(24.dp))
|
Spacer(modifier = Modifier.height(if (AppState.darkMode) 9.dp else 24.dp))
|
||||||
androidx.compose.material.Text(
|
androidx.compose.material.Text(
|
||||||
text = "还没有人关注哦",
|
text = "还没有人关注你呢",
|
||||||
color = AppColors.text,
|
color = AppColors.text,
|
||||||
fontSize = 16.sp,
|
fontSize = 16.sp,
|
||||||
fontWeight = FontWeight.W600
|
fontWeight = FontWeight.W600
|
||||||
)
|
)
|
||||||
Spacer(modifier = Modifier.size(8.dp))
|
Spacer(modifier = Modifier.size(8.dp))
|
||||||
androidx.compose.material.Text(
|
androidx.compose.material.Text(
|
||||||
text = "去发布动态,吸引更多粉丝~",
|
text = "试着发信号出来,某人就会被吸引啦~",
|
||||||
color = AppColors.text,
|
color = AppColors.text,
|
||||||
fontSize = 14.sp,
|
fontSize = 14.sp,
|
||||||
fontWeight = FontWeight.W400
|
fontWeight = FontWeight.W400
|
||||||
|
|||||||
@@ -126,14 +126,14 @@ fun FollowingListScreen(userId: Int) {
|
|||||||
) {
|
) {
|
||||||
Image(
|
Image(
|
||||||
painter = painterResource(
|
painter = painterResource(
|
||||||
id =if(AppState.darkMode) R.mipmap.qst_gz_qs_as_img_my
|
id = if(AppState.darkMode) R.mipmap.frame_3
|
||||||
else R.mipmap.invalid_name_9),
|
else R.mipmap.invalid_name_9),
|
||||||
contentDescription = null,
|
contentDescription = null,
|
||||||
modifier = Modifier.size(181.dp)
|
modifier = Modifier.size(181.dp, 153.dp)
|
||||||
)
|
)
|
||||||
Spacer(modifier = Modifier.size(24.dp))
|
Spacer(modifier = Modifier.size(9.dp)) // 调整间距为9dp
|
||||||
androidx.compose.material.Text(
|
androidx.compose.material.Text(
|
||||||
text = "没有关注任何灵魂",
|
text = "还没有关注任何灵魂",
|
||||||
color = appColors.text,
|
color = appColors.text,
|
||||||
fontSize = 16.sp,
|
fontSize = 16.sp,
|
||||||
fontWeight = FontWeight.W600
|
fontWeight = FontWeight.W600
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.aiosman.ravenow.ui.group
|
package com.aiosman.ravenow.ui.group
|
||||||
|
|
||||||
|
import android.util.Log
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.runtime.mutableStateOf
|
import androidx.compose.runtime.mutableStateOf
|
||||||
import androidx.compose.runtime.setValue
|
import androidx.compose.runtime.setValue
|
||||||
@@ -8,6 +9,14 @@ import androidx.lifecycle.viewModelScope
|
|||||||
import com.aiosman.ravenow.AppStore
|
import com.aiosman.ravenow.AppStore
|
||||||
import com.aiosman.ravenow.ChatState
|
import com.aiosman.ravenow.ChatState
|
||||||
import com.aiosman.ravenow.data.api.ApiClient
|
import com.aiosman.ravenow.data.api.ApiClient
|
||||||
|
import com.aiosman.ravenow.data.api.AgentRule
|
||||||
|
import com.aiosman.ravenow.data.api.AgentRuleQuota
|
||||||
|
import com.aiosman.ravenow.data.api.CreateAgentRuleRequestBody
|
||||||
|
import com.aiosman.ravenow.data.api.UpdateAgentRuleRequestBody
|
||||||
|
import com.aiosman.ravenow.data.api.CreateAgentRuleRequestBody
|
||||||
|
import com.aiosman.ravenow.data.api.AgentRule
|
||||||
|
import com.aiosman.ravenow.data.api.AgentRuleQuota
|
||||||
|
import com.aiosman.ravenow.data.parseErrorResponse
|
||||||
import com.aiosman.ravenow.entity.ChatNotification
|
import com.aiosman.ravenow.entity.ChatNotification
|
||||||
import com.aiosman.ravenow.entity.GroupInfo
|
import com.aiosman.ravenow.entity.GroupInfo
|
||||||
import com.aiosman.ravenow.entity.GroupMember
|
import com.aiosman.ravenow.entity.GroupMember
|
||||||
@@ -22,9 +31,36 @@ class GroupChatInfoViewModel(
|
|||||||
var isLoading by mutableStateOf(false)
|
var isLoading by mutableStateOf(false)
|
||||||
var error by mutableStateOf<String?>(null)
|
var error by mutableStateOf<String?>(null)
|
||||||
var chatNotification by mutableStateOf<ChatNotification?>(null)
|
var chatNotification by mutableStateOf<ChatNotification?>(null)
|
||||||
|
var isAddingMemory by mutableStateOf(false)
|
||||||
|
var addMemoryError by mutableStateOf<String?>(null)
|
||||||
|
var addMemorySuccess by mutableStateOf(false)
|
||||||
val notificationStrategy get() = chatNotification?.strategy ?: "default"
|
val notificationStrategy get() = chatNotification?.strategy ?: "default"
|
||||||
|
|
||||||
|
// 记忆管理相关状态
|
||||||
|
var memoryQuota by mutableStateOf<AgentRuleQuota?>(null)
|
||||||
|
var memoryList by mutableStateOf<List<AgentRule>>(emptyList())
|
||||||
|
var isLoadingMemory by mutableStateOf(false)
|
||||||
|
var memoryError by mutableStateOf<String?>(null)
|
||||||
|
var promptOpenId by mutableStateOf<String?>(null)
|
||||||
init {
|
init {
|
||||||
loadGroupInfo()
|
loadGroupInfo()
|
||||||
|
loadPromptOpenId()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取群聊中智能体的 OpenID
|
||||||
|
*/
|
||||||
|
private fun loadPromptOpenId() {
|
||||||
|
viewModelScope.launch {
|
||||||
|
try {
|
||||||
|
val response = ApiClient.api.createGroupChatAi(trtcGroupId = groupId)
|
||||||
|
val groupChatResponse = response.body()?.data
|
||||||
|
val prompts = groupChatResponse?.prompts
|
||||||
|
promptOpenId = prompts?.firstOrNull()?.openId
|
||||||
|
} catch (e: Exception) {
|
||||||
|
Log.e("GroupChatInfoViewModel", "获取智能体OpenID失败: ${e.message}", e)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
suspend fun updateNotificationStrategy(strategy: String) {
|
suspend fun updateNotificationStrategy(strategy: String) {
|
||||||
val result = ChatState.updateChatNotification(groupId.hashCode(), strategy)
|
val result = ChatState.updateChatNotification(groupId.hashCode(), strategy)
|
||||||
@@ -71,4 +107,218 @@ class GroupChatInfoViewModel(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加群记忆
|
||||||
|
* @param memoryText 记忆内容
|
||||||
|
* @param promptOpenId 智能体的 OpenID(可选),如果不提供则从群聊信息中获取
|
||||||
|
*/
|
||||||
|
fun addGroupMemory(memoryText: String, promptOpenId: String? = null) {
|
||||||
|
viewModelScope.launch {
|
||||||
|
try {
|
||||||
|
isAddingMemory = true
|
||||||
|
addMemoryError = null
|
||||||
|
addMemorySuccess = false
|
||||||
|
|
||||||
|
// 如果没有提供 promptOpenId,需要先获取群聊的智能体信息
|
||||||
|
val openId = promptOpenId ?: run {
|
||||||
|
// 通过 createGroupChatAi 接口获取群聊详细信息(包含 prompts)
|
||||||
|
val response = ApiClient.api.createGroupChatAi(trtcGroupId = groupId)
|
||||||
|
val groupChatResponse = response.body()?.data
|
||||||
|
val prompts = groupChatResponse?.prompts
|
||||||
|
|
||||||
|
if (prompts.isNullOrEmpty()) {
|
||||||
|
throw Exception("群聊中没有找到智能体,无法添加记忆")
|
||||||
|
}
|
||||||
|
|
||||||
|
// 使用第一个智能体的 openId
|
||||||
|
prompts.firstOrNull()?.openId
|
||||||
|
?: throw Exception("无法获取智能体信息")
|
||||||
|
}
|
||||||
|
|
||||||
|
if (openId.isBlank()) {
|
||||||
|
throw Exception("智能体ID不能为空")
|
||||||
|
}
|
||||||
|
|
||||||
|
// 创建智能体规则(群记忆)
|
||||||
|
val requestBody = CreateAgentRuleRequestBody(
|
||||||
|
rule = memoryText,
|
||||||
|
openId = openId
|
||||||
|
)
|
||||||
|
|
||||||
|
val response = ApiClient.api.createAgentRule(requestBody)
|
||||||
|
|
||||||
|
if (response.isSuccessful) {
|
||||||
|
addMemorySuccess = true
|
||||||
|
Log.d("GroupChatInfoViewModel", "群记忆添加成功")
|
||||||
|
// 刷新记忆列表和配额
|
||||||
|
loadMemoryQuota(openId)
|
||||||
|
loadMemoryList(openId)
|
||||||
|
} else {
|
||||||
|
val errorResponse = parseErrorResponse(response.errorBody())
|
||||||
|
val errorMessage = errorResponse?.toServiceException()?.message
|
||||||
|
?: "添加群记忆失败: ${response.code()}"
|
||||||
|
throw Exception(errorMessage)
|
||||||
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
|
addMemoryError = e.message ?: "添加群记忆失败"
|
||||||
|
Log.e("GroupChatInfoViewModel", "添加群记忆失败: ${e.message}", e)
|
||||||
|
} finally {
|
||||||
|
isAddingMemory = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取记忆配额信息
|
||||||
|
*/
|
||||||
|
fun loadMemoryQuota(openId: String? = null) {
|
||||||
|
viewModelScope.launch {
|
||||||
|
try {
|
||||||
|
isLoadingMemory = true
|
||||||
|
memoryError = null
|
||||||
|
|
||||||
|
val targetOpenId = openId ?: promptOpenId
|
||||||
|
if (targetOpenId.isNullOrBlank()) {
|
||||||
|
// 如果还没有获取到 openId,先获取
|
||||||
|
val response = ApiClient.api.createGroupChatAi(trtcGroupId = groupId)
|
||||||
|
val groupChatResponse = response.body()?.data
|
||||||
|
val prompts = groupChatResponse?.prompts
|
||||||
|
val fetchedOpenId = prompts?.firstOrNull()?.openId
|
||||||
|
?: throw Exception("无法获取智能体信息")
|
||||||
|
|
||||||
|
promptOpenId = fetchedOpenId
|
||||||
|
val quotaResponse = ApiClient.api.getAgentRuleQuota(fetchedOpenId)
|
||||||
|
if (quotaResponse.isSuccessful) {
|
||||||
|
memoryQuota = quotaResponse.body()?.data
|
||||||
|
} else {
|
||||||
|
throw Exception("获取配额信息失败: ${quotaResponse.code()}")
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
val quotaResponse = ApiClient.api.getAgentRuleQuota(targetOpenId)
|
||||||
|
if (quotaResponse.isSuccessful) {
|
||||||
|
memoryQuota = quotaResponse.body()?.data
|
||||||
|
} else {
|
||||||
|
throw Exception("获取配额信息失败: ${quotaResponse.code()}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
|
memoryError = e.message ?: "获取配额信息失败"
|
||||||
|
Log.e("GroupChatInfoViewModel", "获取配额信息失败: ${e.message}", e)
|
||||||
|
} finally {
|
||||||
|
isLoadingMemory = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取记忆列表
|
||||||
|
*/
|
||||||
|
fun loadMemoryList(openId: String? = null, page: Int = 1, pageSize: Int = 20) {
|
||||||
|
viewModelScope.launch {
|
||||||
|
try {
|
||||||
|
isLoadingMemory = true
|
||||||
|
memoryError = null
|
||||||
|
|
||||||
|
val targetOpenId = openId ?: promptOpenId
|
||||||
|
if (targetOpenId.isNullOrBlank()) {
|
||||||
|
// 如果还没有获取到 openId,先获取
|
||||||
|
val response = ApiClient.api.createGroupChatAi(trtcGroupId = groupId)
|
||||||
|
val groupChatResponse = response.body()?.data
|
||||||
|
val prompts = groupChatResponse?.prompts
|
||||||
|
val fetchedOpenId = prompts?.firstOrNull()?.openId
|
||||||
|
?: throw Exception("无法获取智能体信息")
|
||||||
|
|
||||||
|
promptOpenId = fetchedOpenId
|
||||||
|
val listResponse = ApiClient.api.getAgentRuleList(fetchedOpenId, page = page, pageSize = pageSize)
|
||||||
|
if (listResponse.isSuccessful) {
|
||||||
|
memoryList = listResponse.body()?.data?.list ?: emptyList()
|
||||||
|
} else {
|
||||||
|
throw Exception("获取记忆列表失败: ${listResponse.code()}")
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
val listResponse = ApiClient.api.getAgentRuleList(targetOpenId, page = page, pageSize = pageSize)
|
||||||
|
if (listResponse.isSuccessful) {
|
||||||
|
memoryList = listResponse.body()?.data?.list ?: emptyList()
|
||||||
|
} else {
|
||||||
|
throw Exception("获取记忆列表失败: ${listResponse.code()}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
|
memoryError = e.message ?: "获取记忆列表失败"
|
||||||
|
Log.e("GroupChatInfoViewModel", "获取记忆列表失败: ${e.message}", e)
|
||||||
|
} finally {
|
||||||
|
isLoadingMemory = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除记忆
|
||||||
|
*/
|
||||||
|
fun deleteMemory(ruleId: Int) {
|
||||||
|
viewModelScope.launch {
|
||||||
|
try {
|
||||||
|
isLoadingMemory = true
|
||||||
|
memoryError = null
|
||||||
|
|
||||||
|
val response = ApiClient.api.deleteAgentRule(ruleId)
|
||||||
|
if (response.isSuccessful) {
|
||||||
|
// 刷新记忆列表和配额
|
||||||
|
promptOpenId?.let { openId ->
|
||||||
|
loadMemoryQuota(openId)
|
||||||
|
loadMemoryList(openId)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
val errorResponse = parseErrorResponse(response.errorBody())
|
||||||
|
val errorMessage = errorResponse?.toServiceException()?.message
|
||||||
|
?: "删除记忆失败: ${response.code()}"
|
||||||
|
throw Exception(errorMessage)
|
||||||
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
|
memoryError = e.message ?: "删除记忆失败"
|
||||||
|
Log.e("GroupChatInfoViewModel", "删除记忆失败: ${e.message}", e)
|
||||||
|
} finally {
|
||||||
|
isLoadingMemory = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新记忆
|
||||||
|
*/
|
||||||
|
fun updateMemory(ruleId: Int, newRuleText: String, targetOpenId: String? = null) {
|
||||||
|
viewModelScope.launch {
|
||||||
|
try {
|
||||||
|
isLoadingMemory = true
|
||||||
|
memoryError = null
|
||||||
|
|
||||||
|
val openId = targetOpenId ?: promptOpenId
|
||||||
|
?: throw Exception("无法获取智能体ID")
|
||||||
|
|
||||||
|
val requestBody = UpdateAgentRuleRequestBody(
|
||||||
|
id = ruleId,
|
||||||
|
rule = newRuleText,
|
||||||
|
openId = openId
|
||||||
|
)
|
||||||
|
|
||||||
|
val response = ApiClient.api.updateAgentRule(requestBody)
|
||||||
|
if (response.isSuccessful) {
|
||||||
|
// 刷新记忆列表和配额
|
||||||
|
loadMemoryQuota(openId)
|
||||||
|
loadMemoryList(openId)
|
||||||
|
} else {
|
||||||
|
val errorResponse = parseErrorResponse(response.errorBody())
|
||||||
|
val errorMessage = errorResponse?.toServiceException()?.message
|
||||||
|
?: "更新记忆失败: ${response.code()}"
|
||||||
|
throw Exception(errorMessage)
|
||||||
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
|
memoryError = e.message ?: "更新记忆失败"
|
||||||
|
Log.e("GroupChatInfoViewModel", "更新记忆失败: ${e.message}", e)
|
||||||
|
} finally {
|
||||||
|
isLoadingMemory = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,625 @@
|
|||||||
|
package com.aiosman.ravenow.ui.group
|
||||||
|
|
||||||
|
import androidx.compose.foundation.background
|
||||||
|
import androidx.compose.foundation.layout.*
|
||||||
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
|
import androidx.compose.foundation.lazy.items
|
||||||
|
import androidx.compose.foundation.shape.CircleShape
|
||||||
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
|
import androidx.compose.material3.CircularProgressIndicator
|
||||||
|
import androidx.compose.material3.Text
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.runtime.LaunchedEffect
|
||||||
|
import androidx.compose.ui.Alignment
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.draw.clip
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
|
import androidx.compose.ui.graphics.ColorFilter
|
||||||
|
import androidx.compose.ui.platform.LocalConfiguration
|
||||||
|
import androidx.compose.ui.res.painterResource
|
||||||
|
import androidx.compose.ui.text.TextStyle
|
||||||
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
|
import androidx.compose.ui.text.style.TextAlign
|
||||||
|
import androidx.compose.ui.text.style.TextOverflow
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
|
import androidx.compose.ui.unit.sp
|
||||||
|
import com.aiosman.ravenow.LocalAppTheme
|
||||||
|
import com.aiosman.ravenow.R
|
||||||
|
import com.aiosman.ravenow.ui.modifiers.noRippleClickable
|
||||||
|
import androidx.compose.foundation.Image
|
||||||
|
import androidx.compose.foundation.text.BasicTextField
|
||||||
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||||
|
import androidx.compose.material3.ModalBottomSheet
|
||||||
|
import androidx.compose.material3.rememberModalBottomSheetState
|
||||||
|
import androidx.compose.runtime.getValue
|
||||||
|
import androidx.compose.runtime.mutableStateOf
|
||||||
|
import androidx.compose.runtime.remember
|
||||||
|
import androidx.compose.runtime.setValue
|
||||||
|
import androidx.compose.ui.graphics.SolidColor
|
||||||
|
import androidx.compose.ui.platform.LocalContext
|
||||||
|
import android.widget.Toast
|
||||||
|
import androidx.compose.ui.graphics.Brush
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun GroupMemoryManageContent(
|
||||||
|
groupId: String,
|
||||||
|
viewModel: GroupChatInfoViewModel,
|
||||||
|
onAddMemoryClick: () -> Unit = {},
|
||||||
|
onDismiss: () -> Unit = {}
|
||||||
|
) {
|
||||||
|
val AppColors = LocalAppTheme.current
|
||||||
|
val configuration = LocalConfiguration.current
|
||||||
|
val screenHeight = configuration.screenHeightDp.dp
|
||||||
|
val sheetHeight = screenHeight * 0.95f
|
||||||
|
val context = LocalContext.current
|
||||||
|
|
||||||
|
// 编辑记忆的状态 - 存储正在编辑的记忆ID
|
||||||
|
var editingMemoryId by remember { mutableStateOf<Int?>(null) }
|
||||||
|
|
||||||
|
// 加载配额和列表数据
|
||||||
|
LaunchedEffect(Unit) {
|
||||||
|
viewModel.loadMemoryQuota()
|
||||||
|
viewModel.loadMemoryList()
|
||||||
|
}
|
||||||
|
|
||||||
|
val quota = viewModel.memoryQuota
|
||||||
|
val memoryList = viewModel.memoryList
|
||||||
|
val isLoading = viewModel.isLoadingMemory
|
||||||
|
|
||||||
|
Column(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.height(sheetHeight)
|
||||||
|
.background(Color(0xFFFAF9FB))
|
||||||
|
) {
|
||||||
|
// 顶部栏:返回按钮 + 标题 + 加号按钮
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.height(44.dp)
|
||||||
|
.padding(horizontal = 16.dp)
|
||||||
|
) {
|
||||||
|
// 中间标题 - 绝对居中,不受其他组件影响
|
||||||
|
Text(
|
||||||
|
text = "记忆管理",
|
||||||
|
style = TextStyle(
|
||||||
|
color = Color.Black,
|
||||||
|
fontSize = 17.sp,
|
||||||
|
fontWeight = FontWeight.SemiBold
|
||||||
|
),
|
||||||
|
modifier = Modifier.align(Alignment.Center),
|
||||||
|
textAlign = TextAlign.Center
|
||||||
|
)
|
||||||
|
|
||||||
|
// 左侧返回按钮
|
||||||
|
Row(
|
||||||
|
modifier = Modifier
|
||||||
|
.align(Alignment.CenterStart)
|
||||||
|
.clip(RoundedCornerShape(296.dp))
|
||||||
|
.background(Color.White) // 浅灰色背景
|
||||||
|
.noRippleClickable { onDismiss() }
|
||||||
|
.padding(horizontal = 12.dp, vertical = 8.dp),
|
||||||
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
|
horizontalArrangement = Arrangement.spacedBy(4.dp)
|
||||||
|
) {
|
||||||
|
Image(
|
||||||
|
painter = painterResource(R.drawable.rider_pro_back_icon),
|
||||||
|
contentDescription = "返回",
|
||||||
|
modifier = Modifier.size(16.dp),
|
||||||
|
colorFilter = ColorFilter.tint(Color.Black)
|
||||||
|
)
|
||||||
|
Text(
|
||||||
|
text = "返回",
|
||||||
|
style = TextStyle(
|
||||||
|
color = Color.Black,
|
||||||
|
fontSize = 15.sp,
|
||||||
|
fontWeight = FontWeight.Normal
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 右侧圆形加号按钮
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.align(Alignment.CenterEnd)
|
||||||
|
.size(32.dp)
|
||||||
|
.clip(CircleShape)
|
||||||
|
.background(Color.White)
|
||||||
|
.noRippleClickable { onAddMemoryClick() },
|
||||||
|
contentAlignment = Alignment.Center
|
||||||
|
) {
|
||||||
|
Text(
|
||||||
|
text = "+",
|
||||||
|
style = TextStyle(
|
||||||
|
color = Color.Black,
|
||||||
|
fontSize = 20.sp,
|
||||||
|
fontWeight = FontWeight.Medium
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 浅黄色提示栏 - 显示真实的配额数据
|
||||||
|
Row(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.background(Color(0xFFFBF8EF))
|
||||||
|
.padding(horizontal = 16.dp, vertical = 12.dp),
|
||||||
|
horizontalArrangement = Arrangement.SpaceBetween,
|
||||||
|
verticalAlignment = Alignment.CenterVertically
|
||||||
|
) {
|
||||||
|
Row(horizontalArrangement = Arrangement.spacedBy(16.dp), verticalAlignment = Alignment.CenterVertically) {
|
||||||
|
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||||
|
Text("已付费:", style = TextStyle(color = Color(0x993C3C43), fontSize = 13.sp))
|
||||||
|
Spacer(Modifier.width(3.dp))
|
||||||
|
Text(
|
||||||
|
"${quota?.purchasedCount ?: 0}",
|
||||||
|
style = TextStyle(color = Color(0xFFFF8D28), fontSize = 13.sp)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||||
|
Text("已使用:", style = TextStyle(color = Color(0x993C3C43), fontSize = 13.sp))
|
||||||
|
Spacer(Modifier.width(3.dp))
|
||||||
|
Text(
|
||||||
|
"${quota?.currentCount ?: 0}",
|
||||||
|
style = TextStyle(color = Color(0xFFFF8D28), fontSize = 13.sp)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||||
|
Text("可用上限:", style = TextStyle(color = Color(0x993C3C43), fontSize = 13.sp))
|
||||||
|
Spacer(Modifier.width(3.dp))
|
||||||
|
Text(
|
||||||
|
"50",
|
||||||
|
style = TextStyle(color = Color(0xFFFF8D28), fontSize = 13.sp)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 记忆列表或空状态
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.weight(1f)
|
||||||
|
) {
|
||||||
|
if (isLoading) {
|
||||||
|
// 加载中状态
|
||||||
|
Box(
|
||||||
|
modifier = Modifier.fillMaxSize(),
|
||||||
|
contentAlignment = Alignment.Center
|
||||||
|
) {
|
||||||
|
CircularProgressIndicator(
|
||||||
|
modifier = Modifier.size(40.dp),
|
||||||
|
color = Color(0xFFFF8D28)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
} else if (memoryList.isNotEmpty()) {
|
||||||
|
// 显示记忆列表
|
||||||
|
LazyColumn(
|
||||||
|
modifier = Modifier.fillMaxSize(),
|
||||||
|
contentPadding = PaddingValues(horizontal = 16.dp, vertical = 12.dp),
|
||||||
|
verticalArrangement = Arrangement.spacedBy(12.dp)
|
||||||
|
) {
|
||||||
|
items(memoryList) { memory ->
|
||||||
|
MemoryItem(
|
||||||
|
memory = memory,
|
||||||
|
isEditing = editingMemoryId == memory.id,
|
||||||
|
onEdit = {
|
||||||
|
editingMemoryId = memory.id
|
||||||
|
},
|
||||||
|
onCancel = {
|
||||||
|
editingMemoryId = null
|
||||||
|
},
|
||||||
|
onSave = { newText ->
|
||||||
|
viewModel.updateMemory(memory.id, newText)
|
||||||
|
editingMemoryId = null
|
||||||
|
},
|
||||||
|
onDelete = {
|
||||||
|
viewModel.deleteMemory(memory.id)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Column(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxSize()
|
||||||
|
.padding(vertical = 60.dp),
|
||||||
|
horizontalAlignment = Alignment.CenterHorizontally,
|
||||||
|
verticalArrangement = Arrangement.Center
|
||||||
|
) {
|
||||||
|
Image(
|
||||||
|
painter = painterResource(id = R.mipmap.group),
|
||||||
|
contentDescription = "暂无记忆",
|
||||||
|
modifier = Modifier
|
||||||
|
.height(150.dp).width(180.dp)
|
||||||
|
)
|
||||||
|
|
||||||
|
Spacer(Modifier.height(10.dp))
|
||||||
|
Text(
|
||||||
|
text = "暂无记忆",
|
||||||
|
style = TextStyle(color = Color.Black, fontSize = 16.sp, fontWeight = FontWeight.SemiBold)
|
||||||
|
)
|
||||||
|
Spacer(Modifier.height(6.dp))
|
||||||
|
Text(
|
||||||
|
text = "点击上方按钮添加群记忆",
|
||||||
|
style = TextStyle(color = Color.Black, fontSize = 14.sp, fontWeight = FontWeight.Normal)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑记忆对话框
|
||||||
|
*/
|
||||||
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
|
@Composable
|
||||||
|
fun EditGroupMemoryDialog(
|
||||||
|
memory: com.aiosman.ravenow.data.api.AgentRule,
|
||||||
|
viewModel: GroupChatInfoViewModel,
|
||||||
|
onDismiss: () -> Unit,
|
||||||
|
onUpdateMemory: (String) -> Unit
|
||||||
|
) {
|
||||||
|
val AppColors = LocalAppTheme.current
|
||||||
|
val context = LocalContext.current
|
||||||
|
var memoryText by remember { mutableStateOf(memory.rule) }
|
||||||
|
val maxLength = 500
|
||||||
|
val sheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true)
|
||||||
|
|
||||||
|
val gradientColors = listOf(
|
||||||
|
Color(0xFF7C45ED),
|
||||||
|
Color(0xFF7C57EE),
|
||||||
|
Color(0xFF7BD8F8)
|
||||||
|
)
|
||||||
|
val gradientBrush = Brush.horizontalGradient(colors = gradientColors)
|
||||||
|
|
||||||
|
ModalBottomSheet(
|
||||||
|
onDismissRequest = onDismiss,
|
||||||
|
sheetState = sheetState,
|
||||||
|
containerColor = Color(0xFFFAF9FB),
|
||||||
|
dragHandle = {
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.width(36.dp)
|
||||||
|
.height(5.dp)
|
||||||
|
.padding(top = 5.dp)
|
||||||
|
.background(
|
||||||
|
Color(0xFFCCCCCC),
|
||||||
|
RoundedCornerShape(100.dp)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
},
|
||||||
|
shape = RoundedCornerShape(topStart = 20.dp, topEnd = 20.dp)
|
||||||
|
) {
|
||||||
|
Column(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.padding(horizontal = 12.dp, vertical = 16.dp),
|
||||||
|
horizontalAlignment = Alignment.CenterHorizontally,
|
||||||
|
verticalArrangement = Arrangement.spacedBy(12.dp)
|
||||||
|
) {
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.height(88.dp)
|
||||||
|
) {
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxSize()
|
||||||
|
.clip(RoundedCornerShape(16.dp))
|
||||||
|
.background(brush = gradientBrush)
|
||||||
|
)
|
||||||
|
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxSize()
|
||||||
|
.padding(1.dp)
|
||||||
|
.clip(RoundedCornerShape(15.dp))
|
||||||
|
.background(Color.White)
|
||||||
|
.padding(12.dp),
|
||||||
|
contentAlignment = Alignment.TopStart
|
||||||
|
) {
|
||||||
|
BasicTextField(
|
||||||
|
value = memoryText,
|
||||||
|
onValueChange = { newText ->
|
||||||
|
if (newText.length <= maxLength) {
|
||||||
|
memoryText = newText
|
||||||
|
}
|
||||||
|
},
|
||||||
|
cursorBrush = SolidColor(Color.Black),
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
textStyle = TextStyle(
|
||||||
|
fontSize = 13.sp,
|
||||||
|
color = Color.Black,
|
||||||
|
lineHeight = 18.sp
|
||||||
|
),
|
||||||
|
decorationBox = { innerTextField ->
|
||||||
|
Box(
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
contentAlignment = Alignment.TopStart
|
||||||
|
) {
|
||||||
|
innerTextField()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row(
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
horizontalArrangement = Arrangement.spacedBy(12.dp)
|
||||||
|
) {
|
||||||
|
// 取消按钮
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.weight(1f)
|
||||||
|
.height(34.dp)
|
||||||
|
.clip(RoundedCornerShape(653.8.dp))
|
||||||
|
.background(Color(0x147C7480))
|
||||||
|
.noRippleClickable { onDismiss() },
|
||||||
|
contentAlignment = Alignment.Center
|
||||||
|
) {
|
||||||
|
Text(
|
||||||
|
text = "取消",
|
||||||
|
style = TextStyle(
|
||||||
|
fontSize = 15.sp,
|
||||||
|
color = Color.Black
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 保存按钮
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.weight(1f)
|
||||||
|
.height(34.dp)
|
||||||
|
.clip(RoundedCornerShape(653.8.dp))
|
||||||
|
.background(Color(0xFF110C13))
|
||||||
|
.noRippleClickable {
|
||||||
|
if (memoryText.isNotBlank() && memoryText != memory.rule) {
|
||||||
|
onUpdateMemory(memoryText)
|
||||||
|
Toast.makeText(context, "记忆更新成功", Toast.LENGTH_SHORT).show()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
contentAlignment = Alignment.Center
|
||||||
|
) {
|
||||||
|
Text(
|
||||||
|
text = "保存",
|
||||||
|
style = TextStyle(
|
||||||
|
fontSize = 15.sp,
|
||||||
|
color = Color.White
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 记忆项组件
|
||||||
|
*/
|
||||||
|
@Composable
|
||||||
|
fun MemoryItem(
|
||||||
|
memory: com.aiosman.ravenow.data.api.AgentRule,
|
||||||
|
isEditing: Boolean = false,
|
||||||
|
onEdit: () -> Unit = {},
|
||||||
|
onCancel: () -> Unit = {},
|
||||||
|
onSave: (String) -> Unit = {},
|
||||||
|
onDelete: () -> Unit
|
||||||
|
) {
|
||||||
|
val AppColors = LocalAppTheme.current
|
||||||
|
val context = LocalContext.current
|
||||||
|
var memoryText by remember { mutableStateOf(memory.rule) }
|
||||||
|
val maxLength = 500
|
||||||
|
|
||||||
|
// 渐变边框颜色
|
||||||
|
val gradientColors = listOf(
|
||||||
|
Color(0xFF7C45ED),
|
||||||
|
Color(0xFF7C57EE),
|
||||||
|
Color(0xFF7BD8F8)
|
||||||
|
)
|
||||||
|
val gradientBrush = Brush.horizontalGradient(colors = gradientColors)
|
||||||
|
|
||||||
|
// 当进入编辑模式时,重置文本
|
||||||
|
LaunchedEffect(isEditing) {
|
||||||
|
if (isEditing) {
|
||||||
|
memoryText = memory.rule
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isEditing) {
|
||||||
|
// 编辑模式:显示编辑界面
|
||||||
|
Column(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.clip(RoundedCornerShape(16.dp))
|
||||||
|
.background(Color.White)
|
||||||
|
.padding(horizontal = 12.dp, vertical = 16.dp),
|
||||||
|
verticalArrangement = Arrangement.spacedBy(12.dp)
|
||||||
|
) {
|
||||||
|
// 文本输入框 - 带渐变边框
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.height(88.dp)
|
||||||
|
) {
|
||||||
|
// 渐变边框层
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxSize()
|
||||||
|
.clip(RoundedCornerShape(16.dp))
|
||||||
|
.background(brush = gradientBrush)
|
||||||
|
)
|
||||||
|
|
||||||
|
// 内容层 - 白色背景,通过padding形成边框效果
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxSize()
|
||||||
|
.padding(1.dp)
|
||||||
|
.clip(RoundedCornerShape(15.dp))
|
||||||
|
.background(Color.White)
|
||||||
|
.padding(12.dp),
|
||||||
|
contentAlignment = Alignment.TopStart
|
||||||
|
) {
|
||||||
|
BasicTextField(
|
||||||
|
value = memoryText,
|
||||||
|
onValueChange = { newText ->
|
||||||
|
if (newText.length <= maxLength) {
|
||||||
|
memoryText = newText
|
||||||
|
}
|
||||||
|
},
|
||||||
|
cursorBrush = SolidColor(Color.Black),
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
textStyle = TextStyle(
|
||||||
|
fontSize = 13.sp,
|
||||||
|
color = Color.Black,
|
||||||
|
lineHeight = 18.sp
|
||||||
|
),
|
||||||
|
decorationBox = { innerTextField ->
|
||||||
|
Box(
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
contentAlignment = Alignment.TopStart
|
||||||
|
) {
|
||||||
|
innerTextField()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 按钮行:取消和保存
|
||||||
|
Row(
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
horizontalArrangement = Arrangement.spacedBy(12.dp)
|
||||||
|
) {
|
||||||
|
// 取消按钮
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.weight(1f)
|
||||||
|
.height(34.dp)
|
||||||
|
.clip(RoundedCornerShape(653.8.dp))
|
||||||
|
.background(Color(0x147C7480))
|
||||||
|
.noRippleClickable { onCancel() },
|
||||||
|
contentAlignment = Alignment.Center
|
||||||
|
) {
|
||||||
|
Text(
|
||||||
|
text = "取消",
|
||||||
|
style = TextStyle(
|
||||||
|
fontSize = 15.sp,
|
||||||
|
color = Color.Black
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 保存按钮
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.weight(1f)
|
||||||
|
.height(34.dp)
|
||||||
|
.clip(RoundedCornerShape(653.8.dp))
|
||||||
|
.background(Color(0xFF110C13))
|
||||||
|
.noRippleClickable {
|
||||||
|
if (memoryText.isNotBlank() && memoryText != memory.rule) {
|
||||||
|
onSave(memoryText)
|
||||||
|
Toast.makeText(context, "记忆更新成功", Toast.LENGTH_SHORT).show()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
contentAlignment = Alignment.Center
|
||||||
|
) {
|
||||||
|
Text(
|
||||||
|
text = "保存",
|
||||||
|
style = TextStyle(
|
||||||
|
fontSize = 15.sp,
|
||||||
|
color = Color.White
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 显示模式:显示记忆内容
|
||||||
|
// 格式化日期:从 "2025-10-20T10:30:00Z" 格式转换为 "2025年10月20日"
|
||||||
|
val formattedDate = try {
|
||||||
|
if (memory.createdAt.length >= 10) {
|
||||||
|
val dateStr = memory.createdAt.substring(0, 10)
|
||||||
|
val parts = dateStr.split("-")
|
||||||
|
if (parts.size == 3) {
|
||||||
|
"${parts[0]}年${parts[1].toInt()}月${parts[2].toInt()}日"
|
||||||
|
} else {
|
||||||
|
dateStr
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
memory.createdAt
|
||||||
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
|
if (memory.createdAt.length >= 10) memory.createdAt.substring(0, 10) else memory.createdAt
|
||||||
|
}
|
||||||
|
|
||||||
|
Column(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.clip(RoundedCornerShape(16.dp))
|
||||||
|
.background(Color.White)
|
||||||
|
.padding(horizontal = 12.dp, vertical = 16.dp)
|
||||||
|
) {
|
||||||
|
// 主文本 - 顶部
|
||||||
|
Text(
|
||||||
|
text = memory.rule,
|
||||||
|
style = TextStyle(
|
||||||
|
color = Color.Black,
|
||||||
|
fontSize = 13.sp,
|
||||||
|
lineHeight = 18.sp
|
||||||
|
),
|
||||||
|
maxLines = 3,
|
||||||
|
overflow = TextOverflow.Ellipsis
|
||||||
|
)
|
||||||
|
|
||||||
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
|
|
||||||
|
// 底部行:日期 + 编辑删除按钮
|
||||||
|
Row(
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
horizontalArrangement = Arrangement.SpaceBetween,
|
||||||
|
verticalAlignment = Alignment.Bottom
|
||||||
|
) {
|
||||||
|
// 日期文本 - 左侧
|
||||||
|
Text(
|
||||||
|
text = formattedDate,
|
||||||
|
style = TextStyle(
|
||||||
|
color = Color(0x993C3C43),
|
||||||
|
fontSize = 11.sp
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
// 编辑和删除图标 - 右侧
|
||||||
|
Row(
|
||||||
|
horizontalArrangement = Arrangement.spacedBy(16.dp),
|
||||||
|
verticalAlignment = Alignment.CenterVertically
|
||||||
|
) {
|
||||||
|
// 编辑图标
|
||||||
|
Image(
|
||||||
|
painter = painterResource(R.mipmap.icons_infor_edit),
|
||||||
|
contentDescription = "编辑",
|
||||||
|
modifier = Modifier
|
||||||
|
.size(20.dp)
|
||||||
|
.noRippleClickable { onEdit() },
|
||||||
|
colorFilter = ColorFilter.tint(Color.Black)
|
||||||
|
)
|
||||||
|
|
||||||
|
Image(
|
||||||
|
painter = painterResource(R.mipmap.iconsdelete),
|
||||||
|
contentDescription = "删除",
|
||||||
|
modifier = Modifier
|
||||||
|
.size(20.dp)
|
||||||
|
.noRippleClickable { onDelete() },
|
||||||
|
colorFilter = ColorFilter.tint(Color(0xFFEE2A33))
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -1,6 +1,12 @@
|
|||||||
package com.aiosman.ravenow.ui.index
|
package com.aiosman.ravenow.ui.index
|
||||||
|
|
||||||
import androidx.compose.animation.animateColorAsState
|
import androidx.compose.animation.animateColorAsState
|
||||||
|
import androidx.compose.animation.core.animateFloatAsState
|
||||||
|
import androidx.compose.animation.core.FastOutLinearInEasing
|
||||||
|
import androidx.compose.animation.core.LinearOutSlowInEasing
|
||||||
|
import androidx.compose.animation.core.updateTransition
|
||||||
|
import androidx.compose.animation.core.animateFloat
|
||||||
|
import androidx.compose.animation.core.FastOutSlowInEasing
|
||||||
import androidx.compose.animation.core.tween
|
import androidx.compose.animation.core.tween
|
||||||
import androidx.compose.foundation.ExperimentalFoundationApi
|
import androidx.compose.foundation.ExperimentalFoundationApi
|
||||||
import androidx.compose.foundation.Image
|
import androidx.compose.foundation.Image
|
||||||
@@ -11,15 +17,21 @@ 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.WindowInsets
|
import androidx.compose.foundation.layout.WindowInsets
|
||||||
|
import androidx.compose.foundation.layout.asPaddingValues
|
||||||
|
import androidx.compose.foundation.layout.systemBars
|
||||||
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
|
||||||
import androidx.compose.foundation.layout.height
|
import androidx.compose.foundation.layout.height
|
||||||
|
import androidx.compose.foundation.layout.heightIn
|
||||||
import androidx.compose.foundation.layout.navigationBars
|
import androidx.compose.foundation.layout.navigationBars
|
||||||
|
import androidx.compose.foundation.layout.requiredHeight
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
|
import androidx.compose.foundation.layout.offset
|
||||||
import androidx.compose.foundation.layout.requiredWidth
|
import androidx.compose.foundation.layout.requiredWidth
|
||||||
import androidx.compose.foundation.layout.size
|
import androidx.compose.foundation.layout.size
|
||||||
import androidx.compose.foundation.layout.width
|
import androidx.compose.foundation.layout.width
|
||||||
|
import androidx.compose.foundation.shape.CircleShape
|
||||||
import androidx.compose.foundation.interaction.MutableInteractionSource
|
import androidx.compose.foundation.interaction.MutableInteractionSource
|
||||||
import androidx.compose.foundation.pager.HorizontalPager
|
import androidx.compose.foundation.pager.HorizontalPager
|
||||||
import androidx.compose.foundation.pager.rememberPagerState
|
import androidx.compose.foundation.pager.rememberPagerState
|
||||||
@@ -42,8 +54,10 @@ import androidx.compose.runtime.CompositionLocalProvider
|
|||||||
import androidx.compose.runtime.DisposableEffect
|
import androidx.compose.runtime.DisposableEffect
|
||||||
import androidx.compose.runtime.LaunchedEffect
|
import androidx.compose.runtime.LaunchedEffect
|
||||||
import androidx.compose.runtime.getValue
|
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.draw.alpha
|
import androidx.compose.ui.draw.alpha
|
||||||
@@ -59,7 +73,11 @@ import androidx.compose.ui.text.font.FontWeight
|
|||||||
import androidx.compose.ui.unit.LayoutDirection
|
import androidx.compose.ui.unit.LayoutDirection
|
||||||
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.compose.ui.zIndex
|
||||||
import com.aiosman.ravenow.AppState
|
import com.aiosman.ravenow.AppState
|
||||||
|
import java.text.SimpleDateFormat
|
||||||
|
import java.util.Date
|
||||||
|
import java.util.Locale
|
||||||
import com.aiosman.ravenow.AppStore
|
import com.aiosman.ravenow.AppStore
|
||||||
import com.aiosman.ravenow.GuestLoginCheckOut
|
import com.aiosman.ravenow.GuestLoginCheckOut
|
||||||
import com.aiosman.ravenow.GuestLoginCheckOutScene
|
import com.aiosman.ravenow.GuestLoginCheckOutScene
|
||||||
@@ -123,152 +141,17 @@ fun IndexScreen() {
|
|||||||
gesturesEnabled = drawerState.isOpen,
|
gesturesEnabled = drawerState.isOpen,
|
||||||
drawerContent = {
|
drawerContent = {
|
||||||
CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Ltr) {
|
CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Ltr) {
|
||||||
Column(
|
SideMenuContent(
|
||||||
modifier = Modifier
|
onClose = {
|
||||||
.requiredWidth(250.dp)
|
|
||||||
.fillMaxHeight()
|
|
||||||
.background(
|
|
||||||
AppColors.background
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
Spacer(modifier = Modifier.height(88.dp))
|
|
||||||
NavItem(
|
|
||||||
iconRes = R.drawable.rave_now_nav_account,
|
|
||||||
label = stringResource(R.string.account_and_security),
|
|
||||||
modifier = Modifier.noRippleClickable {
|
|
||||||
coroutineScope.launch {
|
coroutineScope.launch {
|
||||||
drawerState.close()
|
drawerState.close()
|
||||||
navController.navigate(NavigationRoute.AccountSetting.route)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
)
|
|
||||||
Spacer(modifier = Modifier.height(16.dp))
|
|
||||||
NavItem(
|
|
||||||
iconRes = R.drawable.rider_pro_favourited,
|
|
||||||
label = stringResource(R.string.favourites),
|
|
||||||
modifier = Modifier.noRippleClickable {
|
|
||||||
coroutineScope.launch {
|
|
||||||
drawerState.close()
|
|
||||||
navController.navigate(NavigationRoute.FavouriteList.route)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
NavItem(
|
|
||||||
iconRes = R.drawable.rave_now_nav_night,
|
|
||||||
label = stringResource(R.string.dark_mode),
|
|
||||||
rightContent = {
|
|
||||||
Switch(
|
|
||||||
checked = AppState.darkMode,
|
|
||||||
onCheckedChange = {
|
|
||||||
AppState.switchTheme()
|
|
||||||
},
|
},
|
||||||
|
navController = navController,
|
||||||
colors = SwitchDefaults.colors(
|
context = context,
|
||||||
checkedThumbColor = Color.White,
|
isDrawerOpen = drawerState.isOpen
|
||||||
checkedTrackColor = AppColors.main,
|
|
||||||
uncheckedThumbColor = Color.White,
|
|
||||||
uncheckedTrackColor = AppColors.main.copy(alpha = 0.5f),
|
|
||||||
uncheckedBorderColor = Color.Transparent
|
|
||||||
),
|
|
||||||
modifier = Modifier.scale(0.8f)
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
)
|
|
||||||
// divider
|
|
||||||
Box(
|
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.padding(top = 16.dp, bottom = 16.dp, start = 16.dp, end = 16.dp)
|
|
||||||
) {
|
|
||||||
Box(
|
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.height(1.dp)
|
|
||||||
.background(AppColors.divider)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
NavItem(
|
|
||||||
iconRes = R.drawable.rave_now_nav_about,
|
|
||||||
label = stringResource(R.string.blocked),
|
|
||||||
modifier = Modifier.noRippleClickable {
|
|
||||||
coroutineScope.launch {
|
|
||||||
drawerState.close()
|
|
||||||
navController.navigate(NavigationRoute.AboutScreen.route)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
NavItem(
|
|
||||||
iconRes = R.drawable.rave_now_nav_about,
|
|
||||||
label = stringResource(R.string.feedback),
|
|
||||||
modifier = Modifier.noRippleClickable {
|
|
||||||
coroutineScope.launch {
|
|
||||||
drawerState.close()
|
|
||||||
navController.navigate(NavigationRoute.AboutScreen.route)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
NavItem(
|
|
||||||
iconRes = R.drawable.rave_now_nav_about,
|
|
||||||
label = stringResource(R.string.about_rave_now),
|
|
||||||
modifier = Modifier.noRippleClickable {
|
|
||||||
coroutineScope.launch {
|
|
||||||
drawerState.close()
|
|
||||||
navController.navigate(NavigationRoute.AboutScreen.route)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
// divider
|
|
||||||
Box(
|
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.padding(top = 16.dp, bottom = 16.dp, start = 16.dp, end = 16.dp)
|
|
||||||
) {
|
|
||||||
Box(
|
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.height(1.dp)
|
|
||||||
.background(AppColors.divider)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
// NavItem(
|
|
||||||
// iconRes = R.drawable.rave_now_nav_switch,
|
|
||||||
// label = "Switch Account"
|
|
||||||
// )
|
|
||||||
// Spacer(modifier = Modifier.height(16.dp))
|
|
||||||
NavItem(
|
|
||||||
iconRes = R.drawable.rave_now_nav_logout,
|
|
||||||
label = stringResource(R.string.logout),
|
|
||||||
modifier = Modifier.noRippleClickable {
|
|
||||||
coroutineScope.launch {
|
|
||||||
drawerState.close()
|
|
||||||
// 只有非游客用户才需要取消注册推送设备
|
|
||||||
if (!AppStore.isGuest) {
|
|
||||||
Messaging.unregisterDevice(context)
|
|
||||||
}
|
|
||||||
AppStore.apply {
|
|
||||||
token = null
|
|
||||||
rememberMe = false
|
|
||||||
isGuest = false // 清除游客状态
|
|
||||||
saveData()
|
|
||||||
}
|
|
||||||
// 删除推送渠道
|
|
||||||
|
|
||||||
navController.navigate(NavigationRoute.Login.route) {
|
|
||||||
popUpTo(NavigationRoute.Login.route) {
|
|
||||||
inclusive = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
AppState.ReloadAppState(context)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Ltr) {
|
CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Ltr) {
|
||||||
@@ -447,7 +330,6 @@ fun IndexScreen() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
@@ -624,3 +506,343 @@ fun NavItem(
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun SideMenuContent(
|
||||||
|
onClose: () -> Unit,
|
||||||
|
navController: androidx.navigation.NavController,
|
||||||
|
context: android.content.Context,
|
||||||
|
isDrawerOpen: Boolean
|
||||||
|
) {
|
||||||
|
val appColors = LocalAppTheme.current
|
||||||
|
val coroutineScope = rememberCoroutineScope()
|
||||||
|
var messageNotificationEnabled by remember { mutableStateOf(true) }
|
||||||
|
var darkModeEnabled by remember { mutableStateOf(AppState.darkMode) }
|
||||||
|
|
||||||
|
// 菜单背景色 #FAF9FB
|
||||||
|
val menuBackgroundColor = Color(0xFFFAF9FB)
|
||||||
|
// 遮罩颜色 黑色透明度0.6
|
||||||
|
val overlayColor = Color.Black.copy(alpha = 0.6f)
|
||||||
|
// 卡片背景色 白色
|
||||||
|
val cardBackgroundColor = Color.White
|
||||||
|
// 跟随系统文字颜色 #979499
|
||||||
|
val followSystemTextColor = Color(0xFF979499)
|
||||||
|
// 开关开启颜色 #7C45ED
|
||||||
|
val switchActiveColor = Color(0xFF7C45ED)
|
||||||
|
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxSize()
|
||||||
|
) {
|
||||||
|
// 左侧半透明遮罩(平滑淡入淡出)
|
||||||
|
val overlayTransition = updateTransition(targetState = isDrawerOpen, label = "overlay")
|
||||||
|
val overlayAlpha by overlayTransition.animateFloat(
|
||||||
|
transitionSpec = {
|
||||||
|
if (targetState) {
|
||||||
|
tween(durationMillis = 400, easing = LinearOutSlowInEasing)
|
||||||
|
} else {
|
||||||
|
tween(durationMillis = 300, easing = FastOutLinearInEasing)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
label = "overlayAlpha"
|
||||||
|
) { open -> if (open) 0.6f else 0f }
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxSize()
|
||||||
|
.background(Color.Black.copy(alpha = overlayAlpha))
|
||||||
|
)
|
||||||
|
|
||||||
|
// 右侧菜单面板
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.requiredWidth(302.dp)
|
||||||
|
.requiredHeight(874.dp)
|
||||||
|
.align(Alignment.CenterEnd)
|
||||||
|
.background(menuBackgroundColor)
|
||||||
|
) {
|
||||||
|
// 顶部状态栏间距
|
||||||
|
val statusBarHeight = WindowInsets.systemBars.asPaddingValues().calculateTopPadding()
|
||||||
|
|
||||||
|
// 扫一扫功能入口 - 右边距离右边66pt
|
||||||
|
Row(
|
||||||
|
modifier = Modifier
|
||||||
|
.align(Alignment.TopEnd)
|
||||||
|
.offset(x = (-112).dp, y = 88.dp)
|
||||||
|
.noRippleClickable {
|
||||||
|
// TODO: 实现扫一扫功能
|
||||||
|
},
|
||||||
|
horizontalArrangement = Arrangement.spacedBy(16.dp),
|
||||||
|
verticalAlignment = Alignment.CenterVertically
|
||||||
|
) {
|
||||||
|
// 扫一扫图标(使用现有图标或占位)
|
||||||
|
Image(
|
||||||
|
painter = painterResource(id = R.mipmap.sao),
|
||||||
|
contentDescription = null,
|
||||||
|
modifier = Modifier.size(24.dp),
|
||||||
|
colorFilter = ColorFilter.tint(Color.Black)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
// 绝对定位的"扫一扫"文字:上方71.5dp,右侧66dp
|
||||||
|
Text(
|
||||||
|
text = stringResource(R.string.scan_qr),
|
||||||
|
fontSize = 14.sp,
|
||||||
|
color = Color.Black,
|
||||||
|
modifier = Modifier
|
||||||
|
.align(Alignment.TopEnd)
|
||||||
|
.offset(x = (-66).dp, y = 91.5.dp)
|
||||||
|
)
|
||||||
|
// QR码图标 - 右边距离右边112dp,上边距离上边68pt
|
||||||
|
Image(
|
||||||
|
painter = painterResource(id = R.mipmap.qr_code_icon),
|
||||||
|
contentDescription = null,
|
||||||
|
modifier = Modifier
|
||||||
|
.size(24.dp)
|
||||||
|
.align(Alignment.TopEnd)
|
||||||
|
.offset(x = (-26).dp, y = 88.dp)
|
||||||
|
.noRippleClickable {
|
||||||
|
// TODO: 实现QR码功能
|
||||||
|
},
|
||||||
|
colorFilter = ColorFilter.tint(Color.Black)
|
||||||
|
)
|
||||||
|
|
||||||
|
// 菜单选项卡片组 - 第一组卡片上方距离上方108pt(绝对定位)
|
||||||
|
Column(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.offset(y = 128.dp) // 直接距离顶部128dp(整体下移20dp)
|
||||||
|
.padding(horizontal = 16.dp),
|
||||||
|
verticalArrangement = Arrangement.spacedBy(8.dp)
|
||||||
|
) {
|
||||||
|
// 第一组卡片:编辑资料、账号安全、收藏
|
||||||
|
MenuCard(
|
||||||
|
backgroundColor = cardBackgroundColor,
|
||||||
|
width = 270.dp,
|
||||||
|
height = 164.dp,
|
||||||
|
items = listOf(
|
||||||
|
MenuItem(
|
||||||
|
icon = R.mipmap.icons_edited_data,
|
||||||
|
label = stringResource(R.string.edit_profile_info),
|
||||||
|
onClick = {
|
||||||
|
coroutineScope.launch {
|
||||||
|
onClose()
|
||||||
|
navController.navigate(NavigationRoute.AccountEdit.route)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
),
|
||||||
|
MenuItem(
|
||||||
|
icon = R.mipmap.icons_account_and_security,
|
||||||
|
label = stringResource(R.string.account_and_security),
|
||||||
|
onClick = {
|
||||||
|
coroutineScope.launch {
|
||||||
|
onClose()
|
||||||
|
navController.navigate(NavigationRoute.AccountSetting.route)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
),
|
||||||
|
MenuItem(
|
||||||
|
icon = R.mipmap.collect,
|
||||||
|
label = stringResource(R.string.favourites),
|
||||||
|
onClick = {
|
||||||
|
coroutineScope.launch {
|
||||||
|
onClose()
|
||||||
|
navController.navigate(NavigationRoute.FavouriteList.route)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
// 第二组卡片:暗色模式、消息通知
|
||||||
|
MenuCard(
|
||||||
|
backgroundColor = cardBackgroundColor,
|
||||||
|
width = 270.dp,
|
||||||
|
height = 112.dp, // 根据设计图,第二组卡片高度为112dp
|
||||||
|
items = listOf(
|
||||||
|
MenuItem(
|
||||||
|
icon = R.mipmap.icons_dark_mode,
|
||||||
|
label = stringResource(R.string.dark_mode),
|
||||||
|
rightContent = {
|
||||||
|
Switch(
|
||||||
|
checked = darkModeEnabled,
|
||||||
|
onCheckedChange = {
|
||||||
|
darkModeEnabled = it
|
||||||
|
AppState.darkMode = it
|
||||||
|
AppState.appTheme = if (it) {
|
||||||
|
com.aiosman.ravenow.DarkThemeColors()
|
||||||
|
} else {
|
||||||
|
com.aiosman.ravenow.LightThemeColors()
|
||||||
|
}
|
||||||
|
AppStore.saveDarkMode(it)
|
||||||
|
},
|
||||||
|
colors = SwitchDefaults.colors(
|
||||||
|
checkedThumbColor = Color.White,
|
||||||
|
checkedTrackColor = switchActiveColor,
|
||||||
|
uncheckedThumbColor = Color.White,
|
||||||
|
uncheckedTrackColor = switchActiveColor.copy(alpha = 0.5f),
|
||||||
|
uncheckedBorderColor = Color.Transparent
|
||||||
|
),
|
||||||
|
modifier = Modifier.size(width = 64.dp, height = 28.dp)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
),
|
||||||
|
MenuItem(
|
||||||
|
icon = R.mipmap.icons_bell,
|
||||||
|
label = stringResource(R.string.message_notification),
|
||||||
|
rightContent = {
|
||||||
|
Switch(
|
||||||
|
checked = messageNotificationEnabled,
|
||||||
|
onCheckedChange = { messageNotificationEnabled = it },
|
||||||
|
colors = SwitchDefaults.colors(
|
||||||
|
checkedThumbColor = Color.White,
|
||||||
|
checkedTrackColor = switchActiveColor,
|
||||||
|
uncheckedThumbColor = Color.White,
|
||||||
|
uncheckedTrackColor = switchActiveColor.copy(alpha = 0.5f),
|
||||||
|
uncheckedBorderColor = Color.Transparent
|
||||||
|
),
|
||||||
|
modifier = Modifier.size(width = 64.dp, height = 28.dp)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
// 第三组卡片:关于派派、反馈、退出登录
|
||||||
|
MenuCard(
|
||||||
|
backgroundColor = cardBackgroundColor,
|
||||||
|
width = 270.dp,
|
||||||
|
height = 164.dp,
|
||||||
|
items = listOf(
|
||||||
|
MenuItem(
|
||||||
|
icon = R.mipmap.icons_about,
|
||||||
|
label = stringResource(R.string.about_paipai),
|
||||||
|
onClick = {
|
||||||
|
coroutineScope.launch {
|
||||||
|
onClose()
|
||||||
|
navController.navigate(NavigationRoute.AboutScreen.route)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
),
|
||||||
|
MenuItem(
|
||||||
|
icon = R.mipmap.feedback_icon,
|
||||||
|
label = stringResource(R.string.feedback),
|
||||||
|
onClick = {
|
||||||
|
coroutineScope.launch {
|
||||||
|
onClose()
|
||||||
|
navController.navigate(NavigationRoute.AboutScreen.route)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
),
|
||||||
|
MenuItem(
|
||||||
|
icon = R.mipmap.log_out_icon,
|
||||||
|
label = stringResource(R.string.logout_confirm),
|
||||||
|
onClick = {
|
||||||
|
coroutineScope.launch {
|
||||||
|
onClose()
|
||||||
|
// 只有非游客用户才需要取消注册推送设备
|
||||||
|
if (!AppStore.isGuest) {
|
||||||
|
Messaging.unregisterDevice(context)
|
||||||
|
}
|
||||||
|
AppStore.apply {
|
||||||
|
token = null
|
||||||
|
rememberMe = false
|
||||||
|
isGuest = false
|
||||||
|
saveData()
|
||||||
|
}
|
||||||
|
navController.navigate(NavigationRoute.Login.route) {
|
||||||
|
popUpTo(NavigationRoute.Login.route) {
|
||||||
|
inclusive = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
AppState.ReloadAppState(context)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
showRightArrow = false
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
data class MenuItem(
|
||||||
|
val icon: Int,
|
||||||
|
val label: String,
|
||||||
|
val onClick: (() -> Unit)? = null,
|
||||||
|
val rightContent: @Composable (() -> Unit)? = null,
|
||||||
|
val showRightArrow: Boolean = true
|
||||||
|
)
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun MenuCard(
|
||||||
|
backgroundColor: Color,
|
||||||
|
items: List<MenuItem>,
|
||||||
|
width: androidx.compose.ui.unit.Dp? = null,
|
||||||
|
height: androidx.compose.ui.unit.Dp? = null
|
||||||
|
) {
|
||||||
|
Column(
|
||||||
|
modifier = Modifier
|
||||||
|
.then(if (width != null) Modifier.requiredWidth(width) else Modifier.fillMaxWidth())
|
||||||
|
.then(if (height != null) Modifier.requiredHeight(height) else Modifier)
|
||||||
|
.background(backgroundColor, RoundedCornerShape(16.dp))
|
||||||
|
.padding(horizontal = 16.dp),
|
||||||
|
verticalArrangement = if (height != null) Arrangement.SpaceEvenly else Arrangement.spacedBy(8.dp) // 固定高度时均匀分布
|
||||||
|
) {
|
||||||
|
items.forEachIndexed { index, item ->
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.then(if (height != null) Modifier.weight(1f) else Modifier),
|
||||||
|
contentAlignment = Alignment.Center
|
||||||
|
) {
|
||||||
|
MenuItemRow(item = item, compact = height != null) // 传递compact参数
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun MenuItemRow(item: MenuItem, compact: Boolean = false) {
|
||||||
|
Row(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.then(
|
||||||
|
if (item.onClick != null) {
|
||||||
|
Modifier.noRippleClickable { item.onClick?.invoke() }
|
||||||
|
} else {
|
||||||
|
Modifier
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.padding(vertical = if (compact) 4.dp else 8.dp), // 紧凑模式下减少垂直padding
|
||||||
|
horizontalArrangement = Arrangement.SpaceBetween,
|
||||||
|
verticalAlignment = Alignment.CenterVertically
|
||||||
|
) {
|
||||||
|
Row(
|
||||||
|
horizontalArrangement = Arrangement.spacedBy(12.dp),
|
||||||
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
|
modifier = Modifier.weight(1f)
|
||||||
|
) {
|
||||||
|
Image(
|
||||||
|
painter = painterResource(id = item.icon),
|
||||||
|
contentDescription = null,
|
||||||
|
modifier = Modifier.size(24.dp),
|
||||||
|
colorFilter = ColorFilter.tint(Color.Black)
|
||||||
|
)
|
||||||
|
Text(
|
||||||
|
text = item.label,
|
||||||
|
fontSize = 14.sp,
|
||||||
|
color = Color.Black
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item.rightContent != null) {
|
||||||
|
item.rightContent?.invoke()
|
||||||
|
} else if (item.showRightArrow) {
|
||||||
|
Image(
|
||||||
|
painter = painterResource(id = R.drawable.rave_now_nav_right),
|
||||||
|
contentDescription = null,
|
||||||
|
modifier = Modifier.size(24.dp),
|
||||||
|
colorFilter = ColorFilter.tint(Color(0xFF111213))
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -234,22 +234,24 @@ object AgentViewModel: ViewModel() {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
// 获取完整的语言标记(如 "zh-CN")
|
// 获取完整的语言标记(如 "zh-CN")
|
||||||
val sysLang = com.aiosman.ravenow.utils.Utils.getPreferredLanguageTag()
|
val fullLangTag = com.aiosman.ravenow.utils.Utils.getPreferredLanguageTag()
|
||||||
|
// 转换为后端支持的语言代码(仅支持 zh、cn、ja)
|
||||||
|
val sysLang = convertToSupportedLangCode(fullLangTag)
|
||||||
val response = apiClient.getCategories(
|
val response = apiClient.getCategories(
|
||||||
page = 1,
|
page = 1,
|
||||||
pageSize = 100,
|
pageSize = 100,
|
||||||
isActive = true,
|
isActive = true,
|
||||||
withChildren = false,
|
// withChildren = false,
|
||||||
withParent = false,
|
// withParent = false,
|
||||||
withCount = true,
|
// withCount = true,
|
||||||
hideEmpty = true,
|
// hideEmpty = true,
|
||||||
lang = sysLang
|
lang = sysLang
|
||||||
)
|
)
|
||||||
println("分类数据请求完成,响应成功: ${response.isSuccessful}, 语言标记: $sysLang")
|
println("分类数据请求完成,响应成功: ${response.isSuccessful}, 原始语言标记: $fullLangTag, 转换后: $sysLang")
|
||||||
if (response.isSuccessful) {
|
if (response.isSuccessful) {
|
||||||
val categoryList = response.body()?.list ?: emptyList()
|
val categoryList = response.body()?.list ?: emptyList()
|
||||||
println("获取到 ${categoryList.size} 个分类")
|
println("获取到 ${categoryList.size} 个分类")
|
||||||
// 使用当前语言获取翻译后的分类名称
|
// 使用转换后的语言代码获取翻译后的分类名称
|
||||||
categories = categoryList.map { category ->
|
categories = categoryList.map { category ->
|
||||||
CategoryItem.fromCategoryTemplate(category, sysLang)
|
CategoryItem.fromCategoryTemplate(category, sysLang)
|
||||||
}
|
}
|
||||||
@@ -266,6 +268,24 @@ object AgentViewModel: ViewModel() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将完整的语言标记转换为后端支持的语言代码
|
||||||
|
* 后端仅支持: zh, cn, ja
|
||||||
|
*
|
||||||
|
* @param langTag 完整的语言标记,如 "zh-CN", "zh-TW", "ja-JP", "en-US" 等
|
||||||
|
* @return 后端支持的语言代码,默认返回 "zh"
|
||||||
|
*/
|
||||||
|
private fun convertToSupportedLangCode(langTag: String): String {
|
||||||
|
return when {
|
||||||
|
langTag.startsWith("zh", ignoreCase = true) -> "zh"
|
||||||
|
langTag.startsWith("ja", ignoreCase = true) -> "ja"
|
||||||
|
// 如果是中文相关的其他标记,也返回 zh
|
||||||
|
langTag.equals("cn", ignoreCase = true) -> "cn"
|
||||||
|
// 默认返回中文
|
||||||
|
else -> "zh"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun loadAgentsByCategory(categoryId: Int) {
|
fun loadAgentsByCategory(categoryId: Int) {
|
||||||
loadAgentData(categoryId)
|
loadAgentData(categoryId)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,13 +97,13 @@ fun AgentChatListScreen() {
|
|||||||
Spacer(modifier = Modifier.height(39.dp))
|
Spacer(modifier = Modifier.height(39.dp))
|
||||||
Image(
|
Image(
|
||||||
painter = painterResource(
|
painter = painterResource(
|
||||||
id = if(AppState.darkMode) R.mipmap.qs_znt_qs_as_img
|
id = if(AppState.darkMode) R.mipmap.juhao_dark
|
||||||
else R.mipmap.invalid_name_5),
|
else R.mipmap.invalid_name_5),
|
||||||
contentDescription = "null data",
|
contentDescription = "null data",
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.size(181.dp)
|
.size(width = 181.dp, height = 153.dp)
|
||||||
)
|
)
|
||||||
Spacer(modifier = Modifier.height(24.dp))
|
Spacer(modifier = Modifier.height(if (AppState.darkMode) 9.dp else 24.dp))
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(R.string.agent_chat_empty_title),
|
text = stringResource(R.string.agent_chat_empty_title),
|
||||||
color = AppColors.text,
|
color = AppColors.text,
|
||||||
|
|||||||
@@ -175,13 +175,13 @@ fun AllChatListScreen() {
|
|||||||
Spacer(modifier = Modifier.height(39.dp))
|
Spacer(modifier = Modifier.height(39.dp))
|
||||||
Image(
|
Image(
|
||||||
painter = painterResource(
|
painter = painterResource(
|
||||||
id = if(AppState.darkMode) R.mipmap.qs_py_qs_as_img
|
id = if(AppState.darkMode) R.mipmap.piao_dark
|
||||||
else R.mipmap.invalid_name_2),
|
else R.mipmap.invalid_name_2),
|
||||||
contentDescription = "null data",
|
contentDescription = "null data",
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.size(181.dp)
|
.size(width = 181.dp, height = 153.dp)
|
||||||
)
|
)
|
||||||
Spacer(modifier = Modifier.height(24.dp))
|
Spacer(modifier = Modifier.height(if (AppState.darkMode) 9.dp else 24.dp))
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(R.string.friend_chat_empty_title),
|
text = stringResource(R.string.friend_chat_empty_title),
|
||||||
color = AppColors.text,
|
color = AppColors.text,
|
||||||
|
|||||||
@@ -85,13 +85,13 @@ fun FriendChatListScreen() {
|
|||||||
Spacer(modifier = Modifier.height(39.dp))
|
Spacer(modifier = Modifier.height(39.dp))
|
||||||
Image(
|
Image(
|
||||||
painter = painterResource(
|
painter = painterResource(
|
||||||
id = if(AppState.darkMode) R.mipmap.qs_py_qs_as_img
|
id = if(AppState.darkMode) R.mipmap.piao_dark
|
||||||
else R.mipmap.invalid_name_2),
|
else R.mipmap.invalid_name_2),
|
||||||
contentDescription = "null data",
|
contentDescription = "null data",
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.size(181.dp)
|
.size(width = 181.dp, height = 153.dp)
|
||||||
)
|
)
|
||||||
Spacer(modifier = Modifier.height(24.dp))
|
Spacer(modifier = Modifier.height(if (AppState.darkMode) 9.dp else 24.dp))
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(R.string.friend_chat_empty_title),
|
text = stringResource(R.string.friend_chat_empty_title),
|
||||||
color = AppColors.text,
|
color = AppColors.text,
|
||||||
|
|||||||
@@ -77,13 +77,13 @@ fun GroupChatListScreen() {
|
|||||||
Spacer(modifier = Modifier.height(39.dp))
|
Spacer(modifier = Modifier.height(39.dp))
|
||||||
Image(
|
Image(
|
||||||
painter = painterResource(
|
painter = painterResource(
|
||||||
id = if(AppState.darkMode) R.mipmap.qs_ql_qs_as_img
|
id = if(AppState.darkMode) R.mipmap.fei_dark
|
||||||
else R.mipmap.invalid_name_12),
|
else R.mipmap.invalid_name_12),
|
||||||
contentDescription = "null data",
|
contentDescription = "null data",
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.size(181.dp)
|
.size(width = 181.dp, height = 153.dp)
|
||||||
)
|
)
|
||||||
Spacer(modifier = Modifier.height(24.dp))
|
Spacer(modifier = Modifier.height(if (AppState.darkMode) 9.dp else 24.dp))
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(R.string.group_chat_empty),
|
text = stringResource(R.string.group_chat_empty),
|
||||||
color = AppColors.text,
|
color = AppColors.text,
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import com.aiosman.ravenow.event.MomentAddEvent
|
|||||||
import com.aiosman.ravenow.event.MomentFavouriteChangeEvent
|
import com.aiosman.ravenow.event.MomentFavouriteChangeEvent
|
||||||
import com.aiosman.ravenow.event.MomentLikeChangeEvent
|
import com.aiosman.ravenow.event.MomentLikeChangeEvent
|
||||||
import com.aiosman.ravenow.event.MomentRemoveEvent
|
import com.aiosman.ravenow.event.MomentRemoveEvent
|
||||||
|
import com.aiosman.ravenow.ui.follower.FollowerNoticeViewModel
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import org.greenrobot.eventbus.EventBus
|
import org.greenrobot.eventbus.EventBus
|
||||||
import org.greenrobot.eventbus.Subscribe
|
import org.greenrobot.eventbus.Subscribe
|
||||||
@@ -122,8 +123,9 @@ open class BaseMomentModel :ViewModel(){
|
|||||||
userService.unFollowUser(moment.authorId.toString())
|
userService.unFollowUser(moment.authorId.toString())
|
||||||
EventBus.getDefault().post(FollowChangeEvent(moment.authorId, false))
|
EventBus.getDefault().post(FollowChangeEvent(moment.authorId, false))
|
||||||
} else {
|
} else {
|
||||||
userService.followUser(moment.authorId.toString())
|
// 调用 FollowerNoticeViewModel.followUser() 实现与 FollowerNotice.kt 相同的效果
|
||||||
EventBus.getDefault().post(FollowChangeEvent(moment.authorId, true))
|
// 该方法内部会调用 userService.followUser() 并发布 FollowChangeEvent 事件
|
||||||
|
FollowerNoticeViewModel.followUser(moment.authorId)
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
e.printStackTrace()
|
e.printStackTrace()
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import android.util.Log
|
|||||||
import androidx.compose.foundation.ExperimentalFoundationApi
|
import androidx.compose.foundation.ExperimentalFoundationApi
|
||||||
import androidx.compose.foundation.Image
|
import androidx.compose.foundation.Image
|
||||||
import androidx.compose.foundation.background
|
import androidx.compose.foundation.background
|
||||||
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
@@ -86,8 +87,8 @@ import com.aiosman.ravenow.ui.composables.toolbar.rememberCollapsingToolbarScaff
|
|||||||
import com.aiosman.ravenow.ui.index.IndexViewModel
|
import com.aiosman.ravenow.ui.index.IndexViewModel
|
||||||
import com.aiosman.ravenow.ui.index.tabs.profile.composable.GalleryGrid
|
import com.aiosman.ravenow.ui.index.tabs.profile.composable.GalleryGrid
|
||||||
import com.aiosman.ravenow.ui.post.MenuActionItem
|
import com.aiosman.ravenow.ui.post.MenuActionItem
|
||||||
|
import com.aiosman.ravenow.ui.index.tabs.profile.composable.GroupChatEmptyContent
|
||||||
import com.aiosman.ravenow.ui.index.tabs.profile.composable.OtherProfileAction
|
import com.aiosman.ravenow.ui.index.tabs.profile.composable.OtherProfileAction
|
||||||
import com.aiosman.ravenow.ui.index.tabs.profile.composable.SelfProfileAction
|
|
||||||
import com.aiosman.ravenow.ui.index.tabs.profile.composable.UserAgentsList
|
import com.aiosman.ravenow.ui.index.tabs.profile.composable.UserAgentsList
|
||||||
import com.aiosman.ravenow.ui.index.tabs.profile.composable.UserAgentsRow
|
import com.aiosman.ravenow.ui.index.tabs.profile.composable.UserAgentsRow
|
||||||
import com.aiosman.ravenow.ui.index.tabs.profile.composable.UserContentPageIndicator
|
import com.aiosman.ravenow.ui.index.tabs.profile.composable.UserContentPageIndicator
|
||||||
@@ -100,6 +101,13 @@ import kotlinx.coroutines.launch
|
|||||||
import java.io.File
|
import java.io.File
|
||||||
import androidx.compose.foundation.rememberScrollState
|
import androidx.compose.foundation.rememberScrollState
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
|
import androidx.compose.foundation.Canvas
|
||||||
|
import androidx.compose.foundation.border
|
||||||
|
import androidx.compose.ui.geometry.Offset
|
||||||
|
import androidx.compose.ui.text.style.TextAlign
|
||||||
|
import androidx.compose.ui.graphics.Brush
|
||||||
|
import java.text.NumberFormat
|
||||||
|
import java.util.Locale
|
||||||
|
|
||||||
@OptIn(ExperimentalFoundationApi::class, ExperimentalMaterialApi::class, ExperimentalMaterial3Api::class)
|
@OptIn(ExperimentalFoundationApi::class, ExperimentalMaterialApi::class, ExperimentalMaterial3Api::class)
|
||||||
@Composable
|
@Composable
|
||||||
@@ -118,10 +126,11 @@ fun ProfileV3(
|
|||||||
onLike: (MomentEntity) -> Unit = {},
|
onLike: (MomentEntity) -> Unit = {},
|
||||||
onComment: (MomentEntity) -> Unit = {},
|
onComment: (MomentEntity) -> Unit = {},
|
||||||
onAgentClick: (AgentEntity) -> Unit = {},
|
onAgentClick: (AgentEntity) -> Unit = {},
|
||||||
postCount: Int? = null, // 新增参数用于传递帖子总数
|
postCount: Long? = null, // 新增参数用于传递帖子总数
|
||||||
) {
|
) {
|
||||||
val model = MyProfileViewModel
|
val model = MyProfileViewModel
|
||||||
val pagerState = rememberPagerState(pageCount = { if (isAiAccount) 1 else 2 })
|
// Tabs: 动态、(可选)智能体、群聊
|
||||||
|
val pagerState = rememberPagerState(pageCount = { if (isAiAccount) 2 else 3 })
|
||||||
val enabled by remember { mutableStateOf(true) }
|
val enabled by remember { mutableStateOf(true) }
|
||||||
val statusBarPaddingValues = WindowInsets.systemBars.asPaddingValues()
|
val statusBarPaddingValues = WindowInsets.systemBars.asPaddingValues()
|
||||||
var expanded by remember { mutableStateOf(false) }
|
var expanded by remember { mutableStateOf(false) }
|
||||||
@@ -134,7 +143,8 @@ fun ProfileV3(
|
|||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
val scope = rememberCoroutineScope()
|
val scope = rememberCoroutineScope()
|
||||||
val navController = LocalNavController.current
|
val navController = LocalNavController.current
|
||||||
val bannerHeight = 400
|
val bannerWidth = 402
|
||||||
|
val bannerHeight = 206
|
||||||
val pickBannerImageLauncher = pickupAndCompressLauncher(
|
val pickBannerImageLauncher = pickupAndCompressLauncher(
|
||||||
context,
|
context,
|
||||||
scope,
|
scope,
|
||||||
@@ -156,12 +166,13 @@ fun ProfileV3(
|
|||||||
val gridState = rememberLazyGridState()
|
val gridState = rememberLazyGridState()
|
||||||
val scrollState = rememberScrollState()
|
val scrollState = rememberScrollState()
|
||||||
|
|
||||||
val toolbarAlpha by remember {
|
// 计算导航栏背景透明度,根据滚动位置从0到1
|
||||||
|
val toolbarBackgroundAlpha by remember {
|
||||||
derivedStateOf {
|
derivedStateOf {
|
||||||
if (!isSelf) {
|
if (!isSelf) {
|
||||||
1f
|
1f
|
||||||
} else {
|
} else {
|
||||||
val maxScroll = 500f // 最大滚动距离,可调整
|
val maxScroll = 600f // 增加最大滚动距离,让渐变更平缓
|
||||||
val progress = (scrollState.value.coerceAtMost(maxScroll.toInt()) / maxScroll).coerceIn(0f, 1f)
|
val progress = (scrollState.value.coerceAtMost(maxScroll.toInt()) / maxScroll).coerceIn(0f, 1f)
|
||||||
progress
|
progress
|
||||||
}
|
}
|
||||||
@@ -308,12 +319,19 @@ fun ProfileV3(
|
|||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.height(bannerHeight.dp)
|
.height(bannerHeight.dp)
|
||||||
.background(AppColors.profileBackground)
|
.background(AppColors.profileBackground),
|
||||||
|
contentAlignment = Alignment.Center
|
||||||
) {
|
) {
|
||||||
Box(
|
Box(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.width(bannerWidth.dp)
|
||||||
.height(bannerHeight.dp - 24.dp)
|
.height(bannerHeight.dp)
|
||||||
|
.clip(
|
||||||
|
RoundedCornerShape(
|
||||||
|
bottomStart = 32.dp,
|
||||||
|
bottomEnd = 32.dp
|
||||||
|
)
|
||||||
|
)
|
||||||
.let {
|
.let {
|
||||||
if (isSelf && isMain) {
|
if (isSelf && isMain) {
|
||||||
it.noRippleClickable {
|
it.noRippleClickable {
|
||||||
@@ -326,13 +344,6 @@ fun ProfileV3(
|
|||||||
it
|
it
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.shadow(
|
|
||||||
elevation = 6.dp,
|
|
||||||
shape = RoundedCornerShape(
|
|
||||||
bottomStart = 32.dp,
|
|
||||||
bottomEnd = 32.dp
|
|
||||||
),
|
|
||||||
)
|
|
||||||
) {
|
) {
|
||||||
CustomAsyncImage(
|
CustomAsyncImage(
|
||||||
LocalContext.current,
|
LocalContext.current,
|
||||||
@@ -347,6 +358,9 @@ fun ProfileV3(
|
|||||||
Spacer(modifier = Modifier.height(100.dp))
|
Spacer(modifier = Modifier.height(100.dp))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 壁纸下方间距
|
||||||
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
|
|
||||||
// 用户信息
|
// 用户信息
|
||||||
Box(
|
Box(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
@@ -357,31 +371,25 @@ fun ProfileV3(
|
|||||||
profile?.let {
|
profile?.let {
|
||||||
UserItem(
|
UserItem(
|
||||||
accountProfileEntity = it,
|
accountProfileEntity = it,
|
||||||
postCount = postCount ?: if (isSelf) MyProfileViewModel.momentLoader.total else moments.size
|
postCount = postCount ?: if (isSelf) MyProfileViewModel.momentLoader.total else moments.size.toLong(),
|
||||||
|
isSelf = isSelf,
|
||||||
|
onEditClick = {
|
||||||
|
navController.navigate(NavigationRoute.AccountEdit.route)
|
||||||
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Spacer(modifier = Modifier.height(20.dp))
|
Spacer(modifier = Modifier.height(20.dp))
|
||||||
|
|
||||||
// 操作按钮
|
// 操作按钮(仅其他用户显示)
|
||||||
profile?.let {
|
profile?.let {
|
||||||
|
if (!isSelf && it.id != AppState.UserId) {
|
||||||
Box(
|
Box(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(horizontal = 16.dp)
|
.padding(horizontal = 16.dp)
|
||||||
) {
|
) {
|
||||||
if (isSelf) {
|
|
||||||
SelfProfileAction(
|
|
||||||
onEditProfile = {
|
|
||||||
navController.navigate(NavigationRoute.AccountEdit.route)
|
|
||||||
},
|
|
||||||
onPremiumClick = {
|
|
||||||
navController.navigate(NavigationRoute.VipSelPage.route)
|
|
||||||
}
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
if (it.id != AppState.UserId) {
|
|
||||||
OtherProfileAction(
|
OtherProfileAction(
|
||||||
it,
|
it,
|
||||||
onFollow = {
|
onFollow = {
|
||||||
@@ -394,7 +402,6 @@ fun ProfileV3(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// 用户智能体行
|
// 用户智能体行
|
||||||
if (!isAiAccount) {
|
if (!isAiAccount) {
|
||||||
@@ -445,15 +452,14 @@ fun ProfileV3(
|
|||||||
pagerState = pagerState,
|
pagerState = pagerState,
|
||||||
showAgentTab = !isAiAccount
|
showAgentTab = !isAiAccount
|
||||||
)
|
)
|
||||||
Spacer(modifier = Modifier.height(8.dp))
|
|
||||||
HorizontalPager(
|
HorizontalPager(
|
||||||
state = pagerState,
|
state = pagerState,
|
||||||
modifier = Modifier.height(500.dp) // 固定滚动高度
|
modifier = Modifier.height(500.dp) // 固定滚动高度
|
||||||
) { idx ->
|
) { idx ->
|
||||||
when (idx) {
|
when (idx) {
|
||||||
0 ->
|
0 -> GalleryGrid(moments = moments)
|
||||||
GalleryGrid(moments = moments)
|
1 -> {
|
||||||
1 ->
|
if (!isAiAccount) {
|
||||||
UserAgentsList(
|
UserAgentsList(
|
||||||
agents = agents,
|
agents = agents,
|
||||||
onAgentClick = onAgentClick,
|
onAgentClick = onAgentClick,
|
||||||
@@ -475,10 +481,22 @@ fun ProfileV3(
|
|||||||
},
|
},
|
||||||
modifier = Modifier.fillMaxSize()
|
modifier = Modifier.fillMaxSize()
|
||||||
)
|
)
|
||||||
|
} else {
|
||||||
|
GroupChatPlaceholder()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
2 -> {
|
||||||
|
if (!isAiAccount) {
|
||||||
|
GroupChatPlaceholder()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 底部间距,增加滚动距离
|
||||||
|
Spacer(modifier = Modifier.height(100.dp))
|
||||||
|
}
|
||||||
|
|
||||||
// 顶部导航栏
|
// 顶部导航栏
|
||||||
TopNavigationBar(
|
TopNavigationBar(
|
||||||
@@ -486,9 +504,13 @@ fun ProfileV3(
|
|||||||
isSelf = isSelf,
|
isSelf = isSelf,
|
||||||
profile = profile,
|
profile = profile,
|
||||||
navController = navController,
|
navController = navController,
|
||||||
alpha = toolbarAlpha,
|
backgroundAlpha = toolbarBackgroundAlpha,
|
||||||
|
interactionCount = moments.sumOf { it.likeCount }, // 计算总点赞数作为互动数据
|
||||||
onMenuClick = {
|
onMenuClick = {
|
||||||
showOtherUserMenu = true
|
showOtherUserMenu = true
|
||||||
|
},
|
||||||
|
onShareClick = {
|
||||||
|
// TODO: 实现分享功能
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -562,6 +584,11 @@ fun ProfileV3(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun GroupChatPlaceholder() {
|
||||||
|
GroupChatEmptyContent()
|
||||||
|
}
|
||||||
|
|
||||||
//顶部导航栏组件
|
//顶部导航栏组件
|
||||||
@Composable
|
@Composable
|
||||||
fun TopNavigationBar(
|
fun TopNavigationBar(
|
||||||
@@ -569,30 +596,161 @@ fun TopNavigationBar(
|
|||||||
isSelf: Boolean,
|
isSelf: Boolean,
|
||||||
profile: AccountProfileEntity?,
|
profile: AccountProfileEntity?,
|
||||||
navController: androidx.navigation.NavController,
|
navController: androidx.navigation.NavController,
|
||||||
alpha: Float,
|
backgroundAlpha: Float,
|
||||||
onMenuClick: () -> Unit = {}
|
interactionCount: Int = 0,
|
||||||
|
onMenuClick: () -> Unit = {},
|
||||||
|
onShareClick: () -> Unit = {}
|
||||||
) {
|
) {
|
||||||
val appColors = LocalAppTheme.current
|
val appColors = LocalAppTheme.current
|
||||||
|
val numberFormat = remember { NumberFormat.getNumberInstance(Locale.getDefault()) }
|
||||||
|
|
||||||
|
// 根据背景透明度决定图标颜色:透明度为1时变黑,否则为白色
|
||||||
|
val iconColor = if (backgroundAlpha >= 1f) Color.Black else Color.White
|
||||||
|
val cardBorderColor = if (backgroundAlpha >= 1f) Color.Black else Color.White
|
||||||
|
|
||||||
Box(
|
Box(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.graphicsLayer { this.alpha = alpha }
|
|
||||||
) {
|
) {
|
||||||
Column(
|
val statusBarPadding = WindowInsets.systemBars.asPaddingValues()
|
||||||
|
val statusBarHeight = statusBarPadding.calculateTopPadding()
|
||||||
|
val navigationBarHeight = 56.dp // 增加导航栏高度,包括图标和额外空间
|
||||||
|
|
||||||
|
// 导航栏背景层,包括状态栏区域,根据滚动位置逐渐变白
|
||||||
|
val totalHeight = statusBarHeight + navigationBarHeight
|
||||||
|
val density = LocalDensity.current
|
||||||
|
val totalHeightPx = with(density) { totalHeight.toPx() }
|
||||||
|
|
||||||
|
// 根据滚动位置计算基础颜色,从深色平滑过渡到白色,透明度从初始值逐渐减到0
|
||||||
|
val baseColor = remember(backgroundAlpha) {
|
||||||
|
val smoothProgress = backgroundAlpha.coerceIn(0f, 1f)
|
||||||
|
|
||||||
|
// 初始状态:半透明深色,让白色图标清晰可见
|
||||||
|
val initialDarkAlpha = 0.12f
|
||||||
|
|
||||||
|
// 使用平滑的插值函数,让整个过渡更自然
|
||||||
|
val easedProgress = smoothProgress * smoothProgress * (3f - 2f * smoothProgress) // smoothstep
|
||||||
|
|
||||||
|
// 颜色值:从黑色(0)平滑过渡到白色(1)
|
||||||
|
val colorValue = easedProgress
|
||||||
|
|
||||||
|
// 透明度:从初始值(0.12f)逐渐减少到0
|
||||||
|
// 当smoothProgress从0到1时,alpha从initialDarkAlpha减少到0
|
||||||
|
val alpha = initialDarkAlpha * (1f - easedProgress)
|
||||||
|
|
||||||
|
Color(
|
||||||
|
red = colorValue,
|
||||||
|
green = colorValue,
|
||||||
|
blue = colorValue,
|
||||||
|
alpha = alpha.coerceIn(0f, initialDarkAlpha)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
Box(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.background(appColors.profileBackground)
|
.height(totalHeight) // 状态栏高度 + 导航栏高度
|
||||||
) {
|
.align(Alignment.TopCenter)
|
||||||
StatusBarSpacer()
|
.background(
|
||||||
|
brush = Brush.verticalGradient(
|
||||||
|
colors = listOf(
|
||||||
|
baseColor, // 顶部保持基础颜色
|
||||||
|
baseColor, // 中间保持基础颜色
|
||||||
|
baseColor.copy(alpha = baseColor.alpha * 0.5f), // 底部过渡,逐渐变透明
|
||||||
|
Color.Transparent // 最底部完全透明
|
||||||
|
),
|
||||||
|
startY = 0f,
|
||||||
|
endY = totalHeightPx
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
// 功能按钮区域,图标和文字根据背景透明度改变颜色
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(horizontal = 16.dp, vertical = 8.dp)
|
.padding(top = 16.dp, bottom = 16.dp, end = 16.dp) // 增加上下内边距
|
||||||
.noRippleClickable {
|
.align(Alignment.TopEnd)
|
||||||
},
|
.padding(top = statusBarHeight), // 从状态栏下方开始
|
||||||
|
horizontalArrangement = Arrangement.End,
|
||||||
verticalAlignment = Alignment.CenterVertically
|
verticalAlignment = Alignment.CenterVertically
|
||||||
) {
|
) {
|
||||||
|
// 左侧:互动数据卡片
|
||||||
|
Row(
|
||||||
|
modifier = Modifier
|
||||||
|
.height(24.dp)
|
||||||
|
.background(
|
||||||
|
color = Color.White.copy(alpha = 0.52f),
|
||||||
|
shape = RoundedCornerShape(16.dp)
|
||||||
|
)
|
||||||
|
.border(
|
||||||
|
width = 0.5.dp,
|
||||||
|
color = cardBorderColor, // 根据背景透明度改变边框颜色
|
||||||
|
shape = RoundedCornerShape(16.dp)
|
||||||
|
)
|
||||||
|
.padding(horizontal = 8.dp),
|
||||||
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
|
horizontalArrangement = Arrangement.Center
|
||||||
|
) {
|
||||||
|
// 互动图标
|
||||||
|
Image(
|
||||||
|
painter = painterResource(id = R.mipmap.paip_coin_img),
|
||||||
|
contentDescription = "互动",
|
||||||
|
modifier = Modifier.size(24.dp),
|
||||||
|
)
|
||||||
|
Spacer(modifier = Modifier.width(4.dp))
|
||||||
|
Text(
|
||||||
|
text = numberFormat.format(interactionCount),
|
||||||
|
fontSize = 14.sp,
|
||||||
|
fontWeight = FontWeight.W500,
|
||||||
|
color = Color.Black, // 文字始终为黑色
|
||||||
|
textAlign = TextAlign.Center
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
Spacer(modifier = Modifier.width(16.dp))
|
||||||
|
|
||||||
|
// 中间:分享图标
|
||||||
|
Image(
|
||||||
|
painter = painterResource(id = R.mipmap.menu_icon),
|
||||||
|
contentDescription = "分享",
|
||||||
|
modifier = Modifier
|
||||||
|
.size(24.dp)
|
||||||
|
.noRippleClickable {
|
||||||
|
onShareClick()
|
||||||
|
},
|
||||||
|
colorFilter = ColorFilter.tint(iconColor) // 根据背景透明度改变颜色
|
||||||
|
)
|
||||||
|
|
||||||
|
Spacer(modifier = Modifier.width(16.dp))
|
||||||
|
|
||||||
|
// 右侧:菜单图标
|
||||||
|
Image(
|
||||||
|
painter = painterResource(id = R.mipmap.menu_ico),
|
||||||
|
contentDescription = "菜单",
|
||||||
|
modifier = Modifier
|
||||||
|
.size(24.dp)
|
||||||
|
.noRippleClickable {
|
||||||
|
if (isSelf && isMain) {
|
||||||
|
IndexViewModel.openDrawer = true
|
||||||
|
} else {
|
||||||
|
onMenuClick()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
colorFilter = ColorFilter.tint(iconColor) // 根据背景透明度改变颜色
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果不是主页面,显示返回按钮和用户信息
|
||||||
if (!isMain) {
|
if (!isMain) {
|
||||||
|
val statusBarPadding = WindowInsets.systemBars.asPaddingValues()
|
||||||
|
Row(
|
||||||
|
modifier = Modifier
|
||||||
|
.align(Alignment.TopStart)
|
||||||
|
.padding(horizontal = 16.dp, vertical = 8.dp)
|
||||||
|
.padding(top = statusBarPadding.calculateTopPadding()),
|
||||||
|
verticalAlignment = Alignment.CenterVertically
|
||||||
|
) {
|
||||||
Image(
|
Image(
|
||||||
painter = painterResource(id = R.drawable.rider_pro_back_icon),
|
painter = painterResource(id = R.drawable.rider_pro_back_icon),
|
||||||
contentDescription = "Back",
|
contentDescription = "Back",
|
||||||
@@ -601,7 +759,7 @@ fun TopNavigationBar(
|
|||||||
navController.navigateUp()
|
navController.navigateUp()
|
||||||
}
|
}
|
||||||
.size(24.dp),
|
.size(24.dp),
|
||||||
colorFilter = ColorFilter.tint(appColors.text)
|
colorFilter = ColorFilter.tint(Color.White)
|
||||||
)
|
)
|
||||||
Spacer(modifier = Modifier.width(8.dp))
|
Spacer(modifier = Modifier.width(8.dp))
|
||||||
CustomAsyncImage(
|
CustomAsyncImage(
|
||||||
@@ -618,55 +776,81 @@ fun TopNavigationBar(
|
|||||||
text = profile?.nickName ?: "",
|
text = profile?.nickName ?: "",
|
||||||
fontSize = 16.sp,
|
fontSize = 16.sp,
|
||||||
fontWeight = FontWeight.W600,
|
fontWeight = FontWeight.W600,
|
||||||
color = appColors.text
|
color = Color.White
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
Spacer(modifier = Modifier.weight(1f))
|
|
||||||
if (isSelf && isMain) {
|
|
||||||
Box(
|
|
||||||
modifier = Modifier
|
|
||||||
.size(24.dp)
|
|
||||||
.padding(16.dp)
|
|
||||||
)
|
|
||||||
} else if (!isSelf) {
|
|
||||||
Box(
|
|
||||||
modifier = Modifier
|
|
||||||
.noRippleClickable {
|
|
||||||
onMenuClick()
|
|
||||||
}
|
}
|
||||||
.padding(16.dp)
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 分享图标(向上箭头)
|
||||||
|
@Composable
|
||||||
|
fun ShareIcon(
|
||||||
|
color: Color,
|
||||||
|
modifier: Modifier = Modifier
|
||||||
) {
|
) {
|
||||||
Icon(
|
Canvas(modifier = modifier) {
|
||||||
painter = painterResource(id = R.drawable.rider_pro_more_horizon),
|
val strokeWidth = 2.dp.toPx()
|
||||||
contentDescription = "菜单",
|
val centerX = size.width / 2
|
||||||
tint = appColors.text,
|
val centerY = size.height / 2
|
||||||
modifier = Modifier.size(24.dp)
|
|
||||||
|
// 绘制向上的箭头
|
||||||
|
// 底部横线
|
||||||
|
drawLine(
|
||||||
|
color = color,
|
||||||
|
start = Offset(centerX - 9.dp.toPx(), centerY + 6.dp.toPx()),
|
||||||
|
end = Offset(centerX + 9.dp.toPx(), centerY + 6.dp.toPx()),
|
||||||
|
strokeWidth = strokeWidth
|
||||||
|
)
|
||||||
|
// 顶部横线
|
||||||
|
drawLine(
|
||||||
|
color = color,
|
||||||
|
start = Offset(centerX - 5.dp.toPx(), centerY - 6.5.dp.toPx()),
|
||||||
|
end = Offset(centerX + 5.dp.toPx(), centerY - 6.5.dp.toPx()),
|
||||||
|
strokeWidth = strokeWidth
|
||||||
|
)
|
||||||
|
// 中间竖线
|
||||||
|
drawLine(
|
||||||
|
color = color,
|
||||||
|
start = Offset(centerX, centerY - 3.dp.toPx()),
|
||||||
|
end = Offset(centerX, centerY + 6.dp.toPx()),
|
||||||
|
strokeWidth = strokeWidth
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
Spacer(modifier = Modifier.height(8.dp))
|
// 菜单图标(三条横线)
|
||||||
}
|
@Composable
|
||||||
if (isSelf && isMain) {
|
fun MenuIcon(
|
||||||
Box(
|
color: Color,
|
||||||
modifier = Modifier
|
modifier: Modifier = Modifier
|
||||||
.align(Alignment.TopEnd)
|
|
||||||
.padding(top = 32.dp, end = 16.dp)
|
|
||||||
.noRippleClickable {
|
|
||||||
IndexViewModel.openDrawer = true
|
|
||||||
}
|
|
||||||
) {
|
) {
|
||||||
Box(
|
Canvas(modifier = modifier) {
|
||||||
modifier = Modifier.padding(16.dp)
|
val strokeWidth = 2.dp.toPx()
|
||||||
) {
|
val centerX = size.width / 2
|
||||||
Icon(
|
val centerY = size.height / 2
|
||||||
painter = painterResource(id = R.drawable.rider_pro_more_horizon),
|
val lineLength = 16.dp.toPx()
|
||||||
contentDescription = "",
|
val spacing = 6.dp.toPx()
|
||||||
tint = appColors.text
|
|
||||||
|
// 绘制三条横线
|
||||||
|
drawLine(
|
||||||
|
color = color,
|
||||||
|
start = Offset(centerX - lineLength / 2, centerY - spacing),
|
||||||
|
end = Offset(centerX + lineLength / 2, centerY - spacing),
|
||||||
|
strokeWidth = strokeWidth
|
||||||
|
)
|
||||||
|
drawLine(
|
||||||
|
color = color,
|
||||||
|
start = Offset(centerX - lineLength / 2, centerY),
|
||||||
|
end = Offset(centerX + lineLength / 2, centerY),
|
||||||
|
strokeWidth = strokeWidth
|
||||||
|
)
|
||||||
|
drawLine(
|
||||||
|
color = color,
|
||||||
|
start = Offset(centerX - lineLength / 2, centerY + spacing),
|
||||||
|
end = Offset(centerX + lineLength / 2, centerY + spacing),
|
||||||
|
strokeWidth = strokeWidth
|
||||||
)
|
)
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -189,16 +189,17 @@ fun GalleryGrid(
|
|||||||
) {
|
) {
|
||||||
Image(
|
Image(
|
||||||
painter = painterResource(
|
painter = painterResource(
|
||||||
id = if(AppState.darkMode) R.mipmap.qs_dt_qs_as_img
|
id = if(AppState.darkMode) R.mipmap.shuihu_dark
|
||||||
else R.mipmap.invalid_name_7),
|
else R.mipmap.invalid_name_7),
|
||||||
contentDescription = "暂无图片",
|
contentDescription = "暂无图片",
|
||||||
modifier = Modifier.size(181.dp),
|
modifier = Modifier
|
||||||
|
.size(width = 181.dp, height = 153.dp),
|
||||||
)
|
)
|
||||||
|
|
||||||
Spacer(modifier = Modifier.height(24.dp))
|
Spacer(modifier = Modifier.height(if(AppState.darkMode) 9.dp else 24.dp))
|
||||||
|
|
||||||
Text(
|
Text(
|
||||||
text = "故事还没开始",
|
text = stringResource(R.string.your_story_not_started),
|
||||||
fontSize = 16.sp,
|
fontSize = 16.sp,
|
||||||
color = AppColors.text,
|
color = AppColors.text,
|
||||||
fontWeight = FontWeight.W600
|
fontWeight = FontWeight.W600
|
||||||
@@ -207,7 +208,7 @@ fun GalleryGrid(
|
|||||||
Spacer(modifier = Modifier.height(8.dp))
|
Spacer(modifier = Modifier.height(8.dp))
|
||||||
|
|
||||||
Text(
|
Text(
|
||||||
text = "发布一条动态,和世界打个招呼吧",
|
text = stringResource(R.string.publish_moment_greeting),
|
||||||
fontSize = 14.sp,
|
fontSize = 14.sp,
|
||||||
color = AppColors.secondaryText,
|
color = AppColors.secondaryText,
|
||||||
fontWeight = FontWeight.W400
|
fontWeight = FontWeight.W400
|
||||||
|
|||||||
@@ -0,0 +1,168 @@
|
|||||||
|
package com.aiosman.ravenow.ui.index.tabs.profile.composable
|
||||||
|
|
||||||
|
import androidx.compose.foundation.Image
|
||||||
|
import androidx.compose.foundation.background
|
||||||
|
import androidx.compose.foundation.clickable
|
||||||
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
|
import androidx.compose.foundation.layout.Box
|
||||||
|
import androidx.compose.foundation.layout.Column
|
||||||
|
import androidx.compose.foundation.layout.Row
|
||||||
|
import androidx.compose.foundation.layout.Spacer
|
||||||
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
|
import androidx.compose.foundation.layout.height
|
||||||
|
import androidx.compose.foundation.layout.padding
|
||||||
|
import androidx.compose.foundation.layout.size
|
||||||
|
import androidx.compose.foundation.layout.width
|
||||||
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
|
import androidx.compose.material3.Divider
|
||||||
|
import androidx.compose.material3.Text
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.runtime.getValue
|
||||||
|
import androidx.compose.runtime.mutableStateOf
|
||||||
|
import androidx.compose.runtime.remember
|
||||||
|
import androidx.compose.runtime.setValue
|
||||||
|
import androidx.compose.ui.Alignment
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
|
import androidx.compose.ui.layout.ContentScale
|
||||||
|
import androidx.compose.ui.res.painterResource
|
||||||
|
import androidx.compose.ui.res.stringResource
|
||||||
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
|
import androidx.compose.ui.unit.sp
|
||||||
|
import com.aiosman.ravenow.R
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun GroupChatEmptyContent() {
|
||||||
|
var selectedSegment by remember { mutableStateOf(0) } // 0: 全部, 1: 公开, 2: 私有
|
||||||
|
|
||||||
|
Column(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxSize()
|
||||||
|
.padding(horizontal = 16.dp)
|
||||||
|
) {
|
||||||
|
// 分割线(紧贴上方栏)
|
||||||
|
Divider(
|
||||||
|
color = Color(0xFFF0F0F0), // 更浅的灰色
|
||||||
|
thickness = 1.dp,
|
||||||
|
modifier = Modifier.fillMaxWidth()
|
||||||
|
)
|
||||||
|
|
||||||
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
|
|
||||||
|
// 分段控制器
|
||||||
|
SegmentedControl(
|
||||||
|
selectedIndex = selectedSegment,
|
||||||
|
onSegmentSelected = { selectedSegment = it },
|
||||||
|
modifier = Modifier.fillMaxWidth()
|
||||||
|
)
|
||||||
|
|
||||||
|
Spacer(modifier = Modifier.height(8.dp))
|
||||||
|
|
||||||
|
// 空状态内容(居中)
|
||||||
|
Column(
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
horizontalAlignment = Alignment.CenterHorizontally
|
||||||
|
) {
|
||||||
|
// 空状态插图
|
||||||
|
EmptyStateIllustration()
|
||||||
|
|
||||||
|
Spacer(modifier = Modifier.height(9.dp))
|
||||||
|
|
||||||
|
// 空状态文本
|
||||||
|
Text(
|
||||||
|
text = stringResource(R.string.empty_nothing),
|
||||||
|
fontSize = 16.sp,
|
||||||
|
fontWeight = FontWeight.SemiBold,
|
||||||
|
color = Color(0xFF000000)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun SegmentedControl(
|
||||||
|
selectedIndex: Int,
|
||||||
|
onSegmentSelected: (Int) -> Unit,
|
||||||
|
modifier: Modifier = Modifier
|
||||||
|
) {
|
||||||
|
Row(
|
||||||
|
modifier = modifier
|
||||||
|
.height(32.dp),
|
||||||
|
horizontalArrangement = Arrangement.Start,
|
||||||
|
verticalAlignment = Alignment.CenterVertically
|
||||||
|
) {
|
||||||
|
// 全部
|
||||||
|
SegmentButton(
|
||||||
|
text = stringResource(R.string.chat_all),
|
||||||
|
isSelected = selectedIndex == 0,
|
||||||
|
onClick = { onSegmentSelected(0) },
|
||||||
|
width = 54.dp
|
||||||
|
)
|
||||||
|
|
||||||
|
Spacer(modifier = Modifier.width(8.dp))
|
||||||
|
|
||||||
|
// 公开
|
||||||
|
SegmentButton(
|
||||||
|
text = stringResource(R.string.public_label),
|
||||||
|
isSelected = selectedIndex == 1,
|
||||||
|
onClick = { onSegmentSelected(1) },
|
||||||
|
width = 59.dp
|
||||||
|
)
|
||||||
|
|
||||||
|
Spacer(modifier = Modifier.width(8.dp))
|
||||||
|
|
||||||
|
// 私有
|
||||||
|
SegmentButton(
|
||||||
|
text = stringResource(R.string.private_label),
|
||||||
|
isSelected = selectedIndex == 2,
|
||||||
|
onClick = { onSegmentSelected(2) },
|
||||||
|
width = 54.dp
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun SegmentButton(
|
||||||
|
text: String,
|
||||||
|
isSelected: Boolean,
|
||||||
|
onClick: () -> Unit,
|
||||||
|
width: androidx.compose.ui.unit.Dp
|
||||||
|
) {
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.width(width)
|
||||||
|
.height(32.dp)
|
||||||
|
.background(
|
||||||
|
color = if (isSelected) {
|
||||||
|
Color(0xFF110C13) // RGB(17, 12, 19)
|
||||||
|
} else {
|
||||||
|
Color(0x147C7480) // RGB(124, 116, 128, alpha 0.08)
|
||||||
|
},
|
||||||
|
shape = RoundedCornerShape(1000.dp)
|
||||||
|
)
|
||||||
|
.clickable(onClick = onClick),
|
||||||
|
contentAlignment = Alignment.Center
|
||||||
|
) {
|
||||||
|
Text(
|
||||||
|
text = text,
|
||||||
|
fontSize = 13.sp,
|
||||||
|
fontWeight = FontWeight.Normal,
|
||||||
|
color = if (isSelected) Color(0xFFFFFFFF) else Color(0xFF000000)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun EmptyStateIllustration() {
|
||||||
|
Image(
|
||||||
|
painter = painterResource(id = R.mipmap.l_empty_img),
|
||||||
|
contentDescription = "空状态",
|
||||||
|
modifier = Modifier
|
||||||
|
.width(181.dp)
|
||||||
|
.height(153.dp),
|
||||||
|
contentScale = ContentScale.Fit
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
@@ -98,7 +98,7 @@ fun OtherProfileAction(
|
|||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
text = if (profile.isFollowing) "已关注" else stringResource(R.string.follow_upper),
|
text = if (profile.isFollowing) stringResource(R.string.follow_upper_had) else stringResource(R.string.follow_upper),
|
||||||
fontSize = 14.sp,
|
fontSize = 14.sp,
|
||||||
fontWeight = FontWeight.W900,
|
fontWeight = FontWeight.W900,
|
||||||
color = if (profile.isFollowing) {
|
color = if (profile.isFollowing) {
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import androidx.compose.foundation.layout.width
|
|||||||
import androidx.compose.foundation.lazy.LazyColumn
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
import androidx.compose.foundation.lazy.items
|
import androidx.compose.foundation.lazy.items
|
||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
|
import androidx.compose.material3.Divider
|
||||||
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
|
||||||
@@ -60,15 +61,14 @@ fun UserAgentsList(
|
|||||||
) {
|
) {
|
||||||
val AppColors = LocalAppTheme.current
|
val AppColors = LocalAppTheme.current
|
||||||
|
|
||||||
|
if (agents.isEmpty()) {
|
||||||
|
// 使用带分段控制器的空状态布局
|
||||||
|
AgentEmptyContentWithSegments()
|
||||||
|
} else {
|
||||||
LazyColumn(
|
LazyColumn(
|
||||||
modifier = modifier.fillMaxSize(),
|
modifier = modifier.fillMaxSize(),
|
||||||
verticalArrangement = Arrangement.spacedBy(8.dp)
|
verticalArrangement = Arrangement.spacedBy(8.dp)
|
||||||
) {
|
) {
|
||||||
if (agents.isEmpty()) {
|
|
||||||
item {
|
|
||||||
EmptyAgentsView()
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
items(agents) { agent ->
|
items(agents) { agent ->
|
||||||
UserAgentCard(
|
UserAgentCard(
|
||||||
agent = agent,
|
agent = agent,
|
||||||
@@ -76,7 +76,6 @@ fun UserAgentsList(
|
|||||||
onAvatarClick = onAvatarClick
|
onAvatarClick = onAvatarClick
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// 底部间距
|
// 底部间距
|
||||||
item {
|
item {
|
||||||
@@ -84,6 +83,7 @@ fun UserAgentsList(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun UserAgentCard(
|
fun UserAgentCard(
|
||||||
@@ -198,6 +198,178 @@ fun UserAgentCard(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun AgentEmptyContentWithSegments() {
|
||||||
|
var selectedSegment by remember { mutableStateOf(0) } // 0: 全部, 1: 公开, 2: 私有
|
||||||
|
val AppColors = LocalAppTheme.current
|
||||||
|
val isNetworkAvailable = NetworkUtils.isNetworkAvailable(LocalContext.current)
|
||||||
|
|
||||||
|
Column(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxSize()
|
||||||
|
.padding(horizontal = 16.dp)
|
||||||
|
) {
|
||||||
|
// 分割线(紧贴上方栏)
|
||||||
|
Divider(
|
||||||
|
color = Color(0xFFF0F0F0), // 更浅的灰色
|
||||||
|
thickness = 1.dp,
|
||||||
|
modifier = Modifier.fillMaxWidth()
|
||||||
|
)
|
||||||
|
|
||||||
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
|
|
||||||
|
// 分段控制器
|
||||||
|
AgentSegmentedControl(
|
||||||
|
selectedIndex = selectedSegment,
|
||||||
|
onSegmentSelected = { selectedSegment = it },
|
||||||
|
modifier = Modifier.fillMaxWidth()
|
||||||
|
)
|
||||||
|
|
||||||
|
Spacer(modifier = Modifier.height(8.dp))
|
||||||
|
|
||||||
|
// 空状态内容(使用智能体原本的图标和文字)
|
||||||
|
Column(
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
horizontalAlignment = Alignment.CenterHorizontally
|
||||||
|
) {
|
||||||
|
if (isNetworkAvailable) {
|
||||||
|
Image(
|
||||||
|
painter = painterResource(
|
||||||
|
id = if(AppState.darkMode) R.mipmap.ai_dark
|
||||||
|
else R.mipmap.ai),
|
||||||
|
contentDescription = "暂无Agent",
|
||||||
|
modifier = Modifier
|
||||||
|
.size(width = 181.dp, height = 153.dp)
|
||||||
|
.align(Alignment.CenterHorizontally),
|
||||||
|
)
|
||||||
|
|
||||||
|
// 根据是否为深色模式调整间距
|
||||||
|
Spacer(modifier = Modifier.height(if(AppState.darkMode) 9.dp else 24.dp))
|
||||||
|
|
||||||
|
Text(
|
||||||
|
text = stringResource(R.string.exclusive_ai_waiting),
|
||||||
|
fontSize = 16.sp,
|
||||||
|
color = AppColors.text,
|
||||||
|
fontWeight = FontWeight.W600
|
||||||
|
)
|
||||||
|
|
||||||
|
Spacer(modifier = Modifier.height(8.dp))
|
||||||
|
|
||||||
|
Text(
|
||||||
|
text = stringResource(R.string.ai_companion_not_tool),
|
||||||
|
fontSize = 14.sp,
|
||||||
|
color = AppColors.secondaryText,
|
||||||
|
fontWeight = FontWeight.W400
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
Image(
|
||||||
|
painter = painterResource(id = R.mipmap.invalid_name_10),
|
||||||
|
contentDescription = "network error",
|
||||||
|
modifier = Modifier.size(181.dp),
|
||||||
|
)
|
||||||
|
|
||||||
|
Spacer(modifier = Modifier.height(24.dp))
|
||||||
|
|
||||||
|
Text(
|
||||||
|
text = stringResource(R.string.friend_chat_no_network_title),
|
||||||
|
fontSize = 16.sp,
|
||||||
|
color = AppColors.text,
|
||||||
|
fontWeight = FontWeight.W600
|
||||||
|
)
|
||||||
|
|
||||||
|
Spacer(modifier = Modifier.height(8.dp))
|
||||||
|
|
||||||
|
Text(
|
||||||
|
text = stringResource(R.string.friend_chat_no_network_subtitle),
|
||||||
|
fontSize = 14.sp,
|
||||||
|
color = AppColors.secondaryText,
|
||||||
|
fontWeight = FontWeight.W400
|
||||||
|
)
|
||||||
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
|
ReloadButton(
|
||||||
|
onClick = {
|
||||||
|
MyProfileViewModel.ResetModel()
|
||||||
|
MyProfileViewModel.loadProfile(pullRefresh = true)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun AgentSegmentedControl(
|
||||||
|
selectedIndex: Int,
|
||||||
|
onSegmentSelected: (Int) -> Unit,
|
||||||
|
modifier: Modifier = Modifier
|
||||||
|
) {
|
||||||
|
Row(
|
||||||
|
modifier = modifier
|
||||||
|
.height(32.dp),
|
||||||
|
horizontalArrangement = Arrangement.Start,
|
||||||
|
verticalAlignment = Alignment.CenterVertically
|
||||||
|
) {
|
||||||
|
// 全部
|
||||||
|
AgentSegmentButton(
|
||||||
|
text = stringResource(R.string.chat_all),
|
||||||
|
isSelected = selectedIndex == 0,
|
||||||
|
onClick = { onSegmentSelected(0) },
|
||||||
|
width = 54.dp
|
||||||
|
)
|
||||||
|
|
||||||
|
Spacer(modifier = Modifier.width(8.dp))
|
||||||
|
|
||||||
|
// 公开
|
||||||
|
AgentSegmentButton(
|
||||||
|
text = stringResource(R.string.public_label),
|
||||||
|
isSelected = selectedIndex == 1,
|
||||||
|
onClick = { onSegmentSelected(1) },
|
||||||
|
width = 59.dp
|
||||||
|
)
|
||||||
|
|
||||||
|
Spacer(modifier = Modifier.width(8.dp))
|
||||||
|
|
||||||
|
// 私有
|
||||||
|
AgentSegmentButton(
|
||||||
|
text = stringResource(R.string.private_label),
|
||||||
|
isSelected = selectedIndex == 2,
|
||||||
|
onClick = { onSegmentSelected(2) },
|
||||||
|
width = 54.dp
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun AgentSegmentButton(
|
||||||
|
text: String,
|
||||||
|
isSelected: Boolean,
|
||||||
|
onClick: () -> Unit,
|
||||||
|
width: androidx.compose.ui.unit.Dp
|
||||||
|
) {
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.width(width)
|
||||||
|
.height(32.dp)
|
||||||
|
.background(
|
||||||
|
color = if (isSelected) {
|
||||||
|
Color(0xFF110C13) // RGB(17, 12, 19)
|
||||||
|
} else {
|
||||||
|
Color(0x147C7480) // RGB(124, 116, 128, alpha 0.08)
|
||||||
|
},
|
||||||
|
shape = RoundedCornerShape(1000.dp)
|
||||||
|
)
|
||||||
|
.clickable(onClick = onClick),
|
||||||
|
contentAlignment = Alignment.Center
|
||||||
|
) {
|
||||||
|
Text(
|
||||||
|
text = text,
|
||||||
|
fontSize = 13.sp,
|
||||||
|
fontWeight = FontWeight.Normal,
|
||||||
|
color = if (isSelected) Color(0xFFFFFFFF) else Color(0xFF000000)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun EmptyAgentsView() {
|
fun EmptyAgentsView() {
|
||||||
val AppColors = LocalAppTheme.current
|
val AppColors = LocalAppTheme.current
|
||||||
@@ -220,7 +392,8 @@ fun EmptyAgentsView() {
|
|||||||
.align(Alignment.CenterHorizontally),
|
.align(Alignment.CenterHorizontally),
|
||||||
)
|
)
|
||||||
|
|
||||||
Spacer(modifier = Modifier.height(24.dp))
|
// 根据是否为深色模式调整间距
|
||||||
|
Spacer(modifier = Modifier.height(if(AppState.darkMode) 9.dp else 24.dp))
|
||||||
|
|
||||||
Text(
|
Text(
|
||||||
text = "专属AI等你召唤",
|
text = "专属AI等你召唤",
|
||||||
|
|||||||
@@ -10,21 +10,14 @@ 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.height
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.layout.size
|
|
||||||
import androidx.compose.foundation.layout.width
|
import androidx.compose.foundation.layout.width
|
||||||
import androidx.compose.foundation.pager.PagerState
|
import androidx.compose.foundation.pager.PagerState
|
||||||
import androidx.compose.foundation.rememberScrollState
|
|
||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
||||||
import androidx.compose.foundation.verticalScroll
|
|
||||||
import androidx.compose.material3.Icon
|
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
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.draw.clip
|
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
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
|
||||||
@@ -52,7 +45,7 @@ fun UserContentPageIndicator(
|
|||||||
.padding(horizontal = 16.dp),
|
.padding(horizontal = 16.dp),
|
||||||
horizontalArrangement = Arrangement.SpaceEvenly
|
horizontalArrangement = Arrangement.SpaceEvenly
|
||||||
) {
|
) {
|
||||||
// 图片/相册 Tab
|
// 动态 Tab
|
||||||
Column(
|
Column(
|
||||||
horizontalAlignment = Alignment.CenterHorizontally,
|
horizontalAlignment = Alignment.CenterHorizontally,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
@@ -64,15 +57,24 @@ fun UserContentPageIndicator(
|
|||||||
}
|
}
|
||||||
.padding(vertical = 12.dp)
|
.padding(vertical = 12.dp)
|
||||||
) {
|
) {
|
||||||
Icon(
|
Text(
|
||||||
painter = painterResource(id = R.drawable.rider_pro_images),
|
text = stringResource(R.string.index_dynamic),
|
||||||
contentDescription = "Gallery",
|
fontSize = 16.sp,
|
||||||
tint = if (pagerState.currentPage == 0) AppColors.text else AppColors.text.copy(alpha = 0.6f),
|
fontWeight = if (pagerState.currentPage == 0) FontWeight.SemiBold else FontWeight.Medium,
|
||||||
modifier = Modifier.size(24.dp)
|
color = if (pagerState.currentPage == 0) Color(0xFF000000) else Color(0x993C3C43)
|
||||||
|
)
|
||||||
|
Spacer(modifier = Modifier.height(if (pagerState.currentPage == 0) 6.dp else 4.dp))
|
||||||
|
if (pagerState.currentPage == 0) {
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.width(20.dp)
|
||||||
|
.height(2.dp)
|
||||||
|
.background(Color(0xFF000000))
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Agent Tab (只在非智能体用户时显示)
|
// 智能体 Tab (只在非智能体用户时显示)
|
||||||
if (showAgentTab) {
|
if (showAgentTab) {
|
||||||
Column(
|
Column(
|
||||||
horizontalAlignment = Alignment.CenterHorizontally,
|
horizontalAlignment = Alignment.CenterHorizontally,
|
||||||
@@ -85,40 +87,54 @@ fun UserContentPageIndicator(
|
|||||||
}
|
}
|
||||||
.padding(vertical = 12.dp)
|
.padding(vertical = 12.dp)
|
||||||
) {
|
) {
|
||||||
Icon(
|
Text(
|
||||||
painter = painterResource(id = R.drawable.rider_pro_nav_ai),
|
text = stringResource(R.string.chat_ai),
|
||||||
contentDescription = "Agents",
|
fontSize = 16.sp,
|
||||||
tint = if (pagerState.currentPage == 1) AppColors.text else AppColors.text.copy(alpha = 0.6f),
|
fontWeight = if (pagerState.currentPage == 1) FontWeight.SemiBold else FontWeight.Medium,
|
||||||
modifier = Modifier.size(24.dp)
|
color = if (pagerState.currentPage == 1) Color(0xFF000000) else Color(0x993C3C43)
|
||||||
|
)
|
||||||
|
Spacer(modifier = Modifier.height(if (pagerState.currentPage == 1) 6.dp else 4.dp))
|
||||||
|
if (pagerState.currentPage == 1) {
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.width(20.dp)
|
||||||
|
.height(2.dp)
|
||||||
|
.background(Color(0xFF000000))
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 下划线指示器
|
// 群聊 Tab (只在非智能体用户时显示)
|
||||||
Row(
|
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.padding(horizontal = 16.dp)
|
|
||||||
) {
|
|
||||||
Box(
|
|
||||||
modifier = Modifier
|
|
||||||
.weight(1f)
|
|
||||||
.height(2.dp)
|
|
||||||
.background(
|
|
||||||
if (pagerState.currentPage == 0) AppColors.text else Color.Transparent
|
|
||||||
)
|
|
||||||
)
|
|
||||||
if (showAgentTab) {
|
if (showAgentTab) {
|
||||||
Box(
|
Column(
|
||||||
|
horizontalAlignment = Alignment.CenterHorizontally,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.weight(1f)
|
.weight(1f)
|
||||||
|
.noRippleClickable {
|
||||||
|
scope.launch {
|
||||||
|
pagerState.scrollToPage(2)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.padding(vertical = 12.dp)
|
||||||
|
) {
|
||||||
|
Text(
|
||||||
|
text = stringResource(R.string.chat_group),
|
||||||
|
fontSize = 16.sp,
|
||||||
|
fontWeight = if (pagerState.currentPage == 2) FontWeight.SemiBold else FontWeight.Medium,
|
||||||
|
color = if (pagerState.currentPage == 2) Color(0xFF000000) else Color(0x993C3C43)
|
||||||
|
)
|
||||||
|
Spacer(modifier = Modifier.height(if (pagerState.currentPage == 2) 6.dp else 4.dp))
|
||||||
|
if (pagerState.currentPage == 2) {
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.width(20.dp)
|
||||||
.height(2.dp)
|
.height(2.dp)
|
||||||
.background(
|
.background(Color(0xFF000000))
|
||||||
if (pagerState.currentPage == 1) AppColors.text else Color.Transparent
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,26 +1,39 @@
|
|||||||
package com.aiosman.ravenow.ui.index.tabs.profile.composable
|
package com.aiosman.ravenow.ui.index.tabs.profile.composable
|
||||||
|
|
||||||
|
import androidx.compose.foundation.Image
|
||||||
|
import androidx.compose.foundation.background
|
||||||
|
import androidx.compose.foundation.clickable
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
|
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.height
|
||||||
|
import androidx.compose.foundation.layout.offset
|
||||||
|
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
|
||||||
import androidx.compose.foundation.shape.CircleShape
|
import androidx.compose.foundation.shape.CircleShape
|
||||||
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.runtime.remember
|
||||||
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.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.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.text.style.TextAlign
|
||||||
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.ravenow.AppStore
|
||||||
import com.aiosman.ravenow.LocalAppTheme
|
import com.aiosman.ravenow.LocalAppTheme
|
||||||
import com.aiosman.ravenow.LocalNavController
|
import com.aiosman.ravenow.LocalNavController
|
||||||
import com.aiosman.ravenow.R
|
import com.aiosman.ravenow.R
|
||||||
@@ -29,23 +42,52 @@ import com.aiosman.ravenow.ui.NavigationRoute
|
|||||||
import com.aiosman.ravenow.ui.composables.CustomAsyncImage
|
import com.aiosman.ravenow.ui.composables.CustomAsyncImage
|
||||||
import com.aiosman.ravenow.ui.composables.rememberDebouncer
|
import com.aiosman.ravenow.ui.composables.rememberDebouncer
|
||||||
import com.aiosman.ravenow.ui.modifiers.noRippleClickable
|
import com.aiosman.ravenow.ui.modifiers.noRippleClickable
|
||||||
|
import java.text.NumberFormat
|
||||||
|
import java.util.Locale
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun UserItem(
|
fun UserItem(
|
||||||
accountProfileEntity: AccountProfileEntity,
|
accountProfileEntity: AccountProfileEntity,
|
||||||
postCount: Int = 0
|
postCount: Long = 0,
|
||||||
|
isSelf: Boolean = false,
|
||||||
|
onEditClick: () -> Unit = {}
|
||||||
) {
|
) {
|
||||||
val navController = LocalNavController.current
|
val navController = LocalNavController.current
|
||||||
val AppColors = LocalAppTheme.current
|
val AppColors = LocalAppTheme.current
|
||||||
val followerDebouncer = rememberDebouncer()
|
val followerDebouncer = rememberDebouncer()
|
||||||
val followingDebouncer = rememberDebouncer()
|
val followingDebouncer = rememberDebouncer()
|
||||||
|
|
||||||
|
// 获取 MBTI 和星座信息
|
||||||
|
val mbti = remember(accountProfileEntity.id) {
|
||||||
|
AppStore.getUserMbti(accountProfileEntity.id)
|
||||||
|
}
|
||||||
|
val zodiac = remember(accountProfileEntity.id) {
|
||||||
|
AppStore.getUserZodiac(accountProfileEntity.id)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 格式化粉丝数
|
||||||
|
val numberFormat = remember { NumberFormat.getNumberInstance(Locale.getDefault()) }
|
||||||
|
val formattedFollowerCount = remember(accountProfileEntity.followerCount) {
|
||||||
|
if (accountProfileEntity.followerCount >= 10000) {
|
||||||
|
val wan = accountProfileEntity.followerCount / 10000.0
|
||||||
|
if (wan >= 100) {
|
||||||
|
"${wan.toInt()}万"
|
||||||
|
} else {
|
||||||
|
String.format("%.1f万", wan)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
numberFormat.format(accountProfileEntity.followerCount)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
) {
|
) {
|
||||||
|
// 顶部:头像和统计数据
|
||||||
Row(
|
Row(
|
||||||
verticalAlignment = Alignment.CenterVertically
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
|
horizontalArrangement = Arrangement.spacedBy(16.dp)
|
||||||
) {
|
) {
|
||||||
// 头像
|
// 头像
|
||||||
CustomAsyncImage(
|
CustomAsyncImage(
|
||||||
@@ -53,39 +95,47 @@ fun UserItem(
|
|||||||
accountProfileEntity.avatar,
|
accountProfileEntity.avatar,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.clip(CircleShape)
|
.clip(CircleShape)
|
||||||
.size(48.dp),
|
.size(96.dp),
|
||||||
contentDescription = "",
|
contentDescription = "",
|
||||||
contentScale = ContentScale.Crop
|
contentScale = ContentScale.Crop
|
||||||
)
|
)
|
||||||
Spacer(modifier = Modifier.width(32.dp))
|
|
||||||
//个人统计
|
// 统计数据
|
||||||
Row(
|
Row(
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
modifier = Modifier.weight(1f),
|
||||||
modifier = Modifier.weight(1f)
|
horizontalArrangement = Arrangement.spacedBy(0.dp),
|
||||||
|
verticalAlignment = Alignment.CenterVertically
|
||||||
) {
|
) {
|
||||||
// 帖子数
|
// 帖子数
|
||||||
Column(
|
Column(
|
||||||
|
modifier = Modifier
|
||||||
|
.width(80.dp)
|
||||||
|
.height(40.dp),
|
||||||
horizontalAlignment = Alignment.CenterHorizontally,
|
horizontalAlignment = Alignment.CenterHorizontally,
|
||||||
modifier = Modifier.weight(1f)
|
verticalArrangement = Arrangement.Center
|
||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
text = postCount.toString(),
|
text = postCount.toString(),
|
||||||
fontWeight = FontWeight.W600,
|
fontWeight = FontWeight.Medium,
|
||||||
fontSize = 16.sp,
|
fontSize = 15.sp,
|
||||||
color = AppColors.text
|
color = Color(0xFF000000),
|
||||||
|
textAlign = TextAlign.Center
|
||||||
)
|
)
|
||||||
Spacer(modifier = Modifier.height(8.dp))
|
Spacer(modifier = Modifier.height(2.dp))
|
||||||
Text(
|
Text(
|
||||||
text = "帖子",
|
text = stringResource(R.string.posts),
|
||||||
color = AppColors.text
|
fontWeight = FontWeight.Normal,
|
||||||
|
fontSize = 11.sp,
|
||||||
|
color = Color(0xFF000000),
|
||||||
|
textAlign = TextAlign.Center
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 粉丝数
|
// 粉丝数
|
||||||
Column(
|
Column(
|
||||||
horizontalAlignment = Alignment.CenterHorizontally,
|
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.weight(1f)
|
.width(80.dp)
|
||||||
|
.height(40.dp)
|
||||||
.noRippleClickable {
|
.noRippleClickable {
|
||||||
followerDebouncer {
|
followerDebouncer {
|
||||||
navController.navigate(
|
navController.navigate(
|
||||||
@@ -95,26 +145,33 @@ fun UserItem(
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
horizontalAlignment = Alignment.CenterHorizontally,
|
||||||
|
verticalArrangement = Arrangement.Center
|
||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
text = accountProfileEntity.followerCount.toString(),
|
text = formattedFollowerCount,
|
||||||
fontWeight = FontWeight.W600,
|
fontWeight = FontWeight.Medium,
|
||||||
fontSize = 16.sp,
|
fontSize = 15.sp,
|
||||||
color = AppColors.text
|
color = Color(0xFF000000),
|
||||||
|
textAlign = TextAlign.Center
|
||||||
)
|
)
|
||||||
Spacer(modifier = Modifier.height(8.dp))
|
Spacer(modifier = Modifier.height(2.dp))
|
||||||
Text(
|
Text(
|
||||||
text = "粉丝",
|
text = stringResource(R.string.followers_upper),
|
||||||
color = AppColors.text
|
fontWeight = FontWeight.Normal,
|
||||||
|
fontSize = 11.sp,
|
||||||
|
color = Color(0xFF000000),
|
||||||
|
textAlign = TextAlign.Center
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 关注数
|
// 关注数
|
||||||
Column(
|
Column(
|
||||||
horizontalAlignment = Alignment.CenterHorizontally,
|
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.weight(1f)
|
.width(80.dp)
|
||||||
|
.height(40.dp)
|
||||||
|
.offset(x = 6.dp)
|
||||||
.noRippleClickable {
|
.noRippleClickable {
|
||||||
followingDebouncer {
|
followingDebouncer {
|
||||||
navController.navigate(
|
navController.navigate(
|
||||||
@@ -124,49 +181,161 @@ fun UserItem(
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
horizontalAlignment = Alignment.CenterHorizontally,
|
||||||
|
verticalArrangement = Arrangement.Center
|
||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
text = accountProfileEntity.followingCount.toString(),
|
text = accountProfileEntity.followingCount.toString(),
|
||||||
fontWeight = FontWeight.W600,
|
fontWeight = FontWeight.Medium,
|
||||||
fontSize = 16.sp,
|
fontSize = 15.sp,
|
||||||
color = AppColors.text
|
color = Color(0xFF000000),
|
||||||
|
textAlign = TextAlign.Center
|
||||||
)
|
)
|
||||||
Spacer(modifier = Modifier.height(8.dp))
|
Spacer(modifier = Modifier.height(2.dp))
|
||||||
Text(
|
Text(
|
||||||
text = "关注",
|
text = stringResource(R.string.following_upper),
|
||||||
color = AppColors.text
|
fontWeight = FontWeight.Normal,
|
||||||
|
fontSize = 11.sp,
|
||||||
|
color = Color(0xFF000000),
|
||||||
|
textAlign = TextAlign.Center
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Spacer(modifier = Modifier.height(12.dp))
|
Spacer(modifier = Modifier.height(12.dp))
|
||||||
|
|
||||||
|
// 中间:昵称、简介、创建者信息
|
||||||
|
Column(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
) {
|
||||||
// 昵称
|
// 昵称
|
||||||
Text(
|
Text(
|
||||||
text = accountProfileEntity.nickName,
|
text = accountProfileEntity.nickName,
|
||||||
fontWeight = FontWeight.W600,
|
fontWeight = FontWeight.Bold,
|
||||||
fontSize = 16.sp,
|
fontSize = 22.sp,
|
||||||
color = AppColors.text
|
letterSpacing = (-0.3).sp,
|
||||||
|
color = Color(0xFF000000)
|
||||||
)
|
)
|
||||||
|
|
||||||
Spacer(modifier = Modifier.height(4.dp))
|
Spacer(modifier = Modifier.height(4.dp))
|
||||||
|
|
||||||
// 个人简介
|
// 个人简介
|
||||||
if (accountProfileEntity.bio.isNotEmpty()) {
|
if (accountProfileEntity.bio.isNotEmpty()) {
|
||||||
Text(
|
Text(
|
||||||
text = accountProfileEntity.bio,
|
text = accountProfileEntity.bio,
|
||||||
fontSize = 14.sp,
|
fontSize = 13.sp,
|
||||||
color = AppColors.secondaryText,
|
color = Color(0x993C3C43), // 60/255, 60/255, 67/255, alpha 0.6
|
||||||
maxLines = 1,
|
maxLines = 2,
|
||||||
overflow = TextOverflow.Ellipsis
|
overflow = TextOverflow.Ellipsis
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
Text(
|
Text(
|
||||||
text = "No bio here.",
|
text = "Welcome to my fantiac word i will show you something about magic",
|
||||||
fontSize = 14.sp,
|
fontSize = 13.sp,
|
||||||
color = AppColors.secondaryText,
|
color = Color(0x993C3C43),
|
||||||
maxLines = 1,
|
maxLines = 2,
|
||||||
overflow = TextOverflow.Ellipsis
|
overflow = TextOverflow.Ellipsis
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 创建者信息(如果是 AI 账户,可以显示创建者)
|
||||||
|
// 注意:当前 AccountProfileEntity 没有创建者字段,这里暂时留空
|
||||||
|
// 如果需要显示,需要从其他地方获取创建者信息
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Spacer(modifier = Modifier.height(12.dp))
|
||||||
|
|
||||||
|
// 底部:标签按钮
|
||||||
|
Row(
|
||||||
|
horizontalArrangement = Arrangement.spacedBy(4.dp),
|
||||||
|
verticalAlignment = Alignment.CenterVertically
|
||||||
|
) {
|
||||||
|
// MBTI 标签
|
||||||
|
if (!mbti.isNullOrEmpty()) {
|
||||||
|
ProfileTag(
|
||||||
|
text = mbti,
|
||||||
|
backgroundColor = Color(0x33FF8D28), // 255/255, 141/255, 40/255, alpha 0.2
|
||||||
|
textColor = Color(0xFF000000)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 星座标签
|
||||||
|
if (!zodiac.isNullOrEmpty()) {
|
||||||
|
ProfileTag(
|
||||||
|
text = zodiac,
|
||||||
|
backgroundColor = Color(0x33FFCC00), // 255/255, 204/255, 0/255, alpha 0.2
|
||||||
|
textColor = Color(0xFF000000)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 编辑标签(仅自己可见)
|
||||||
|
if (isSelf) {
|
||||||
|
ProfileTag(
|
||||||
|
text = stringResource(R.string.edit_profile),
|
||||||
|
backgroundColor = Color(0x14947A80), // 124/255, 116/255, 128/255, alpha 0.08
|
||||||
|
textColor = Color(0xFF9284BD), // 146/255, 132/255, 189/255
|
||||||
|
leadingIcon = {
|
||||||
|
EditIcon(
|
||||||
|
color = Color(0xFF9284BD),
|
||||||
|
modifier = Modifier.size(16.dp)
|
||||||
|
)
|
||||||
|
},
|
||||||
|
onClick = onEditClick
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun ProfileTag(
|
||||||
|
text: String,
|
||||||
|
backgroundColor: Color,
|
||||||
|
textColor: Color,
|
||||||
|
leadingIcon: (@Composable () -> Unit)? = null,
|
||||||
|
onClick: (() -> Unit)? = null
|
||||||
|
) {
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.height(25.dp)
|
||||||
|
.clip(RoundedCornerShape(12.dp))
|
||||||
|
.background(backgroundColor)
|
||||||
|
.then(
|
||||||
|
if (onClick != null) {
|
||||||
|
Modifier.clickable(onClick = onClick)
|
||||||
|
} else {
|
||||||
|
Modifier
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.padding(horizontal = 8.dp, vertical = 4.dp),
|
||||||
|
contentAlignment = Alignment.Center
|
||||||
|
) {
|
||||||
|
Row(
|
||||||
|
horizontalArrangement = Arrangement.spacedBy(4.dp),
|
||||||
|
verticalAlignment = Alignment.CenterVertically
|
||||||
|
) {
|
||||||
|
leadingIcon?.invoke()
|
||||||
|
Text(
|
||||||
|
text = text,
|
||||||
|
fontSize = 12.sp,
|
||||||
|
color = textColor
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun EditIcon(
|
||||||
|
color: Color,
|
||||||
|
modifier: Modifier = Modifier
|
||||||
|
) {
|
||||||
|
Image(
|
||||||
|
painter = painterResource(id = R.mipmap.bi),
|
||||||
|
contentDescription = stringResource(R.string.edit_profile),
|
||||||
|
modifier = modifier,
|
||||||
|
colorFilter = ColorFilter.tint(color)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -123,14 +123,15 @@ fun LikeNoticeScreen() {
|
|||||||
) {
|
) {
|
||||||
Image(
|
Image(
|
||||||
painter = painterResource(
|
painter = painterResource(
|
||||||
id =if(AppState.darkMode) R.mipmap.qst_z_qs_as_img
|
id = if(AppState.darkMode) R.mipmap.sanqiu_dark
|
||||||
else R.mipmap.invalid_name_6),
|
else R.mipmap.invalid_name_6),
|
||||||
contentDescription = "No Notice",
|
contentDescription = "No Notice",
|
||||||
modifier = Modifier.size(181.dp)
|
modifier = Modifier
|
||||||
|
.size(width = 181.dp, height = 153.dp)
|
||||||
)
|
)
|
||||||
Spacer(modifier = Modifier.height(24.dp))
|
Spacer(modifier = Modifier.height(if (AppState.darkMode) 9.dp else 24.dp))
|
||||||
Text(
|
Text(
|
||||||
text = "你的赞在路上~",
|
text = "你的赞在赶来的路上",
|
||||||
color = AppColors.text,
|
color = AppColors.text,
|
||||||
fontSize = 16.sp,
|
fontSize = 16.sp,
|
||||||
fontWeight = FontWeight.W600,
|
fontWeight = FontWeight.W600,
|
||||||
|
|||||||
@@ -1,15 +1,19 @@
|
|||||||
package com.aiosman.ravenow.ui.login
|
package com.aiosman.ravenow.ui.login
|
||||||
|
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
|
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.Spacer
|
import androidx.compose.foundation.layout.Spacer
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.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.width
|
import androidx.compose.foundation.layout.width
|
||||||
|
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
|
||||||
import androidx.compose.runtime.mutableStateOf
|
import androidx.compose.runtime.mutableStateOf
|
||||||
@@ -19,9 +23,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.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
|
import androidx.compose.ui.graphics.ColorFilter
|
||||||
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.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
|
import androidx.compose.ui.unit.sp
|
||||||
import com.aiosman.ravenow.AppState
|
import com.aiosman.ravenow.AppState
|
||||||
import com.aiosman.ravenow.AppStore
|
import com.aiosman.ravenow.AppStore
|
||||||
import com.aiosman.ravenow.LocalAppTheme
|
import com.aiosman.ravenow.LocalAppTheme
|
||||||
@@ -33,25 +41,28 @@ import com.aiosman.ravenow.data.ServiceException
|
|||||||
import com.aiosman.ravenow.data.AccountServiceImpl
|
import com.aiosman.ravenow.data.AccountServiceImpl
|
||||||
import com.aiosman.ravenow.data.api.getErrorMessageCode
|
import com.aiosman.ravenow.data.api.getErrorMessageCode
|
||||||
import com.aiosman.ravenow.ui.NavigationRoute
|
import com.aiosman.ravenow.ui.NavigationRoute
|
||||||
import com.aiosman.ravenow.ui.comment.NoticeScreenHeader
|
|
||||||
import com.aiosman.ravenow.ui.composables.ActionButton
|
import com.aiosman.ravenow.ui.composables.ActionButton
|
||||||
import com.aiosman.ravenow.ui.composables.CheckboxWithLabel
|
import com.aiosman.ravenow.ui.composables.CheckboxWithLabel
|
||||||
import com.aiosman.ravenow.ui.composables.PolicyCheckbox
|
import com.aiosman.ravenow.ui.composables.PolicyCheckbox
|
||||||
import com.aiosman.ravenow.ui.composables.StatusBarSpacer
|
import com.aiosman.ravenow.ui.composables.StatusBarSpacer
|
||||||
import com.aiosman.ravenow.ui.composables.TextInputField
|
import com.aiosman.ravenow.ui.composables.TextInputField
|
||||||
|
import com.aiosman.ravenow.ui.modifiers.noRippleClickable
|
||||||
import com.aiosman.ravenow.utils.PasswordValidator
|
import com.aiosman.ravenow.utils.PasswordValidator
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
|
||||||
|
private val LightGrayBackground = Color(red = 250f / 255f, green = 249f / 255f, blue = 251f / 255f)
|
||||||
|
private val IconGray = Color(red = 151f / 255f, green = 148f / 255f, blue = 153f / 255f)
|
||||||
|
private val PurpleButton = Color(0xFF7C45ED)
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun EmailSignupScreen() {
|
fun EmailSignupScreen() {
|
||||||
var appColor = LocalAppTheme.current
|
val appColor = LocalAppTheme.current
|
||||||
var email by remember { mutableStateOf("") }
|
var email by remember { mutableStateOf("") }
|
||||||
var password by remember { mutableStateOf("") }
|
var password by remember { mutableStateOf("") }
|
||||||
var confirmPassword by remember { mutableStateOf("") }
|
var confirmPassword by remember { mutableStateOf("") }
|
||||||
var rememberMe by remember { mutableStateOf(false) }
|
var rememberMe by remember { mutableStateOf(false) }
|
||||||
var acceptTerms by remember { mutableStateOf(false) }
|
var acceptTerms by remember { mutableStateOf(false) }
|
||||||
var acceptPromotions by remember { mutableStateOf(false) }
|
|
||||||
val scope = rememberCoroutineScope()
|
val scope = rememberCoroutineScope()
|
||||||
val navController = LocalNavController.current
|
val navController = LocalNavController.current
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
@@ -60,14 +71,13 @@ fun EmailSignupScreen() {
|
|||||||
var passwordError by remember { mutableStateOf<String?>(null) }
|
var passwordError by remember { mutableStateOf<String?>(null) }
|
||||||
var confirmPasswordError by remember { mutableStateOf<String?>(null) }
|
var confirmPasswordError by remember { mutableStateOf<String?>(null) }
|
||||||
var termsError by remember { mutableStateOf<Boolean>(false) }
|
var termsError by remember { mutableStateOf<Boolean>(false) }
|
||||||
var promotionsError by remember { mutableStateOf<Boolean>(false) }
|
|
||||||
fun validateForm(): Boolean {
|
fun validateForm(): Boolean {
|
||||||
emailError = when {
|
emailError = when {
|
||||||
// 非空
|
// 非空
|
||||||
email.isEmpty() -> context.getString(R.string.text_error_email_required)
|
email.isEmpty() -> context.getString(R.string.text_error_email_required)
|
||||||
// 邮箱格式
|
// 邮箱格式
|
||||||
!android.util.Patterns.EMAIL_ADDRESS.matcher(email)
|
!android.util.Patterns.EMAIL_ADDRESS.matcher(email)
|
||||||
.matches() -> context.getString(R.string.text_error_email_format)
|
.matches() -> context.getString(R.string.text_error_email_format_1)
|
||||||
|
|
||||||
else -> null
|
else -> null
|
||||||
}
|
}
|
||||||
@@ -88,22 +98,8 @@ fun EmailSignupScreen() {
|
|||||||
}
|
}
|
||||||
termsError = true
|
termsError = true
|
||||||
return false
|
return false
|
||||||
} else {
|
}
|
||||||
termsError = false
|
termsError = false
|
||||||
}
|
|
||||||
if (!acceptPromotions) {
|
|
||||||
scope.launch(Dispatchers.Main) {
|
|
||||||
Toast.makeText(
|
|
||||||
context,
|
|
||||||
context.getString(R.string.error_not_accept_recive_notice),
|
|
||||||
Toast.LENGTH_SHORT
|
|
||||||
).show()
|
|
||||||
}
|
|
||||||
promotionsError = true
|
|
||||||
return false
|
|
||||||
} else {
|
|
||||||
promotionsError = false
|
|
||||||
}
|
|
||||||
|
|
||||||
return emailError == null && passwordError == null && confirmPasswordError == null
|
return emailError == null && passwordError == null && confirmPasswordError == null
|
||||||
}
|
}
|
||||||
@@ -158,63 +154,127 @@ fun EmailSignupScreen() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Column(
|
Column(
|
||||||
horizontalAlignment = Alignment.CenterHorizontally,
|
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
.background(appColor.background)
|
.background(appColor.background)
|
||||||
) {
|
) {
|
||||||
StatusBarSpacer()
|
StatusBarSpacer()
|
||||||
Box(
|
// 顶部导航栏:返回箭头 + "注册"标题,左对齐
|
||||||
|
Row(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(top = 16.dp, start = 16.dp, end = 16.dp)
|
.padding(top = 15.dp, start = 16.dp, bottom = 15.dp, end = 16.dp),
|
||||||
|
verticalAlignment = Alignment.CenterVertically
|
||||||
) {
|
) {
|
||||||
NoticeScreenHeader(stringResource(R.string.sign_up_upper), moreIcon = false)
|
Image(
|
||||||
|
painter = painterResource(id = R.drawable.rider_pro_back_icon),
|
||||||
|
contentDescription = "Back",
|
||||||
|
modifier = Modifier
|
||||||
|
.size(24.dp)
|
||||||
|
.noRippleClickable {
|
||||||
|
navController.navigateUp()
|
||||||
|
},
|
||||||
|
colorFilter = ColorFilter.tint(Color.Black)
|
||||||
|
)
|
||||||
|
Spacer(modifier = Modifier.width(8.dp))
|
||||||
|
Text(
|
||||||
|
text = stringResource(R.string.sign_up_upper),
|
||||||
|
fontSize = 20.sp,
|
||||||
|
fontWeight = FontWeight.W600,
|
||||||
|
color = Color.Black
|
||||||
|
)
|
||||||
}
|
}
|
||||||
Spacer(modifier = Modifier.padding(32.dp))
|
|
||||||
|
// 输入区域
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.weight(1f)
|
.weight(1f)
|
||||||
.padding(horizontal = 24.dp)
|
.padding(horizontal = 0.dp)
|
||||||
) {
|
) {
|
||||||
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
|
|
||||||
|
// 邮箱输入框
|
||||||
TextInputField(
|
TextInputField(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth(),
|
.fillMaxWidth()
|
||||||
|
.padding(horizontal = 24.dp),
|
||||||
text = email,
|
text = email,
|
||||||
onValueChange = {
|
onValueChange = {
|
||||||
email = it
|
email = it
|
||||||
},
|
},
|
||||||
hint = stringResource(R.string.text_hint_email),
|
label = stringResource(R.string.login_email_label),
|
||||||
error = emailError
|
hint = "输入电子邮件",
|
||||||
|
error = emailError,
|
||||||
|
leadingIcon = {
|
||||||
|
Image(
|
||||||
|
painter = painterResource(id = R.mipmap.icon_email_light),
|
||||||
|
contentDescription = "Email",
|
||||||
|
modifier = Modifier.size(24.dp),
|
||||||
|
colorFilter = ColorFilter.tint(IconGray)
|
||||||
)
|
)
|
||||||
Spacer(modifier = Modifier.padding(4.dp))
|
},
|
||||||
|
customBackgroundColor = LightGrayBackground,
|
||||||
|
customCornerRadius = 16f
|
||||||
|
)
|
||||||
|
|
||||||
|
// 密码输入框
|
||||||
TextInputField(
|
TextInputField(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth(),
|
.fillMaxWidth()
|
||||||
|
.padding(horizontal = 24.dp),
|
||||||
text = password,
|
text = password,
|
||||||
onValueChange = {
|
onValueChange = {
|
||||||
password = it
|
password = it
|
||||||
},
|
},
|
||||||
password = true,
|
password = true,
|
||||||
|
label = stringResource(R.string.text_hint_password).replace("输入", ""),
|
||||||
hint = stringResource(R.string.text_hint_password),
|
hint = stringResource(R.string.text_hint_password),
|
||||||
error = passwordError
|
error = passwordError,
|
||||||
|
leadingIcon = {
|
||||||
|
Image(
|
||||||
|
painter = painterResource(id = R.mipmap.icon_lock_light),
|
||||||
|
contentDescription = "Lock",
|
||||||
|
modifier = Modifier.size(24.dp),
|
||||||
|
colorFilter = ColorFilter.tint(IconGray)
|
||||||
)
|
)
|
||||||
Spacer(modifier = Modifier.padding(4.dp))
|
},
|
||||||
|
customBackgroundColor = LightGrayBackground,
|
||||||
|
customCornerRadius = 16f
|
||||||
|
)
|
||||||
|
|
||||||
|
// 确认密码输入框
|
||||||
TextInputField(
|
TextInputField(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth(),
|
.fillMaxWidth()
|
||||||
|
.padding(horizontal = 24.dp),
|
||||||
text = confirmPassword,
|
text = confirmPassword,
|
||||||
onValueChange = {
|
onValueChange = {
|
||||||
confirmPassword = it
|
confirmPassword = it
|
||||||
},
|
},
|
||||||
password = true,
|
password = true,
|
||||||
hint = stringResource(R.string.text_hint_confirm_password),
|
label = stringResource(R.string.confirm_password_label),
|
||||||
error = confirmPasswordError
|
hint = stringResource(R.string.text_hint_password),
|
||||||
|
error = confirmPasswordError,
|
||||||
|
leadingIcon = {
|
||||||
|
Image(
|
||||||
|
painter = painterResource(id = R.mipmap.icon_lock_light),
|
||||||
|
contentDescription = "Lock",
|
||||||
|
modifier = Modifier.size(24.dp),
|
||||||
|
colorFilter = ColorFilter.tint(IconGray)
|
||||||
)
|
)
|
||||||
Spacer(modifier = Modifier.height(8.dp))
|
},
|
||||||
|
customBackgroundColor = LightGrayBackground,
|
||||||
|
customCornerRadius = 16f
|
||||||
|
)
|
||||||
|
|
||||||
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
|
|
||||||
|
// 功能选项区域
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.padding(horizontal = 24.dp),
|
||||||
horizontalAlignment = Alignment.Start,
|
horizontalAlignment = Alignment.Start,
|
||||||
) {
|
) {
|
||||||
CheckboxWithLabel(
|
CheckboxWithLabel(
|
||||||
@@ -236,42 +296,31 @@ fun EmailSignupScreen() {
|
|||||||
termsError = false
|
termsError = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Spacer(modifier = Modifier.height(16.dp))
|
|
||||||
CheckboxWithLabel(
|
|
||||||
checked = acceptPromotions,
|
|
||||||
checkSize = 16,
|
|
||||||
fontSize = 12,
|
|
||||||
label = stringResource(R.string.agree_promotion),
|
|
||||||
error = promotionsError
|
|
||||||
) {
|
|
||||||
acceptPromotions = it
|
|
||||||
// 当用户勾选时,立即清除错误状态
|
|
||||||
if (it) {
|
|
||||||
promotionsError = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Spacer(modifier = Modifier.height(32.dp))
|
Spacer(modifier = Modifier.height(76.dp))
|
||||||
|
|
||||||
|
// 底部注册按钮
|
||||||
Box(
|
Box(
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.padding(horizontal = 24.dp),
|
||||||
contentAlignment = Alignment.Center
|
contentAlignment = Alignment.Center
|
||||||
) {
|
) {
|
||||||
ActionButton(
|
ActionButton(
|
||||||
modifier = Modifier
|
modifier = Modifier.fillMaxWidth(),
|
||||||
.width(345.dp),
|
text = stringResource(R.string.sign_up_upper),
|
||||||
text = stringResource(R.string.lets_ride_upper),
|
backgroundColor = PurpleButton,
|
||||||
backgroundColor = Color(0xffda3832),
|
color = Color.White,
|
||||||
color = Color.White
|
fontSize = 17.sp,
|
||||||
|
fontWeight = FontWeight.W600
|
||||||
) {
|
) {
|
||||||
scope.launch(Dispatchers.IO) {
|
scope.launch(Dispatchers.IO) {
|
||||||
registerUser()
|
registerUser()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -72,8 +72,17 @@ fun UserAuthScreen() {
|
|||||||
var passwordError by remember { mutableStateOf<String?>(null) }
|
var passwordError by remember { mutableStateOf<String?>(null) }
|
||||||
var captchaInfo by remember { mutableStateOf<CaptchaInfo?>(null) }
|
var captchaInfo by remember { mutableStateOf<CaptchaInfo?>(null) }
|
||||||
fun validateForm(): Boolean {
|
fun validateForm(): Boolean {
|
||||||
emailError =
|
// 如果密码为空,先检查邮箱格式
|
||||||
if (email.isEmpty()) context.getString(R.string.text_error_email_required) else null
|
if (password.isEmpty()) {
|
||||||
|
emailError = when {
|
||||||
|
email.isEmpty() -> context.getString(R.string.text_error_email_required)
|
||||||
|
!android.util.Patterns.EMAIL_ADDRESS.matcher(email).matches() ->
|
||||||
|
context.getString(R.string.text_error_email_format)
|
||||||
|
else -> null
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
emailError = if (email.isEmpty()) context.getString(R.string.text_error_email_required) else null
|
||||||
|
}
|
||||||
|
|
||||||
// 使用通用密码校验器
|
// 使用通用密码校验器
|
||||||
val passwordValidation = PasswordValidator.validateCurrentPassword(password, context)
|
val passwordValidation = PasswordValidator.validateCurrentPassword(password, context)
|
||||||
|
|||||||
@@ -52,6 +52,8 @@ import androidx.compose.ui.draw.rotate
|
|||||||
import androidx.compose.ui.draw.scale
|
import androidx.compose.ui.draw.scale
|
||||||
import androidx.compose.ui.draw.shadow
|
import androidx.compose.ui.draw.shadow
|
||||||
import androidx.compose.ui.geometry.CornerRadius
|
import androidx.compose.ui.geometry.CornerRadius
|
||||||
|
import androidx.compose.ui.geometry.Offset
|
||||||
|
import androidx.compose.ui.graphics.Brush
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.graphics.ColorFilter
|
import androidx.compose.ui.graphics.ColorFilter
|
||||||
import androidx.compose.ui.graphics.PathEffect
|
import androidx.compose.ui.graphics.PathEffect
|
||||||
@@ -151,71 +153,42 @@ fun NewPostScreen() {
|
|||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.height(1.dp)
|
.height(1.dp)
|
||||||
|
.padding(horizontal = 16.dp)
|
||||||
.background(AppColors.divider)
|
.background(AppColors.divider)
|
||||||
)
|
)
|
||||||
|
Spacer(modifier = Modifier.height(24.dp))
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.padding(start = 16.dp)
|
||||||
.padding(top = 8.dp, start = 16.dp, end = 16.dp, bottom = 8.dp),
|
.width(100.dp)
|
||||||
verticalAlignment = Alignment.CenterVertically
|
.height(40.dp)
|
||||||
|
.clip(RoundedCornerShape(20.dp))
|
||||||
|
.background(
|
||||||
|
brush = Brush.linearGradient(
|
||||||
|
colors = listOf(
|
||||||
|
Color(0xFF8CDDFF),
|
||||||
|
Color(0xFF9887FF),
|
||||||
|
Color(0xFFFF8D28)
|
||||||
|
),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
.padding(horizontal = 14.dp, vertical = 8.dp),
|
||||||
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
|
horizontalArrangement = Arrangement.Center
|
||||||
) {
|
) {
|
||||||
Image(
|
Image(
|
||||||
painter = painterResource(id = R.mipmap.rider_pro_moment_ai),
|
painter = painterResource(id = R.mipmap.icon_ai),
|
||||||
contentDescription = null,
|
contentDescription = null,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.size(24.dp)
|
.size(16.dp)
|
||||||
|
|
||||||
)
|
)
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(R.string.moment_ai_co),
|
text = stringResource(R.string.moment_ai_co),
|
||||||
fontWeight = FontWeight.Bold,
|
fontWeight = FontWeight.Normal,
|
||||||
fontSize = 15.sp,
|
fontSize = 13.sp,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.padding(start = 8.dp)
|
.padding(start = 2.dp),
|
||||||
.weight(1f),
|
color = Color.White,
|
||||||
color = AppColors.text,
|
|
||||||
)
|
|
||||||
Switch(
|
|
||||||
checked = isAiEnabled,
|
|
||||||
onCheckedChange = {
|
|
||||||
isChecked ->
|
|
||||||
isAiEnabled = isChecked
|
|
||||||
if (isChecked) {
|
|
||||||
// 收起键盘
|
|
||||||
keyboardController?.hide()
|
|
||||||
isRequesting = true
|
|
||||||
isRotating = true
|
|
||||||
model.viewModelScope.launch {
|
|
||||||
try {
|
|
||||||
model.agentMoment(model.textContent)
|
|
||||||
} catch (e: Exception) {
|
|
||||||
e.printStackTrace()
|
|
||||||
}finally {
|
|
||||||
isRequesting = false
|
|
||||||
isRotating = false
|
|
||||||
isAiEnabled = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
|
||||||
enabled = !isRequesting && model.textContent.isNotEmpty(),
|
|
||||||
colors = SwitchDefaults.colors(
|
|
||||||
checkedThumbColor = Color.White,
|
|
||||||
checkedTrackColor = AppColors.brandColorsColor,
|
|
||||||
uncheckedThumbColor = Color.White,
|
|
||||||
uncheckedTrackColor = AppColors.nonActive,
|
|
||||||
uncheckedBorderColor = Color.White,
|
|
||||||
disabledCheckedTrackColor = AppColors.brandColorsColor.copy(alpha = 0.8f),
|
|
||||||
disabledCheckedThumbColor= Color.White,
|
|
||||||
disabledUncheckedTrackColor = AppColors.nonActive,
|
|
||||||
disabledUncheckedThumbColor= Color.White
|
|
||||||
|
|
||||||
),
|
|
||||||
modifier = Modifier.scale(0.8f)
|
|
||||||
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -352,7 +325,7 @@ fun NewPostTopBar(onSendClick: () -> Unit = {}) {
|
|||||||
modifier = Modifier.align(Alignment.CenterStart),
|
modifier = Modifier.align(Alignment.CenterStart),
|
||||||
) {
|
) {
|
||||||
Image(
|
Image(
|
||||||
painter = painterResource(id = R.drawable.rider_pro_close),
|
painter = painterResource(id = R.drawable.rider_pro_back_icon),
|
||||||
contentDescription = "Back",
|
contentDescription = "Back",
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.size(24.dp)
|
.size(24.dp)
|
||||||
@@ -366,9 +339,31 @@ fun NewPostTopBar(onSendClick: () -> Unit = {}) {
|
|||||||
},
|
},
|
||||||
colorFilter = ColorFilter.tint(AppColors.text)
|
colorFilter = ColorFilter.tint(AppColors.text)
|
||||||
)
|
)
|
||||||
|
Spacer(modifier = Modifier.width(8.dp))
|
||||||
|
Text(
|
||||||
|
modifier = Modifier.align(Alignment.CenterVertically),
|
||||||
|
text = stringResource(R.string.publish_dynamic),
|
||||||
|
fontSize = 17.sp,
|
||||||
|
color = AppColors.text,
|
||||||
|
)
|
||||||
Spacer(modifier = Modifier.weight(1f))
|
Spacer(modifier = Modifier.weight(1f))
|
||||||
Image(
|
Image(
|
||||||
painter = painterResource(id = R.mipmap.rider_pro_moment_post),
|
painter = painterResource(id = R.mipmap.icon_draft_box_light),
|
||||||
|
contentDescription = "",
|
||||||
|
modifier = Modifier
|
||||||
|
.size(24.dp)
|
||||||
|
.noRippleClickable {
|
||||||
|
// 添加防抖逻辑
|
||||||
|
val currentTime = System.currentTimeMillis()
|
||||||
|
if (currentTime - lastSendClickTime > debounceTime) {
|
||||||
|
lastSendClickTime = currentTime
|
||||||
|
}
|
||||||
|
},
|
||||||
|
colorFilter = ColorFilter.tint(AppColors.text)
|
||||||
|
)
|
||||||
|
Spacer(modifier = Modifier.width(20.dp))
|
||||||
|
Image(
|
||||||
|
painter = painterResource(id = R.mipmap.icon_released_light),
|
||||||
contentDescription = "Send",
|
contentDescription = "Send",
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.size(24.dp)
|
.size(24.dp)
|
||||||
@@ -391,11 +386,8 @@ fun NewPostTopBar(onSendClick: () -> Unit = {}) {
|
|||||||
}finally {
|
}finally {
|
||||||
uploading = false
|
uploading = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -488,72 +480,24 @@ fun AddImageGrid() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
val addImageDebouncer = rememberDebouncer()
|
val addImageDebouncer = rememberDebouncer()
|
||||||
val takePhotoDebouncer = rememberDebouncer()
|
|
||||||
|
|
||||||
val stroke = Stroke(
|
|
||||||
width = 2f,
|
|
||||||
pathEffect = PathEffect.dashPathEffect(floatArrayOf(10f, 10f), 0f)
|
|
||||||
)
|
|
||||||
DraggableGrid(
|
|
||||||
items = NewPostViewModel.imageList,
|
|
||||||
onMove = { from, to ->
|
|
||||||
NewPostViewModel.imageList = NewPostViewModel.imageList.toMutableList().apply {
|
|
||||||
add(to, removeAt(from))
|
|
||||||
}
|
|
||||||
},
|
|
||||||
lockedIndices = listOf(
|
|
||||||
|
|
||||||
),
|
|
||||||
onDragModeEnd = {},
|
|
||||||
onDragModeStart = {},
|
|
||||||
additionalItems = listOf(
|
|
||||||
|
|
||||||
),
|
|
||||||
getItemId = { it.id }
|
|
||||||
) { item, isDrag ->
|
|
||||||
Box(
|
|
||||||
modifier = Modifier
|
|
||||||
) {
|
|
||||||
CustomAsyncImage(
|
|
||||||
LocalContext.current,
|
|
||||||
item.bitmap,
|
|
||||||
contentDescription = "Image",
|
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.aspectRatio(1f)
|
|
||||||
.noRippleClickable {
|
|
||||||
navController.navigate(NavigationRoute.NewPostImageGrid.route)
|
|
||||||
},
|
|
||||||
contentScale = ContentScale.Crop
|
|
||||||
)
|
|
||||||
if (isDrag) {
|
|
||||||
Box(
|
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxSize()
|
|
||||||
.background(Color.Black.copy(alpha = 0.4f))
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
val canAddMoreImages = model.imageList.size < 9
|
val canAddMoreImages = model.imageList.size < 9
|
||||||
|
|
||||||
LazyVerticalGrid(
|
LazyVerticalGrid(
|
||||||
columns = GridCells.Fixed(5),
|
columns = GridCells.Fixed(5),
|
||||||
contentPadding = PaddingValues(8.dp),
|
contentPadding = PaddingValues(horizontal = 19.dp, vertical = 4.dp),
|
||||||
modifier = Modifier
|
modifier = Modifier.fillMaxWidth(),
|
||||||
.fillMaxWidth()
|
|
||||||
.padding(horizontal = 8.dp),
|
|
||||||
horizontalArrangement = Arrangement.spacedBy(8.dp),
|
horizontalArrangement = Arrangement.spacedBy(8.dp),
|
||||||
verticalArrangement = Arrangement.spacedBy(8.dp)
|
verticalArrangement = Arrangement.spacedBy(8.dp)
|
||||||
) {
|
) {
|
||||||
|
// 添加按钮
|
||||||
if (canAddMoreImages) {
|
if (canAddMoreImages) {
|
||||||
item {
|
item {
|
||||||
Box(
|
Box(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.aspectRatio(1f)
|
.aspectRatio(1f)
|
||||||
.clip(RoundedCornerShape(16.dp)) // 设置圆角
|
.clip(RoundedCornerShape(24.dp))
|
||||||
.background(AppColors.basicMain) // 设置背景色
|
.background(Color(0xFFFAF9FB))
|
||||||
.noRippleClickable {
|
.noRippleClickable {
|
||||||
addImageDebouncer {
|
addImageDebouncer {
|
||||||
if (model.imageList.size < 9) {
|
if (model.imageList.size < 9) {
|
||||||
@@ -572,20 +516,21 @@ fun AddImageGrid() {
|
|||||||
painter = painterResource(id = R.drawable.rider_pro_new_post_add_pic),
|
painter = painterResource(id = R.drawable.rider_pro_new_post_add_pic),
|
||||||
contentDescription = "Add Image",
|
contentDescription = "Add Image",
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.size(24.dp)
|
.size(23.3.dp)
|
||||||
.align(Alignment.Center),
|
.align(Alignment.Center),
|
||||||
tint = AppColors.nonActiveText
|
tint = AppColors.nonActiveText
|
||||||
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 相机按钮
|
||||||
item {
|
item {
|
||||||
Box(
|
Box(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.aspectRatio(1f)
|
.aspectRatio(1f)
|
||||||
.clip(RoundedCornerShape(16.dp)) // 设置圆角
|
.clip(RoundedCornerShape(24.dp))
|
||||||
.background(AppColors.basicMain) // 设置背景色
|
.background(Color(0xFFFAF9FB))
|
||||||
.noRippleClickable {
|
.noRippleClickable {
|
||||||
if (model.imageList.size < 9) {
|
if (model.imageList.size < 9) {
|
||||||
val photoFile = File(context.cacheDir, "photo.jpg")
|
val photoFile = File(context.cacheDir, "photo.jpg")
|
||||||
@@ -605,13 +550,60 @@ fun AddImageGrid() {
|
|||||||
painter = painterResource(id = R.drawable.rider_pro_camera),
|
painter = painterResource(id = R.drawable.rider_pro_camera),
|
||||||
contentDescription = "Take Photo",
|
contentDescription = "Take Photo",
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.size(24.dp)
|
.size(23.3.dp)
|
||||||
.align(Alignment.Center),
|
.align(Alignment.Center),
|
||||||
tint = AppColors.nonActiveText
|
tint = AppColors.nonActiveText
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 已添加的图片,显示在相机按钮后面
|
||||||
|
items(model.imageList.size) { index ->
|
||||||
|
val item = model.imageList[index]
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.aspectRatio(1f)
|
||||||
|
.clip(RoundedCornerShape(24.dp))
|
||||||
|
.background(Color(0xFFFAF9FB))
|
||||||
|
) {
|
||||||
|
CustomAsyncImage(
|
||||||
|
context,
|
||||||
|
item.bitmap,
|
||||||
|
contentDescription = "Image",
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxSize()
|
||||||
|
.noRippleClickable {
|
||||||
|
navController.navigate(NavigationRoute.NewPostImageGrid.route)
|
||||||
|
},
|
||||||
|
contentScale = ContentScale.Crop
|
||||||
|
)
|
||||||
|
|
||||||
|
// // 删除按钮 - 右上角
|
||||||
|
// Box(
|
||||||
|
// modifier = Modifier
|
||||||
|
// .align(Alignment.TopEnd)
|
||||||
|
// .padding(4.dp)
|
||||||
|
// .size(20.dp)
|
||||||
|
// .clip(RoundedCornerShape(10.dp))
|
||||||
|
// .background(Color.Black.copy(alpha = 0.6f))
|
||||||
|
// .noRippleClickable {
|
||||||
|
// model.imageList = model.imageList.toMutableList().apply {
|
||||||
|
// removeAt(index)
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// contentAlignment = Alignment.Center
|
||||||
|
// ) {
|
||||||
|
// Icon(
|
||||||
|
// painter = painterResource(id = R.drawable.rider_pro_close),
|
||||||
|
// contentDescription = "Delete",
|
||||||
|
// modifier = Modifier.size(12.dp),
|
||||||
|
// tint = Color.White
|
||||||
|
// )
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import com.aiosman.ravenow.data.UserServiceImpl
|
|||||||
import com.aiosman.ravenow.entity.AccountProfileEntity
|
import com.aiosman.ravenow.entity.AccountProfileEntity
|
||||||
import com.aiosman.ravenow.entity.MomentEntity
|
import com.aiosman.ravenow.entity.MomentEntity
|
||||||
import com.aiosman.ravenow.entity.MomentServiceImpl
|
import com.aiosman.ravenow.entity.MomentServiceImpl
|
||||||
|
import com.aiosman.ravenow.event.FollowChangeEvent
|
||||||
import com.aiosman.ravenow.event.MomentFavouriteChangeEvent
|
import com.aiosman.ravenow.event.MomentFavouriteChangeEvent
|
||||||
import com.aiosman.ravenow.event.MomentLikeChangeEvent
|
import com.aiosman.ravenow.event.MomentLikeChangeEvent
|
||||||
import com.aiosman.ravenow.event.MomentRemoveEvent
|
import com.aiosman.ravenow.event.MomentRemoveEvent
|
||||||
@@ -166,7 +167,8 @@ class PostViewModel(
|
|||||||
moment?.let {
|
moment?.let {
|
||||||
userService.followUser(it.authorId.toString())
|
userService.followUser(it.authorId.toString())
|
||||||
moment = moment?.copy(followStatus = true)
|
moment = moment?.copy(followStatus = true)
|
||||||
// 更新我的关注页面的关注数
|
// 发送关注事件,通知动态列表更新关注状态
|
||||||
|
EventBus.getDefault().post(FollowChangeEvent(it.authorId, true))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -174,7 +176,8 @@ class PostViewModel(
|
|||||||
moment?.let {
|
moment?.let {
|
||||||
userService.unFollowUser(it.authorId.toString())
|
userService.unFollowUser(it.authorId.toString())
|
||||||
moment = moment?.copy(followStatus = false)
|
moment = moment?.copy(followStatus = false)
|
||||||
// 更新我的关注页面的关注数
|
// 发送取消关注事件,通知动态列表更新关注状态
|
||||||
|
EventBus.getDefault().post(FollowChangeEvent(it.authorId, false))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ fun SplashScreen() {
|
|||||||
) {
|
) {
|
||||||
// 居中的图标
|
// 居中的图标
|
||||||
Image(
|
Image(
|
||||||
painter = painterResource(id = R.mipmap.invalid_name),
|
painter = painterResource(id = R.mipmap.kp_logo_img),
|
||||||
contentDescription = "App Logo",
|
contentDescription = "App Logo",
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.align(Alignment.Center)
|
.align(Alignment.Center)
|
||||||
|
|||||||
BIN
app/src/main/res/drawable/icons_circle_camera.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
app/src/main/res/mipmap-hdpi/ai_dark.png
Normal file
|
After Width: | Height: | Size: 2.4 KiB |
BIN
app/src/main/res/mipmap-hdpi/bi.png
Normal file
|
After Width: | Height: | Size: 331 B |
BIN
app/src/main/res/mipmap-hdpi/collect.png
Normal file
|
After Width: | Height: | Size: 438 B |
BIN
app/src/main/res/mipmap-hdpi/feedback_icon.png
Normal file
|
After Width: | Height: | Size: 434 B |
BIN
app/src/main/res/mipmap-hdpi/fei_dark.png
Normal file
|
After Width: | Height: | Size: 3.1 KiB |
BIN
app/src/main/res/mipmap-hdpi/fengm.png
Normal file
|
After Width: | Height: | Size: 331 B |
BIN
app/src/main/res/mipmap-hdpi/frame_3.png
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
BIN
app/src/main/res/mipmap-hdpi/frame_4.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
app/src/main/res/mipmap-hdpi/icons_about.png
Normal file
|
After Width: | Height: | Size: 465 B |
BIN
app/src/main/res/mipmap-hdpi/icons_account_and_security.png
Normal file
|
After Width: | Height: | Size: 390 B |
BIN
app/src/main/res/mipmap-hdpi/icons_bell.png
Normal file
|
After Width: | Height: | Size: 425 B |
BIN
app/src/main/res/mipmap-hdpi/icons_block.png
Normal file
|
After Width: | Height: | Size: 476 B |
BIN
app/src/main/res/mipmap-hdpi/icons_brain.png
Normal file
|
After Width: | Height: | Size: 551 B |
BIN
app/src/main/res/mipmap-hdpi/icons_dark_mode.png
Normal file
|
After Width: | Height: | Size: 381 B |
BIN
app/src/main/res/mipmap-hdpi/icons_edited_data.png
Normal file
|
After Width: | Height: | Size: 428 B |
BIN
app/src/main/res/mipmap-hdpi/icons_padlock.png
Normal file
|
After Width: | Height: | Size: 391 B |
BIN
app/src/main/res/mipmap-hdpi/icons_remove.png
Normal file
|
After Width: | Height: | Size: 396 B |
BIN
app/src/main/res/mipmap-hdpi/invalid_dark.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
app/src/main/res/mipmap-hdpi/juhao_dark.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
app/src/main/res/mipmap-hdpi/l_empty_img.png
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
BIN
app/src/main/res/mipmap-hdpi/log_out_icon.png
Normal file
|
After Width: | Height: | Size: 402 B |
BIN
app/src/main/res/mipmap-hdpi/menu_ico.png
Normal file
|
After Width: | Height: | Size: 156 B |
BIN
app/src/main/res/mipmap-hdpi/menu_icon.png
Normal file
|
After Width: | Height: | Size: 283 B |
BIN
app/src/main/res/mipmap-hdpi/naoz.png
Normal file
|
After Width: | Height: | Size: 551 B |
BIN
app/src/main/res/mipmap-hdpi/paip_coin_img.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
app/src/main/res/mipmap-hdpi/piao_dark.png
Normal file
|
After Width: | Height: | Size: 2.4 KiB |
BIN
app/src/main/res/mipmap-hdpi/qr_code_icon.png
Normal file
|
After Width: | Height: | Size: 490 B |
BIN
app/src/main/res/mipmap-hdpi/sanqiu_dark.png
Normal file
|
After Width: | Height: | Size: 3.1 KiB |
BIN
app/src/main/res/mipmap-hdpi/sao.png
Normal file
|
After Width: | Height: | Size: 367 B |
BIN
app/src/main/res/mipmap-hdpi/shuihu_dark.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
app/src/main/res/mipmap-hdpi/tietie_dark.png
Normal file
|
After Width: | Height: | Size: 4.0 KiB |
BIN
app/src/main/res/mipmap-hdpi/xingzuo.png
Normal file
|
After Width: | Height: | Size: 593 B |
BIN
app/src/main/res/mipmap-mdpi/ai_dark.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
app/src/main/res/mipmap-mdpi/bi.png
Normal file
|
After Width: | Height: | Size: 283 B |
BIN
app/src/main/res/mipmap-mdpi/collect.png
Normal file
|
After Width: | Height: | Size: 348 B |
BIN
app/src/main/res/mipmap-mdpi/feedback_icon.png
Normal file
|
After Width: | Height: | Size: 326 B |
BIN
app/src/main/res/mipmap-mdpi/fei_dark.png
Normal file
|
After Width: | Height: | Size: 2.3 KiB |
BIN
app/src/main/res/mipmap-mdpi/fengm.png
Normal file
|
After Width: | Height: | Size: 283 B |
BIN
app/src/main/res/mipmap-mdpi/frame_3.png
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
BIN
app/src/main/res/mipmap-mdpi/frame_4.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
app/src/main/res/mipmap-mdpi/icon_ai.png
Normal file
|
After Width: | Height: | Size: 300 B |
BIN
app/src/main/res/mipmap-mdpi/icon_draft_box_light.png
Normal file
|
After Width: | Height: | Size: 330 B |
BIN
app/src/main/res/mipmap-mdpi/icon_email_light.png
Normal file
|
After Width: | Height: | Size: 354 B |
BIN
app/src/main/res/mipmap-mdpi/icon_eyes_closed_light.png
Normal file
|
After Width: | Height: | Size: 268 B |
BIN
app/src/main/res/mipmap-mdpi/icon_lock_light.png
Normal file
|
After Width: | Height: | Size: 319 B |
BIN
app/src/main/res/mipmap-mdpi/icon_released_light.png
Normal file
|
After Width: | Height: | Size: 308 B |
BIN
app/src/main/res/mipmap-mdpi/icons_about.png
Normal file
|
After Width: | Height: | Size: 347 B |
BIN
app/src/main/res/mipmap-mdpi/icons_account_and_security.png
Normal file
|
After Width: | Height: | Size: 325 B |
BIN
app/src/main/res/mipmap-mdpi/icons_bell.png
Normal file
|
After Width: | Height: | Size: 328 B |
BIN
app/src/main/res/mipmap-mdpi/icons_block.png
Normal file
|
After Width: | Height: | Size: 404 B |
BIN
app/src/main/res/mipmap-mdpi/icons_brain.png
Normal file
|
After Width: | Height: | Size: 419 B |
BIN
app/src/main/res/mipmap-mdpi/icons_dark_mode.png
Normal file
|
After Width: | Height: | Size: 329 B |