-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Feature: Home Screen Photo Widget #16524
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
szyxxx
wants to merge
21
commits into
nextcloud:master
Choose a base branch
from
szyxxx:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
6da72df
feat: implement a new photo widget to display Nextcloud photos.
szyxxx 33ec730
feat: implement photo widget functionality including background job m…
szyxxx 14f7e7c
feat: Implement a new photo widget with configuration, background upd…
szyxxx c212802
fix: address PR review and Codacy static analysis issues
szyxxx 8832393
fix: add date validity check and use thread-safe DateTimeFormatter
szyxxx 542ad66
ci: add auto-sync upstream and auto-build release workflows
szyxxx e95f327
feat: implement photo widget worker and its layout to display random …
szyxxx 77acabc
feat: implement a new photo widget to display Nextcloud photos.
szyxxx c272673
feat: implement photo widget functionality including background job m…
szyxxx 1ff3760
feat: Implement a new photo widget with configuration, background upd…
szyxxx fb7dd45
fix: address PR review and Codacy static analysis issues
szyxxx fc29538
fix: add date validity check and use thread-safe DateTimeFormatter
szyxxx b71cf9e
ci: add auto-sync upstream and auto-build release workflows
szyxxx 8daed6f
feat: implement photo widget worker and its layout to display random …
szyxxx af5807b
Merge branch 'master' of https://github.com/szyxxx/nextcloud-photos-w…
szyxxx f54d752
fix(ci): rewrite build workflow - unique tags, fix gradle config, use…
szyxxx ff5b767
feat: Add a new photo widget with configurable image and video display.
szyxxx 9daf46e
feat: Add PhotoWidgetRepository to manage photo widget configurations…
szyxxx b10dc01
feat: introduce photo widget with configuration and background updates
szyxxx dee4a22
feat: Initial setup of Android application build with Gradle Kotlin D…
szyxxx 1bd9a36
feat: implement PhotoWidgetWorker to fetch and display random photos,…
szyxxx File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| # SPDX-FileCopyrightText: 2026 Axel | ||
| # SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only | ||
|
|
||
| name: "Build & Release APK" | ||
|
|
||
| on: | ||
| push: | ||
| branches: [master] | ||
| workflow_dispatch: # Allow manual trigger | ||
|
|
||
| permissions: | ||
| contents: write | ||
|
|
||
| concurrency: | ||
| group: build-release | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up JDK 21 | ||
| uses: actions/setup-java@v4 | ||
| with: | ||
| distribution: "temurin" | ||
| java-version: 21 | ||
|
|
||
| - name: Configure Gradle | ||
| run: | | ||
| echo "org.gradle.jvmargs=-Xmx6g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 -XX:+UseParallelGC -XX:MaxMetaspaceSize=1g" >> gradle.properties | ||
| echo "org.gradle.caching=true" >> gradle.properties | ||
| echo "org.gradle.parallel=true" >> gradle.properties | ||
| echo "org.gradle.configureondemand=true" >> gradle.properties | ||
| echo "kapt.incremental.apt=true" >> gradle.properties | ||
|
|
||
| - name: Build Generic Debug APK | ||
| run: ./gradlew assembleGenericDebug | ||
|
|
||
| - name: Prepare release info | ||
| id: info | ||
| run: | | ||
| APK=$(find app/build/outputs/apk/generic/debug -name "*.apk" | head -1) | ||
| DATE=$(date -u +"%Y%m%d-%H%M%S") | ||
| SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7) | ||
| TAG="v${DATE}-${SHORT_SHA}" | ||
| echo "apk_path=$APK" >> "$GITHUB_OUTPUT" | ||
| echo "tag=$TAG" >> "$GITHUB_OUTPUT" | ||
| echo "date=$(date -u +'%Y-%m-%d %H:%M UTC')" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Rename APK | ||
| run: | | ||
| APK="${{ steps.info.outputs.apk_path }}" | ||
| DIR=$(dirname "$APK") | ||
| cp "$APK" "${DIR}/nextcloud-photo-widget-${{ steps.info.outputs.tag }}.apk" | ||
| echo "final_apk=${DIR}/nextcloud-photo-widget-${{ steps.info.outputs.tag }}.apk" >> "$GITHUB_OUTPUT" | ||
| id: rename | ||
|
|
||
| - name: Create Release | ||
| uses: softprops/action-gh-release@v2 | ||
| with: | ||
| tag_name: ${{ steps.info.outputs.tag }} | ||
| name: "Photo Widget — ${{ steps.info.outputs.date }}" | ||
| body: | | ||
| Auto-built from `master` on ${{ steps.info.outputs.date }}. | ||
| **Commit**: `${{ github.sha }}` | ||
|
|
||
| Install via [Obtainium](https://github.com/ImranR98/Obtainium) for automatic updates. | ||
| draft: false | ||
| prerelease: false | ||
| make_latest: true | ||
| files: ${{ steps.rename.outputs.final_apk }} | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| # SPDX-FileCopyrightText: 2026 Axel | ||
| # SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only | ||
|
|
||
| name: "Sync Upstream" | ||
|
|
||
| on: | ||
| schedule: | ||
| # Run daily at 04:00 UTC (11:00 WIB) | ||
| - cron: "0 4 * * *" | ||
| workflow_dispatch: # Allow manual trigger | ||
|
|
||
| permissions: | ||
| contents: write | ||
| issues: write | ||
|
|
||
| jobs: | ||
| sync: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout fork | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| token: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Configure git | ||
| run: | | ||
| git config user.name "github-actions[bot]" | ||
| git config user.email "github-actions[bot]@users.noreply.github.com" | ||
|
|
||
| - name: Add upstream remote | ||
| run: git remote add upstream https://github.com/nextcloud/android.git || true | ||
|
|
||
| - name: Fetch upstream | ||
| run: git fetch upstream master | ||
|
|
||
| - name: Rebase on upstream | ||
| id: rebase | ||
| run: | | ||
| git rebase upstream/master | ||
| echo "success=true" >> "$GITHUB_OUTPUT" | ||
| continue-on-error: true | ||
|
|
||
| - name: Handle rebase failure | ||
| if: steps.rebase.outputs.success != 'true' | ||
| run: | | ||
| git rebase --abort | ||
| echo "::error::Rebase failed due to conflicts. Manual resolution needed." | ||
|
|
||
| - name: Push changes | ||
| if: steps.rebase.outputs.success == 'true' | ||
| run: git push --force-with-lease origin master | ||
|
|
||
| - name: Create issue on failure | ||
| if: steps.rebase.outputs.success != 'true' | ||
| uses: actions/github-script@v7 | ||
| with: | ||
| script: | | ||
| const existing = await github.rest.issues.listForRepo({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| state: 'open', | ||
| labels: 'sync-conflict' | ||
| }); | ||
| if (existing.data.length === 0) { | ||
| await github.rest.issues.create({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| title: '⚠️ Upstream sync failed — rebase conflict', | ||
| body: 'The daily upstream sync failed due to merge conflicts.\n\nPlease resolve manually:\n```bash\ngit fetch upstream master\ngit rebase upstream/master\n# resolve conflicts\ngit push --force-with-lease origin master\n```', | ||
| labels: ['sync-conflict'] | ||
| }); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
app/src/main/java/com/nextcloud/client/widget/photo/PhotoWidgetConfig.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| /* | ||
| * Nextcloud - Android Client | ||
| * | ||
| * SPDX-FileCopyrightText: 2026 Axel | ||
| * SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only | ||
| */ | ||
| package com.nextcloud.client.widget.photo | ||
|
|
||
| /** | ||
| * Holds per-widget configuration for the Photo Widget. | ||
| * | ||
| * @param intervalMinutes Refresh interval in minutes. 0 means manual-only (no auto-refresh). | ||
| */ | ||
| data class PhotoWidgetConfig( | ||
| val widgetId: Int, | ||
| val folderPath: String, | ||
| val accountName: String, | ||
| val intervalMinutes: Long = DEFAULT_INTERVAL_MINUTES | ||
| ) { | ||
| companion object { | ||
| const val DEFAULT_INTERVAL_MINUTES = 15L | ||
| val INTERVAL_OPTIONS = longArrayOf(15L, 30L, 60L, 0L) // 0 = manual | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The schedulePeriodicPhotoWidgetUpdate method requires network connectivity (line 837), but the PhotoWidgetRepository is designed to support offline fallback by using cached images. When users enable the widget and select a manual-only refresh interval, they may still expect cached images to rotate. Consider removing the network constraint from periodic updates or making it optional, as the repository can successfully serve cached images offline.