Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

General small refactors #942

Merged
merged 2 commits into from
Jul 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@

<p align="center">
<a href="https://github.com/dessalines/jerboa" rel="noopener">
<img width=200px height=200px src="https://raw.githubusercontent.com/dessalines/jerboa/main/app/src/main/res/jerboa.svg"></a>
<img width=200px height=200px src="https://raw.githubusercontent.com/dessalines/jerboa/main/app/src/main/res/jerboa.svg"></a>

<h3 align="center"><a href="https://github.com/dessalines/jerboa">Jerboa</a></h3>
<h3 align="center"><a href="https://github.com/dessalines/jerboa">Jerboa</a></h3>
<p align="center">
An Android client for <a href="https://github.com/LemmyNet/lemmy">Lemmy</a>, a federated reddit alternative
<br />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,12 @@ fun ImageViewerDialog(url: String, onBackRequest: () -> Unit) {
val topBarAlpha = animateFloatAsState(
targetValue = if (showTopBar) 1f else 0f,
animationSpec = tween(backFadeTime),
label = "topBarAlpha",
)
val backgroundColor = animateColorAsState(
targetValue = if (showTopBar) backColorTranslucent else backColor,
animationSpec = tween(backFadeTime),
label = "backgroundColor",
)

val context = LocalContext.current
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.jerboa.ui.components.common

import BlurTransformation
import android.content.Context
import android.net.Uri
import android.os.Build
Expand Down Expand Up @@ -41,6 +40,7 @@ import com.jerboa.ui.theme.LARGER_ICON_THUMBNAIL_SIZE
import com.jerboa.ui.theme.MAX_IMAGE_SIZE
import com.jerboa.ui.theme.THUMBNAIL_SIZE
import com.jerboa.ui.theme.muted
import com.jerboa.util.BlurTransformation

@Composable
fun CircularIcon(
Expand Down
19 changes: 8 additions & 11 deletions app/src/main/java/com/jerboa/ui/theme/Theme.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,15 @@ import androidx.core.view.WindowCompat
import com.jerboa.ThemeColor
import com.jerboa.ThemeMode
import com.jerboa.db.AppSettings
import com.jerboa.db.DEFAULT_FONT_SIZE

@Composable
fun JerboaTheme(
appSettings: AppSettings?,
appSettings: AppSettings,
content: @Composable () -> Unit,
) {
val themeMode = ThemeMode.values()[appSettings?.theme ?: 0]
val themeColor = ThemeColor.values()[appSettings?.themeColor ?: 0]
val fontSize = (appSettings?.fontSize ?: DEFAULT_FONT_SIZE).sp
val themeMode = ThemeMode.values()[appSettings.theme]
val themeColor = ThemeColor.values()[appSettings.themeColor]
val fontSize = appSettings.fontSize.sp

val ctx = LocalContext.current
val android12OrLater = Build.VERSION.SDK_INT >= Build.VERSION_CODES.S
Expand Down Expand Up @@ -90,12 +89,10 @@ fun JerboaTheme(
else -> true
}

appSettings?.let {
if (it.secureWindow) {
window.addFlags(WindowManager.LayoutParams.FLAG_SECURE)
} else {
window.clearFlags(WindowManager.LayoutParams.FLAG_SECURE)
}
if (appSettings.secureWindow) {
window.addFlags(WindowManager.LayoutParams.FLAG_SECURE)
} else {
window.clearFlags(WindowManager.LayoutParams.FLAG_SECURE)
}

window.statusBarColor = colors.background.toArgb()
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/java/com/jerboa/util/BlurTransformation.kt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package com.jerboa.util

/*
* Thanks to T8RIN for building this class!
*
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/xml/locales_config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@
<locale android:name="pt-BR"/>
<locale android:name="ru"/>
<locale android:name="se"/>
<locale android:name="pl"/>
</locale-config>