-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat/ui: Added global search and announcement viewing reminder functions
- Added GoToAnnouncementActivity to remind users to view announcements - Implemented global search function to allow users to search public chats - Optimized chat list display logic and added processing for those who did not join the chat- Adjusted the settings interface and updated the configuration related to announcement viewing reminders - Fixed some UI style issues, such as button color and text style feat/ui: 新增全局搜索和公告查看提醒功能 - 新增 GoToAnnouncementActivity,用于提示用户查看公告 - 实现全局搜索功能,允许用户搜索公共聊天 - 优化聊天列表显示逻辑,增加未加入聊天的处理- 调整设置界面,更新公告查看提醒相关配置 - 修复了一些 UI 样式问题,如按钮颜色和文本样式 Signed-off-by: gohj99 <[email protected]>
- Loading branch information
Showing
26 changed files
with
775 additions
and
168 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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
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
162 changes: 162 additions & 0 deletions
162
app/src/main/java/com/gohj99/telewatch/GoToAnnouncementActivity.kt
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 @@ | ||
/* | ||
* Copyright (c) 2024 gohj99. Lorem ipsum dolor sit amet, consectetur adipiscing elit. | ||
* Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan. | ||
* Etiam sed turpis ac ipsum condimentum fringilla. Maecenas magna. | ||
* Proin dapibus sapien vel ante. Aliquam erat volutpat. Pellentesque sagittis ligula eget metus. | ||
* Vestibulum commodo. Ut rhoncus gravida arcu. | ||
*/ | ||
|
||
package com.gohj99.telewatch | ||
|
||
import android.content.Context | ||
import android.content.Intent | ||
import android.os.Bundle | ||
import androidx.activity.ComponentActivity | ||
import androidx.activity.compose.setContent | ||
import androidx.activity.enableEdgeToEdge | ||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.Box | ||
import androidx.compose.foundation.layout.Column | ||
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.rememberScrollState | ||
import androidx.compose.foundation.verticalScroll | ||
import androidx.compose.material3.Button | ||
import androidx.compose.material3.ButtonDefaults | ||
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.graphics.Color | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.text.font.FontWeight | ||
import androidx.compose.ui.text.style.TextAlign | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import androidx.compose.ui.unit.dp | ||
import androidx.compose.ui.unit.sp | ||
import com.gohj99.telewatch.ui.theme.TelewatchTheme | ||
import com.gohj99.telewatch.ui.verticalRotaryScroll | ||
|
||
class GoToAnnouncementActivity : ComponentActivity() { | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
enableEdgeToEdge() | ||
|
||
val settingsSharedPref = getSharedPreferences("app_settings", Context.MODE_PRIVATE) | ||
if (settingsSharedPref.getBoolean("Skip_GoToAnnouncementActivity", false)) { | ||
startActivity( | ||
Intent( | ||
this@GoToAnnouncementActivity, | ||
AnnouncementActivity::class.java | ||
) | ||
) | ||
finish() | ||
} else { | ||
setContent { | ||
TelewatchTheme { | ||
SplashAnnouncementActivityScreen { isSkip -> | ||
with(settingsSharedPref.edit()) { | ||
putBoolean("Skip_GoToAnnouncementActivity", isSkip) | ||
commit() | ||
startActivity( | ||
Intent( | ||
this@GoToAnnouncementActivity, | ||
AnnouncementActivity::class.java | ||
) | ||
) | ||
finish() | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
@Composable | ||
fun SplashAnnouncementActivityScreen(set: (Boolean) -> Unit) { | ||
val scrollState = rememberScrollState() | ||
LaunchedEffect(Unit) { | ||
scrollState.scrollTo(80) | ||
} | ||
|
||
Column( | ||
modifier = Modifier | ||
.fillMaxSize() | ||
.verticalScroll(scrollState) | ||
.verticalRotaryScroll(scrollState), | ||
verticalArrangement = Arrangement.Center, | ||
horizontalAlignment = Alignment.CenterHorizontally | ||
) { | ||
// 标题 | ||
Text( | ||
text = stringResource(id = R.string.GoToAnnouncementActivity_title), | ||
fontSize = 20.sp, | ||
fontWeight = FontWeight.Bold, | ||
color = Color.White, | ||
textAlign = TextAlign.Center, | ||
modifier = Modifier.padding(top = 86.dp) | ||
) | ||
|
||
// 主要说明部分 | ||
Text( | ||
text = stringResource(id = R.string.GoToAnnouncementActivity_description), | ||
fontSize = 16.sp, | ||
color = Color.White, | ||
textAlign = TextAlign.Center, | ||
modifier = Modifier.padding(16.dp) | ||
) | ||
|
||
Spacer(modifier = Modifier.height(16.dp)) | ||
|
||
// 不提醒继续和继续按钮 | ||
Box( | ||
modifier = Modifier | ||
.padding(bottom = 4.dp, start = 16.dp, end = 16.dp) | ||
.fillMaxSize(), | ||
contentAlignment = Alignment.Center | ||
) { | ||
Button( | ||
onClick = { set(true) }, | ||
modifier = Modifier.fillMaxWidth(), | ||
colors = ButtonDefaults.buttonColors( | ||
containerColor = Color(0xFF3A7FBE), // 按钮背景颜色 | ||
contentColor = Color.White // 按钮文字颜色 | ||
) | ||
) { | ||
Text(text = stringResource(id = R.string.don_remind_me_again)) | ||
} | ||
} | ||
Box( | ||
modifier = Modifier | ||
.padding(bottom = 16.dp, start = 16.dp, end = 16.dp) | ||
.fillMaxSize(), | ||
contentAlignment = Alignment.Center | ||
) { | ||
Button( | ||
onClick = { set(false) }, | ||
modifier = Modifier.fillMaxWidth(), | ||
colors = ButtonDefaults.buttonColors( | ||
containerColor = Color(0xFF3E4D58), // 按钮背景颜色 | ||
contentColor = Color.White // 按钮文字颜色 | ||
) | ||
) { | ||
Text(text = stringResource(id = R.string.agree)) | ||
} | ||
} | ||
|
||
Spacer(modifier = Modifier.height(42.dp)) | ||
} | ||
} | ||
|
||
@Preview(showBackground = true) | ||
@Composable | ||
fun SplashGoToAnnouncementActivityPreview() { | ||
TelewatchTheme { | ||
SplashAnnouncementActivityScreen { /*TODO*/ } | ||
} | ||
} |
Oops, something went wrong.