Skip to content

Commit

Permalink
[optimize|build] Optimize SettingsItem.kt; update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
SkyD666 committed Apr 25, 2024
1 parent f626191 commit 1504f03
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 24 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ If you are interested, please help us **translate**, thank you.
- **TensorFlow** Lite
- **ML Kit** (Machine Learning)
- **Room**
- **AIDL**
- Splash Screen
- Navigation
- Coil
Expand All @@ -152,6 +153,11 @@ If you are interested, please help us **translate**, thank you.
</tr>
</thead>
<tbody>
<tr>
<td><img src="image/AniVu.svg" style="height: 100px"/></td>
<td><b>AniVu</b>, an <b>all-in-one tool</b> for <b>RSS anime subscription and updates</b>, <b>bit torrent downloads</b>, and <b>video playback</b>.</td>
<td><a href="https://github.com/SkyD666/AniVu">https://github.com/SkyD666/AniVu</a></td>
</tr>
<tr>
<td><img src="image/Raca.svg" style="height: 100px"/></td>
<td><b>Raca (Record All Classic Articles)</b>, a tool to <b>record and search abstract passages and mini-essays</b> in the comments section locally. 🤗 Are you still having trouble remembering the content of your mini-essay and facing the embarrassing situation of forgetting the front, middle and back? Using this tool will help you <b>record the mini-essays</b> you come across and never worry about forgetting them again! 😋</td>
Expand All @@ -165,6 +171,7 @@ If you are interested, please help us **translate**, thank you.
</tbody>
</table>


## 📃 License

