feat(v1.4.0): Checklists feature + WiFi permission cleanup

Features:
- Interactive checklists with tap-to-check, drag & drop sorting
- GitHub-flavored Markdown export (- [ ] / - [x])
- FAB menu for note type selection

Fixes:
- Improved Markdown parsing (robust line-based content extraction)
- Better duplicate filename handling (ID suffix)
- Foreground notification suppression

Privacy:
- Removed ACCESS_WIFI_STATE and CHANGE_WIFI_STATE permissions
  (SSID binding was never used, app only checks connectivity state)

Code Quality:
- Fixed 7 Detekt warnings (SwallowedException, MaxLineLength, MagicNumber)
This commit is contained in:
inventory69
2026-01-10 23:37:22 +01:00
parent 2324743f43
commit e3e64b83e2
39 changed files with 1425 additions and 176 deletions

View File

@@ -78,7 +78,7 @@ val syncRequest = PeriodicWorkRequestBuilder<SyncWorker>(
### Network Detection
Instead of SSID-based detection (Android 13+ privacy issues), we use **Gateway IP Comparison**:
We use **Gateway IP Comparison** to check if the server is reachable:
```kotlin
fun isInHomeNetwork(): Boolean {
@@ -127,7 +127,7 @@ The app uses **4 different sync triggers** with different use cases:
| **1. Manual Sync** | `MainActivity.kt` | `triggerManualSync()` | User clicks sync button in menu | ✅ Yes |
| **2. Auto-Sync (onResume)** | `MainActivity.kt` | `triggerAutoSync()` | App opened/resumed | ✅ Yes |
| **3. Background Sync (Periodic)** | `SyncWorker.kt` | `doWork()` | Every 15/30/60 minutes (configurable) | ✅ Yes |
| **4. WiFi-Connect Sync** | `NetworkMonitor.kt``SyncWorker.kt` | `triggerWifiConnectSync()` | WiFi enabled/SSID changed | ✅ Yes |
| **4. WiFi-Connect Sync** | `NetworkMonitor.kt``SyncWorker.kt` | `triggerWifiConnectSync()` | WiFi connected | ✅ Yes |
### Server Reachability Check (Pre-Check)
@@ -168,7 +168,7 @@ suspend fun isServerReachable(): Boolean = withContext(Dispatchers.IO) {
| Manual Sync | Toast: "Server not reachable" | Toast: "✅ Synced: X notes" | None |
| Auto-Sync (onResume) | Silent abort (no toast) | Toast: "✅ Synced: X notes" | Max. 1x/min |
| Background Sync | Silent abort (no toast) | Silent (LocalBroadcast only) | 15/30/60 min |
| WiFi-Connect Sync | Silent abort (no toast) | Silent (LocalBroadcast only) | SSID-based |
| WiFi-Connect Sync | Silent abort (no toast) | Silent (LocalBroadcast only) | WiFi-based |
---
@@ -349,7 +349,7 @@ The app requires **minimal permissions**:
```
**No Location Permissions!**
Earlier versions required `ACCESS_FINE_LOCATION` for SSID detection. Now we use Gateway IP Comparison.
We use Gateway IP Comparison instead of SSID detection. No location permission required.
---

View File

@@ -78,7 +78,7 @@ val syncRequest = PeriodicWorkRequestBuilder<SyncWorker>(
### Network Detection
Statt SSID-basierter Erkennung (Android 13+ Privacy-Probleme) verwenden wir **Gateway IP Comparison**:
Wir verwenden **Gateway IP Comparison** um zu prüfen, ob der Server erreichbar ist:
```kotlin
fun isInHomeNetwork(): Boolean {
@@ -127,7 +127,7 @@ Die App verwendet **4 verschiedene Sync-Trigger** mit unterschiedlichen Anwendun
| **1. Manueller Sync** | `MainActivity.kt` | `triggerManualSync()` | User klickt auf Sync-Button im Menü | ✅ Ja |
| **2. Auto-Sync (onResume)** | `MainActivity.kt` | `triggerAutoSync()` | App wird geöffnet/fortgesetzt | ✅ Ja |
| **3. Hintergrund-Sync (Periodic)** | `SyncWorker.kt` | `doWork()` | Alle 15/30/60 Minuten (konfigurierbar) | ✅ Ja |
| **4. WiFi-Connect Sync** | `NetworkMonitor.kt``SyncWorker.kt` | `triggerWifiConnectSync()` | WiFi an/SSID-Wechsel | ✅ Ja |
| **4. WiFi-Connect Sync** | `NetworkMonitor.kt``SyncWorker.kt` | `triggerWifiConnectSync()` | WiFi verbunden | ✅ Ja |
### Server-Erreichbarkeits-Check (Pre-Check)
@@ -168,7 +168,7 @@ suspend fun isServerReachable(): Boolean = withContext(Dispatchers.IO) {
| Manueller Sync | Toast: "Server nicht erreichbar" | Toast: "✅ Gesynct: X Notizen" | Keins |
| Auto-Sync (onResume) | Silent abort (kein Toast) | Toast: "✅ Gesynct: X Notizen" | Max. 1x/Min |
| Hintergrund-Sync | Silent abort (kein Toast) | Silent (LocalBroadcast only) | 15/30/60 Min |
| WiFi-Connect Sync | Silent abort (kein Toast) | Silent (LocalBroadcast only) | SSID-basiert |
| WiFi-Connect Sync | Silent abort (kein Toast) | Silent (LocalBroadcast only) | WiFi-basiert |
---
@@ -349,7 +349,7 @@ Die App benötigt **minimale Permissions**:
```
**Keine Location Permissions!**
Frühere Versionen benötigten `ACCESS_FINE_LOCATION` für SSID-Erkennung. Jetzt verwenden wir Gateway IP Comparison.
Wir verwenden Gateway IP Comparison statt SSID-Erkennung. Keine Standortberechtigung nötig.
---

View File

@@ -8,8 +8,16 @@
## 📝 Note Management
### Note Types
-**Text notes** - Classic free-form notes
-**Checklists** _(NEW in v1.4.0)_ - Task lists with tap-to-check
- Add items via input field
- ☑️ Tap to check/uncheck
- 📌 Long-press for drag & drop sorting
- 🗑️ Swipe-to-delete individual items
- ~~Strikethrough~~ for completed entries
### Basic Features
-**Simple text notes** - Focus on content, no distractions
-**Auto-save** - No manual saving needed
-**Title + content** - Clear structure for each note
-**Timestamps** - Creation and modification date automatically
@@ -52,9 +60,11 @@
### Markdown Export
-**Automatic export** - Each note → `.md` file
-**Checklists as task lists** _(NEW)_ - `- [ ]` / `- [x]` format (GitHub-compatible)
-**Dual-format** - JSON (master) + Markdown (mirror)
-**Filename sanitization** - Safe filenames from titles
-**Frontmatter metadata** - YAML with ID, timestamps, tags
-**Duplicate handling** _(NEW)_ - ID suffix for same titles
-**Frontmatter metadata** - YAML with ID, timestamps, type
-**WebDAV sync** - Parallel to JSON sync
-**Optional** - Toggle in settings
-**Initial export** - All existing notes when activated
@@ -81,16 +91,16 @@
### Auto-Sync
-**Interval selection** - 15, 30 or 60 minutes
-**WiFi binding** - Only in configured home WiFi
-**WiFi trigger** - Sync on WiFi connection _(no SSID restriction)_
-**Battery-friendly** - ~0.2-0.8% per day
-**Smart server check** - No errors on foreign networks
-**Smart server check** - Sync only when server is reachable
-**WorkManager** - Reliable background execution
-**Battery optimization compatible** - Works even with Doze mode
### Sync Triggers (6 total)
1.**Periodic sync** - Automatically after interval
2.**App-start sync** - When opening the app
3.**WiFi-connect sync** - When home WiFi connects
3.**WiFi-connect sync** - On any WiFi connection
4.**Manual sync** - Button in settings
5.**Pull-to-refresh** - Swipe gesture in notes list
6.**Settings-save sync** - After server configuration
@@ -109,7 +119,6 @@
-**HTTP/HTTPS** - HTTP only local, HTTPS for external
-**Username/password** - Basic authentication
-**Connection test** - Test in settings
-**Gateway SSID** - WiFi name for auto-sync
-**Server URL normalization** - Automatic `/notes/` and `/notes-md/` _(NEW in v1.2.1)_
-**Flexible URL input** - Both variants work: `http://server/` and `http://server/notes/`
@@ -142,7 +151,7 @@
### Battery Efficiency
-**Optimized sync intervals** - 15/30/60 min
-**WiFi-only** - No mobile data sync
-**Smart server check** - Only in home WiFi
-**Smart server check** - Sync only when server is reachable
-**WorkManager** - System-optimized execution
-**Doze mode compatible** - Sync runs even in standby
-**Measured consumption:**

View File

@@ -8,8 +8,16 @@
## 📝 Notiz-Verwaltung
### Notiz-Typen
-**Textnotizen** - Klassische Freitext-Notizen
-**Checklisten** _(NEU in v1.4.0)_ - Aufgabenlisten mit Tap-to-Check
- Items hinzufügen über Eingabefeld
- ☑️ Tap zum Abhaken/Wieder-Öffnen
- 📌 Long-Press für Drag & Drop Sortierung
- 🗑️ Swipe-to-Delete für einzelne Items
- ~~Durchstreichen~~ bei erledigten Einträgen
### Basis-Funktionen
-**Einfache Textnotizen** - Fokus auf Inhalt, keine Ablenkung
-**Automatisches Speichern** - Kein manuelles Speichern nötig
-**Titel + Inhalt** - Klare Struktur für jede Notiz
-**Zeitstempel** - Erstellungs- und Änderungsdatum automatisch
@@ -52,9 +60,11 @@
### Markdown-Export
-**Automatischer Export** - Jede Notiz → `.md` Datei
-**Checklisten als Task-Listen** _(NEU)_ - `- [ ]` / `- [x]` Format (GitHub-kompatibel)
-**Dual-Format** - JSON (Master) + Markdown (Mirror)
-**Dateinamen-Sanitization** - Sichere Dateinamen aus Titeln
-**Frontmatter-Metadata** - YAML mit ID, Timestamps, Tags
-**Duplikat-Handling** _(NEU)_ - ID-Suffix bei gleichen Titeln
-**Frontmatter-Metadata** - YAML mit ID, Timestamps, Type
-**WebDAV-Sync** - Parallel zum JSON-Sync
-**Optional** - In Einstellungen ein/ausschaltbar
-**Initial Export** - Alle bestehenden Notizen beim Aktivieren
@@ -81,16 +91,16 @@
### Auto-Sync
-**Intervall-Auswahl** - 15, 30 oder 60 Minuten
-**WLAN-Bindung** - Nur im konfigurierten Heim-WLAN
-**WiFi-Trigger** - Sync bei WiFi-Verbindung _(keine SSID-Einschränkung)_
-**Akkuschonend** - ~0.2-0.8% pro Tag
-**Smart Server-Check** - Keine Fehler in fremden Netzwerken
-**Smart Server-Check** - Sync nur wenn Server erreichbar
-**WorkManager** - Zuverlässige Background-Ausführung
-**Battery-Optimierung kompatibel** - Funktioniert auch mit Doze Mode
### Sync-Trigger (6 Stück)
1.**Periodic Sync** - Automatisch nach Intervall
2.**App-Start Sync** - Beim Öffnen der App
3.**WiFi-Connect Sync** - Wenn Heim-WLAN verbindet
3.**WiFi-Connect Sync** - Bei jeder WiFi-Verbindung
4.**Manual Sync** - Button in Einstellungen
5.**Pull-to-Refresh** - Wisch-Geste in Notizliste
6.**Settings-Save Sync** - Nach Server-Konfiguration
@@ -109,7 +119,6 @@
-**HTTP/HTTPS** - HTTP nur lokal, HTTPS für extern
-**Username/Password** - Basic Authentication
-**Connection Test** - In Einstellungen testen
-**Gateway SSID** - WLAN-Name für Auto-Sync
-**Server-URL Normalisierung** - Automatisches `/notes/` und `/notes-md/` _(NEU in v1.2.1)_
-**Flexible URL-Eingabe** - Beide Varianten funktionieren: `http://server/` und `http://server/notes/`
@@ -141,8 +150,8 @@
### Akku-Effizienz
-**Optimierte Sync-Intervalle** - 15/30/60 Min
-**WLAN-Only** - Kein Mobile Data Sync
-**Smart Server-Check** - Nur im Heim-WLAN
-**WiFi-Only** - Kein Mobile Data Sync
-**Smart Server-Check** - Sync nur wenn Server erreichbar
-**WorkManager** - System-optimierte Ausführung
-**Doze Mode kompatibel** - Sync läuft auch im Standby
-**Gemessener Verbrauch:**

View File

@@ -0,0 +1,234 @@
# Settings-Redesign Plan (v1.5.0)
## 📋 Übersicht
Die aktuelle Settings-Activity hat 857 Zeilen XML und ist unübersichtlich geworden.
Ziel: Moderne, gruppierte Settings nach Material Design 3 Richtlinien.
---
## 🔍 Aktuelle Struktur (v1.4.0)
### Vorhandene Cards (6 Stück)
1. **Server-Konfiguration** (~200 Zeilen)
- Protokoll-Auswahl (HTTP/HTTPS)
- Server-URL
- Username/Password
- Verbindung testen
2. **Sync-Einstellungen** (~160 Zeilen)
- Auto-Sync Toggle
- Sync-Intervall (15/30/60 Min)
- Jetzt synchronisieren Button
3. **Markdown-Integration** (~100 Zeilen)
- Markdown Auto-Sync Toggle
- Manueller Markdown-Sync Button
4. **Backup & Wiederherstellung** (~100 Zeilen)
- Backup erstellen
- Aus Datei wiederherstellen
- Vom Server wiederherstellen
5. **Debug/Entwickler** (~100 Zeilen)
- File Logging Toggle
- Logs exportieren
- Logs löschen
6. **Über die App** (~100 Zeilen)
- Version
- GitHub-Links
- Lizenz
---
## 🎯 Neue Struktur (v1.5.0)
### Ansatz: PreferenceFragmentCompat + Material 3
Anstatt XML-Cards mit manuellen Views verwenden wir das moderne Preference-System:
```
┌─────────────────────────────────────────┐
│ ⚙️ Einstellungen │
├─────────────────────────────────────────┤
│ │
│ 🔄 SYNCHRONISATION │
│ ├─ Server-Verbindung → │
│ ├─ Auto-Sync 🔘 │
│ └─ Sync-Intervall 30 Min │
│ │
│ 📝 NOTIZEN │
│ └─ Markdown-Export 🔘 │
│ │
│ 💾 DATEN │
│ ├─ Backup erstellen → │
│ ├─ Wiederherstellen → │
│ └─ Vom Server laden → │
│ │
│ 🔧 ERWEITERT │
│ ├─ Datei-Logging 🔘 │
│ └─ Logs verwalten → │
│ │
ÜBER │
│ ├─ Version 1.5.0 │
│ ├─ GitHub Repository → │
│ ├─ Entwickler → │
│ └─ Lizenz MIT │
│ │
└─────────────────────────────────────────┘
```
---
## 📐 Technische Implementierung
### Option A: PreferenceFragmentCompat (Empfohlen)
**Vorteile:**
- Native Android Preference-System
- Automatische State-Verwaltung
- Eingebaute Material 3 Styles
- Hierarchische Navigation (Sub-Screens)
- Weniger Code (~300 Zeilen statt 1148)
**Dateien:**
```
res/xml/
├── preferences_root.xml # Hauptmenü mit Kategorien
├── preferences_sync.xml # Server-Konfiguration
├── preferences_data.xml # Backup-Optionen
└── preferences_debug.xml # Entwickler-Optionen
SettingsActivity.kt # Wird zu SettingsFragment.kt
```
### Option B: Jetpack Compose (Zukunftssicher)
**Vorteile:**
- Modernste UI-Technologie
- Deklarativer Code
- Hot Reload während Entwicklung
- Besser für komplexe Custom-UI
**Nachteile:**
- Größere Migration
- Mischung mit View-System komplizierter
- Lernkurve
### Empfehlung: **Option A** für v1.5.0
PreferenceFragmentCompat ist der richtige Mittelweg:
- Schnell zu implementieren (~1-2 Tage)
- Native Material 3 Unterstützung
- Etabliertes Pattern
- Compose-Migration kann später erfolgen (v2.0.0)
---
## 🎨 Design-Prinzipien (Material 3)
### 1. Preference Categories
```xml
<PreferenceCategory
app:title="Synchronisation"
app:iconSpaceReserved="false">
```
### 2. Switch Preferences
```xml
<SwitchPreferenceCompat
app:key="auto_sync"
app:title="Auto-Sync"
app:summary="Automatisch bei WLAN-Verbindung"
app:icon="@drawable/ic_sync" />
```
### 3. Navigations-Preferences (→ Sub-Screen)
```xml
<Preference
app:key="server_config"
app:title="Server-Verbindung"
app:summary="192.168.0.188:8080"
app:fragment="dev.dettmer.simplenotes.settings.ServerSettingsFragment" />
```
### 4. List Preferences (Dropdown)
```xml
<ListPreference
app:key="sync_interval"
app:title="Sync-Intervall"
app:entries="@array/sync_interval_entries"
app:entryValues="@array/sync_interval_values"
app:defaultValue="30" />
```
---
## 📁 Neue Dateistruktur
```
app/src/main/java/dev/dettmer/simplenotes/
├── settings/
│ ├── SettingsFragment.kt # Haupt-Preference-Fragment
│ ├── ServerSettingsFragment.kt # Server-Konfiguration
│ ├── BackupSettingsFragment.kt # Backup/Restore Dialoge
│ └── DebugSettingsFragment.kt # Logging & Logs
app/src/main/res/xml/
├── preferences_root.xml
├── preferences_server.xml
├── preferences_backup.xml
└── preferences_debug.xml
```
---
## ✅ Implementierungs-Checklist
### Phase 1: Grundstruktur
- [ ] `preferences_root.xml` erstellen
- [ ] `SettingsFragment.kt` mit PreferenceFragmentCompat
- [ ] SettingsActivity als Container anpassen
- [ ] Kategorien: Sync, Notizen, Daten, Erweitert, Über
### Phase 2: Server-Konfiguration
- [ ] `preferences_server.xml` für Server-Details
- [ ] `ServerSettingsFragment.kt` mit Custom-Dialogen
- [ ] Verbindungstest-Button als Preference-Action
- [ ] Protocol-Auswahl als ListPreference
### Phase 3: Sync & Markdown
- [ ] Auto-Sync als SwitchPreference
- [ ] Sync-Intervall als ListPreference
- [ ] Markdown-Export als SwitchPreference
- [ ] "Jetzt synchronisieren" als Action-Preference
### Phase 4: Backup & Debug
- [ ] Backup-Aktionen als Preferences
- [ ] Logging-Toggle
- [ ] Log-Export/Clear Aktionen
### Phase 5: Über & Polish
- [ ] Version, Links, Lizenz
- [ ] Icons für alle Kategorien
- [ ] Animationen & Transitions
- [ ] Dark Mode Testing
---
## ⏱️ Zeitschätzung
| Phase | Aufwand |
|-------|---------|
| Phase 1: Grundstruktur | 2-3h |
| Phase 2: Server | 3-4h |
| Phase 3: Sync | 2h |
| Phase 4: Backup/Debug | 2h |
| Phase 5: Polish | 2h |
| **Gesamt** | **~12h** |
---
## 🔗 Referenzen
- [Material 3 Settings](https://m3.material.io/components/lists/overview)
- [AndroidX Preference](https://developer.android.com/develop/ui/views/components/settings)
- [Preference Styling](https://developer.android.com/develop/ui/views/components/settings/organize-your-settings)