-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
925 additions
and
656 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package org.b3log.siyuan.ld246 | ||
|
||
data class 回帖消息( | ||
val dataId: String, | ||
val authorName: String, | ||
val hasRead: Boolean, | ||
val title: String, | ||
val content: String | ||
) | ||
data class 回复消息( | ||
val dataId: String, | ||
val authorName: String, | ||
val hasRead: Boolean, | ||
val title: String, | ||
val content: String | ||
) | ||
data class 提及我的消息( | ||
val dataId: String, | ||
val authorName: String, | ||
val hasRead: Boolean, | ||
val title: String, | ||
val content: String | ||
) | ||
data class 我关注的消息( | ||
val dataId: String, | ||
val authorName: String, | ||
val hasRead: Boolean, | ||
val title: String, | ||
val content: String | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,162 @@ | ||
package org.b3log.siyuan.ld246 | ||
|
||
import android.annotation.SuppressLint | ||
import android.app.Activity | ||
import android.content.Intent | ||
import android.content.pm.ActivityInfo | ||
import android.content.res.Configuration | ||
import android.os.Bundle | ||
import androidx.activity.ComponentActivity | ||
import androidx.activity.compose.setContent | ||
import androidx.compose.foundation.background | ||
import androidx.compose.foundation.layout.Box | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.fillMaxSize | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.lazy.LazyColumn | ||
import androidx.compose.material3.Card | ||
import androidx.compose.material3.ExperimentalMaterial3Api | ||
import androidx.compose.material3.LinearProgressIndicator | ||
import androidx.compose.material3.ListItem | ||
import androidx.compose.material3.Scaffold | ||
import androidx.compose.material3.Text | ||
import androidx.compose.material3.pulltorefresh.rememberPullToRefreshState | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.LaunchedEffect | ||
import androidx.compose.runtime.getValue | ||
import androidx.compose.runtime.mutableStateOf | ||
import androidx.compose.runtime.remember | ||
import androidx.compose.runtime.rememberCoroutineScope | ||
import androidx.compose.runtime.saveable.rememberSaveable | ||
import androidx.compose.runtime.setValue | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.graphics.Color | ||
import androidx.compose.ui.input.nestedscroll.nestedScroll | ||
import androidx.compose.ui.platform.LocalConfiguration | ||
import androidx.compose.ui.platform.LocalContext | ||
import androidx.compose.ui.platform.LocalInspectionMode | ||
import androidx.compose.ui.text.font.FontStyle | ||
import androidx.compose.ui.text.font.FontWeight | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import androidx.compose.ui.unit.dp | ||
import androidx.compose.ui.unit.sp | ||
import kotlinx.coroutines.DelicateCoroutinesApi | ||
import kotlinx.coroutines.delay | ||
import org.b3log.siyuan.CascadeMaterialTheme | ||
import org.b3log.siyuan.Us | ||
import org.b3log.siyuan.compose.components.CommonTopAppBar | ||
|
||
class ManageSpaceActivity : ComponentActivity() { | ||
// 将"清除数据"项变为"管理空间",自定义数据清除 https://github.com/Hi-Windom/Sillot-android/issues/49 | ||
val TAG = "ManageSpaceActivity" | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
// 设置沉浸式通知栏 | ||
window.setDecorFitsSystemWindows(false) | ||
window.decorView.setOnApplyWindowInsetsListener { _, insets -> | ||
insets | ||
} | ||
setContent { | ||
CascadeMaterialTheme { | ||
UI(intent) | ||
} | ||
} | ||
|
||
//设置竖屏锁定 | ||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); | ||
} | ||
} | ||
|
||
|
||
|
||
|
||
@SuppressLint("UnusedMaterial3ScaffoldPaddingParameter") | ||
@OptIn(ExperimentalMaterial3Api::class, DelicateCoroutinesApi::class) | ||
@Composable | ||
private fun UI(intent: Intent?) { | ||
val TAG = "MainPro-MyUI" | ||
val uri = intent?.data | ||
val Lcc = LocalContext.current | ||
val inspectionMode = LocalInspectionMode.current // 获取当前是否处于预览模式// 获取窗口尺寸 | ||
val coroutineScope = rememberCoroutineScope() | ||
val fileName = uri?.let { Us.getFileName(Lcc, it) } | ||
val fileSize = uri?.let { Us.getFileSize(Lcc, it) } | ||
val mimeType = intent?.data?.let { Us.getMimeType(Lcc, it) } ?: "" | ||
val fileType = fileName?.let { Us.getFileMIMEType(mimeType, it) } ?: run { Us.getFileMIMEType(mimeType) } | ||
val isLandscape = LocalConfiguration.current.orientation == Configuration.ORIENTATION_LANDSCAPE // 是否横屏(宽高比) | ||
|
||
var isMenuVisible by rememberSaveable { mutableStateOf(false) } | ||
var itemCount by remember { mutableStateOf(15) } | ||
val state = rememberPullToRefreshState() | ||
if (state.isRefreshing) { | ||
LaunchedEffect(true) { | ||
// fetch something | ||
delay(1500) | ||
itemCount += 5 | ||
state.endRefresh() | ||
} | ||
} | ||
|
||
Scaffold( | ||
topBar = { | ||
CommonTopAppBar("汐洛链滴社区客户端", uri) { | ||
// 将Context对象安全地转换为Activity | ||
if (Lcc is Activity) { | ||
Lcc.finish() // 结束活动 | ||
} | ||
} | ||
}, modifier = Modifier.background(Color.Gray).nestedScroll(state.nestedScrollConnection) | ||
) { | ||
Box(Modifier.padding(it).fillMaxSize()) { | ||
LazyColumn(Modifier.fillMaxSize()) { | ||
if (!state.isRefreshing) { | ||
items(itemCount) { | ||
// ListItem({ | ||
// Text(text = "Item ${itemCount - it}") | ||
// }) | ||
NotificationsList(收到的回帖消息列表) | ||
} | ||
} | ||
} | ||
if (state.isRefreshing) { | ||
LinearProgressIndicator(Modifier.fillMaxWidth()) | ||
} else { | ||
LinearProgressIndicator(progress = { state.progress }, Modifier.fillMaxWidth()) | ||
} | ||
} | ||
// NotificationsList(收到的回帖消息列表) | ||
} | ||
} | ||
|
||
|
||
@Composable | ||
fun NotificationsList(notifications: List<回帖消息>) { | ||
Column { | ||
notifications.forEach { notification -> | ||
NotificationCard(notification) | ||
} | ||
} | ||
} | ||
|
||
@Composable | ||
fun NotificationCard(notification: 回帖消息) { | ||
Card( | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.padding(16.dp), | ||
) { | ||
Column(modifier = Modifier.padding(16.dp)) { | ||
Text(text = notification.title, fontSize = 20.sp, fontWeight = FontWeight.Bold) | ||
Text(text = "By ${notification.authorName}", fontSize = 16.sp, fontStyle = FontStyle.Italic) | ||
Text(text = notification.content, fontSize = 14.sp) | ||
Text(text = "Read: ${notification.hasRead}", fontSize = 12.sp) | ||
} | ||
} | ||
} | ||
|
||
@Preview(showBackground = true) | ||
@Composable | ||
fun DefaultPreview() { | ||
UI(null) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package org.b3log.siyuan.ld246 | ||
|
||
// 假设您有一个包含Notification对象的列表 | ||
val 收到的回帖消息列表: List<回帖消息> = listOf( | ||
回帖消息( | ||
dataId = "1716258027153", | ||
authorName = "yuan93", | ||
hasRead = true, | ||
title = "汐洛 v0.34.1700 发布,基于思源 v3.0.15 构建", | ||
content = "到时候介绍一下 不知道用来干啥" | ||
), | ||
回帖消息( | ||
dataId = "1716258027153", | ||
authorName = "Lanternight", | ||
hasRead = true, | ||
title = "汐洛 v0.34.1700 发布,基于思源 v3.0.15 构建", | ||
content = "<p>加油老哥,期待出炉</p>" | ||
), | ||
回帖消息( | ||
dataId = "1716258027153", | ||
authorName = "Henmy", | ||
hasRead = true, | ||
title = "汐洛 v0.34.1700 发布,基于思源 v3.0.15 构建", | ||
content = "<p>加油</p>" | ||
), | ||
回帖消息( | ||
dataId = "1716258027153", | ||
authorName = "aleegreat", | ||
hasRead = true, | ||
title = "汐洛 v0.34.1700 发布,基于思源 v3.0.15 构建", | ||
content = "<p>给个介绍吧,没看懂是来干啥的</p>" | ||
), | ||
// ... 其他通知 | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,80 +1,81 @@ | ||
<resources> | ||
<!-- 在 build.gradle 里动态定义了 <string name="app_name">汐洛</string>--> | ||
<string name="activity_name_SillotHome">汐洛</string> | ||
<string name="activity_name_Sithw">司华</string> | ||
<string name="activity_name_Boot">思源汐洛版</string> | ||
<string name="activity_name_USB_AUDIO_EXCLUSIVE">汐洛音乐播放器</string> | ||
<string name="shortcut_long_label_1">启动->汐洛</string> | ||
<string name="shortcut_short_label_1">启动汐洛</string> | ||
<string name="ManageSpaceActivity">管理汐洛空间</string> | ||
|
||
<string name="open_source_license">开源许可</string> | ||
<string name="back">返回</string> | ||
<string name="no_file_selected">未选择文件</string> | ||
<string name="error">❌ 错误</string> | ||
<string name="ok">确定</string> | ||
<string name="description">描述</string> | ||
<string name="log">日志</string> | ||
<string name="alist_server">AList服务器</string> | ||
<string name="add_desktop_shortcut">添加桌面快捷方式</string> | ||
<string name="shutdown">关闭</string> | ||
<string name="copy_address">复制地址</string> | ||
<string name="alist_server_running">AList运行中</string> | ||
<string name="cancel">取消</string> | ||
<string name="admin_password_set_to">admin 密码已设为:\n %1$s</string> | ||
<string name="admin_password">admin 密码</string> | ||
<string name="server_shutdown_failed">关闭失败:%1$s</string> | ||
<string name="address_copied">已复制地址</string> | ||
<string name="set_admin_pwd_for_not_running">⚠️启动服务器才可设置admin密码</string> | ||
<string name="alist_config">AList配置</string> | ||
<string name="settings">设置</string> | ||
<string name="password">密码</string> | ||
<string name="alist_starting">启动中</string> | ||
<string name="alist_shut_downing">关闭中</string> | ||
<string name="app_switch">开关</string> | ||
<string name="more_options">更多选项</string> | ||
<string name="about">关于</string> | ||
<string name="listen_address">监听地址</string> | ||
<string name="edit_config_json">编辑 config.json</string> | ||
<string name="no_server_enable_warn_msg">请至少启用一个服务器!</string> | ||
<string name="alist_provider">AList提供者</string> | ||
<string name="provider_root_summary">account</string> | ||
<string name="path_copied">路径已复制</string> | ||
<string name="check_update">检查更新</string> | ||
<string name="start">启动</string> | ||
<string name="all_files_manage_permission">所有文件访问权限</string> | ||
<string name="files_permission_desc">挂载本地存储时必须打开,否则无权限读写文件。</string> | ||
<string name="read_external_storage_permission">读取存储权限</string> | ||
<string name="write_external_storage_permission">写入存储权限</string> | ||
<string name="grant_battery_whiltelist">请求电池优化白名单</string> | ||
<string name="grant_battery_whiltelist_desc">如果程序在后台运行时被系统杀死,可以尝试设置。</string> | ||
<string name="close">关闭</string> | ||
<string name="auto_check_updates">自动检查更新</string> | ||
<string name="auto_check_updates_desc">打开程序主界面时从Github检查更新</string> | ||
<string name="wake_lock">唤醒锁</string> | ||
<string name="wake_lock_desc">打开可防止锁屏后CPU休眠,但在部分系统可能会导致杀后台</string> | ||
<string name="importent_settings">重要设置</string> | ||
<string name="open_data_folder">打开data文件夹</string> | ||
<string name="open_data_folder_tips">点按上方路径选择“MT管理器”打开data文件夹</string> | ||
<string name="web">网页</string> | ||
<string name="togo_app_failed">跳转失败: %1$s</string> | ||
<string name="clear_web_data">清空网页数据</string> | ||
<string name="clear_web_cache">清空网页缓存</string> | ||
<string name="clear_web_data_desc">清空网页数据库、Cookie、DomStorage。</string> | ||
<string name="clear_web_cache_desc">仅清空资源缓存,不影响用户数据。</string> | ||
<string name="cleared">已清除</string> | ||
<string name="confirm">确定</string> | ||
<string name="auto_open_web">自动打开网页界面</string> | ||
<string name="auto_open_web_desc">打开主界面时,自动跳转到网页界面。</string> | ||
<string name="download_file">下载文件</string> | ||
<string name="system_downloader">系统下载器</string> | ||
<string name="open_url">打开链接</string> | ||
<string name="url_copied">已复制链接</string> | ||
<string name="starting">启动中</string> | ||
<string name="shutdowned">已关闭: %1$s</string> | ||
<string name="browser">浏览器</string> | ||
<string name="select_downloader">选择下载器</string> | ||
<string name="last_used">上次使用</string> | ||
<string name="start_at_boot">开机自启动服务</string> | ||
<string name="start_at_boot_desc">在开机时自动开启AList服务。</string> | ||
<resources> | ||
<!-- 在 build.gradle 里动态定义了 <string name="app_name">汐洛</string>--> | ||
<string name="activity_name_SillotHome">汐洛</string> | ||
<string name="activity_name_Sithw">司华</string> | ||
<string name="activity_name_Boot">思源汐洛版</string> | ||
<string name="activity_name_USB_AUDIO_EXCLUSIVE">汐洛音乐播放器</string> | ||
<string name="activity_name_ld246Home">汐洛链滴社区客户端</string> | ||
<string name="shortcut_long_label_1">启动->汐洛</string> | ||
<string name="shortcut_short_label_1">启动汐洛</string> | ||
<string name="ManageSpaceActivity">管理汐洛空间</string> | ||
|
||
<string name="open_source_license">开源许可</string> | ||
<string name="back">返回</string> | ||
<string name="no_file_selected">未选择文件</string> | ||
<string name="error">❌ 错误</string> | ||
<string name="ok">确定</string> | ||
<string name="description">描述</string> | ||
<string name="log">日志</string> | ||
<string name="alist_server">AList服务器</string> | ||
<string name="add_desktop_shortcut">添加桌面快捷方式</string> | ||
<string name="shutdown">关闭</string> | ||
<string name="copy_address">复制地址</string> | ||
<string name="alist_server_running">AList运行中</string> | ||
<string name="cancel">取消</string> | ||
<string name="admin_password_set_to">admin 密码已设为:\n %1$s</string> | ||
<string name="admin_password">admin 密码</string> | ||
<string name="server_shutdown_failed">关闭失败:%1$s</string> | ||
<string name="address_copied">已复制地址</string> | ||
<string name="set_admin_pwd_for_not_running">⚠️启动服务器才可设置admin密码</string> | ||
<string name="alist_config">AList配置</string> | ||
<string name="settings">设置</string> | ||
<string name="password">密码</string> | ||
<string name="alist_starting">启动中</string> | ||
<string name="alist_shut_downing">关闭中</string> | ||
<string name="app_switch">开关</string> | ||
<string name="more_options">更多选项</string> | ||
<string name="about">关于</string> | ||
<string name="listen_address">监听地址</string> | ||
<string name="edit_config_json">编辑 config.json</string> | ||
<string name="no_server_enable_warn_msg">请至少启用一个服务器!</string> | ||
<string name="alist_provider">AList提供者</string> | ||
<string name="provider_root_summary">account</string> | ||
<string name="path_copied">路径已复制</string> | ||
<string name="check_update">检查更新</string> | ||
<string name="start">启动</string> | ||
<string name="all_files_manage_permission">所有文件访问权限</string> | ||
<string name="files_permission_desc">挂载本地存储时必须打开,否则无权限读写文件。</string> | ||
<string name="read_external_storage_permission">读取存储权限</string> | ||
<string name="write_external_storage_permission">写入存储权限</string> | ||
<string name="grant_battery_whiltelist">请求电池优化白名单</string> | ||
<string name="grant_battery_whiltelist_desc">如果程序在后台运行时被系统杀死,可以尝试设置。</string> | ||
<string name="close">关闭</string> | ||
<string name="auto_check_updates">自动检查更新</string> | ||
<string name="auto_check_updates_desc">打开程序主界面时从Github检查更新</string> | ||
<string name="wake_lock">唤醒锁</string> | ||
<string name="wake_lock_desc">打开可防止锁屏后CPU休眠,但在部分系统可能会导致杀后台</string> | ||
<string name="importent_settings">重要设置</string> | ||
<string name="open_data_folder">打开data文件夹</string> | ||
<string name="open_data_folder_tips">点按上方路径选择“MT管理器”打开data文件夹</string> | ||
<string name="web">网页</string> | ||
<string name="togo_app_failed">跳转失败: %1$s</string> | ||
<string name="clear_web_data">清空网页数据</string> | ||
<string name="clear_web_cache">清空网页缓存</string> | ||
<string name="clear_web_data_desc">清空网页数据库、Cookie、DomStorage。</string> | ||
<string name="clear_web_cache_desc">仅清空资源缓存,不影响用户数据。</string> | ||
<string name="cleared">已清除</string> | ||
<string name="confirm">确定</string> | ||
<string name="auto_open_web">自动打开网页界面</string> | ||
<string name="auto_open_web_desc">打开主界面时,自动跳转到网页界面。</string> | ||
<string name="download_file">下载文件</string> | ||
<string name="system_downloader">系统下载器</string> | ||
<string name="open_url">打开链接</string> | ||
<string name="url_copied">已复制链接</string> | ||
<string name="starting">启动中</string> | ||
<string name="shutdowned">已关闭: %1$s</string> | ||
<string name="browser">浏览器</string> | ||
<string name="select_downloader">选择下载器</string> | ||
<string name="last_used">上次使用</string> | ||
<string name="start_at_boot">开机自启动服务</string> | ||
<string name="start_at_boot_desc">在开机时自动开启AList服务。</string> | ||
</resources> |
Oops, something went wrong.