Skip to content

Commit

Permalink
Merge branch 'develop' into Upgrade-to-AGP-8.7.2-&-Android-35
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickunterwegs committed Dec 8, 2024
2 parents 66cedb6 + 4d02af0 commit 034b3b0
Show file tree
Hide file tree
Showing 15 changed files with 123 additions and 12 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ android {
buildConfigField("long", "buildTime", "${System.currentTimeMillis()}L")
minSdk = 23
targetSdk = 35
versionCode = 209040001
versionName = "2.09.03-alpha01" // keep -release as a suffix also for release, build flavor adds the suffix e.g. .gplay (e.g. 1.00.00-rc0.gplay)
versionCode = 209040002
versionName = "2.09.04-beta01" // keep -release as a suffix also for release, build flavor adds the suffix e.g. .gplay (e.g. 1.00.00-rc0.gplay)
buildConfigField("String", "versionCodename", "\"Pride is a protest \uD83C\uDF08\"")
multiDexEnabled = true
vectorDrawables.useSupportLibrary = true
Expand Down
18 changes: 12 additions & 6 deletions app/src/main/java/at/techbee/jtx/MainActivity2.kt
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.serialization.json.Json
import net.fortuna.ical4j.model.TimeZoneRegistryFactory
import java.io.FileNotFoundException
import java.time.ZonedDateTime
import kotlin.time.Duration.Companion.minutes

Expand Down Expand Up @@ -277,9 +278,14 @@ class MainActivity2 : AppCompatActivity() {
Intent.ACTION_VIEW -> {
if (intent.type == "text/calendar") {
val ics = intent.data ?: return
this.contentResolver.openInputStream(ics)?.use { stream ->
globalStateHolder.icalString2Import.value =
stream.readBytes().decodeToString()
try {
this.contentResolver.openInputStream(ics)?.use { stream ->
globalStateHolder.icalString2Import.value =
stream.readBytes().decodeToString()
}
} catch (e: FileNotFoundException) {
Toast.makeText(applicationContext, e.localizedMessage, Toast.LENGTH_SHORT).show()
//Log.e("MainActivity2", e.stackTraceToString())
}
}
}
Expand All @@ -304,7 +310,7 @@ class MainActivity2 : AppCompatActivity() {
}
intent.removeExtra(Intent.EXTRA_TEXT)
intent.removeExtra(Intent.EXTRA_STREAM)
setResult(Activity.RESULT_OK)
setResult(RESULT_OK)
}
lastProcessedIntentHash = intent.hashCode()

Expand Down Expand Up @@ -412,8 +418,8 @@ fun MainNavHost(

val icalObjectId = backStackEntry.arguments?.getLong(DetailDestination.argICalObjectId) ?: return@composable
val icalObjectIdList = backStackEntry.arguments?.getString(DetailDestination.argICalObjectIdList)?.let { Json.decodeFromString<List<Long>>(it)} ?: listOf(icalObjectId)
val editImmediately = backStackEntry.arguments?.getBoolean(DetailDestination.argIsEditMode) ?: false
val returnToLauncher = backStackEntry.arguments?.getBoolean(DetailDestination.argReturnToLauncher) ?: false
val editImmediately = backStackEntry.arguments?.getBoolean(DetailDestination.argIsEditMode) == true
val returnToLauncher = backStackEntry.arguments?.getBoolean(DetailDestination.argReturnToLauncher) == true

/*
backStackEntry.savedStateHandle[DetailDestination.argICalObjectId] = icalObjectId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ data class StoredListSettingData(
var searchResourcesAnyAllNone: AnyAllNone = AnyAllNone.ANY,
var searchStatus: List<Status> = emptyList(),
var searchClassification: List<Classification> = emptyList(),
var searchPriority: List<Int?> = emptyList(),
var searchCollection: List<String> = emptyList(),
var searchAccount: List<String> = emptyList(),
var orderBy: OrderBy = OrderBy.CREATED,
Expand Down Expand Up @@ -115,6 +116,7 @@ data class StoredListSettingData(
searchResourcesAnyAllNone = listSettings.searchResourcesAnyAllNone.value,
searchStatus = listSettings.searchStatus,
searchClassification = listSettings.searchClassification,
searchPriority = listSettings.searchPriority,
searchCollection = listSettings.searchCollection,
searchAccount = listSettings.searchAccount,
orderBy = listSettings.orderBy.value,
Expand Down Expand Up @@ -161,6 +163,7 @@ data class StoredListSettingData(
listSettings.searchResourcesAnyAllNone.value = searchResourcesAnyAllNone
listSettings.searchStatus.addAll(searchStatus)
listSettings.searchClassification.addAll(searchClassification)
listSettings.searchPriority.addAll(searchPriority)
listSettings.searchCollection.addAll(searchCollection)
listSettings.searchAccount.addAll(searchAccount)
listSettings.orderBy.value = orderBy
Expand Down
12 changes: 12 additions & 0 deletions app/src/main/java/at/techbee/jtx/database/views/ICal4List.kt
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ data class ICal4List(
searchStatus: List<Status> = emptyList(),
searchXStatus: List<String> = emptyList(),
searchClassification: List<Classification> = emptyList(),
searchPriority: List<Int?> = emptyList(),
searchCollection: List<String> = emptyList(),
searchAccount: List<String> = emptyList(),
orderBy: OrderBy = OrderBy.CREATED,
Expand Down Expand Up @@ -516,6 +517,17 @@ data class ICal4List(
queryString += ") "
}

//PRIORITY
if (searchPriority.isNotEmpty()) {
queryString += "AND ("
queryString += searchPriority.joinToString(separator = "OR ", transform = { "$COLUMN_PRIORITY = ? " })
args.addAll(searchPriority.map { it?.toString() ?: "0"})

if(searchPriority.contains(null) || searchPriority.contains(0))
queryString += "OR $COLUMN_PRIORITY IS NULL"
queryString += ") "
}

//Hide biometric protected
hideBiometricProtected.forEach {
if(it == Classification.NO_CLASSIFICATION) {
Expand Down
13 changes: 13 additions & 0 deletions app/src/main/java/at/techbee/jtx/ui/list/ListActiveFiltersRow.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import androidx.compose.foundation.layout.size
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.outlined.Label
import androidx.compose.material.icons.outlined.AccountBalance
import androidx.compose.material.icons.outlined.AssignmentLate
import androidx.compose.material.icons.outlined.FolderOpen
import androidx.compose.material.icons.outlined.PrivacyTip
import androidx.compose.material.icons.outlined.PublishedWithChanges
Expand All @@ -29,6 +30,7 @@ import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringArrayResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
Expand Down Expand Up @@ -157,6 +159,17 @@ fun ListActiveFiltersRow(
isAccessibilityMode = isAccessibilityMode
)
}
listSettings.searchPriority.forEach { priorityInt ->
if(priorityInt in 0..9) {
ListBadge(
icon = Icons.Outlined.AssignmentLate,
iconDesc = stringResource(R.string.priority),
text = stringArrayResource(id = R.array.priority)[priorityInt?:0],
modifier = Modifier.padding(vertical = 2.dp),
isAccessibilityMode = isAccessibilityMode
)
}
}
AnimatedVisibility(listSettings.isExcludeDone.value) {
ListBadge(
text = stringResource(R.string.list_hide_completed_tasks),
Expand Down
39 changes: 39 additions & 0 deletions app/src/main/java/at/techbee/jtx/ui/list/ListOptionsFilter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import androidx.compose.foundation.layout.Row
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.outlined.Label
import androidx.compose.material.icons.outlined.AccountBalance
import androidx.compose.material.icons.outlined.AssignmentLate
import androidx.compose.material.icons.outlined.CalendarMonth
import androidx.compose.material.icons.outlined.Close
import androidx.compose.material.icons.outlined.DashboardCustomize
Expand Down Expand Up @@ -44,6 +45,7 @@ import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringArrayResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import at.techbee.jtx.R
Expand Down Expand Up @@ -877,6 +879,43 @@ fun ListOptionsFilter(
}


////// Priority
val priorities = stringArrayResource(id = R.array.priority)
if(module == Module.TODO) {
FilterSection(
icon = Icons.Outlined.AssignmentLate,
headline = stringResource(id = R.string.priority),
onResetSelection = {
listSettings.searchPriority.clear()
onListSettingsChanged()
},
onInvertSelection = {
priorities.forEachIndexed { index, _ ->
if (listSettings.searchPriority.contains(index))
listSettings.searchPriority.remove(index)
else
listSettings.searchPriority.add(index)
}
onListSettingsChanged()
})
{
priorities.forEachIndexed { index, prio ->
FilterChip(
selected = listSettings.searchPriority.contains(index),
onClick = {
if (listSettings.searchPriority.contains(index))
listSettings.searchPriority.remove(index)
else
listSettings.searchPriority.add(index)
onListSettingsChanged()
},
label = { Text(prio) }
)
}
}
}


////// RESOURCES
if (module == Module.TODO) {
FilterSection(
Expand Down
7 changes: 7 additions & 0 deletions app/src/main/java/at/techbee/jtx/ui/list/ListSettings.kt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class ListSettings {
var searchStatus = mutableStateListOf<Status>()
var searchXStatus = mutableStateListOf<String>()
var searchClassification = mutableStateListOf<Classification>()
var searchPriority = mutableStateListOf<Int?>()
var searchCollection = mutableStateListOf<String>()
var searchAccount = mutableStateListOf<String>()
var orderBy: MutableState<OrderBy> = mutableStateOf(OrderBy.DRAG_AND_DROP)
Expand Down Expand Up @@ -107,6 +108,7 @@ class ListSettings {
private const val PREFS_RESOURCES = "prefsResources"
private const val PREFS_RESOURCES_ANYALLNONE = "prefsResourcesAnyAllNone"
private const val PREFS_CLASSIFICATION = "prefsClassification"
private const val PREFS_PRIORITY = "prefsPriority"
private const val PREFS_STATUS = "prefsStatus"
private const val PREFS_EXTENDED_STATUS = "prefsXStatus"
private const val PREFS_EXCLUDE_DONE = "prefsExcludeDone"
Expand Down Expand Up @@ -208,6 +210,7 @@ class ListSettings {
searchStatus.addAll(Status.getListFromStringList(prefs.getStringSet(PREFS_STATUS, null)))
searchXStatus.addAll(prefs.getStringSet(PREFS_EXTENDED_STATUS, emptySet())?.toList() ?: emptyList())
searchClassification.addAll(Classification.getListFromStringList(prefs.getStringSet(PREFS_CLASSIFICATION, null)))
searchPriority.addAll(prefs.getStringSet(PREFS_PRIORITY, null)?.map { it.toIntOrNull() } ?: emptyList())
searchCollection.addAll(prefs.getStringSet(PREFS_COLLECTION, emptySet())?.toList() ?: emptyList())
searchAccount.addAll(prefs.getStringSet(PREFS_ACCOUNT, emptySet())?.toList() ?: emptyList())

Expand Down Expand Up @@ -277,6 +280,7 @@ class ListSettings {
searchStatus.addAll(listWidgetConfig.searchStatus)
searchXStatus.addAll(listWidgetConfig.searchXStatus)
searchClassification.addAll(listWidgetConfig.searchClassification)
searchPriority.addAll(listWidgetConfig.searchPriority)
searchCollection.addAll(listWidgetConfig.searchCollection)
searchAccount.addAll(listWidgetConfig.searchAccount)

Expand Down Expand Up @@ -367,6 +371,7 @@ class ListSettings {
putStringSet(PREFS_STATUS, Status.getStringSetFromList(searchStatus))
putStringSet(PREFS_EXTENDED_STATUS, searchXStatus.toSet())
putStringSet(PREFS_CLASSIFICATION, Classification.getStringSetFromList(searchClassification))
putStringSet(PREFS_PRIORITY, searchPriority.map { it.toString() }.toSet())
putStringSet(PREFS_COLLECTION, searchCollection.toSet())
putStringSet(PREFS_ACCOUNT, searchAccount.toSet())

Expand Down Expand Up @@ -397,6 +402,7 @@ class ListSettings {
searchStatus.clear()
searchXStatus.clear()
searchClassification.clear()
searchPriority.clear()
searchCollection.clear()
searchAccount.clear()
isExcludeDone.value = false
Expand Down Expand Up @@ -435,6 +441,7 @@ class ListSettings {
|| searchStatus.isNotEmpty()
|| searchXStatus.isNotEmpty()
|| searchClassification.isNotEmpty()
|| searchPriority.isNotEmpty()
|| searchCollection.isNotEmpty()
|| searchAccount.isNotEmpty()
|| isExcludeDone.value
Expand Down
1 change: 1 addition & 0 deletions app/src/main/java/at/techbee/jtx/ui/list/ListViewModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ open class ListViewModel(application: Application, val module: Module) : Android
searchStatus = listSettings.searchStatus,
searchXStatus = listSettings.searchXStatus,
searchClassification = listSettings.searchClassification,
searchPriority = listSettings.searchPriority,
searchCollection = listSettings.searchCollection,
searchAccount = listSettings.searchAccount,
orderBy = listSettings.orderBy.value,
Expand Down
1 change: 1 addition & 0 deletions app/src/main/java/at/techbee/jtx/widgets/ListWidget.kt
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ class ListWidget : GlanceAppWidget() {
searchResources = listWidgetConfig.searchResources,
searchStatus = listWidgetConfig.searchStatus,
searchClassification = listWidgetConfig.searchClassification,
searchPriority = listWidgetConfig.searchPriority,
searchCollection = listWidgetConfig.searchCollection,
searchAccount = listWidgetConfig.searchAccount,
orderBy = listWidgetConfig.orderBy,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
package at.techbee.jtx.widgets

import android.widget.Toast
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
Expand Down Expand Up @@ -64,7 +63,7 @@ import at.techbee.jtx.ui.list.ViewMode
import kotlinx.coroutines.launch


@OptIn(ExperimentalMaterial3Api::class, ExperimentalFoundationApi::class)
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun ListWidgetConfigContent(
initialConfig: ListWidgetConfig,
Expand Down Expand Up @@ -233,6 +232,7 @@ fun ListWidgetConfigContent(
searchStatus = listSettings.searchStatus
searchXStatus = listSettings.searchXStatus
searchClassification = listSettings.searchClassification
searchPriority = listSettings.searchPriority
searchCollection = listSettings.searchCollection
searchAccount = listSettings.searchAccount
orderBy = listSettings.orderBy.value
Expand Down Expand Up @@ -332,6 +332,7 @@ data class ListWidgetConfig(
var searchStatus: List<Status> = emptyList(),
var searchXStatus: List<String> = emptyList(),
var searchClassification: List<Classification> = emptyList(),
var searchPriority: List<Int?> = emptyList(),
var searchCollection: List<String> = emptyList(),
var searchAccount: List<String> = emptyList(),
var orderBy: OrderBy = OrderBy.CREATED,
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/res/values-cs/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@
<string name="menu_collections_add_remote_to_sync_app">"Přidat vzdálenou Sbírku (%1$s)"</string>
<string name="menu_collection_popup_show_in_sync_app">"Zobrazit v %1$s"</string>
<string name="menu_collection_popup_export_as_ics">"Exportovat jako .ics"</string>
<string name="export_as_csv">"Exportovat jako .csv"</string>
<string name="journal">"Deník"</string>
<string name="note">"Poznámka"</string>
<string name="task">"Úkol"</string>
Expand Down Expand Up @@ -334,6 +335,8 @@
<string name="edit_recur_ends_never">"nikdy nekončí"</string>
<string name="edit_recur_ends_on">"končí"</string>
<string name="edit_recur_ends_after">"končí po"</string>
<string name="list_toast_export_success">"Seznam úspěšně exportován"</string>
<string name="list_toast_export_error">"Chyba při exportu seznamu"</string>
<string name="collections_toast_export_success">"Sbírky úspěšně exportovány"</string>
<string name="collections_toast_export_error">"Chyba při exportu sbírek"</string>
<string name="menu_collections_export_all">"Exportovat vše"</string>
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@
<string name="menu_collections_add_remote_to_sync_app">"Remote Collection hinzufügen (%1$s)"</string>
<string name="menu_collection_popup_show_in_sync_app">"In %1$s anzeigen"</string>
<string name="menu_collection_popup_export_as_ics">"Als .ics exportieren"</string>
<string name="export_as_csv">"Als .csv exportieren"</string>
<string name="journal">"Journal"</string>
<string name="note">"Notiz"</string>
<string name="task">"Aufgabe"</string>
Expand Down Expand Up @@ -334,6 +335,8 @@
<string name="edit_recur_ends_never">"endet nie"</string>
<string name="edit_recur_ends_on">"endet am"</string>
<string name="edit_recur_ends_after">"endet nach"</string>
<string name="list_toast_export_success">"Liste erfolgreich exportiert"</string>
<string name="list_toast_export_error">"Fehler beim Export der Liste"</string>
<string name="collections_toast_export_success">"Collections erfolgreich exportiert"</string>
<string name="collections_toast_export_error">"Fehler beim Exportieren der Collections"</string>
<string name="menu_collections_export_all">"Alle exportieren"</string>
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@
<string name="menu_collections_add_remote_to_sync_app">"Ajouter une collection distante (%1$s)"</string>
<string name="menu_collection_popup_show_in_sync_app">"Afficher dans %1$s"</string>
<string name="menu_collection_popup_export_as_ics">"Exporter en .ics"</string>
<string name="export_as_csv">"Exporter en .csv"</string>
<string name="journal">"Journal"</string>
<string name="note">"Note"</string>
<string name="task">"Tâche"</string>
Expand Down Expand Up @@ -334,6 +335,8 @@
<string name="edit_recur_ends_never">"ne se termine jamais"</string>
<string name="edit_recur_ends_on">"se termine le"</string>
<string name="edit_recur_ends_after">"se termine après"</string>
<string name="list_toast_export_success">"Liste exportée avec succès"</string>
<string name="list_toast_export_error">"Erreur lors de l'export de la liste"</string>
<string name="collections_toast_export_success">"Collections correctement exportées"</string>
<string name="collections_toast_export_error">"Erreur lors de l'exportation des collections"</string>
<string name="menu_collections_export_all">"Exporter tout"</string>
Expand Down
Loading

0 comments on commit 034b3b0

Please sign in to comment.