Skip to content
This repository was archived by the owner on Sep 17, 2025. It is now read-only.

Commit d963dfd

Browse files
committed
Update 1.6.1
1 parent 0feec1c commit d963dfd

15 files changed

Lines changed: 240 additions & 211 deletions

File tree

.idea/deploymentTargetSelector.xml

Lines changed: 7 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/build.gradle.kts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ android {
1717
applicationId = "com.yangdai.opennote"
1818
minSdk = 29
1919
targetSdk = 35
20-
versionCode = 1600
21-
versionName = "1.6.0"
20+
versionCode = 1610
21+
versionName = "1.6.1"
2222

2323
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
2424
vectorDrawables {
@@ -116,7 +116,6 @@ dependencies {
116116

117117
// Room, for local database
118118
implementation(libs.androidx.room.runtime)
119-
annotationProcessor(libs.androidx.room.compiler)
120119
ksp(libs.androidx.room.compiler)
121120
implementation(libs.androidx.room.ktx)
122121
testImplementation(libs.androidx.room.testing)

app/src/main/java/com/yangdai/opennote/presentation/component/dialog/ProgressDialog.kt

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
package com.yangdai.opennote.presentation.component.dialog
22

33
import androidx.compose.animation.AnimatedContent
4+
import androidx.compose.foundation.background
45
import androidx.compose.foundation.layout.Arrangement
56
import androidx.compose.foundation.layout.Box
67
import androidx.compose.foundation.layout.Column
78
import androidx.compose.foundation.layout.Spacer
89
import androidx.compose.foundation.layout.fillMaxWidth
910
import androidx.compose.foundation.layout.height
1011
import androidx.compose.foundation.layout.size
12+
import androidx.compose.foundation.shape.CircleShape
1113
import androidx.compose.material.icons.Icons
1214
import androidx.compose.material.icons.rounded.Done
1315
import androidx.compose.material3.AlertDialog
@@ -19,6 +21,7 @@ import androidx.compose.material3.TextButton
1921
import androidx.compose.runtime.Composable
2022
import androidx.compose.ui.Alignment
2123
import androidx.compose.ui.Modifier
24+
import androidx.compose.ui.draw.clip
2225
import androidx.compose.ui.res.stringResource
2326
import androidx.compose.ui.tooling.preview.Preview
2427
import androidx.compose.ui.unit.dp
@@ -71,7 +74,18 @@ fun ProgressDialog(
7174
)
7275
else
7376
if (!infinite)
74-
Text(text = "${(progress * 100).toInt()}%")
77+
Box(
78+
modifier = Modifier
79+
.size(48.dp)
80+
.clip(CircleShape)
81+
.background(MaterialTheme.colorScheme.primaryContainer),
82+
contentAlignment = Alignment.Center
83+
) {
84+
Text(
85+
text = "${(progress * 100).toInt()}%",
86+
color = MaterialTheme.colorScheme.onPrimaryContainer
87+
)
88+
}
7589
}
7690
}
7791
if (message.isNotEmpty()) {
@@ -92,22 +106,17 @@ fun ProgressDialog(
92106

93107
@Composable
94108
@Preview
95-
fun ProgressDialogPreview1() {
96-
ProgressDialog(isLoading = true, progress = 1f, onDismissRequest = {})
97-
}
98-
99-
@Composable
100-
@Preview
101-
fun ProgressDialogPreview2() {
109+
fun ProgressDialogPreview() {
102110
ProgressDialog(
103111
isLoading = true,
104-
progress = 0.3f,
105-
message = "exception",
106-
onDismissRequest = {})
112+
progress = 0.4f,
113+
message = "Loading...",
114+
onDismissRequest = {}
115+
)
107116
}
108117

109118
@Composable
110119
@Preview
111-
fun ProgressDialogPreview3() {
120+
fun ProgressDialogPreview1() {
112121
ProgressDialog(isLoading = true, progress = 0.3f, infinite = true, onDismissRequest = {})
113122
}

app/src/main/java/com/yangdai/opennote/presentation/component/note/StandardModeMutators.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ fun TextFieldBuffer.underline() = inlineWrap("++")
179179

180180
fun TextFieldBuffer.strikeThrough() = inlineWrap("~~")
181181

182-
fun TextFieldBuffer.mark() = inlineWrap("<mark>", "</mark>")
182+
fun TextFieldBuffer.highlight() = inlineWrap("==")
183183

184184
fun TextFieldBuffer.inlineBrackets() = inlineWrap("[", "]")
185185

app/src/main/java/com/yangdai/opennote/presentation/component/note/StandardTextField.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ fun StandardTextField(
252252
}
253253

254254
Key.M -> {
255-
state.edit { mark() }
255+
state.edit { highlight() }
256256
true
257257
}
258258

app/src/main/java/com/yangdai/opennote/presentation/component/setting/AboutPane.kt

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import android.graphics.Bitmap
55
import android.graphics.BitmapFactory
66
import android.os.Build
77
import androidx.compose.animation.core.animateFloatAsState
8-
import androidx.compose.animation.core.tween
98
import androidx.compose.foundation.Image
109
import androidx.compose.foundation.background
1110
import androidx.compose.foundation.clickable
@@ -82,14 +81,11 @@ fun AboutPane() {
8281
horizontalAlignment = Alignment.CenterHorizontally
8382
) {
8483

85-
val packageInfo = context.packageManager.getPackageInfo(
86-
context.packageName, 0
87-
)
88-
val version = packageInfo.versionName
84+
val packageInfo = context.packageManager
85+
.getPackageInfo(context.packageName, 0)
86+
val version = remember(packageInfo) { packageInfo.versionName }
8987
var pressAMP by remember { mutableFloatStateOf(16f) }
90-
val animatedPress by animateFloatAsState(
91-
targetValue = pressAMP, animationSpec = tween(), label = ""
92-
)
88+
val animatedPress by animateFloatAsState(pressAMP)
9389

9490
val haptic = LocalHapticFeedback.current
9591

@@ -174,18 +170,18 @@ fun AboutPane() {
174170
.clip(CircleShape)
175171
.clickable {
176172
customTabsIntent.launchUrl(
177-
context, "https://github.com/YangDai2003/OpenNote-Compose".toUri()
173+
context, "https://github.com/YangDai2003/OpenNote-Compose/issues".toUri()
178174
)
179175
},
180176
colors = ListItemDefaults.colors()
181177
.copy(containerColor = MaterialTheme.colorScheme.surfaceContainerLowest),
182178
leadingContent = {
183179
Icon(
184-
imageVector = Icons.Outlined.Commit, contentDescription = "code"
180+
imageVector = Icons.Outlined.BugReport, contentDescription = "bug"
185181
)
186182
},
187183
headlineContent = {
188-
Text(text = stringResource(R.string.source_code))
184+
Text(text = stringResource(R.string.report_a_bug_or_request_a_feature))
189185
})
190186

191187
ListItem(
@@ -194,18 +190,18 @@ fun AboutPane() {
194190
.clip(CircleShape)
195191
.clickable {
196192
customTabsIntent.launchUrl(
197-
context, "https://github.com/YangDai2003/OpenNote-Compose/issues".toUri()
193+
context, "https://github.com/YangDai2003/OpenNote-Compose".toUri()
198194
)
199195
},
200196
colors = ListItemDefaults.colors()
201197
.copy(containerColor = MaterialTheme.colorScheme.surfaceContainerLowest),
202198
leadingContent = {
203199
Icon(
204-
imageVector = Icons.Outlined.BugReport, contentDescription = "bug"
200+
imageVector = Icons.Outlined.Commit, contentDescription = "code"
205201
)
206202
},
207203
headlineContent = {
208-
Text(text = stringResource(R.string.report_a_bug_or_request_a_feature))
204+
Text(text = stringResource(R.string.source_code))
209205
})
210206

211207
ListItem(

app/src/main/java/com/yangdai/opennote/presentation/component/setting/SettingItem.kt

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,26 @@ fun SettingItem(
1616
headlineText: String,
1717
supportingText: String,
1818
modifier: Modifier = Modifier,
19-
overlineContent: @Composable (() -> Unit)? = null,
2019
leadingContent: @Composable (() -> Unit)? = null,
21-
trailingContent: @Composable (() -> Unit)? = null,
2220
colors: ListItemColors = ListItemDefaults.colors(containerColor = Color.Transparent),
2321
tonalElevation: Dp = ListItemDefaults.Elevation,
2422
shadowElevation: Dp = ListItemDefaults.Elevation
2523
) = ListItem(
26-
headlineContent = { Text(text = headlineText) },
24+
modifier = modifier,
25+
headlineContent = {
26+
Text(
27+
text = headlineText,
28+
maxLines = 1
29+
)
30+
},
2731
supportingContent = {
2832
Text(
2933
text = supportingText,
3034
maxLines = 1,
3135
modifier = Modifier.basicMarquee()
3236
)
3337
},
34-
modifier = modifier,
35-
overlineContent = overlineContent,
3638
leadingContent = leadingContent,
37-
trailingContent = trailingContent,
3839
colors = colors,
3940
tonalElevation = tonalElevation,
4041
shadowElevation = shadowElevation
@@ -45,8 +46,6 @@ fun SettingItem(
4546
fun SettingItemPreview() {
4647
SettingItem(
4748
headlineText = "Headline",
48-
supportingText = "Supporting",
49-
leadingContent = { Text("Leading") },
50-
trailingContent = { Text("Trailing") }
49+
supportingText = "Supporting"
5150
)
5251
}

app/src/main/java/com/yangdai/opennote/presentation/screen/BaseScreen.kt

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,14 @@ fun BaseScreen(
4343
val isCreatingPass by sharedViewModel.isCreatingPassword.collectAsStateWithLifecycle()
4444
val activity = LocalActivity.current
4545

46-
if (settingsState.isScreenProtected) {
47-
activity?.window?.addFlags(android.view.WindowManager.LayoutParams.FLAG_SECURE)
48-
} else {
49-
activity?.window?.clearFlags(android.view.WindowManager.LayoutParams.FLAG_SECURE)
46+
LaunchedEffect(settingsState.isScreenProtected) {
47+
activity?.window?.let { window ->
48+
if (settingsState.isScreenProtected) {
49+
window.addFlags(android.view.WindowManager.LayoutParams.FLAG_SECURE)
50+
} else {
51+
window.clearFlags(android.view.WindowManager.LayoutParams.FLAG_SECURE)
52+
}
53+
}
5054
}
5155

5256
// Check if the user is logged in

0 commit comments

Comments
 (0)