Skip to content

Commit

Permalink
Merge branch 'dev' into 'main'
Browse files Browse the repository at this point in the history
Bugfix:
- Fix a critical bug that caused the app to crash when a card in an article with no image was clicked (#8)

Dev/Meta:
- Upgrade gradle wrapper version
  • Loading branch information
nsh07 committed Oct 22, 2024
2 parents 489f5d5 + 6721365 commit 75ad010
Show file tree
Hide file tree
Showing 8 changed files with 270 additions and 177 deletions.
36 changes: 25 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,27 @@

<div align="center">

<a href="https://github.com/nsh07/WikiReader/releases/latest">
<img src="https://img.shields.io/github/v/release/nsh07/WikiReader?logo=github&labelColor=000000">
</a>
<a href="https://github.com/nsh07/WikiReader/blob/main/LICENSE">
<img src="https://img.shields.io/github/license/nsh07/wikireader?logo=gnu&color=blue&labelColor=000000">
</a>
<img src="https://img.shields.io/badge/API-26+-blue?logo=android&labelColor=000000">

A lightweight Android app for reading Wikipedia articles distraction-free

Supports light mode, dark mode and Material You dynamic colors

<a href="https://apt.izzysoft.de/fdroid/index/apk/org.nsh07.wikireader">
<img src="https://gitlab.com/IzzyOnDroid/repo/-/raw/master/assets/IzzyOnDroid.png" width="20%">
</a>

</div>

---

## Features

- **Fast loading:** The article text is loaded before anything else, so you can get to reading,
quick.
- **Article image:** View an image of the topic from its Wikipedia page. Click on it to enlarge it
and view in full-screen
- **One-handed use:** Use the floating action buttons at the bottom for a complete one-handed
experience
- **Lightweight:** The app starts instantly, and works smoothly
- **Material Design 3:** Designed according to the latest Material Design 3 guidelines
- **Smooth animations:** Smooth and fluent animations
## Screenshots

<p align="center" width="100%">
<img src="fastlane/metadata/android/en-US/images/phoneScreenshots/1.png" width="30%">
Expand All @@ -40,3 +42,15 @@ Supports light mode, dark mode and Material You dynamic colors
<img src="fastlane/metadata/android/en-US/images/phoneScreenshots/5.png" width="30%">
<img src="fastlane/metadata/android/en-US/images/phoneScreenshots/6.png" width="30%">
</p>

## Features

- **Fast loading:** The article text is loaded before anything else, so you can get to reading,
quick.
- **Article image:** View an image of the topic from its Wikipedia page. Click on it to enlarge it
and view in full-screen
- **One-handed use:** Use the floating action buttons at the bottom for a complete one-handed
experience
- **Lightweight:** The app starts instantly, and works smoothly
- **Material Design 3:** Designed according to the latest Material Design 3 guidelines
- **Smooth animations:** Smooth and fluent animations
4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ android {
applicationId = "org.nsh07.wikireader"
minSdk = 26
targetSdk = 35
versionCode = 7
versionName = "1.3.2"
versionCode = 8
versionName = "1.3.3"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
Expand Down
10 changes: 7 additions & 3 deletions app/src/main/java/org/nsh07/wikireader/AppScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,10 @@ fun AppScreen(
AppHomeScreen(
homeScreenState = homeScreenState,
listState = listState,
onImageClick = { navController.navigate(FSImage) },
onImageClick = {
if (homeScreenState.photo != null)
navController.navigate(FSImage)
},
modifier = Modifier
.fillMaxSize()
)
Expand All @@ -119,9 +122,10 @@ fun AppScreen(
) + fadeOut(tween(100))
}
) {
if (homeScreenState.photo == null) navController.navigateUp()
FullScreenImage(
photo = homeScreenState.photo!!,
photoDesc = homeScreenState.photoDesc!!,
photo = homeScreenState.photo,
photoDesc = homeScreenState.photoDesc,
onBack = { navController.navigateUp() }
)
}
Expand Down
61 changes: 31 additions & 30 deletions app/src/main/java/org/nsh07/wikireader/ui/FullScreenImage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ import org.nsh07.wikireader.data.WikiPhotoDesc
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun FullScreenImage(
photo: WikiPhoto,
photoDesc: WikiPhotoDesc,
photo: WikiPhoto?,
photoDesc: WikiPhotoDesc?,
onBack: () -> Unit,
modifier: Modifier = Modifier
) {
Scaffold(
topBar = {
TopAppBar(
title = { Text(photoDesc.label[0]) },
title = { Text(photoDesc?.label?.get(0) ?: "") },
navigationIcon = {
IconButton(onClick = onBack) {
Icon(
Expand Down Expand Up @@ -87,32 +87,33 @@ fun FullScreenImage(

val coroutineScope = rememberCoroutineScope()

Box(modifier = Modifier.fillMaxSize()) {
PageImage(
photo = photo,
photoDesc = photoDesc,
contentScale = ContentScale.Inside,
modifier = Modifier
.onSizeChanged { size = it }
.graphicsLayer(
scaleX = scale,
scaleY = scale,
translationX = offset.x,
translationY = offset.y
)
.transformable(state = state)
.align(Alignment.Center)
.pointerInput(Unit) {
detectTapGestures(onDoubleTap = {
coroutineScope.launch {
if (scale == 1f) // Zoom in only if the image is zoomed out
state.animateZoomBy(4f)
else
state.animateZoomBy(0.25f)
}
})
}
)
}
if (photo != null && photoDesc != null)
Box(modifier = Modifier.fillMaxSize()) {
PageImage(
photo = photo,
photoDesc = photoDesc,
contentScale = ContentScale.Inside,
modifier = Modifier
.onSizeChanged { size = it }
.graphicsLayer(
scaleX = scale,
scaleY = scale,
translationX = offset.x,
translationY = offset.y
)
.transformable(state = state)
.align(Alignment.Center)
.pointerInput(Unit) {
detectTapGestures(onDoubleTap = {
coroutineScope.launch {
if (scale == 1f) // Zoom in only if the image is zoomed out
state.animateZoomBy(4f)
else
state.animateZoomBy(0.25f)
}
})
}
)
}
}
}
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
14 changes: 8 additions & 6 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#Fri Jul 19 09:18:07 IST 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionSha256Sum=d725d707bfabd4dfdc958c624003b3c80accc03f7037b5122c4b1d0ef15cecab
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 75ad010

Please sign in to comment.