Cleanup
This commit is contained in:
+6
-13
@@ -2,7 +2,6 @@ plugins {
|
||||
id 'com.android.application'
|
||||
id 'org.jetbrains.kotlin.plugin.serialization' version '2.4.10'
|
||||
id 'org.jetbrains.kotlin.plugin.compose' version '2.4.10'
|
||||
id 'com.mikepenz.aboutlibraries.plugin' version '15.2.0'
|
||||
}
|
||||
|
||||
android {
|
||||
@@ -74,16 +73,17 @@ android {
|
||||
kotlinCompilerExtensionVersion = "2.2.20"
|
||||
}
|
||||
|
||||
androidResources {
|
||||
// The app ships English strings only; without this the libraries drag
|
||||
// in some eighty locales of their own.
|
||||
localeFilters += ["en"]
|
||||
}
|
||||
|
||||
lint {
|
||||
disable 'UsingMaterialAndMaterial3Libraries'
|
||||
}
|
||||
|
||||
}
|
||||
aboutLibraries {
|
||||
library {
|
||||
exclusionPatterns = [~"androidx.*", ~"com.google.android.*", ~"org.jetbrains.*"]
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'androidx.compose.material3:material3:1.4.0'
|
||||
@@ -94,17 +94,10 @@ dependencies {
|
||||
|
||||
implementation 'org.jetbrains.kotlinx:kotlinx-serialization-json:1.11.0'
|
||||
|
||||
implementation 'androidx.preference:preference-ktx:1.2.1'
|
||||
implementation 'androidx.compose.ui:ui'
|
||||
implementation "androidx.activity:activity-ktx:1.13.0"
|
||||
|
||||
implementation 'androidx.compose.ui:ui-tooling-preview'
|
||||
implementation 'com.google.android.material:material:1.14.0'
|
||||
implementation 'org.jetbrains.kotlinx:kotlinx-serialization-json:1.11.0'
|
||||
|
||||
implementation 'com.mikepenz:aboutlibraries:14.2.1'
|
||||
implementation 'com.mikepenz:aboutlibraries-compose-m3:15.2.0'
|
||||
implementation 'com.mikepenz:aboutlibraries-core:15.2.0'
|
||||
|
||||
|
||||
implementation platform('androidx.compose:compose-bom:2026.08.00')
|
||||
|
||||
@@ -53,16 +53,15 @@ import androidx.navigation.NavHostController
|
||||
import androidx.navigation.compose.NavHost
|
||||
import androidx.navigation.compose.composable
|
||||
import androidx.navigation.compose.rememberNavController
|
||||
import androidx.preference.PreferenceManager
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
import net.helcel.beans.R
|
||||
import net.helcel.beans.activity.sub.AboutScreen
|
||||
import net.helcel.beans.activity.sub.EditPlaceColorDialog
|
||||
import net.helcel.beans.activity.sub.LicenseScreen
|
||||
import net.helcel.beans.countries.GeoLocImporter
|
||||
import net.helcel.beans.helper.Data
|
||||
import net.helcel.beans.helper.defaultPreferences
|
||||
import net.helcel.beans.helper.Settings
|
||||
|
||||
@Composable
|
||||
@@ -70,7 +69,7 @@ fun SysTheme(
|
||||
content: @Composable () -> Unit
|
||||
) {
|
||||
val context = LocalContext.current
|
||||
val prefs = PreferenceManager.getDefaultSharedPreferences(context)
|
||||
val prefs = defaultPreferences(context)
|
||||
val themeKey = prefs.getString(stringResource(R.string.key_theme), stringResource(R.string.system))
|
||||
val darkTheme = when (themeKey) {
|
||||
stringResource(R.string.system) -> isSystemInDarkTheme()
|
||||
@@ -111,7 +110,6 @@ fun settingsNav(): NavHostController {
|
||||
val navController = rememberNavController()
|
||||
NavHost(navController, startDestination= "settings"){
|
||||
composable("settings"){SettingsScreen(navController)}
|
||||
composable("licenses"){ LicenseScreen() }
|
||||
composable("about"){ AboutScreen() }
|
||||
}
|
||||
return navController
|
||||
@@ -150,7 +148,7 @@ fun SettingsMainScreen(onExit: ()->Unit = {}) {
|
||||
@Composable
|
||||
fun SettingsScreen(navController: NavHostController = settingsNav()) {
|
||||
val context = LocalContext.current
|
||||
val prefs = PreferenceManager.getDefaultSharedPreferences(context)
|
||||
val prefs = defaultPreferences(context)
|
||||
val keyTheme = stringResource(R.string.key_theme)
|
||||
val defaultTheme = stringResource(R.string.system)
|
||||
val keyProjection = stringResource(R.string.key_projection)
|
||||
@@ -351,10 +349,6 @@ fun SettingsScreen(navController: NavHostController = settingsNav()) {
|
||||
HorizontalDivider()
|
||||
}
|
||||
item {
|
||||
PreferenceButton(stringResource(R.string.licenses)) {
|
||||
if (navController.currentDestination?.route != "licenses")
|
||||
navController.navigate("licenses")
|
||||
}
|
||||
PreferenceButton(stringResource(R.string.about)) {
|
||||
if (navController.currentDestination?.route != "about")
|
||||
navController.navigate("about")
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
package net.helcel.beans.activity.sub
|
||||
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.material.MaterialTheme
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import com.mikepenz.aboutlibraries.ui.compose.DefaultChipColors
|
||||
import com.mikepenz.aboutlibraries.ui.compose.DefaultLibraryColors
|
||||
import com.mikepenz.aboutlibraries.ui.compose.android.produceLibraries
|
||||
import com.mikepenz.aboutlibraries.ui.compose.m3.LibrariesContainer
|
||||
import net.helcel.beans.R
|
||||
import net.helcel.beans.activity.SysTheme
|
||||
|
||||
|
||||
@Preview
|
||||
@Composable
|
||||
fun LicenseScreen() {
|
||||
val libraries = produceLibraries(R.raw.aboutlibraries)
|
||||
SysTheme {
|
||||
LibrariesContainer(
|
||||
libraries = libraries.value,
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
colors = DefaultLibraryColors(
|
||||
libraryBackgroundColor = MaterialTheme.colors.background,
|
||||
libraryContentColor = MaterialTheme.colors.onBackground,
|
||||
licenseChipColors = DefaultChipColors(
|
||||
containerColor = MaterialTheme.colors.primary,
|
||||
contentColor = MaterialTheme.colors.onPrimary,
|
||||
),
|
||||
versionChipColors = DefaultChipColors(
|
||||
containerColor = MaterialTheme.colors.secondary,
|
||||
contentColor = MaterialTheme.colors.onSecondary,
|
||||
),
|
||||
fundingChipColors = DefaultChipColors(
|
||||
containerColor = MaterialTheme.colors.secondary,
|
||||
contentColor = MaterialTheme.colors.onSecondary,
|
||||
),
|
||||
dialogConfirmButtonColor = MaterialTheme.colors.primary,
|
||||
dialogBackgroundColor = MaterialTheme.colors.onPrimary,
|
||||
dialogContentColor = MaterialTheme.colors.primary,
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,6 @@ import android.os.Build
|
||||
import android.os.Environment
|
||||
import android.provider.MediaStore
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.preference.PreferenceManager
|
||||
import net.helcel.beans.R
|
||||
import net.helcel.beans.countries.GeoLoc
|
||||
import java.util.HashMap
|
||||
@@ -31,7 +30,7 @@ object Data {
|
||||
private lateinit var sharedPreferences: SharedPreferences
|
||||
|
||||
fun loadData(ctx: Context, id:Int) {
|
||||
sharedPreferences = PreferenceManager.getDefaultSharedPreferences(ctx)
|
||||
sharedPreferences = defaultPreferences(ctx)
|
||||
|
||||
val groupsString = sharedPreferences.getString("groups_$id",null)
|
||||
val visitsString = sharedPreferences.getString("visits_$id",null)
|
||||
|
||||
@@ -2,7 +2,6 @@ package net.helcel.beans.helper
|
||||
|
||||
import android.content.Context
|
||||
import android.content.SharedPreferences
|
||||
import androidx.preference.PreferenceManager
|
||||
import net.helcel.beans.R
|
||||
import net.helcel.beans.activity.MainScreen
|
||||
|
||||
@@ -22,7 +21,7 @@ object Settings {
|
||||
private lateinit var mainActivity: MainScreen
|
||||
fun start(ctx: MainScreen) {
|
||||
mainActivity = ctx
|
||||
sp = PreferenceManager.getDefaultSharedPreferences(ctx)
|
||||
sp = defaultPreferences(ctx)
|
||||
}
|
||||
|
||||
fun isSingleGroup(ctx: Context): Boolean {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<style name="Theme.Beans" parent="Theme.MaterialComponents.DayNight.NoActionBar">
|
||||
<style name="Theme.Beans" parent="android:Theme.Material.NoActionBar">
|
||||
<!-- Status bar color in dark mode -->
|
||||
<item name="android:statusBarColor">@color/blue</item>
|
||||
<!-- Window background in dark mode -->
|
||||
@@ -8,8 +8,5 @@
|
||||
<item name="android:windowLightStatusBar">false</item>
|
||||
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
|
||||
|
||||
<item name="colorPrimary">@color/blue</item>
|
||||
<item name="colorPrimaryDark">@color/blue</item>
|
||||
<item name="colorAccent">@color/blue</item>
|
||||
</style>
|
||||
</resources>
|
||||
@@ -13,7 +13,6 @@
|
||||
<string name="key_stats">Statistics</string>
|
||||
<string name="counters">Prefer counters (#)</string>
|
||||
<string name="percentages">Prefer percentages (%)</string>
|
||||
<string name="licenses">Licenses</string>
|
||||
<string name="key_group">Groups</string>
|
||||
<string name="key_regional">Regional mode</string>
|
||||
<string name="key_regional_desc">Enable tracking of states and provinces</string>
|
||||
@@ -37,7 +36,6 @@
|
||||
<string name="beans_is_foss">Beans is free and open source software, licensed under the GNU General Public License (version 3 or later)</string>
|
||||
<string name="beans_repo_uri">https://github.com/helcel-net/beans</string>
|
||||
<string name="beans_repo">Project repository: %1$s\n Feel free to report issues or contribute.</string>
|
||||
<string name="foss_licenses">Free and open source dependencies and licenses</string>
|
||||
<string name="about_beans">About the Beans application</string>
|
||||
<string name="edit_group">Select the group to assign.</string>
|
||||
<string name="edit_group_sub">Long press on a group to edit its name and color.</string>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<style name="Theme.Beans" parent="Theme.MaterialComponents.DayNight.NoActionBar">
|
||||
<style name="Theme.Beans" parent="android:Theme.Material.Light.NoActionBar">
|
||||
<!-- Status bar color -->
|
||||
<item name="android:statusBarColor">@color/blue</item>
|
||||
<!-- Window background - shows through statusBarsPadding() area -->
|
||||
@@ -8,9 +8,5 @@
|
||||
<item name="android:windowLightStatusBar">false</item>
|
||||
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
|
||||
|
||||
<!-- Optional: Primary colors for the theme -->
|
||||
<item name="colorPrimary">@color/blue</item>
|
||||
<item name="colorPrimaryDark">@color/blue</item>
|
||||
<item name="colorAccent">@color/blue</item>
|
||||
</style>
|
||||
</resources>
|
||||
Reference in New Issue
Block a user