Skip to content

Commit 7b35f73

Browse files
committed
Merge branch 'dev'
2 parents a329315 + 0cf0527 commit 7b35f73

File tree

39 files changed

+7619
-7052
lines changed

39 files changed

+7619
-7052
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ Supports light mode, dark mode, Material You dynamic colors and 300+ Wikipedia l
7575
experience
7676
- **Immersive mode:** Hide UI elements while scrolling and enjoy an immersive reading experience
7777
- **Lightweight:** The app starts instantly, and works smoothly
78-
- **Material Design 3:** Designed according to the latest Material Design 3 guidelines
78+
- **Material 3 Expressive:** Designed according to the latest Material 3 Expressive design
79+
guidelines
7980
- **Smooth animations:** Smooth and fluent animations
8081
- **Customizable colors:** Choose from light/dark themes and customize the Material 3 color palette
8182
- **Customizable font size:** Choose your own comfortable font size

app/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ android {
1919
applicationId = "org.nsh07.wikireader"
2020
minSdk = 26
2121
targetSdk = 36
22-
versionCode = 50
23-
versionName = "2.5.2"
22+
versionCode = 51
23+
versionName = "2.5.3"
2424

2525
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
2626
vectorDrawables {

app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
android:label="@string/app_name"
1212
android:supportsRtl="true"
1313
android:theme="@style/Theme.WikiReader.Starting"
14-
android:enableOnBackInvokedCallback="false"
14+
android:enableOnBackInvokedCallback="true"
1515
tools:targetApi="36">
1616
<activity
1717
android:name="org.nsh07.wikireader.MainActivity"

app/src/main/java/org/nsh07/wikireader/data/misc.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ fun String.toColor(): Color {
3838
* on either side)
3939
*/
4040
fun parseSections(text: String): List<String> {
41-
val out = text.split("\n==(?!=)|(?<!=)==[\n ]".toRegex()).toMutableList()
41+
val out = text.split("\n==(?!=)|(?<!=)==\n".toRegex()).toMutableList()
4242

4343
for (i in out.lastIndex downTo 1) {
4444
val curr = out[i].trim()

app/src/main/java/org/nsh07/wikireader/parser/cleanUpWikitext.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ package org.nsh07.wikireader.parser
88
fun cleanUpWikitext(wikitext: String): String {
99
return wikitext
1010
.replace("<!--.+?-->".toRegex(), "")
11+
.replace("== \n", "==\n")
1112
.replace(
1213
"\\{\\{nobility table header.*?\\}\\}"
1314
.toRegex(setOf(RegexOption.IGNORE_CASE, RegexOption.DOT_MATCHES_ALL)),

app/src/main/java/org/nsh07/wikireader/parser/wikitextToAnnotatedString.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1036,7 +1036,7 @@ fun String.toWikitextAnnotatedString(
10361036
listOf("{{nowrap", "{{nobr", "{{nobreak", "{{nwr", "{{nbr").fastAny {
10371037
currSubstring.startsWith(it, ignoreCase = true)
10381038
} -> {
1039-
val curr = currSubstring.substringAfter('|')
1039+
val curr = currSubstring.substringAfter('|', "")
10401040
append(curr.replace(' ', nbsp).twas())
10411041
}
10421042

app/src/main/java/org/nsh07/wikireader/ui/aboutScreen/AboutScreen.kt

Lines changed: 49 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package org.nsh07.wikireader.ui.aboutScreen
22

33
import androidx.compose.foundation.background
4-
import androidx.compose.foundation.clickable
54
import androidx.compose.foundation.layout.Arrangement
65
import androidx.compose.foundation.layout.Column
76
import androidx.compose.foundation.layout.Row
@@ -40,8 +39,9 @@ import androidx.compose.ui.tooling.preview.Preview
4039
import androidx.compose.ui.unit.dp
4140
import org.nsh07.wikireader.BuildConfig
4241
import org.nsh07.wikireader.R
43-
import org.nsh07.wikireader.ui.theme.CustomTopBarColors.topBarColors
44-
import org.nsh07.wikireader.ui.theme.WRShapeDefaults.bottomListItemShape
42+
import org.nsh07.wikireader.ui.settingsScreen.ClickableListItem
43+
import org.nsh07.wikireader.ui.theme.CustomColors.listItemColors
44+
import org.nsh07.wikireader.ui.theme.CustomColors.topBarColors
4545
import org.nsh07.wikireader.ui.theme.WRShapeDefaults.middleListItemShape
4646
import org.nsh07.wikireader.ui.theme.WRShapeDefaults.topListItemShape
4747
import org.nsh07.wikireader.ui.theme.WikiReaderTheme
@@ -67,17 +67,18 @@ fun AboutScreen(
6767
LazyColumn(
6868
verticalArrangement = Arrangement.spacedBy(2.dp),
6969
contentPadding = insets,
70-
modifier = Modifier.background(topBarColors.containerColor)
70+
modifier = Modifier
71+
.background(topBarColors.containerColor)
72+
.padding(horizontal = 16.dp)
7173
) {
7274
item { Spacer(Modifier.height(8.dp)) }
7375
item {
7476
Column(
7577
horizontalAlignment = Alignment.CenterHorizontally,
7678
modifier = Modifier
77-
.padding(horizontal = 16.dp)
7879
.clip(topListItemShape)
7980
.fillMaxWidth()
80-
.background(colorScheme.surface)
81+
.background(listItemColors.containerColor)
8182
) {
8283
Row(verticalAlignment = Alignment.CenterVertically) {
8384
Icon(painterResource(R.drawable.ic_launcher_foreground), null)
@@ -113,70 +114,49 @@ fun AboutScreen(
113114
},
114115
headlineContent = { Text(stringResource(R.string.version)) },
115116
supportingContent = { Text(BuildConfig.VERSION_NAME) },
116-
modifier = Modifier
117-
.padding(horizontal = 16.dp)
118-
.clip(middleListItemShape)
117+
colors = listItemColors,
118+
modifier = Modifier.clip(middleListItemShape)
119119
)
120-
ListItem(
120+
ClickableListItem(
121121
leadingContent = {
122122
Icon(painterResource(R.drawable.code), null)
123123
},
124124
headlineContent = { Text(stringResource(R.string.sourceCode)) },
125125
supportingContent = { Text("GitHub") },
126-
modifier = Modifier
127-
.padding(horizontal = 16.dp)
128-
.clip(middleListItemShape)
129-
.clickable(
130-
onClick = {
131-
uriHandler.openUri("https://github.com/nsh07/WikiReader")
132-
}
133-
)
134-
)
135-
ListItem(
126+
colors = listItemColors,
127+
items = 6,
128+
index = 2
129+
) { uriHandler.openUri("https://github.com/nsh07/WikiReader") }
130+
ClickableListItem(
136131
leadingContent = {
137132
Icon(painterResource(R.drawable.gavel), null)
138133
},
139134
headlineContent = { Text(stringResource(R.string.license)) },
140135
supportingContent = { Text("GPL v3.0") },
141-
modifier = Modifier
142-
.padding(horizontal = 16.dp)
143-
.clip(middleListItemShape)
144-
.clickable(
145-
onClick = {
146-
uriHandler.openUri("https://github.com/nsh07/WikiReader/blob/main/LICENSE")
147-
}
148-
)
149-
)
150-
ListItem(
136+
colors = listItemColors,
137+
items = 6,
138+
index = 3
139+
) { uriHandler.openUri("https://github.com/nsh07/WikiReader/blob/main/LICENSE") }
140+
ClickableListItem(
151141
leadingContent = {
152142
Icon(painterResource(R.drawable.update), null)
153143
},
154144
headlineContent = { Text(stringResource(R.string.releases)) },
155145
supportingContent = { Text(stringResource(R.string.releasesDesc)) },
156-
modifier = Modifier
157-
.padding(horizontal = 16.dp)
158-
.clip(middleListItemShape)
159-
.clickable(
160-
onClick = {
161-
uriHandler.openUri("https://github.com/nsh07/WikiReader/releases")
162-
}
163-
)
164-
)
165-
ListItem(
146+
colors = listItemColors,
147+
items = 6,
148+
index = 4
149+
) { uriHandler.openUri("https://github.com/nsh07/WikiReader/releases") }
150+
ClickableListItem(
166151
leadingContent = {
167152
Icon(painterResource(R.drawable.translate), null)
168153
},
169154
headlineContent = { Text(stringResource(R.string.translate)) },
170155
supportingContent = { Text(stringResource(R.string.translateDesc)) },
171-
modifier = Modifier
172-
.padding(horizontal = 16.dp)
173-
.clip(bottomListItemShape)
174-
.clickable(
175-
onClick = {
176-
uriHandler.openUri("https://hosted.weblate.org/engage/wikireader/")
177-
}
178-
)
179-
)
156+
colors = listItemColors,
157+
items = 6,
158+
index = 5
159+
) { uriHandler.openUri("https://hosted.weblate.org/engage/wikireader/") }
180160
}
181161
}
182162
item {
@@ -187,38 +167,28 @@ fun AboutScreen(
187167
color = colorScheme.primary,
188168
modifier = Modifier.padding(horizontal = 32.dp, vertical = 14.dp)
189169
)
190-
ListItem(
170+
ClickableListItem(
191171
leadingContent = {
192172
Icon(
193173
painterResource(R.drawable.github), null
194174
)
195175
},
196176
headlineContent = { Text("Nishant Mishra") },
197177
supportingContent = { Text(stringResource(R.string.otherProjectsDesc)) },
198-
modifier = Modifier
199-
.padding(horizontal = 16.dp)
200-
.clip(topListItemShape)
201-
.clickable(
202-
onClick = {
203-
uriHandler.openUri("https://github.com/nsh07")
204-
}
205-
)
206-
)
207-
ListItem(
178+
colors = listItemColors,
179+
items = 2,
180+
index = 0
181+
) { uriHandler.openUri("https://github.com/nsh07") }
182+
ClickableListItem(
208183
leadingContent = {
209184
Icon(painterResource(R.drawable.heart), null)
210185
},
211186
headlineContent = { Text(stringResource(R.string.donate)) },
212187
supportingContent = { Text(stringResource(R.string.supportMyWork)) },
213-
modifier = Modifier
214-
.padding(horizontal = 16.dp)
215-
.clip(bottomListItemShape)
216-
.clickable(
217-
onClick = {
218-
uriHandler.openUri("https://github.com/sponsors/nsh07")
219-
}
220-
)
221-
)
188+
colors = listItemColors,
189+
items = 2,
190+
index = 1
191+
) { uriHandler.openUri("https://github.com/sponsors/nsh07") }
222192
}
223193
}
224194
item {
@@ -229,40 +199,30 @@ fun AboutScreen(
229199
color = colorScheme.primary,
230200
modifier = Modifier.padding(horizontal = 32.dp, vertical = 14.dp)
231201
)
232-
ListItem(
202+
ClickableListItem(
233203
leadingContent = {
234204
Icon(
235205
painterResource(R.drawable.wikipedia_s_w), null
236206
)
237207
},
238208
headlineContent = { Text(stringResource(R.string.wikipedia)) },
239209
supportingContent = { Text(stringResource(R.string.wikipediaWebsiteDesc)) },
240-
modifier = Modifier
241-
.padding(horizontal = 16.dp)
242-
.clip(topListItemShape)
243-
.clickable(
244-
onClick = {
245-
uriHandler.openUri("https://wikipedia.org")
246-
}
247-
)
248-
)
249-
ListItem(
210+
colors = listItemColors,
211+
items = 2,
212+
index = 0
213+
) { uriHandler.openUri("https://wikipedia.org") }
214+
ClickableListItem(
250215
leadingContent = {
251216
Icon(
252217
painterResource(R.drawable.wikimedia_logo_black), null
253218
)
254219
},
255220
headlineContent = { Text(stringResource(R.string.supportWikipedia)) },
256221
supportingContent = { Text(stringResource(R.string.donateToWikipedia)) },
257-
modifier = Modifier
258-
.padding(horizontal = 16.dp)
259-
.clip(bottomListItemShape)
260-
.clickable(
261-
onClick = {
262-
uriHandler.openUri("https://wikimediafoundation.org/support/")
263-
}
264-
)
265-
)
222+
colors = listItemColors,
223+
items = 2,
224+
index = 1
225+
) { uriHandler.openUri("https://wikimediafoundation.org/support/") }
266226
}
267227
}
268228
item { Spacer(Modifier.height(16.dp)) }

app/src/main/java/org/nsh07/wikireader/ui/aboutScreen/AboutTopAppBar.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ package org.nsh07.wikireader.ui.aboutScreen
22

33
import androidx.compose.material3.ExperimentalMaterial3Api
44
import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi
5+
import androidx.compose.material3.FilledTonalIconButton
56
import androidx.compose.material3.Icon
6-
import androidx.compose.material3.IconButton
77
import androidx.compose.material3.IconButtonDefaults
88
import androidx.compose.material3.LargeFlexibleTopAppBar
99
import androidx.compose.material3.Text
@@ -12,7 +12,8 @@ import androidx.compose.runtime.Composable
1212
import androidx.compose.ui.res.painterResource
1313
import androidx.compose.ui.res.stringResource
1414
import org.nsh07.wikireader.R
15-
import org.nsh07.wikireader.ui.theme.CustomTopBarColors.topBarColors
15+
import org.nsh07.wikireader.ui.theme.CustomColors.listItemColors
16+
import org.nsh07.wikireader.ui.theme.CustomColors.topBarColors
1617

1718
@Composable
1819
@OptIn(ExperimentalMaterial3Api::class, ExperimentalMaterial3ExpressiveApi::class)
@@ -21,8 +22,9 @@ fun AboutTopAppBar(scrollBehavior: TopAppBarScrollBehavior, onBack: () -> Unit)
2122
title = { Text(stringResource(R.string.about)) },
2223
subtitle = { Text(stringResource(R.string.app_name)) },
2324
navigationIcon = {
24-
IconButton(
25+
FilledTonalIconButton(
2526
shapes = IconButtonDefaults.shapes(),
27+
colors = IconButtonDefaults.filledTonalIconButtonColors(containerColor = listItemColors.containerColor),
2628
onClick = onBack
2729
) {
2830
Icon(

0 commit comments

Comments
 (0)