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

chore: remove deprecations #403

Merged
merged 1 commit into from
May 20, 2024
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
1 change: 0 additions & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ dependencies {
implementation(libs.androidx.lifecycle.viewmodel.compose)
implementation(libs.androidx.navigation.compose)
implementation(libs.mikepenz.aboutlibraries.compose.m3)
implementation(libs.google.accompanist.systemuicontroller)

implementation(libs.androidx.startup.runtime)
implementation(libs.androidx.lifecycle.runtime.ktx)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Léon - The URL Cleaner
* Copyright (C) 2022 Sven Jacobs
* Copyright (C) 2024 Sven Jacobs
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand All @@ -20,7 +20,7 @@ package com.svenjacobs.app.leon.ui.common.views

import androidx.compose.foundation.layout.statusBarsPadding
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.ArrowBack
import androidx.compose.material.icons.automirrored.filled.ArrowBack
import androidx.compose.material3.CenterAlignedTopAppBar
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
Expand Down Expand Up @@ -53,7 +53,7 @@ private fun NavigationIcon(modifier: Modifier = Modifier, onClick: () -> Unit) {
onClick = onClick,
) {
Icon(
Icons.Filled.ArrowBack,
Icons.AutoMirrored.Filled.ArrowBack,
contentDescription = stringResource(R.string.a11y_back_navigation),
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@

package com.svenjacobs.app.leon.ui.screens.main

import android.app.Activity
import android.content.Context
import android.content.ContextWrapper
import android.content.Intent
import android.net.Uri
import android.view.Window
import androidx.compose.foundation.Image
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.foundation.layout.Arrangement
Expand Down Expand Up @@ -51,21 +55,21 @@ import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalClipboardManager
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalView
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.AnnotatedString
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.core.view.WindowCompat
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.lifecycle.viewmodel.compose.viewModel
import androidx.navigation.compose.NavHost
import androidx.navigation.compose.composable
import androidx.navigation.compose.rememberNavController
import com.google.accompanist.systemuicontroller.rememberSystemUiController
import com.svenjacobs.app.leon.R
import com.svenjacobs.app.leon.core.domain.action.ActionAfterClean
import com.svenjacobs.app.leon.ui.common.views.TopAppBar
Expand All @@ -92,20 +96,22 @@ fun MainScreen(
val navController = rememberNavController()
val snackbarHostState = remember { SnackbarHostState() }
val coroutineScope = rememberCoroutineScope()
val systemUiController = rememberSystemUiController()
val isDarkTheme = isSystemInDarkTheme()
val context = LocalContext.current
val clipboard = LocalClipboardManager.current
val shareTitle = stringResource(R.string.share)
val openTitle = stringResource(R.string.open)
var didPerformActionAfterClean by remember(uiState.result) { mutableStateOf(false) }
val view = LocalView.current

LaunchedEffect(sourceText.value) {
viewModel.setText(sourceText.value)
}

LaunchedEffect(Unit) {
systemUiController.setStatusBarColor(Color.Transparent, darkIcons = !isDarkTheme)
val window = view.context.findWindow() ?: return@LaunchedEffect
val insetsController = WindowCompat.getInsetsController(window, view)
insetsController.isAppearanceLightStatusBars = !isDarkTheme
}

fun openShareMenu(result: Result.Success) {
Expand Down Expand Up @@ -445,6 +451,12 @@ private fun HowToBody(modifier: Modifier = Modifier, onImportFromClipboardClick:
}
}

private tailrec fun Context.findWindow(): Window? = when (this) {
is Activity -> window
is ContextWrapper -> baseContext.findWindow()
else -> null
}

@Preview(showBackground = true)
@Composable
private fun SuccessBodyPreview() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Léon - The URL Cleaner
* Copyright (C) 2023 Sven Jacobs
* Copyright (C) 2024 Sven Jacobs
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -29,6 +29,7 @@ import androidx.compose.material3.DropdownMenuItem
import androidx.compose.material3.ExposedDropdownMenuBox
import androidx.compose.material3.ExposedDropdownMenuDefaults
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.MenuAnchorType
import androidx.compose.material3.OutlinedButton
import androidx.compose.material3.Switch
import androidx.compose.material3.Text
Expand Down Expand Up @@ -144,7 +145,7 @@ private fun Content(
TextField(
modifier = Modifier
.fillMaxWidth()
.menuAnchor(),
.menuAnchor(MenuAnchorType.PrimaryNotEditable),
value = actionAfterClean.text(),
onValueChange = {},
readOnly = true,
Expand Down
2 changes: 0 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ android-gradle-plugin = "8.4.0"
androidx-activity = "1.9.0"
androidx-compose-bom = "2024.05.00" # https://developer.android.com/jetpack/compose/bom/bom-mapping
androidx-lifecycle = "2.8.0"
google-accompanist = "0.34.0"
kotest = "5.9.0"
kotlin = "2.0.0-RC3"
kotlinx-coroutines = "1.8.1"
Expand All @@ -30,7 +29,6 @@ androidx-navigation-compose = "androidx.navigation:navigation-compose:2.8.0-beta
androidx-startup-runtime = "androidx.startup:startup-runtime:1.1.1"
chrisbanes-compose-bom-alpha = "dev.chrisbanes.compose:compose-bom:2024.05.00-alpha02"
facebook-stetho = "com.facebook.stetho:stetho:1.6.0"
google-accompanist-systemuicontroller = { module = "com.google.accompanist:accompanist-systemuicontroller", version.ref = "google-accompanist" }
jakewharton-timber = "com.jakewharton.timber:timber:5.0.1"
kotest-assertions-core = { module = "io.kotest:kotest-assertions-core", version.ref = "kotest" }
kotest-framework-api-jvm = { module = "io.kotest:kotest-framework-api-jvm", version.ref = "kotest" }
Expand Down