This software code is available under the following **license**
Expand Down
16 changes: 8 additions & 8 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ android {
aidl = true
}
composeOptions {
kotlinCompilerExtensionVersion = "1.5.4"
kotlinCompilerExtensionVersion = "1.5.12"
}
packaging {
resources.excludes += mutableSetOf(
Expand Down Expand Up @@ -150,17 +150,17 @@ dependencies {
val accompanistVersion: String by rootProject.extra
val mlkitRecognitionVersion: String by rootProject.extra
val roomVersion: String by rootProject.extra
implementation("androidx.core:core-ktx:1.12.0")
implementation("androidx.core:core-ktx:1.13.0")
implementation("androidx.compose.ui:ui:$composeVersion")
implementation("androidx.compose.material3:material3:$md3Version")
implementation("androidx.compose.material3:material3-window-size-class:$md3Version")
implementation("androidx.compose.material:material:1.6.5")
implementation("androidx.compose.material:material-icons-extended:1.6.5")
implementation("androidx.compose.material:material:1.6.6")
implementation("androidx.compose.material:material-icons-extended:1.6.6")
implementation("androidx.compose.ui:ui-tooling-preview:$md3Version")
implementation("com.google.android.material:material:1.11.0")
implementation("androidx.lifecycle:lifecycle-runtime-compose:2.7.0")
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.7.0")
implementation("androidx.activity:activity-compose:1.8.2")
implementation("androidx.activity:activity-compose:1.9.0")
implementation("androidx.palette:palette-ktx:1.0.0")
implementation("com.google.dagger:hilt-android:2.51")
ksp("com.google.dagger:hilt-android-compiler:2.51")
Expand All @@ -178,7 +178,7 @@ dependencies {
implementation("com.github.thegrizzlylabs:sardine-android:0.8")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.3")
implementation("com.materialkolor:material-kolor:1.4.4")
implementation("androidx.datastore:datastore-preferences:1.0.0")
implementation("androidx.datastore:datastore-preferences:1.1.0")
implementation("com.airbnb.android:lottie-compose:6.3.0")

implementation("com.squareup.retrofit2:retrofit:2.10.0")
Expand All @@ -198,6 +198,6 @@ dependencies {

implementation("com.github.penfeizhou.android.animation:apng:2.28.0")

debugImplementation("androidx.compose.ui:ui-tooling:1.6.5")
debugImplementation("androidx.compose.ui:ui-test-manifest:1.6.5")
debugImplementation("androidx.compose.ui:ui-tooling:1.6.6")
debugImplementation("androidx.compose.ui:ui-test-manifest:1.6.6")
}
30 changes: 19 additions & 11 deletions app/src/main/java/com/skyd/rays/ui/component/ClipboardTextField.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ package com.skyd.rays.ui.component

import androidx.compose.foundation.horizontalScroll
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.text.KeyboardActionScope
Expand All @@ -30,12 +28,11 @@ fun ClipboardTextField(
isPassword: Boolean = false,
errorText: String = "",
imeAction: ImeAction = ImeAction.Done,
keyboardAction: ((focusManager: FocusManager?, value: String) -> (KeyboardActionScope.() -> Unit))? = null,
keyboardAction: (KeyboardActionScope.(focusManager: FocusManager?, value: String) -> Unit)? = null,
focusManager: FocusManager? = null,
onConfirm: (String) -> Unit = {},
) {
Column(modifier = modifier) {
Spacer(modifier = Modifier.height(10.dp))
RaysTextField(
readOnly = readOnly,
value = value,
Expand All @@ -48,27 +45,39 @@ fun ClipboardTextField(
keyboardActions = KeyboardActions(
onDone = if (imeAction == ImeAction.Done) {
if (keyboardAction == null) action(focusManager, onConfirm, value)
else keyboardAction(focusManager, value)
else {
{ keyboardAction(focusManager, value) }
}
} else null,
onGo = if (imeAction == ImeAction.Go) {
if (keyboardAction == null) action(focusManager, onConfirm, value)
else keyboardAction(focusManager, value)
else {
{ keyboardAction(focusManager, value) }
}
} else null,
onNext = if (imeAction == ImeAction.Next) {
if (keyboardAction == null) action(focusManager, onConfirm, value)
else keyboardAction(focusManager, value)
else {
{ keyboardAction(focusManager, value) }
}
} else null,
onPrevious = if (imeAction == ImeAction.Previous) {
if (keyboardAction == null) action(focusManager, onConfirm, value)
else keyboardAction(focusManager, value)
else {
{ keyboardAction(focusManager, value) }
}
} else null,
onSearch = if (imeAction == ImeAction.Search) {
if (keyboardAction == null) action(focusManager, onConfirm, value)
else keyboardAction(focusManager, value)
else {
{ keyboardAction(focusManager, value) }
}
} else null,
onSend = if (imeAction == ImeAction.Send) {
if (keyboardAction == null) action(focusManager, onConfirm, value)
else keyboardAction(focusManager, value)
else {
{ keyboardAction(focusManager, value) }
}
} else null,
),
keyboardOptions = KeyboardOptions(
Expand All @@ -88,7 +97,6 @@ fun ClipboardTextField(
)
}
}
Spacer(modifier = Modifier.height(10.dp))
}
}

Expand Down
6 changes: 3 additions & 3 deletions app/src/main/java/com/skyd/rays/ui/component/SettingsItem.kt
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ fun BannerItem(content: @Composable () -> Unit) {
Spacer(modifier = Modifier.height(16.dp))
CompositionLocalProvider(
LocalContentColor provides (LocalContentColor.current alwaysLight true),
LocalVerticalPadding provides 12.dp
LocalVerticalPadding provides 21.dp
) {
Box(
modifier = Modifier
Expand Down Expand Up @@ -354,7 +354,7 @@ fun BaseSettingsItem(
combinedClickable(onLongClick = onLongClick) { onClick() }
} else this
}
.padding(LocalVerticalPadding.current),
.padding(horizontal = 16.dp),
verticalAlignment = Alignment.CenterVertically
) {
if (painter != null) {
Expand All @@ -379,7 +379,7 @@ fun BaseSettingsItem(
Column(
modifier = Modifier
.weight(1f)
.padding(horizontal = 10.dp)
.padding(horizontal = 10.dp, vertical = LocalVerticalPadding.current)
) {
Text(
text = text,
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/com/skyd/rays/ui/screen/add/AddScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -443,8 +443,8 @@ private fun LazyListScope.titleInputFieldItem(
)
}
},
keyboardOptions = KeyboardOptions(imeAction = ImeAction.Done),
keyboardActions = KeyboardActions(onDone = {
keyboardOptions = KeyboardOptions(imeAction = ImeAction.Next),
keyboardActions = KeyboardActions(onNext = {
focusManager.moveFocus(FocusDirection.Next)
})
)
Expand Down
7 changes: 7 additions & 0 deletions doc/README/README-zh-rCN.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@
- **TensorFlow** Lite
- **ML Kit** (Machine Learning)
- **Room**
- **AIDL**
- Splash Screen
- Navigation
- Coil
Expand All @@ -150,6 +151,11 @@
</tr>
</thead>
<tbody>
<tr>
<td><img src="../../image/AniVu.svg" style="height: 100px"/></td>
<td><b>AniVu</b>,一个集<b> RSS 番剧订阅与更新、比特洪流下载、视频播放</b>为一体的工具。</td>
<td><a href="https://github.com/SkyD666/AniVu">https://github.com/SkyD666/AniVu</a></td>
</tr>
<tr>
<td><img src="../../image/Raca.svg" style="height: 100px"/></td>
<td><b>Raca (Record All Classic Articles)</b>,一个在本地<b>记录、查找抽象段落/评论区小作文</b>的工具。<br/>🤗 您还在为记不住小作文内容,面临<b>前面、中间、后面都忘了</b>的尴尬处境吗?使用这款工具将<b>帮助您记录您所遇到的小作文</b>,再也不因为忘记而烦恼!😋</td>
Expand All @@ -163,6 +169,7 @@
</tbody>
</table>


## 📃许可证

使用此软件代码需**遵循以下许可证协议**
Expand Down
24 changes: 24 additions & 0 deletions image/AniVu.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 1504f03

Please sign in to comment.