Compare commits
67 Commits
cfa784991b
...
1.4
| Author | SHA1 | Date | |
|---|---|---|---|
| a8c4529ee8 | |||
| e7a3f09547 | |||
| 579cf75ca2 | |||
| 121b34c034 | |||
| 97014e9454 | |||
| 674106923f | |||
| e21dad8ed7 | |||
| b2cca2332b | |||
| 13ad82df95 | |||
| 2befea2325 | |||
| f45cc57049 | |||
| a7f05d5d80 | |||
| 269e844a4c | |||
| 818fc49e3d | |||
| 8a3f7f7621 | |||
| 8c50670a9d | |||
| 141ea67d2e | |||
|
291fae7aec
|
|||
| 7a04440eca | |||
| 691d2e4ea1 | |||
| dd5c9387f9 | |||
| 6038d132ec | |||
| 6a0ac3e5c7 | |||
| 327a6550b4 | |||
| 7027d0ffb1 | |||
| 15b33b59ed | |||
| 36787717ff | |||
| c27aef23c0 | |||
| a9e567d299 | |||
| 468fb4ab13 | |||
| e952de3c17 | |||
| da1793bc21 | |||
| 650a59b1ac | |||
| 5a9284749c | |||
| 981fc5ebf4 | |||
| 78f5fe7c35 | |||
| bdf2911a1c | |||
| 40b2040f25 | |||
| 48c88d85a4 | |||
| 727c828128 | |||
| cce6719158 | |||
| 13a79baa2b | |||
| c956fb9876 | |||
| 339ac468f3 | |||
| f1eacee394 | |||
| a000fb4a3d | |||
| 16ff2e1bc8 | |||
| 6ee16f02ab | |||
| fd05d9b6f5 | |||
| eece41d0ba | |||
| b609704cc1 | |||
| 39436f473a | |||
| ce2721025a | |||
| 371a2aa35f | |||
| 0f986616ae | |||
| eb948c2e59 | |||
| 4fe43c5fc6 | |||
| eed23b35d4 | |||
| e9d46d0824 | |||
| ccd18f3717 | |||
| 1e78f269c1 | |||
| 0740c00014 | |||
| 740526104b | |||
| f807fa62d2 | |||
| 18725261e3 | |||
|
cc1a0c1aca
|
|||
|
f2a5efcec5
|
@@ -23,7 +23,7 @@ jobs:
|
||||
contents: write
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/checkout@v7
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
|
||||
+7
-7
@@ -2,7 +2,7 @@ plugins {
|
||||
id 'com.android.application'
|
||||
id 'org.jetbrains.kotlin.plugin.serialization' version '2.4.0'
|
||||
id 'org.jetbrains.kotlin.plugin.compose' version '2.4.0'
|
||||
id 'com.mikepenz.aboutlibraries.plugin' version '14.2.1'
|
||||
id 'com.mikepenz.aboutlibraries.plugin' version '15.0.3'
|
||||
}
|
||||
|
||||
android {
|
||||
@@ -15,7 +15,7 @@ android {
|
||||
applicationId 'net.helcel.beans'
|
||||
minSdk = 28
|
||||
targetSdk = 37
|
||||
versionName "1.3"
|
||||
versionName "1.4"
|
||||
versionCode project.hasProperty('VERSION_CODE') ? project.property('VERSION_CODE').toInteger() : 1
|
||||
}
|
||||
signingConfigs {
|
||||
@@ -87,7 +87,7 @@ aboutLibraries {
|
||||
|
||||
dependencies {
|
||||
implementation 'androidx.compose.material3:material3:1.4.0'
|
||||
implementation "androidx.compose.material:material:1.11.2"
|
||||
implementation "androidx.compose.material:material:1.11.4"
|
||||
implementation 'androidx.compose.material:material-icons-extended:1.7.8'
|
||||
implementation 'androidx.navigation:navigation-compose:2.9.8'
|
||||
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs_nio:2.1.5'
|
||||
@@ -106,12 +106,12 @@ dependencies {
|
||||
implementation 'com.github.chrisbanes:PhotoView:2.3.0'
|
||||
|
||||
implementation 'com.mikepenz:aboutlibraries:14.2.1'
|
||||
implementation 'com.mikepenz:aboutlibraries-compose-m3:14.2.1'
|
||||
implementation 'com.mikepenz:aboutlibraries-core:14.2.1'
|
||||
implementation 'com.mikepenz:aboutlibraries-compose-m3:15.0.3'
|
||||
implementation 'com.mikepenz:aboutlibraries-core:15.0.3'
|
||||
|
||||
|
||||
implementation platform('androidx.compose:compose-bom:2026.05.01')
|
||||
debugImplementation 'androidx.compose.ui:ui-tooling:1.11.2'
|
||||
implementation platform('androidx.compose:compose-bom:2026.06.01')
|
||||
debugImplementation 'androidx.compose.ui:ui-tooling:1.11.4'
|
||||
}
|
||||
|
||||
tasks.configureEach { task ->
|
||||
|
||||
@@ -50,8 +50,8 @@ class MainScreen : ComponentActivity() {
|
||||
super.onCreate(savedInstanceState)
|
||||
actionBar?.hide()
|
||||
Settings.start(this)
|
||||
GeoLocImporter.importStates(this)
|
||||
Data.loadData(this, Int.MIN_VALUE)
|
||||
GeoLocImporter.importStates(this)
|
||||
|
||||
setContent {
|
||||
SysTheme {
|
||||
|
||||
@@ -168,8 +168,10 @@ fun SettingsScreen(navController: NavHostController = settingsNav()) {
|
||||
EditPlaceDialog(true) {
|
||||
showEdit = false
|
||||
val g = Data.selected_group
|
||||
if (it && g != null)
|
||||
if (it && g != null) {
|
||||
Data.visits.reassignAllVisitedToGroup(g.key)
|
||||
Data.saveData()
|
||||
}
|
||||
}
|
||||
|
||||
LazyColumn(
|
||||
@@ -216,8 +218,10 @@ fun SettingsScreen(navController: NavHostController = settingsNav()) {
|
||||
deleteMode = true,
|
||||
onDismiss = {
|
||||
val g = Data.selected_group
|
||||
if (g != null)
|
||||
if (g != null) {
|
||||
Data.visits.reassignAllVisitedToGroup(g.key)
|
||||
Data.saveData()
|
||||
}
|
||||
showDialog = false
|
||||
})
|
||||
}
|
||||
|
||||
@@ -54,27 +54,51 @@ fun EditPlaceScreenPreview(){
|
||||
EditPlaceScreen(Group.EEE)
|
||||
}
|
||||
|
||||
fun syncVisited(loc: GeoLoc?=World.WWW){
|
||||
fun syncVisited(loc: GeoLoc?=World.WWW): Boolean {
|
||||
var changed = false
|
||||
loc?.children?.forEach { tt ->
|
||||
tt.children.forEach {itc->
|
||||
if(Data.visits.getVisited(itc) in listOf(AUTO_GROUP,NO_GROUP)) {
|
||||
if(itc.children.any { c -> Data.visits.getVisited(c) != NO_GROUP })
|
||||
Data.visits.setVisited(itc, AUTO_GROUP)
|
||||
val newState = if(itc.children.any { c -> Data.visits.getVisited(c) != NO_GROUP })
|
||||
AUTO_GROUP
|
||||
else
|
||||
Data.visits.setVisited(itc, NO_GROUP)
|
||||
NO_GROUP
|
||||
|
||||
if (Data.visits.getVisited(itc) != newState) {
|
||||
Data.visits.setVisited(itc, newState)
|
||||
changed = true
|
||||
}
|
||||
}
|
||||
}
|
||||
if(Data.visits.getVisited(tt) in listOf(AUTO_GROUP,NO_GROUP)) {
|
||||
if(tt.children.any { itc -> Data.visits.getVisited(itc) != NO_GROUP })
|
||||
Data.visits.setVisited(tt, AUTO_GROUP)
|
||||
val newState = if(tt.children.any { itc -> Data.visits.getVisited(itc) != NO_GROUP })
|
||||
AUTO_GROUP
|
||||
else
|
||||
Data.visits.setVisited(tt, NO_GROUP)
|
||||
NO_GROUP
|
||||
|
||||
if (Data.visits.getVisited(tt) != newState) {
|
||||
Data.visits.setVisited(tt, newState)
|
||||
changed = true
|
||||
}
|
||||
}
|
||||
}
|
||||
// Sync World from Continents
|
||||
if (loc != null && Data.visits.getVisited(loc) in listOf(AUTO_GROUP, NO_GROUP)) {
|
||||
val newState = if(loc.children.any { Data.visits.getVisited(it) != NO_GROUP })
|
||||
AUTO_GROUP
|
||||
else
|
||||
NO_GROUP
|
||||
if (Data.visits.getVisited(loc) != newState) {
|
||||
Data.visits.setVisited(loc, newState)
|
||||
changed = true
|
||||
}
|
||||
}
|
||||
return changed
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun EditPlaceScreen(loc: GeoLoc, onExit:()->Unit={}) {
|
||||
val visits by Data.visits.visitsFlow.collectAsState()
|
||||
var showEdit by remember { mutableStateOf(false) }
|
||||
val tabs : SnapshotStateList<GeoLoc> = remember { mutableStateListOf(loc) }
|
||||
val ctx = LocalContext.current
|
||||
@@ -84,7 +108,12 @@ fun EditPlaceScreen(loc: GeoLoc, onExit:()->Unit={}) {
|
||||
selectedTab = tabs.lastIndex
|
||||
}
|
||||
SideEffect {
|
||||
syncVisited()
|
||||
// visits is used to trigger sync whenever data changes
|
||||
if (visits.isNotEmpty() || true) {
|
||||
if (syncVisited()) {
|
||||
Data.saveData()
|
||||
}
|
||||
}
|
||||
}
|
||||
BackHandler {
|
||||
if (tabs.size > 1) tabs.removeAt(tabs.lastIndex)
|
||||
@@ -95,6 +124,7 @@ fun EditPlaceScreen(loc: GeoLoc, onExit:()->Unit={}) {
|
||||
showEdit = false
|
||||
if (it) {
|
||||
Data.visits.setVisited(Data.selected_geoloc, NO_GROUP)
|
||||
syncVisited()
|
||||
Data.saveData()
|
||||
|
||||
if (Data.selected_geoloc!=null && Data.selected_geoloc!!.children.any { itc-> Data.visits.getVisited(itc) != NO_GROUP }) {
|
||||
@@ -103,6 +133,7 @@ fun EditPlaceScreen(loc: GeoLoc, onExit:()->Unit={}) {
|
||||
}
|
||||
if (Data.selected_group != null && Data.selected_geoloc != null) {
|
||||
Data.visits.setVisited(Data.selected_geoloc, Data.selected_group!!.key)
|
||||
syncVisited()
|
||||
Data.saveData()
|
||||
}
|
||||
Data.selected_geoloc = null
|
||||
@@ -144,12 +175,14 @@ fun EditPlaceScreen(loc: GeoLoc, onExit:()->Unit={}) {
|
||||
Data.visits.getVisited(itc)!= NO_GROUP } == true) AUTO_GROUP
|
||||
else NO_GROUP
|
||||
)
|
||||
Data.saveData()
|
||||
Data.selected_group = null
|
||||
} else {
|
||||
Data.selected_group = null
|
||||
showEdit=true
|
||||
}
|
||||
|
||||
syncVisited()
|
||||
Data.saveData()
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
@@ -43,14 +43,14 @@ object Data {
|
||||
if (groups.size() == 0) {
|
||||
groups.setGroup(DEFAULT_GROUP, "Visited",
|
||||
ContextCompat.getColor(ctx, R.color.blue).toDrawable())
|
||||
saveData()
|
||||
}
|
||||
saveData()
|
||||
}
|
||||
|
||||
fun saveData() {
|
||||
if(groups.id != visits.id) return
|
||||
val id = groups.id
|
||||
sharedPreferences.edit {
|
||||
sharedPreferences.edit(commit=true) {
|
||||
putString("groups_$id", groupsSerial.writeTo(groups))
|
||||
putString("visits_$id", visitsSerial.writeTo(visits))
|
||||
}
|
||||
|
||||
@@ -32,12 +32,18 @@ class Groups(val id: Int, @SerialName("grps") private val groups: HashMap<Int, G
|
||||
val groupsFlow: StateFlow<List<Group>> = _groupsFlow.asStateFlow()
|
||||
|
||||
fun setGroup(key: Int, name: String, col: ColorDrawable) {
|
||||
val old = groups[key]
|
||||
if (old != null && old.name == name && old.color.color == col.color) return
|
||||
groups[key] = Group(key, name, col)
|
||||
_groupsFlow.value = groups.values.toList()
|
||||
updateFlow()
|
||||
}
|
||||
|
||||
fun deleteGroup(key: Int) {
|
||||
groups.remove(key)
|
||||
updateFlow()
|
||||
}
|
||||
|
||||
private fun updateFlow() {
|
||||
_groupsFlow.value = groups.values.toList()
|
||||
}
|
||||
|
||||
|
||||
@@ -19,24 +19,25 @@ class Visits(val id: Int, private val locs: HashMap<String, Int>) {
|
||||
val visitsFlow: StateFlow<Map<String,Int>> = _visitsFlow
|
||||
|
||||
fun setVisited(key: GeoLoc?, b: Int) {
|
||||
if (key == null)
|
||||
if (key == null || locs[key.code] == b)
|
||||
return
|
||||
_visitsFlow.value = _visitsFlow.value.toMutableMap().apply {
|
||||
this[key.code] = b
|
||||
}
|
||||
locs[key.code] = b
|
||||
updateFlow()
|
||||
}
|
||||
|
||||
private fun updateFlow() {
|
||||
_visitsFlow.value = locs.toMap()
|
||||
}
|
||||
|
||||
fun deleteVisited(key: Int) {
|
||||
val keysToDelete = locs
|
||||
.filter { it.value == key }
|
||||
.map { it.key }
|
||||
_visitsFlow.value = _visitsFlow.value.toMutableMap().apply {
|
||||
keysToDelete.forEach { this.remove(it)}
|
||||
}
|
||||
if (keysToDelete.isEmpty()) return
|
||||
keysToDelete.forEach {
|
||||
locs.remove(it)
|
||||
}
|
||||
updateFlow()
|
||||
}
|
||||
|
||||
fun getVisited(key: GeoLoc): Int {
|
||||
@@ -60,13 +61,19 @@ class Visits(val id: Int, private val locs: HashMap<String, Int>) {
|
||||
}
|
||||
|
||||
fun reassignAllVisitedToGroup(group: Int) {
|
||||
var changed = false
|
||||
val keys = locs.filter { (_, grp) ->
|
||||
grp !in listOf(NO_GROUP, AUTO_GROUP)
|
||||
}.keys
|
||||
keys.forEach {
|
||||
if (locs[it] != group) {
|
||||
locs[it] = group
|
||||
changed = true
|
||||
}
|
||||
}
|
||||
if (changed) {
|
||||
updateFlow()
|
||||
}
|
||||
_visitsFlow.value = locs
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalSerializationApi::class)
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionSha256Sum=bafc141b619ad6350fd975fc903156dd5c151998cc8b058e8c1044ab5f7b031f
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.5.1-bin.zip
|
||||
distributionSha256Sum=9c0f7faeeb306cb14e4279a3e084ca6b596894089a0638e68a07c945a32c9e14
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.6.1-bin.zip
|
||||
networkTimeout=10000
|
||||
retries=0
|
||||
retryBackOffMs=500
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Gradle start up script for POSIX generated by Gradle.
|
||||
# gradlew start up script for POSIX generated by Gradle.
|
||||
#
|
||||
# Important for running:
|
||||
#
|
||||
@@ -29,7 +29,7 @@
|
||||
# bash, then to run this script, type that shell name before the whole
|
||||
# command line, like:
|
||||
#
|
||||
# ksh Gradle
|
||||
# ksh gradlew
|
||||
#
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
|
||||
Vendored
+2
-2
@@ -19,7 +19,7 @@
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem gradlew startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@@ -72,7 +72,7 @@ echo location of your Java installation. 1>&2
|
||||
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
@rem Execute gradlew
|
||||
@rem endlocal doesn't take effect until after the line is parsed and variables are expanded
|
||||
@rem which allows us to clear the local environment before executing the java command
|
||||
endlocal & "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* & call :exitWithErrorLevel
|
||||
|
||||
Reference in New Issue
Block a user