Complete Jetpack Glance Widget Framework
- Implement NoteWidget with 5 responsive size classes
- Support TEXT and CHECKLIST note types
- Material You dynamic colors integration
- Interactive checklist checkboxes in large layouts
- Read-only mode for locked widgets
Widget Configuration System
- NoteWidgetConfigActivity for placement and reconfiguration (Android 12+)
- NoteWidgetConfigScreen with note selection and settings
- Lock widget toggle to prevent accidental edits
- Background opacity slider with 0-100% range
- Auto-save on back navigation plus Save FAB
Widget State Management
- NoteWidgetState keys for per-instance persistence via DataStore
- NoteWidgetActionKeys for type-safe parameter passing
- Five top-level ActionCallback classes
* ToggleChecklistItemAction (updates checklist and marks for sync)
* ToggleLockAction (toggle read-only mode)
* ShowOptionsAction (show permanent options bar)
* RefreshAction (reload from storage)
* OpenConfigAction (launch widget config activity)
Responsive Layout System
- SMALL (110x80dp): Title only
- NARROW_MEDIUM (110x110dp): Preview or compact checklist
- NARROW_TALL (110x250dp): Full content display
- WIDE_MEDIUM (250x110dp): Preview layout
- WIDE_TALL (250x250dp): Interactive checklist
Interactive Widget Features
- Tap content to open editor (unlock) or show options (lock)
- Checklist checkboxes with immediate state sync
- Options bar with Lock/Unlock, Refresh, Settings, Open in App buttons
- Per-widget background transparency control
Connection Leak Fixes (Part of IMPL_019)
- Override put/delete/createDirectory in SafeSardineWrapper with response.use{}
- Proper resource cleanup in exportAllNotesToMarkdown and syncMarkdownFiles
- Use modern OkHttp APIs (toMediaTypeOrNull, toRequestBody)
UI Improvements (Part of IMPL_019)
- Checkbox toggle includes KEY_LAST_UPDATED to force Glance recomposition
- Note selection in config is visual-only (separate from save)
- Config uses moveTaskToBack() plus FLAG_ACTIVITY_CLEAR_TASK
- Proper options bar with standard Material icons
Resources and Configuration
- 8 drawable icons for widget controls
- Widget metadata file (note_widget_info.xml)
- Widget preview layout for Android 12+ widget picker
- Multi-language strings (English and German)
- Glance Jetpack dependencies version 1.1.1
System Integration
- SyncWorker updates all widgets after sync completion
- NoteEditorViewModel reloads checklist state on resume
- ComposeNoteEditorActivity reflects widget edits
- WebDavSyncService maintains clean connections
- AndroidManifest declares widget receiver and config activity
Complete v1.8.0 Widget Feature Set
- Fully responsive design for phones, tablets and foldables
- Seamless Material Design 3 integration
- Production-ready error handling
- Zero connection leaks
- Immediate UI feedback for all interactions
202 lines
7.9 KiB
Plaintext
202 lines
7.9 KiB
Plaintext
plugins {
|
|
alias(libs.plugins.android.application)
|
|
alias(libs.plugins.kotlin.android)
|
|
alias(libs.plugins.kotlin.compose) // v1.5.0: Jetpack Compose Compiler
|
|
alias(libs.plugins.ktlint) // ✅ v1.6.1: Reaktiviert nach Code-Cleanup
|
|
alias(libs.plugins.detekt)
|
|
}
|
|
|
|
import java.util.Properties
|
|
import java.io.FileInputStream
|
|
import java.text.SimpleDateFormat
|
|
import java.util.Date
|
|
import java.util.Locale
|
|
|
|
android {
|
|
namespace = "dev.dettmer.simplenotes"
|
|
compileSdk = 36
|
|
|
|
defaultConfig {
|
|
applicationId = "dev.dettmer.simplenotes"
|
|
minSdk = 24
|
|
targetSdk = 36
|
|
versionCode = 19 // 🔧 v1.7.2: Critical Bugfixes (Timestamp Sync, SyncStatus, etc.)
|
|
versionName = "1.7.2" // 🔧 v1.7.2: Critical Bugfixes
|
|
|
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
|
}
|
|
|
|
// Disable Google dependency metadata for F-Droid/IzzyOnDroid compatibility
|
|
dependenciesInfo {
|
|
includeInApk = false // Removes DEPENDENCY_INFO_BLOCK from APK
|
|
includeInBundle = false // Also disable for AAB (Google Play)
|
|
}
|
|
|
|
// Product Flavors for F-Droid and standard builds
|
|
// Note: APK splits are disabled to ensure single APK output
|
|
flavorDimensions += "distribution"
|
|
productFlavors {
|
|
create("fdroid") {
|
|
dimension = "distribution"
|
|
// F-Droid builds have no proprietary dependencies
|
|
// All dependencies in this project are already FOSS-compatible
|
|
// No APK splits - F-Droid expects single universal APK
|
|
}
|
|
|
|
create("standard") {
|
|
dimension = "distribution"
|
|
// Standard builds can include Play Services in the future if needed
|
|
}
|
|
}
|
|
|
|
// Signing configuration for release builds
|
|
signingConfigs {
|
|
create("release") {
|
|
// Load keystore configuration from key.properties file
|
|
val keystorePropertiesFile = rootProject.file("key.properties")
|
|
if (keystorePropertiesFile.exists()) {
|
|
val keystoreProperties = Properties()
|
|
keystoreProperties.load(FileInputStream(keystorePropertiesFile))
|
|
|
|
storeFile = file(keystoreProperties.getProperty("storeFile"))
|
|
storePassword = keystoreProperties.getProperty("storePassword")
|
|
keyAlias = keystoreProperties.getProperty("keyAlias")
|
|
keyPassword = keystoreProperties.getProperty("keyPassword")
|
|
}
|
|
}
|
|
}
|
|
|
|
buildTypes {
|
|
debug {
|
|
// ⚡ v1.3.1: Debug-Builds können parallel zur Release-App installiert werden
|
|
applicationIdSuffix = ".debug"
|
|
versionNameSuffix = "-debug"
|
|
isDebuggable = true
|
|
|
|
// Optionales separates Icon-Label für Debug-Builds
|
|
resValue("string", "app_name_debug", "Simple Notes (Debug)")
|
|
}
|
|
|
|
release {
|
|
isMinifyEnabled = true
|
|
isShrinkResources = true
|
|
proguardFiles(
|
|
getDefaultProguardFile("proguard-android-optimize.txt"),
|
|
"proguard-rules.pro"
|
|
)
|
|
// Use release signing config if available, otherwise debug
|
|
signingConfig = if (rootProject.file("key.properties").exists()) {
|
|
signingConfigs.getByName("release")
|
|
} else {
|
|
signingConfigs.getByName("debug")
|
|
}
|
|
}
|
|
}
|
|
|
|
buildFeatures {
|
|
viewBinding = true
|
|
buildConfig = true // Enable BuildConfig generation
|
|
compose = true // v1.5.0: Jetpack Compose für Settings Redesign
|
|
}
|
|
|
|
// v1.7.0: Mock Android framework classes in unit tests (Log, etc.)
|
|
testOptions {
|
|
unitTests.isReturnDefaultValues = true
|
|
}
|
|
|
|
// v1.5.0 Hotfix: Strong Skipping Mode für bessere 120Hz Performance
|
|
// v1.6.1: Feature ist ab dieser Kotlin/Compose Version bereits Standard
|
|
// composeCompiler { }
|
|
|
|
compileOptions {
|
|
sourceCompatibility = JavaVersion.VERSION_11
|
|
targetCompatibility = JavaVersion.VERSION_11
|
|
}
|
|
kotlinOptions {
|
|
jvmTarget = "11"
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
// Existing (bleiben so)
|
|
implementation(libs.androidx.core.ktx)
|
|
implementation(libs.androidx.appcompat)
|
|
implementation(libs.material)
|
|
implementation(libs.androidx.activity)
|
|
implementation(libs.androidx.constraintlayout)
|
|
|
|
// Splash Screen API (Android 12+)
|
|
implementation("androidx.core:core-splashscreen:1.0.1")
|
|
|
|
// Unsere Dependencies (DIREKT mit Versionen - viel einfacher!)
|
|
implementation("com.github.thegrizzlylabs:sardine-android:0.8") {
|
|
exclude(group = "xpp3", module = "xpp3")
|
|
}
|
|
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3")
|
|
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3")
|
|
implementation("com.google.code.gson:gson:2.10.1")
|
|
implementation("androidx.work:work-runtime-ktx:2.9.0")
|
|
implementation("androidx.recyclerview:recyclerview:1.3.2")
|
|
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.7.0")
|
|
|
|
// LocalBroadcastManager für UI Refresh
|
|
implementation("androidx.localbroadcastmanager:localbroadcastmanager:1.1.0")
|
|
|
|
// SwipeRefreshLayout für Pull-to-Refresh
|
|
implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.1.0")
|
|
|
|
// 🔐 v1.7.0: AndroidX Security Crypto für Backup-Verschlüsselung
|
|
implementation("androidx.security:security-crypto:1.1.0-alpha06")
|
|
|
|
// ═══════════════════════════════════════════════════════════════════════
|
|
// v1.5.0: Jetpack Compose für Settings Redesign
|
|
// ═══════════════════════════════════════════════════════════════════════
|
|
implementation(platform(libs.androidx.compose.bom))
|
|
implementation(libs.androidx.compose.ui)
|
|
implementation(libs.androidx.compose.ui.graphics)
|
|
implementation(libs.androidx.compose.ui.tooling.preview)
|
|
implementation(libs.androidx.compose.material3)
|
|
implementation(libs.androidx.compose.material.icons)
|
|
implementation(libs.androidx.activity.compose)
|
|
implementation(libs.androidx.navigation.compose)
|
|
implementation(libs.androidx.lifecycle.runtime.compose)
|
|
debugImplementation(libs.androidx.compose.ui.tooling)
|
|
|
|
// ═══════════════════════════════════════════════════════════════════════
|
|
// 🆕 v1.8.0: Homescreen Widgets
|
|
// ═══════════════════════════════════════════════════════════════════════
|
|
implementation("androidx.glance:glance-appwidget:1.1.1")
|
|
implementation("androidx.glance:glance-material3:1.1.1")
|
|
|
|
// Testing (bleiben so)
|
|
testImplementation(libs.junit)
|
|
androidTestImplementation(libs.androidx.junit)
|
|
androidTestImplementation(libs.androidx.espresso.core)
|
|
}
|
|
|
|
// ✅ v1.6.1: ktlint reaktiviert nach Code-Cleanup
|
|
ktlint {
|
|
android = true
|
|
outputToConsole = true
|
|
ignoreFailures = true // Parser-Probleme in WebDavSyncService.kt und build.gradle.kts
|
|
enableExperimentalRules = false
|
|
|
|
filter {
|
|
exclude("**/generated/**")
|
|
exclude("**/build/**")
|
|
// Legacy adapters with ktlint parser issues
|
|
exclude("**/adapters/NotesAdapter.kt")
|
|
exclude("**/SettingsActivity.kt")
|
|
}
|
|
}
|
|
|
|
// ⚡ v1.3.1: detekt-Konfiguration
|
|
detekt {
|
|
buildUponDefaultConfig = true
|
|
allRules = false
|
|
config.setFrom(files("$rootDir/config/detekt/detekt.yml"))
|
|
baseline = file("$rootDir/config/detekt/baseline.xml")
|
|
|
|
// Parallel-Verarbeitung für schnellere Checks
|
|
parallel = true
|
|
} |