Compare commits

...
20 Commits
Author SHA1 Message Date
robin 52a758ff16 chore: add CHANGELOG
Build & Release Android App / build (push) Failing after 9m26s
2026-09-29 19:18:16 +02:00
robin 7dde81a715 chore: v1.0.1 2026-09-29 19:17:53 +02:00
robin e563b2e796 chore: add .idea/misc.xml to .gitignore 2026-09-19 19:38:31 +02:00
robin c27184551c chore: updated to gradle 9.4.1 2026-09-19 19:34:13 +02:00
robin f275ffe0ba fix workflow #16
Build & Release Android App / build (push) Failing after 22m32s
2026-09-19 19:26:05 +02:00
robin 9ef3cb1ee6 fix workflow #15
Build & Release Android App / build (push) Failing after 13m39s
2026-09-19 19:09:09 +02:00
robin 660dc8fd89 fix workflow #14
Build & Release Android App / build (push) Failing after 8m15s
2026-09-19 18:58:50 +02:00
robin 70f0e22e5e fix workflow #13
Build & Release Android App / build (push) Failing after 5m22s
2026-09-19 18:48:11 +02:00
robin f5775cd5a1 fix workflow #13
Build & Release Android App / build (push) Failing after 5m22s
2026-09-19 18:39:01 +02:00
robin 0d189a69de fix workflow #12
Build & Release Android App / build (push) Failing after 5m23s
2026-09-19 18:31:36 +02:00
robin 19dffdc001 fix workflow #11
Build & Release Android App / build (push) Failing after 5m15s
2026-09-19 18:20:55 +02:00
robin 344963a4e5 Merge pull request 'Initial code' (#3) from initial into chore
Reviewed-on: #3
2026-09-19 16:12:08 +00:00
robin 10b0183945 Merge branch 'chore' into initial 2026-09-19 16:11:44 +00:00
robin c74e428bce fix workflow #7 2026-09-18 19:24:53 +00:00
robin 137c8fee49 fix workflow #7
Build & Release Android App / build (push) Failing after 5m12s
2026-09-18 20:34:49 +02:00
robin 2e2c3a9382 fix workflow #6 2026-09-18 20:28:07 +02:00
robin 2ab4dae20d fix workflow #5
Build & Release Android App / build (push) Failing after 2m10s
2026-09-18 19:34:56 +02:00
robin 03cce71d14 fix workflow #4
Build & Release Android App / build (push) Failing after 4m11s
2026-09-18 19:21:21 +02:00
robin 16dc1626f7 style: add light and dark mode support
Build & Release Android App / build (push) Failing after 7s
2026-09-18 18:16:57 +02:00
robin 73e4fd2957 feat: create word
feat: display random word (per week)
2026-09-18 17:32:21 +02:00
16 changed files with 306 additions and 35 deletions

No files matched your search

+58 -5
View File
@@ -1,9 +1,10 @@
# .gitea/workflows/build-release.yml
name: Build & Release Android App name: Build & Release Android App
on: on:
push: push:
tags: tags:
- 'v*' # Startet bei Tags wie v1.0.0, v1.0.1 etc. - 'v*'
jobs: jobs:
build: build:
@@ -12,20 +13,72 @@ jobs:
- name: Code auschecken - name: Code auschecken
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Java/JDK einrichten - name: Java/JDK 17 einrichten
uses: actions/setup-java@v4 uses: actions/setup-java@v5
with: with:
java-version: '17' java-version: '17'
distribution: 'temurin' distribution: 'temurin'
cache: gradle
- name: Rechte für gradlew setzen
run: chmod +x gradlew
- name: Android SDK Pfad prüfen & einrichten
run: |
if [ -d "/usr/local/lib/android/sdk" ]; then
SDK_PATH="/usr/local/lib/android/sdk"
elif [ -d "/opt/android-sdk" ]; then
SDK_PATH="/opt/android-sdk"
else
echo "Android SDK nicht gefunden. Installiere cmdline-tools..."
SDK_PATH="$HOME/android-sdk"
mkdir -p "$SDK_PATH/cmdline-tools"
cd "$SDK_PATH/cmdline-tools"
curl -s -o tools.zip https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip
unzip -q tools.zip
mv cmdline-tools latest
rm tools.zip
fi
echo "ANDROID_HOME=$SDK_PATH" >> $GITHUB_ENV
echo "ANDROID_SDK_ROOT=$SDK_PATH" >> $GITHUB_ENV
echo "sdk.dir=$SDK_PATH" > local.properties
- name: Android SDK Lizenzen vorab akzeptieren
run: |
LIC_DIR="${ANDROID_HOME:-$HOME/android-sdk}/licenses"
mkdir -p "$LIC_DIR"
echo -e "\n24333f8a637b37ea6d1270c750f0160576065016" > "$LIC_DIR/android-sdk-license"
echo -e "\n84831b9409646a456e88576d19212d3582701724" >> "$LIC_DIR/android-sdk-license"
echo -e "\nd975f751698a7780098d5c6814341db27684b376" > "$LIC_DIR/android-sdk-preview-license"
echo -e "\n33b6a2b64607f11b759f320ef9dff4ae5e40007e" > "$LIC_DIR/android-googletv-license"
echo -e "\n6010077ebe6b4f930974d1266684e201b8723913" > "$LIC_DIR/android-googlexr-license"
- name: Android Release APK bauen - name: Android Release APK bauen
run: | run: |
chmod +x gradlew VERSION="${GITHUB_REF_NAME#v}"
./gradlew assembleRelease -Porg.gradle.java.installations.auto-download=false ./gradlew assembleRelease --no-daemon -PversionNameOverride="$VERSION"
env:
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
- name: Release-Notes extrahieren
run: |
VERSION="${GITHUB_REF_NAME#v}"
awk -v v="$VERSION" '
index($0, "## [" v "]") == 1 {found=1; next}
found && /^## \[/ {exit}
found {print}
' CHANGELOG.md > release-notes.md
[ -s release-notes.md ] || echo "Keine Release-Notes vorhanden." > release-notes.md
- name: Release in Gitea erstellen - name: Release in Gitea erstellen
uses: softprops/action-gh-release@v2 uses: softprops/action-gh-release@v2
with: with:
tag_name: ${{ github.ref_name }}
name: ${{ github.ref_name }}
files: app/build/outputs/apk/release/*.apk files: app/build/outputs/apk/release/*.apk
body_path: release-notes.md
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+2 -1
View File
@@ -1,13 +1,14 @@
*.iml *.iml
.gradle .gradle
.idea
/local.properties /local.properties
/.idea
/.idea/caches /.idea/caches
/.idea/libraries /.idea/libraries
/.idea/modules.xml /.idea/modules.xml
/.idea/workspace.xml /.idea/workspace.xml
/.idea/navEditor.xml /.idea/navEditor.xml
/.idea/assetWizardSettings.xml /.idea/assetWizardSettings.xml
/.idea/misc.xml
.DS_Store .DS_Store
/build /build
/captures /captures
+1 -1
View File
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" /> <component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7"> <component name="ProjectRootManager" version="2" languageLevel="JDK_25" project-jdk-name="jbr-25" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" /> <output url="file://$PROJECT_DIR$/build/classes" />
</component> </component>
<component name="ProjectType"> <component name="ProjectType">
+9
View File
@@ -0,0 +1,9 @@
# Changelog
## [1.0.1] - 2026-09-29
### Neu
- Erste stabile Version mit automatischen APK-Builds
- CHANGELOG.md als Release-Body
### Behoben
- VersionCode und -Name
+22 -6
View File
@@ -3,6 +3,22 @@ plugins {
alias(libs.plugins.kotlin.compose) alias(libs.plugins.kotlin.compose)
} }
val tagVersion = (project.findProperty("versionNameOverride") as String?) ?: "0.0.0-dev"
// "1.2.3" oder "1.2.3-alpha9" -> Kern "1.2.3" für den versionCode
val core = tagVersion
.removePrefix("v")
.substringBefore("-")
val parts = core.split(".").map { it.toIntOrNull() ?: 0 }
val major = parts.getOrElse(0) { 0 }
val minor = parts.getOrElse(1) { 0 }
val patch = parts.getOrElse(2) { 0 }
val copyChangelog by tasks.registering(Copy::class) {
from(rootProject.file("CHANGELOG.md"))
into(layout.buildDirectory.dir("generated/changelog"))
}
android { android {
namespace = "de.schanbro.weekfocus" namespace = "de.schanbro.weekfocus"
compileSdk { compileSdk {
@@ -13,8 +29,8 @@ android {
applicationId = "de.schanbro.weekfocus" applicationId = "de.schanbro.weekfocus"
minSdk = 29 minSdk = 29
targetSdk = 37 targetSdk = 37
versionCode = 1 versionCode = major * 10000 + minor * 100 + patch
versionName = "1.0" versionName = tagVersion
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
} }
@@ -33,10 +49,7 @@ android {
buildFeatures { buildFeatures {
compose = true compose = true
} }
} sourceSets["main"].assets.srcDir(layout.buildDirectory.dir("generated/changelog"))
kotlin {
jvmToolchain(17)
} }
dependencies { dependencies {
@@ -56,3 +69,6 @@ dependencies {
debugImplementation(libs.androidx.compose.ui.test.manifest) debugImplementation(libs.androidx.compose.ui.test.manifest)
debugImplementation(libs.androidx.compose.ui.tooling) debugImplementation(libs.androidx.compose.ui.tooling)
} }
tasks.matching { it.name.startsWith("merge") && it.name.endsWith("Assets") }
.configureEach { dependsOn(copyChangelog) }
+10
View File
@@ -23,6 +23,16 @@
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity> </activity>
<receiver
android:name=".SimpleWidget"
android:exported="true">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/widget_info" />
</receiver>
</application> </application>
</manifest> </manifest>
@@ -1,16 +1,20 @@
package de.schanbro.weekfocus package de.schanbro.weekfocus
import android.content.Context
import android.os.Bundle import android.os.Bundle
import androidx.activity.ComponentActivity import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge import androidx.activity.enableEdgeToEdge
import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.*
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.material3.Scaffold import androidx.compose.foundation.lazy.items
import androidx.compose.material3.Text import androidx.compose.material3.*
import androidx.compose.runtime.Composable import androidx.compose.runtime.*
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.unit.dp
import android.appwidget.AppWidgetManager
import android.content.ComponentName
import de.schanbro.weekfocus.ui.theme.WeekFocusTheme import de.schanbro.weekfocus.ui.theme.WeekFocusTheme
class MainActivity : ComponentActivity() { class MainActivity : ComponentActivity() {
@@ -20,8 +24,7 @@ class MainActivity : ComponentActivity() {
setContent { setContent {
WeekFocusTheme { WeekFocusTheme {
Scaffold(modifier = Modifier.fillMaxSize()) { innerPadding -> Scaffold(modifier = Modifier.fillMaxSize()) { innerPadding ->
Greeting( WordListScreen(
name = "Android",
modifier = Modifier.padding(innerPadding) modifier = Modifier.padding(innerPadding)
) )
} }
@@ -31,17 +34,94 @@ class MainActivity : ComponentActivity() {
} }
@Composable @Composable
fun Greeting(name: String, modifier: Modifier = Modifier) { fun WordListScreen(modifier: Modifier = Modifier) {
Text( val context = LocalContext.current
text = "Hello $name!", val sharedPrefs = remember {
modifier = modifier context.getSharedPreferences("WeekFocusPrefs", Context.MODE_PRIVATE)
)
} }
@Preview(showBackground = true) // Wörter aus SharedPreferences laden und Zustand verwalten
@Composable var textInput by remember { mutableStateOf("") }
fun GreetingPreview() { val wordList = remember {
WeekFocusTheme { mutableStateListOf<String>().apply {
Greeting("Android") val savedSet = sharedPrefs.getStringSet("words_key", emptySet()) ?: emptySet()
addAll(savedSet)
}
}
// Funktion zum Speichern in SharedPreferences
fun saveWords() {
sharedPrefs.edit().putStringSet("words_key", wordList.toSet()).apply()
}
Column(
modifier = modifier
.fillMaxSize()
.padding(16.dp)
) {
// Eingabefeld für ein neues Wort
OutlinedTextField(
value = textInput,
onValueChange = { textInput = it },
label = { Text("Neues Wort eingeben...") },
modifier = Modifier.fillMaxWidth(),
singleLine = true
)
Spacer(modifier = Modifier.height(8.dp))
// Button zum Hinzufügen
Button(
onClick = {
val trimmed = textInput.trim()
if (trimmed.isNotEmpty()) {
wordList.add(trimmed)
saveWords()
updateWidget(context)
textInput = ""
}
},
modifier = Modifier.fillMaxWidth()
) {
Text("Wort hinzufügen")
}
Spacer(modifier = Modifier.height(24.dp))
Text(
text = "Gespeicherte Wörter:",
style = MaterialTheme.typography.titleMedium
)
Spacer(modifier = Modifier.height(8.dp))
// Liste der Wörter
if (wordList.isEmpty()) {
Text(
text = "Noch keine Wörter vorhanden.",
style = MaterialTheme.typography.bodyMedium
)
} else {
LazyColumn {
items(wordList) { word ->
Text(
text = "• $word",
style = MaterialTheme.typography.bodyLarge,
modifier = Modifier.padding(vertical = 4.dp)
)
}
}
}
}
}
// Hilfsfunktion zum Aktualisieren des Widgets
fun updateWidget(context: Context) {
val appWidgetManager = AppWidgetManager.getInstance(context)
val componentName = ComponentName(context, SimpleWidget::class.java)
val appWidgetIds = appWidgetManager.getAppWidgetIds(componentName)
for (appWidgetId in appWidgetIds) {
SimpleWidget.updateAppWidget(context, appWidgetManager, appWidgetId)
} }
} }
@@ -0,0 +1,56 @@
package de.schanbro.weekfocus
import android.appwidget.AppWidgetManager
import android.appwidget.AppWidgetProvider
import android.content.Context
import android.widget.RemoteViews
import java.util.Calendar
import java.util.Random
class SimpleWidget : AppWidgetProvider() {
override fun onUpdate(
context: Context,
appWidgetManager: AppWidgetManager,
appWidgetIds: IntArray
) {
for (appWidgetId in appWidgetIds) {
updateAppWidget(context, appWidgetManager, appWidgetId)
}
}
companion object {
fun updateAppWidget(
context: Context,
appWidgetManager: AppWidgetManager,
appWidgetId: Int
) {
// 1. SharedPreferences auslesen
val sharedPrefs = context.getSharedPreferences("WeekFocusPrefs", Context.MODE_PRIVATE)
val savedSet = sharedPrefs.getStringSet("words_key", emptySet()) ?: emptySet()
val wordList = savedSet.toList()
// 2. Aktuelle Kalenderwoche & Jahr bestimmen
val calendar = Calendar.getInstance()
val weekOfYear = calendar.get(Calendar.WEEK_OF_YEAR)
val year = calendar.get(Calendar.YEAR)
// 3. Wort für die aktuelle Kalenderwoche auswählen
val displayText = if (wordList.isNotEmpty()) {
// Kombinierter Seed aus Jahr und Kalenderwoche
val seed = (year * 100 + weekOfYear).toLong()
val random = Random(seed)
val randomIndex = random.nextInt(wordList.size)
wordList[randomIndex]
} else {
"Keine Wörter"
}
// 4. RemoteViews aktualisieren
val views = RemoteViews(context.packageName, R.layout.widget_main)
views.setTextViewText(R.id.appwidget_text, displayText)
appWidgetManager.updateAppWidget(appWidgetId, views)
}
}
}
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="28dp" />
<solid android:color="?android:attr/colorBackgroundFloating" />
</shape>
+32
View File
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:theme="@android:style/Theme.DeviceDefault.DayNight"
android:background="@drawable/widget_background"
android:orientation="vertical"
android:padding="16dp"
android:gravity="center">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="WOCHENFOKUS"
android:textSize="11sp"
android:letterSpacing="0.1"
android:textAllCaps="true"
android:textColor="?android:attr/textColorSecondary"
android:textStyle="bold" />
<TextView
android:id="@+id/appwidget_text"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="center"
android:text="Hallo"
android:textColor="?android:attr/textColorPrimary"
android:textSize="22sp"
android:textStyle="bold" />
</LinearLayout>
File renamed without changes.
File renamed without changes.
File renamed without changes.
+11
View File
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
android:minWidth="130dp"
android:minHeight="80dp"
android:updatePeriodMillis="86400000"
android:initialLayout="@layout/widget_main"
android:resizeMode="horizontal|vertical"
android:widgetCategory="home_screen"
android:targetCellWidth="2"
android:targetCellHeight="2">
</appwidget-provider>
+1 -1
View File
@@ -1,5 +1,5 @@
[versions] [versions]
agp = "9.4.0" agp = "9.4.1"
coreKtx = "1.10.1" coreKtx = "1.10.1"
junit = "4.13.2" junit = "4.13.2"
junitVersion = "1.1.5" junitVersion = "1.1.5"
-3
View File
@@ -11,9 +11,6 @@ pluginManagement {
gradlePluginPortal() gradlePluginPortal()
} }
} }
plugins {
id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0"
}
dependencyResolutionManagement { dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories { repositories {