Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d89912ef10 | ||
|
|
f0cb9d2f7d | ||
|
|
86a37d15b6 | ||
|
|
c4124e0fab | ||
|
|
040b5cb174 | ||
|
|
4647e0daa0 | ||
|
|
a6b9a0fe80 | ||
|
|
4a7c8ca342 | ||
|
|
d2eabe2e9d |
No files matched your search
@@ -1,3 +0,0 @@
|
||||
github: PartyDonut
|
||||
buy_me_a_coffee: jopknaapen
|
||||
patreon: Fladder
|
||||
@@ -1,6 +1,7 @@
|
||||
name: "🐛 Bug Report"
|
||||
description: Create a new ticket for a bug.
|
||||
title: "<TITLE>"
|
||||
title: "🐛 "
|
||||
labels: ["bug"]
|
||||
type: "Bug"
|
||||
body:
|
||||
- type: textarea
|
||||
@@ -16,7 +17,7 @@ body:
|
||||
attributes:
|
||||
label: "Reproduction steps"
|
||||
description: Please provide clear steps to reproduce the bug
|
||||
placeholder: |
|
||||
value: |
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
|
||||
@@ -12,18 +12,6 @@ Resolves #issue-number
|
||||
|
||||
<!-- This section is optional but highly recommended to show off your changes! -->
|
||||
|
||||
## Tested On
|
||||
|
||||
<!-- Please check all platforms you have tested this PR on -->
|
||||
|
||||
- [ ] Android
|
||||
- [ ] Android TV
|
||||
- [ ] iOS
|
||||
- [ ] Linux
|
||||
- [ ] Windows
|
||||
- [ ] macOS
|
||||
- [ ] Web
|
||||
|
||||
## Checklist
|
||||
|
||||
- [ ] If a new package was added, did you ensure it works for all supported platforms? Is the package well maintained
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
SECTIONS = {
|
||||
"breaking": "Breaking Changes 🛠",
|
||||
"feat": "New Features 🏕",
|
||||
"fix": "Bugfixes 🐞",
|
||||
"perf": "Performance ⚡",
|
||||
"refactor": "Refactors 🧹",
|
||||
"revert": "Reverts ⏪",
|
||||
"docs": "Documentation 📖",
|
||||
"other": "Other Changes",
|
||||
}
|
||||
|
||||
OTHER_TYPES = ("style", "test", "build", "ci", "chore")
|
||||
TYPES = "|".join([key for key in SECTIONS if key not in ("breaking", "other")] + list(OTHER_TYPES))
|
||||
|
||||
PATTERN = re.compile(rf"^(?P<type>{TYPES})(?:\((?P<scope>[^()]+)\))?(?P<breaking>!)?: ?(?P<desc>\S.*)$", re.IGNORECASE)
|
||||
BREAKING_FOOTER = re.compile(r"^BREAKING[ -]CHANGE: ", re.MULTILINE)
|
||||
IGNORED = re.compile(r"^(prepare release|merge )", re.IGNORECASE)
|
||||
|
||||
|
||||
def main():
|
||||
rev_range = sys.argv[1] if len(sys.argv) > 1 else "HEAD"
|
||||
commits = subprocess.run(
|
||||
["git", "log", "--format=%h%x1f%s%x1f%b%x1e", rev_range],
|
||||
capture_output=True, text=True, check=True,
|
||||
).stdout.split("\x1e")
|
||||
|
||||
entries = {key: [] for key in SECTIONS}
|
||||
seen = set()
|
||||
for commit in commits:
|
||||
if not commit.strip():
|
||||
continue
|
||||
sha, subject, body = commit.lstrip("\n").split("\x1f", 2)
|
||||
match = PATTERN.match(subject.strip())
|
||||
if not match or IGNORED.match(match["desc"]):
|
||||
continue
|
||||
kind = match["type"].lower()
|
||||
desc = match["desc"].strip()
|
||||
if not re.search(r"\(#\d+\)$", desc):
|
||||
desc += f" ({sha})"
|
||||
key = re.sub(r"[^a-z0-9]", "", re.sub(r"\s*\((#\d+|[0-9a-f]+)\)$", "", desc).lower())
|
||||
if key in seen:
|
||||
continue
|
||||
seen.add(key)
|
||||
if match["breaking"] or BREAKING_FOOTER.search(body):
|
||||
section = "breaking"
|
||||
else:
|
||||
section = "other" if kind in OTHER_TYPES else kind
|
||||
scope = f"**{match['scope']}:** " if match["scope"] else ""
|
||||
entries[section].append(f"- {scope}{desc[0].upper()}{desc[1:]}")
|
||||
|
||||
for key, title in SECTIONS.items():
|
||||
if entries[key]:
|
||||
print(f"### {title}\n")
|
||||
print("\n".join(entries[key]) + "\n")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -6,7 +6,6 @@ on:
|
||||
- "v*"
|
||||
branches:
|
||||
- master
|
||||
- develop
|
||||
pull_request:
|
||||
paths:
|
||||
- pubspec.yaml
|
||||
@@ -15,6 +14,9 @@ on:
|
||||
types:
|
||||
- opened
|
||||
- reopened
|
||||
schedule:
|
||||
# Run nightly at midnight UTC, but only if there were changes to develop
|
||||
- cron: "0 0 * * *"
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
build_type:
|
||||
@@ -34,13 +36,19 @@ env:
|
||||
NIGHTLY_TAG: nightly
|
||||
|
||||
jobs:
|
||||
# Determine build type based on trigger conditions
|
||||
# Check if workflow should run based on trigger conditions
|
||||
check-trigger:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
should_run: ${{ steps.check.outputs.should_run }}
|
||||
build_type: ${{ steps.check.outputs.build_type }}
|
||||
steps:
|
||||
- name: Determine build type
|
||||
- name: Checkout repository
|
||||
uses: actions/[email protected]
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Check if should run and determine build type
|
||||
id: check
|
||||
run: |
|
||||
# Determine build type based on trigger and input
|
||||
@@ -48,7 +56,18 @@ jobs:
|
||||
BUILD_TYPE="${{ github.event.inputs.build_type }}"
|
||||
elif [[ "${{ startsWith(github.ref, 'refs/tags/v') }}" == "true" ]]; then
|
||||
BUILD_TYPE="release"
|
||||
elif [[ "${{ github.ref }}" == "refs/heads/develop" ]]; then
|
||||
elif [[ "${{ github.event_name }}" == "schedule" ]]; then
|
||||
# Check if there were commits to develop in the last 24 hours
|
||||
git checkout develop
|
||||
COMMITS_LAST_24H=$(git log --since="24 hours ago" --oneline | wc -l)
|
||||
if [[ $COMMITS_LAST_24H -gt 0 ]]; then
|
||||
BUILD_TYPE="nightly"
|
||||
else
|
||||
echo "No commits to develop in the last 24 hours, skipping nightly build"
|
||||
echo "should_run=false" >> $GITHUB_OUTPUT
|
||||
exit 0
|
||||
fi
|
||||
elif [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
|
||||
BUILD_TYPE="nightly"
|
||||
else
|
||||
# For PRs and other events, build but don't release
|
||||
@@ -56,10 +75,12 @@ jobs:
|
||||
fi
|
||||
|
||||
echo "build_type=${BUILD_TYPE}" >> $GITHUB_OUTPUT
|
||||
echo "should_run=true" >> $GITHUB_OUTPUT
|
||||
echo "Build type determined: ${BUILD_TYPE}"
|
||||
|
||||
fetch-info:
|
||||
needs: [check-trigger]
|
||||
if: needs.check-trigger.outputs.should_run == 'true'
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
version_name: ${{ steps.fetch.outputs.version_name }}
|
||||
@@ -110,7 +131,6 @@ jobs:
|
||||
echo "ARTIFACT_SUFFIX=${{ needs.fetch-info.outputs.build_type }}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Decode Keystore for release
|
||||
if: needs.fetch-info.outputs.build_type != 'development'
|
||||
env:
|
||||
ENCODED_STRING: ${{ secrets.KEYSTORE_BASE_64 }}
|
||||
RELEASE_KEYSTORE_PASSWORD: ${{ secrets.RELEASE_KEYSTORE_PASSWORD }}
|
||||
@@ -131,7 +151,7 @@ jobs:
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: "zulu"
|
||||
java-version: "21"
|
||||
java-version: "17"
|
||||
cache: "gradle"
|
||||
check-latest: true
|
||||
|
||||
@@ -147,36 +167,16 @@ jobs:
|
||||
- name: Get dependencies
|
||||
run: flutter pub get
|
||||
|
||||
- name: Build Android APK (PRs)
|
||||
if: needs.fetch-info.outputs.build_type == 'development'
|
||||
run: |
|
||||
flutter build apk --debug --split-per-abi --build-number=${{github.run_number}} --flavor production
|
||||
|
||||
- name: Build Android APK and AAB
|
||||
if: needs.fetch-info.outputs.build_type != 'development'
|
||||
run: |
|
||||
flutter build apk --release --split-per-abi --build-number=${{github.run_number}} --flavor production
|
||||
flutter build apk --release --build-number=${{github.run_number}} --flavor production
|
||||
flutter build appbundle --release --build-number=${{github.run_number}} --flavor production
|
||||
|
||||
- name: Rename APK for PR
|
||||
if: needs.fetch-info.outputs.build_type == 'development'
|
||||
run: |
|
||||
mkdir -p build/app/outputs/android_artifacts
|
||||
# Move split debug APKs
|
||||
cp build/app/outputs/flutter-apk/app-armeabi-v7a-production-debug.apk build/app/outputs/android_artifacts/${{ env.ARTIFACT_SUFFIX }}-armeabi-v7a.apk || true
|
||||
cp build/app/outputs/flutter-apk/app-arm64-v8a-production-debug.apk build/app/outputs/android_artifacts/${{ env.ARTIFACT_SUFFIX }}-arm64-v8a.apk || true
|
||||
cp build/app/outputs/flutter-apk/app-x86_64-production-debug.apk build/app/outputs/android_artifacts/${{ env.ARTIFACT_SUFFIX }}-x86_64.apk || true
|
||||
|
||||
- name: Rename APK and AAB
|
||||
if: needs.fetch-info.outputs.build_type != 'development'
|
||||
run: |
|
||||
mkdir -p build/app/outputs/android_artifacts
|
||||
# Move split APKs
|
||||
cp build/app/outputs/flutter-apk/app-armeabi-v7a-production-release.apk build/app/outputs/android_artifacts/${{ env.ARTIFACT_SUFFIX }}-armeabi-v7a.apk || true
|
||||
cp build/app/outputs/flutter-apk/app-arm64-v8a-production-release.apk build/app/outputs/android_artifacts/${{ env.ARTIFACT_SUFFIX }}-arm64-v8a.apk || true
|
||||
cp build/app/outputs/flutter-apk/app-x86_64-production-release.apk build/app/outputs/android_artifacts/${{ env.ARTIFACT_SUFFIX }}-x86_64.apk || true
|
||||
# Move AAB
|
||||
mv build/app/outputs/bundle/productionRelease/app-production-release.aab build/app/outputs/android_artifacts/${{ env.ARTIFACT_SUFFIX }}.aab
|
||||
mv build/app/outputs/flutter-apk/app-production-release.apk "build/app/outputs/android_artifacts/${{ env.ARTIFACT_SUFFIX }}.apk"
|
||||
mv build/app/outputs/bundle/productionRelease/app-production-release.aab "build/app/outputs/android_artifacts/${{ env.ARTIFACT_SUFFIX }}.aab"
|
||||
|
||||
- name: Archive Android artifacts
|
||||
uses: actions/[email protected]
|
||||
@@ -230,6 +230,10 @@ jobs:
|
||||
needs: [fetch-info]
|
||||
|
||||
steps:
|
||||
# - uses: maxim-lobanov/[email protected]
|
||||
# with:
|
||||
# xcode-version: latest-stable
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/[email protected]
|
||||
|
||||
@@ -327,18 +331,18 @@ jobs:
|
||||
- name: Get packages
|
||||
run: |
|
||||
sudo apt-get update -y
|
||||
sudo apt-get install -y ninja-build libgtk-3-dev libx11-dev libxi-dev libmpv-dev patchelf cmake clang libfuse2
|
||||
sudo apt-get install -y ninja-build libgtk-3-dev libmpv-dev patchelf cmake clang libfuse2
|
||||
|
||||
- name: Build Linux app
|
||||
run: flutter build linux --release --build-number=${{ github.run_number }}
|
||||
|
||||
- name: Fix RPATH
|
||||
run: |
|
||||
for lib in "build/linux/x64/release/bundle"/*.so; do
|
||||
for lib in "build/linux/x64/release/bundle/lib"/*.so; do
|
||||
[[ -f "$lib" && -n "$(patchelf --print-rpath "$lib")" ]] && \
|
||||
patchelf --set-rpath '$ORIGIN' "$lib"
|
||||
done
|
||||
patchelf --set-rpath '$ORIGIN/lib' "build/linux/x64/release/bundle/fladder"
|
||||
patchelf --set-rpath '$ORIGIN/lib' "build/linux/x64/release/bundle/Fladder"
|
||||
|
||||
- name: Archive Linux artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
@@ -451,6 +455,7 @@ jobs:
|
||||
contents: write
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
if: needs.fetch-info.outputs.build_type == 'nightly'
|
||||
uses: actions/[email protected]
|
||||
with:
|
||||
fetch-depth: 0
|
||||
@@ -485,35 +490,41 @@ jobs:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Generate changelog
|
||||
if: needs.fetch-info.outputs.build_type == 'nightly'
|
||||
id: changelog
|
||||
run: |
|
||||
PREVIOUS_RELEASE=$(git tag --list 'v*' --sort=-v:refname | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | grep -vx "${{ github.ref_name }}" | head -1 || echo "")
|
||||
RANGE=${PREVIOUS_RELEASE:+$PREVIOUS_RELEASE..}HEAD
|
||||
# Get the latest stable release tag for comparison
|
||||
LATEST_STABLE_RELEASE=$(gh release list --limit 50 --exclude-drafts --json tagName,isPrerelease --jq '.[] | select(.isPrerelease == false) | .tagName' | head -1 || echo "")
|
||||
|
||||
if [[ "${{ needs.fetch-info.outputs.build_type }}" == "nightly" ]]; then
|
||||
cat > changelog.md <<-EOF
|
||||
# Create new changelog with comparison link
|
||||
cat > changelog.md <<-EOF
|
||||
# $(date -u "+%Y-%m-%d %H:%M:%S UTC")
|
||||
|
||||
This is an automated nightly build containing the latest changes from the develop branch.
|
||||
|
||||
**⚠️ Warning:** This is a development build and may contain bugs or incomplete features.
|
||||
EOF
|
||||
|
||||
# Add comparison link if we have a latest stable release
|
||||
if [ -n "$LATEST_STABLE_RELEASE" ]; then
|
||||
cat >> changelog.md <<-EOF
|
||||
|
||||
## 📋 What's Changed
|
||||
|
||||
See all changes since the latest release: [Compare $LATEST_STABLE_RELEASE...HEAD](https://github.com/${{ github.repository }}/compare/$LATEST_STABLE_RELEASE...HEAD)
|
||||
EOF
|
||||
else
|
||||
: > changelog.md
|
||||
fi
|
||||
|
||||
echo "## 📋 What's Changed" >> changelog.md
|
||||
echo "" >> changelog.md
|
||||
python3 .github/scripts/changelog.py "$RANGE" >> changelog.md
|
||||
|
||||
if [ -n "$PREVIOUS_RELEASE" ]; then
|
||||
echo "**Full Changelog:** https://github.com/${{ github.repository }}/compare/$PREVIOUS_RELEASE...${{ github.ref_name }}" >> changelog.md
|
||||
fi
|
||||
|
||||
if [[ "${{ needs.fetch-info.outputs.build_type }}" == "nightly" ]]; then
|
||||
cat >> changelog.md <<-EOF
|
||||
|
||||
## 📋 What's Changed
|
||||
|
||||
See all changes: [View commits](https://github.com/${{ github.repository }}/commits/develop)
|
||||
EOF
|
||||
fi
|
||||
|
||||
# Add build metadata
|
||||
cat >> changelog.md <<-EOF
|
||||
|
||||
---
|
||||
|
||||
📅 **Build Date:** $(date -u "+%Y-%m-%d %H:%M:%S UTC")
|
||||
@@ -521,7 +532,10 @@ jobs:
|
||||
📝 **Commit:** ${{ github.sha }}
|
||||
🌿 **Branch:** develop
|
||||
EOF
|
||||
fi
|
||||
|
||||
echo "changelog_file=changelog.md" >> $GITHUB_OUTPUT
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Download Artifacts Android
|
||||
uses: actions/download-artifact@v4
|
||||
@@ -531,9 +545,7 @@ jobs:
|
||||
|
||||
- name: Move Android
|
||||
run: |
|
||||
mv fladder-android/${{ needs.build-android.outputs.artifact_suffix }}-armeabi-v7a.apk Fladder-Android-${{ steps.version.outputs.version }}-armeabi-v7a.apk || true
|
||||
mv fladder-android/${{ needs.build-android.outputs.artifact_suffix }}-arm64-v8a.apk Fladder-Android-${{ steps.version.outputs.version }}-arm64-v8a.apk || true
|
||||
mv fladder-android/${{ needs.build-android.outputs.artifact_suffix }}-x86_64.apk Fladder-Android-${{ steps.version.outputs.version }}-x86_64.apk || true
|
||||
mv fladder-android/${{ needs.build-android.outputs.artifact_suffix }}.apk Fladder-Android-${{ steps.version.outputs.version }}.apk
|
||||
mv fladder-android/${{ needs.build-android.outputs.artifact_suffix }}.aab Fladder-Android-${{ steps.version.outputs.version }}.aab
|
||||
|
||||
- name: Download Windows portable artifact
|
||||
@@ -586,12 +598,14 @@ jobs:
|
||||
zip -r ../Fladder-Linux-${{ steps.version.outputs.version }}.zip .
|
||||
|
||||
- name: Download Artifacts Linux Flatpak
|
||||
if: needs.fetch-info.outputs.build_type == 'release'
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: fladder-linux-flatpak
|
||||
path: fladder-linux-flatpak
|
||||
|
||||
- name: Move Linux Flatpak
|
||||
if: needs.fetch-info.outputs.build_type == 'release'
|
||||
run: mv fladder-linux-flatpak/Fladder-Linux.flatpak Fladder-Linux-${{ steps.version.outputs.version }}.flatpak
|
||||
|
||||
- name: Download Artifacts Linux AppImage
|
||||
@@ -620,15 +634,14 @@ jobs:
|
||||
with:
|
||||
tag_name: ${{ needs.fetch-info.outputs.build_type == 'nightly' && env.NIGHTLY_TAG || github.ref_name }}
|
||||
name: ${{ needs.fetch-info.outputs.build_type == 'nightly' && format('🌙 Nightly Build - {0}', steps.version.outputs.version) || '' }}
|
||||
body_path: changelog.md
|
||||
body_path: ${{ needs.fetch-info.outputs.build_type == 'nightly' && 'changelog.md' || '' }}
|
||||
draft: ${{ needs.fetch-info.outputs.build_type == 'release' }}
|
||||
prerelease: ${{ needs.fetch-info.outputs.build_type == 'nightly' }}
|
||||
make_latest: ${{ needs.fetch-info.outputs.build_type == 'release' }}
|
||||
generate_release_notes: ${{ needs.fetch-info.outputs.build_type == 'release' }}
|
||||
fail_on_unmatched_files: true
|
||||
files: |
|
||||
Fladder-Android-${{ steps.version.outputs.version }}-arm64-v8a.apk
|
||||
Fladder-Android-${{ steps.version.outputs.version }}-armeabi-v7a.apk
|
||||
Fladder-Android-${{ steps.version.outputs.version }}-x86_64.apk
|
||||
Fladder-Android-${{ steps.version.outputs.version }}.apk
|
||||
Fladder-Android-${{ steps.version.outputs.version }}.aab
|
||||
Fladder-Windows-${{ steps.version.outputs.version }}-Setup.exe
|
||||
Fladder-Windows-${{ steps.version.outputs.version }}.zip
|
||||
@@ -638,6 +651,15 @@ jobs:
|
||||
Fladder-Linux-${{ steps.version.outputs.version }}.zip
|
||||
Fladder-Linux-${{ steps.version.outputs.version }}.AppImage
|
||||
Fladder-Linux-${{ steps.version.outputs.version }}.AppImage.zsync
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Add Flatpak to release
|
||||
if: needs.fetch-info.outputs.build_type == 'release'
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
tag_name: ${{ github.ref_name }}
|
||||
files: |
|
||||
Fladder-Linux-${{ steps.version.outputs.version }}.flatpak
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -720,3 +742,27 @@ jobs:
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
publish_dir: ./build/web
|
||||
|
||||
# Winget package submission
|
||||
# winget-package-submit:
|
||||
# runs-on: ubuntu-latest
|
||||
# needs: [check-trigger, create_release]
|
||||
# strategy:
|
||||
# matrix:
|
||||
# include:
|
||||
# - build_type: release
|
||||
# identifier: DonutWare.Fladder
|
||||
# max_versions: "0"
|
||||
# - build_type: nightly
|
||||
# identifier: DonutWare.Fladder.Nightly
|
||||
# max_versions: "1"
|
||||
# steps:
|
||||
# - name: Submit to Winget (${{ matrix.build_type }})
|
||||
# if: needs.check-trigger.outputs.build_type == matrix.build_type
|
||||
# uses: vedantmgoyal9/winget-releaser@19e706d4c9121098010096f9c495a70a7518b30f
|
||||
# with:
|
||||
# identifier: ${{ matrix.identifier }}
|
||||
# installers-regex: 'Fladder-Windows-.*-Setup\.exe$'
|
||||
# token: ${{ secrets.WINGET_TOKEN }}
|
||||
# max-versions-to-keep: ${{ matrix.max_versions || '' }}
|
||||
# release-tag: ${{ matrix.build_type == 'nightly' && env.NIGHTLY_TAG || github.ref_name }}
|
||||
@@ -10,9 +10,6 @@ jobs:
|
||||
linting:
|
||||
name: Linting & Formatting
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/[email protected]
|
||||
@@ -39,9 +36,7 @@ jobs:
|
||||
- name: Setup Dart
|
||||
uses: dart-lang/setup-dart@v1
|
||||
|
||||
- name: Analyze Flutter
|
||||
uses: ValentinVignal/action-dart-analyze@v2.0
|
||||
- name: Analyze Dart
|
||||
uses: invertase/github-action-dart-analyzer@v3
|
||||
with:
|
||||
emojis: false
|
||||
fail-on: info
|
||||
line-length: 120
|
||||
custom-lint: true
|
||||
@@ -1,94 +0,0 @@
|
||||
name: Prepare Release
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
prepare-release:
|
||||
name: Update Metadata and Tag
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Generate Bot Token
|
||||
id: generate-token
|
||||
uses: actions/[email protected]
|
||||
with:
|
||||
app-id: ${{ secrets.FLADDER_BOT_APP_ID }}
|
||||
private-key: ${{ secrets.FLADDER_BOT_APP_PRIVATE_KEY }}
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/[email protected]
|
||||
with:
|
||||
ref: develop
|
||||
fetch-depth: 0
|
||||
token: ${{ steps.generate-token.outputs.token }}
|
||||
|
||||
- name: Extract Version
|
||||
id: version
|
||||
run: |
|
||||
# Extract version from pubspec.yaml (e.g., 0.10.3+1)
|
||||
FULL_VERSION=$(grep '^version: ' pubspec.yaml | sed 's/version: //')
|
||||
# Remove build number (e.g., 0.10.3)
|
||||
VERSION_NAME=$(echo "$FULL_VERSION" | cut -d'+' -f1)
|
||||
# Exact Build Number (e.g., 1)
|
||||
BUILD_NUMBER=$(echo "$FULL_VERSION" | cut -d'+' -f2)
|
||||
|
||||
echo "version=${VERSION_NAME}" >> "$GITHUB_OUTPUT"
|
||||
echo "build_number=${BUILD_NUMBER}" >> "$GITHUB_OUTPUT"
|
||||
echo "Version: $VERSION_NAME (Build: $BUILD_NUMBER)"
|
||||
|
||||
# Check if this version is already tagged
|
||||
if git rev-parse "v${VERSION_NAME}" >/dev/null 2>&1; then
|
||||
echo "is_new_version=false" >> "$GITHUB_OUTPUT"
|
||||
echo "Status: Version is already tagged."
|
||||
else
|
||||
echo "is_new_version=true" >> "$GITHUB_OUTPUT"
|
||||
echo "Status: New version detected."
|
||||
fi
|
||||
|
||||
- name: Update metainfo.xml
|
||||
if: steps.version.outputs.is_new_version == 'true'
|
||||
env:
|
||||
CHANGELOG_MSG: "See the full changelog at: https://github.com/${{ github.repository }}/releases/tag/v${{ steps.version.outputs.version }}"
|
||||
run: |
|
||||
VERSION="${{ steps.version.outputs.version }}"
|
||||
DATE=$(date +%Y-%m-%d)
|
||||
NEW_RELEASE=" <releases>\n <release version=\"${VERSION}\" date=\"${DATE}\">\n <description>\n <p>${{ env.CHANGELOG_MSG }}</p>\n </description>\n </release>\n </releases>"
|
||||
perl -i -0777 -pe "s@ <releases>.*?</releases>@$NEW_RELEASE@s" flatpak/nl.jknaapen.fladder.metainfo.xml
|
||||
|
||||
- name: Update Fastlane Changelog
|
||||
if: steps.version.outputs.is_new_version == 'true'
|
||||
env:
|
||||
CHANGELOG_MSG: "See the full changelog at: https://github.com/${{ github.repository }}/releases/tag/v${{ steps.version.outputs.version }}"
|
||||
run: |
|
||||
VERSION="${{ steps.version.outputs.version }}"
|
||||
mkdir -p fastlane/metadata/android/en-US/changelogs
|
||||
printf '%s' "${{ env.CHANGELOG_MSG }}" > "fastlane/metadata/android/en-US/changelogs/${VERSION}.txt"
|
||||
|
||||
- name: Commit, Merge and Tag
|
||||
if: steps.version.outputs.is_new_version == 'true'
|
||||
run: |
|
||||
git config user.name "Fladder Bot"
|
||||
git config user.email "fladder-bot[bot]@users.noreply.github.com"
|
||||
|
||||
VERSION="v${{ steps.version.outputs.version }}"
|
||||
|
||||
# 1. Commit metadata to develop
|
||||
git add flatpak/nl.jknaapen.fladder.metainfo.xml
|
||||
git add fastlane/metadata/android/en-US/changelogs/
|
||||
|
||||
if git diff --staged --quiet; then
|
||||
echo "No changes to metadata"
|
||||
else
|
||||
git commit -m "chore: prepare release $VERSION"
|
||||
git push origin develop
|
||||
fi
|
||||
|
||||
# 2. Merge develop into main
|
||||
git fetch origin main
|
||||
git checkout main
|
||||
git merge develop --no-ff -m "chore: merge develop into main for $VERSION"
|
||||
git push origin main
|
||||
|
||||
# 3. Create and push the tag on main
|
||||
git tag "$VERSION"
|
||||
git push origin "$VERSION"
|
||||
@@ -1,18 +0,0 @@
|
||||
name: Validate Fastlane Metadata
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- "fastlane/**"
|
||||
push:
|
||||
branches:
|
||||
- develop
|
||||
paths:
|
||||
- "fastlane/**"
|
||||
|
||||
jobs:
|
||||
validate:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/[email protected]
|
||||
- uses: ashutoshgngwr/[email protected]
|
||||
@@ -78,5 +78,3 @@ Output
|
||||
|
||||
# Generated localizations
|
||||
lib/l10n/generated
|
||||
android/build/reports/problems/
|
||||
android/.kotlin/sessions/*
|
||||
@@ -5,11 +5,9 @@
|
||||
"Jellyfin",
|
||||
"LTRB",
|
||||
"LTWH",
|
||||
"outro",
|
||||
"seerr",
|
||||
"Seerr"
|
||||
"outro"
|
||||
],
|
||||
"dart.flutterSdkPath": ".fvm/versions/3.50.0",
|
||||
"dart.flutterSdkPath": ".fvm/versions/3.35.1",
|
||||
"search.exclude": {
|
||||
"**/.fvm": true
|
||||
},
|
||||
|
||||
@@ -138,51 +138,6 @@
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "Format Unstaged Dart Files",
|
||||
"type": "shell",
|
||||
"command": "bash",
|
||||
"args": [
|
||||
"-c",
|
||||
"git diff --name-only --diff-filter=d -- \"*.dart\" | xargs -r dart format --line-length=120"
|
||||
],
|
||||
"windows": {
|
||||
"command": "powershell",
|
||||
"args": [
|
||||
"-Command",
|
||||
"$files = git diff --name-only --diff-filter=d -- \"*.dart\"; if ($files) { dart format --line-length=120 $files }"
|
||||
]
|
||||
},
|
||||
"group": "build",
|
||||
"problemMatcher": [],
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "Build Web and Docker Image",
|
||||
"type": "shell",
|
||||
"command": "bash",
|
||||
"args": [
|
||||
"-c",
|
||||
"flutter build web --release && docker build -t fladder:latest ."
|
||||
],
|
||||
"windows": {
|
||||
"command": "powershell",
|
||||
"args": [
|
||||
"-Command",
|
||||
"flutter build web; if ($?) { docker build -t fladder:latest . }"
|
||||
]
|
||||
},
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
},
|
||||
"problemMatcher": [],
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}"
|
||||
}
|
||||
}
|
||||
],
|
||||
}
|
||||
@@ -18,7 +18,7 @@ AppDir:
|
||||
name: Fladder
|
||||
icon: fladder_icon_desktop
|
||||
version: latest
|
||||
exec: fladder
|
||||
exec: Fladder
|
||||
exec_args: $@
|
||||
files:
|
||||
include:
|
||||
|
||||
@@ -48,21 +48,17 @@ sudo apt install libmpv-dev
|
||||
Generate build files (e.g., for `json_serializable`, `freezed`, etc.):
|
||||
|
||||
```bash
|
||||
dart run build_runner build
|
||||
flutter pub run build_runner build
|
||||
```
|
||||
|
||||
> Tip: Use `watch` for continuous builds during development:
|
||||
```bash
|
||||
dart run build_runner watch
|
||||
flutter pub run build_runner watch
|
||||
```
|
||||
Update localization definitions:
|
||||
```bash
|
||||
flutter gen-l10n
|
||||
```
|
||||
Format files to spec:
|
||||
```bash
|
||||
dart format --line-length 120 ./lib/
|
||||
```
|
||||
|
||||
## 🌐 Using a demo Server
|
||||
You can use a fake server from Jellyfin.
|
||||
|
||||
@@ -3,16 +3,9 @@ FROM nginx:alpine
|
||||
EXPOSE 80
|
||||
|
||||
ENV BASE_URL=""
|
||||
ENV SEERR_BASE_URL=""
|
||||
ENV SEERR_HEADER="null"
|
||||
ENV FLADDER_WEBPATH="/"
|
||||
|
||||
COPY build/web /usr/share/nginx/html
|
||||
COPY docker-entrypoint.sh /docker-entrypoint.sh
|
||||
|
||||
RUN mkdir -p /usr/share/nginx/html/assets/config && \
|
||||
chown -R nginx:nginx /usr/share/nginx/html && \
|
||||
chmod +x /docker-entrypoint.sh && \
|
||||
chown -R nginx:nginx /etc/nginx/conf.d
|
||||
RUN echo '{"baseUrl": "${BASE_URL}"}' > /usr/share/nginx/html/assets/config/config.json
|
||||
|
||||
CMD ["/docker-entrypoint.sh"]
|
||||
CMD /bin/sh -c 'sed -i "s|\${BASE_URL}|${BASE_URL}|g" /usr/share/nginx/html/assets/config/config.json && nginx -g "daemon off;"'
|
||||
@@ -3,18 +3,14 @@ FROM ghcr.io/nginxinc/nginx-unprivileged:stable-alpine-slim
|
||||
EXPOSE 8080
|
||||
|
||||
ENV BASE_URL=""
|
||||
ENV SEERR_BASE_URL=""
|
||||
ENV SEERR_HEADER="null"
|
||||
ENV FLADDER_WEBPATH="/"
|
||||
|
||||
USER root
|
||||
COPY build/web /usr/share/nginx/html
|
||||
COPY docker-entrypoint.sh /docker-entrypoint.sh
|
||||
RUN mkdir -p /usr/share/nginx/html/assets/config && \
|
||||
chown -R nginx:nginx /usr/share/nginx/html && \
|
||||
chmod +x /docker-entrypoint.sh && \
|
||||
chown nginx:nginx /docker-entrypoint.sh && \
|
||||
chown -R nginx:nginx /etc/nginx/conf.d
|
||||
RUN chown -R nginx:nginx /usr/share/nginx/html
|
||||
|
||||
USER nginx
|
||||
CMD ["/docker-entrypoint.sh"]
|
||||
RUN mkdir -p /usr/share/nginx/html/assets/config && \
|
||||
echo '{"baseUrl": "${BASE_URL}"}' > /usr/share/nginx/html/assets/config/config.json
|
||||
|
||||
USER root
|
||||
CMD /bin/sh -c 'sed -i "s|\${BASE_URL}|${BASE_URL}|g" /usr/share/nginx/html/assets/config/config.json && nginx -g "daemon off;"'
|
||||
@@ -0,0 +1,29 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.5.2.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tizen", "tizen", "{A388AB0E-F47B-31FD-1F3C-3AE867F75632}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Runner", "tizen\Runner.csproj", "{11CBC428-FFDB-ECCF-FBBF-1DB39BFFB147}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{11CBC428-FFDB-ECCF-FBBF-1DB39BFFB147}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{11CBC428-FFDB-ECCF-FBBF-1DB39BFFB147}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{11CBC428-FFDB-ECCF-FBBF-1DB39BFFB147}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{11CBC428-FFDB-ECCF-FBBF-1DB39BFFB147}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{11CBC428-FFDB-ECCF-FBBF-1DB39BFFB147} = {A388AB0E-F47B-31FD-1F3C-3AE867F75632}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {38085DC2-CEE5-4C57-8CBF-1D53D4E7A0F4}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -7,7 +7,6 @@ Platform-specific installation instructions can be found in this document.
|
||||
- [Windows](#windows)
|
||||
- [macOS](#macos)
|
||||
- [Linux](#linux)
|
||||
- [Flatpak](#flatpak)
|
||||
- [Ubuntu/Debian](#ubuntudebian)
|
||||
- [Arch](#arch)
|
||||
- [Fedora](#fedora)
|
||||
@@ -45,13 +44,8 @@ Run `fladder.exe` to start the application.
|
||||
|
||||
## Linux
|
||||
|
||||
### Flatpak
|
||||
|
||||
Fladder is available on Flathub.
|
||||
|
||||
<a href='https://flathub.org/apps/nl.jknaapen.fladder'><img alt='Get it on Flathub' src='https://flathub.org/api/badge?locale=en' width=192/></a>
|
||||
|
||||
You can also download the latest `.flatpak` file from the [Releases](https://github.com/DonutWare/Fladder/releases) page and install it manually.
|
||||
> [!NOTE]
|
||||
> You can install Fladder using Flatpak if you prefer an easier installation method. Download the latest `.flatpak` file from the [Releases](https://github.com/DonutWare/Fladder/releases) page to get started.
|
||||
|
||||
### Ubuntu/Debian
|
||||
|
||||
@@ -83,7 +77,7 @@ Open a terminal and `cd` to the directory where you extracted Fladder to. Run `.
|
||||
## Android
|
||||
|
||||
> [!IMPORTANT]
|
||||
> Alpha support added in v0.8.0 and contributions to add further support are always appreciated.
|
||||
> This app is currently not compatible with Android TV, however contributions to add support are always appreciated.
|
||||
### Play Store
|
||||
|
||||
This is the recommended way to install Fladder on Android.
|
||||
@@ -147,17 +141,6 @@ Run `docker-compose up -d` to start the container. It will be available on `http
|
||||
> [!TIP]
|
||||
> We recommend changing the `BASE_URL` environment variable to the URL you use to access Jellyfin, as this will skip entering it when you load the web UI.
|
||||
|
||||
You can also preconfigure Seerr with this environment variable:
|
||||
|
||||
- `SEERR_BASE_URL`: String URL for your Seerr/Jellyseerr instance.
|
||||
|
||||
Example:
|
||||
|
||||
```env
|
||||
BASE_URL=https://jellyfin.example.com
|
||||
SEERR_BASE_URL=https://seerr.example.com
|
||||
```
|
||||
|
||||
## Web
|
||||
|
||||
You can also manually copy the web .zip build to any static file server such as Nginx, Caddy, or Apache
|
||||
@@ -165,14 +148,3 @@ You can also manually copy the web .zip build to any static file server such as
|
||||
> [!TIP]
|
||||
> You can preconfigure Fladder by placing a config file in [assets/config/config.json](https://github.com/DonutWare/Fladder/blob/develop/config/config.json)
|
||||
|
||||
`config.json` options:
|
||||
|
||||
```json
|
||||
{
|
||||
"baseUrl": "https://jellyfin.example.com",
|
||||
"seerrBaseUrl": "https://seerr.example.com"
|
||||
}
|
||||
```
|
||||
|
||||
- `baseUrl`: String. Presets Jellyfin URL on login.
|
||||
- `seerrBaseUrl`: String. Presets Seerr URL in personal settings.
|
||||
@@ -7,7 +7,7 @@
|
||||
<br>
|
||||
</h1>
|
||||
|
||||
<h4 align="center">A cross-platform Jellyfin Frontend built on top of <a href="https://flutter.dev/" target="_blank">Flutter</a>.</h4>
|
||||
<h4 align="center">A Simple Jellyfin Frontend built on top of <a href="https://flutter.dev/" target="_blank">Flutter</a>.</h4>
|
||||
|
||||
<p align="center">
|
||||
<a href="#key-features">Key Features</a> •
|
||||
@@ -45,8 +45,6 @@
|
||||
* Keyboard shortcuts
|
||||
* Adaptive layout for all platforms
|
||||
* Next-up overview when watching a queue
|
||||
* Server management
|
||||
* Seerr/Jellyseerr integration
|
||||
* Platforms
|
||||
- Android + TV
|
||||
- Web + Docker
|
||||
@@ -102,9 +100,9 @@ Web/Desktop [try out the web build!](https://DonutWare.github.io/Fladder)
|
||||
|
||||
## Planned Features
|
||||
|
||||
* Chromecast support
|
||||
* Improved dPad navigation for non-tv devices
|
||||
* [And more???](https://github.com/DonutWare/Fladder/discussions/categories/ideas)
|
||||
* Music playback
|
||||
* Server management
|
||||
* And more???
|
||||
|
||||
## Download
|
||||
|
||||
@@ -114,8 +112,7 @@ You can pull the Docker version using the following tags: ```ghcr.io/donutware/f
|
||||
|
||||
*Platform-specific installation and usage instructions can be found [here](https://github.com/DonutWare/Fladder/blob/develop/INSTALL.md).*
|
||||
|
||||
<a href='https://play.google.com/store/apps/details?id=nl.jknaapen.fladder&pcampaignid=pcampaignidMKT-Other-global-all-co-prtnr-py-PartBadge-Mar2515-1'><img alt='Get it on Google Play' src='https://play.google.com/intl/en_us/badges/static/images/badges/en_badge_web_generic.png' width=250 align='middle'/></a>
|
||||
<a href='https://flathub.org/apps/nl.jknaapen.fladder'><img alt='Get it on Flathub' src='https://flathub.org/api/badge?locale=en' width=192 align='middle'/></a>
|
||||
<a href='https://play.google.com/store/apps/details?id=nl.jknaapen.fladder&pcampaignid=pcampaignidMKT-Other-global-all-co-prtnr-py-PartBadge-Mar2515-1'><img alt='Get it on Google Play' src='https://play.google.com/intl/en_us/badges/static/images/badges/en_badge_web_generic.png' width=250/></a>
|
||||
|
||||
> [!WARNING]
|
||||
> (Windows) Some flutter applications are marked as false positives by windows defender for more info see [this issue](https://github.com/DonutWare/Fladder/issues/197#issuecomment-2568906874).
|
||||
@@ -149,3 +146,5 @@ This software uses the following open source packages:
|
||||
## License
|
||||
|
||||
This project is licensed under the GNU General Public License v3.0. More information about the license can be found in [this file](https://github.com/DonutWare/Fladder/blob/develop/LICENSE).
|
||||
|
||||
|
||||
@@ -9,22 +9,17 @@ analyzer:
|
||||
- packages/**
|
||||
- lib/jellyfin/**
|
||||
- lib/**/**.g.dart
|
||||
- lib/**/**.gr.dart
|
||||
- lib/**/**.freezed.dart
|
||||
- lib/**/**.mapped.dart
|
||||
- lib/l10n/**
|
||||
- android/**
|
||||
- ios/**
|
||||
- web/**
|
||||
- windows/**
|
||||
- macos/**
|
||||
- linux/**
|
||||
strong-mode:
|
||||
implicit-casts: false
|
||||
implicit-dynamic: false
|
||||
language:
|
||||
# strict-casts: false
|
||||
# strict-raw-types: true
|
||||
plugins:
|
||||
- custom_lint
|
||||
|
||||
linter:
|
||||
rules:
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
plugins {
|
||||
id "com.android.application"
|
||||
id "kotlin-android"
|
||||
id "org.jetbrains.kotlin.plugin.compose"
|
||||
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
|
||||
id "dev.flutter.flutter-gradle-plugin"
|
||||
@@ -46,28 +47,34 @@ android {
|
||||
}
|
||||
}
|
||||
namespace = "nl.jknaapen.fladder"
|
||||
compileSdk = 37
|
||||
compileSdk = flutter.compileSdkVersion
|
||||
ndkVersion = flutter.ndkVersion
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
targetCompatibility = JavaVersion.VERSION_17
|
||||
// Required for java 8+ library desugaring (flutter_local_notifications and others)
|
||||
coreLibraryDesugaringEnabled true
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
buildFeatures {
|
||||
compose = true
|
||||
}
|
||||
|
||||
kotlinOptions {
|
||||
jvmTarget = "1.8"
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
applicationId = "nl.jknaapen.fladder"
|
||||
minSdkVersion flutter.minSdkVersion
|
||||
targetSdk = 37
|
||||
targetSdk = flutter.targetSdkVersion
|
||||
versionCode = flutter.versionCode
|
||||
versionName = flutter.versionName
|
||||
}
|
||||
|
||||
composeOptions {
|
||||
kotlinCompilerExtensionVersion '1.6.4'
|
||||
}
|
||||
|
||||
signingConfigs {
|
||||
release {
|
||||
storeFile file('keystore.jks')
|
||||
@@ -80,17 +87,8 @@ android {
|
||||
release {
|
||||
minifyEnabled true
|
||||
shrinkResources true
|
||||
proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
|
||||
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
|
||||
signingConfig signingConfigs.release
|
||||
|
||||
packagingOptions {
|
||||
resources {
|
||||
excludes += ["assets/dexopt/baseline.prof", "assets/dexopt/baseline.profm"]
|
||||
}
|
||||
}
|
||||
}
|
||||
profile {
|
||||
debuggable false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,42 +105,33 @@ android {
|
||||
}
|
||||
}
|
||||
|
||||
kotlin {
|
||||
compilerOptions {
|
||||
jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17
|
||||
}
|
||||
}
|
||||
|
||||
flutter {
|
||||
source = "../.."
|
||||
}
|
||||
|
||||
dependencies {
|
||||
def composeBom = platform('androidx.compose:compose-bom:2025.12.00')
|
||||
def composeBom = platform('androidx.compose:compose-bom:2025.09.01')
|
||||
implementation composeBom
|
||||
androidTestImplementation composeBom
|
||||
implementation('androidx.compose.material3:material3')
|
||||
implementation('androidx.compose.ui:ui-tooling-preview')
|
||||
debugImplementation('androidx.compose.ui:ui-tooling')
|
||||
implementation('androidx.activity:activity-compose:1.12.1')
|
||||
|
||||
// Required for Java 8+ desugaring used by some libraries
|
||||
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.1.4'
|
||||
implementation('androidx.activity:activity-compose:1.11.0')
|
||||
|
||||
// Media3 (ExoPlayer)
|
||||
def media3_version = "1.11.1"
|
||||
def media3_version = "1.8.0+1"
|
||||
implementation("androidx.media3:media3-exoplayer:$media3_version")
|
||||
implementation("androidx.media3:media3-session:$media3_version")
|
||||
implementation("androidx.media3:media3-ui:$media3_version")
|
||||
|
||||
implementation("androidx.media3:media3-exoplayer-dash:$media3_version")
|
||||
implementation("androidx.media3:media3-exoplayer-hls:$media3_version")
|
||||
implementation("org.jellyfin.media3:media3-ffmpeg-decoder:1.9.0+1")
|
||||
implementation("io.github.peerless2012:ass-media:0.5.1")
|
||||
implementation("org.jellyfin.media3:media3-ffmpeg-decoder:$media3_version")
|
||||
implementation("io.github.peerless2012:ass-media:0.3.0-rc03")
|
||||
|
||||
//UI
|
||||
implementation("io.github.rabehx:iconsax-compose:0.0.5")
|
||||
implementation("io.github.rabehx:iconsax-compose:0.0.4")
|
||||
implementation("io.coil-kt.coil3:coil-compose:3.3.0")
|
||||
implementation("io.coil-kt.coil3:coil-network-okhttp:3.3.0")
|
||||
implementation("com.materialkolor:material-kolor:4.0.5")
|
||||
implementation("com.materialkolor:material-kolor:3.0.1")
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
-dontoptimize
|
||||
@@ -4,9 +4,4 @@
|
||||
to allow setting breakpoints, to provide hot reload, etc.
|
||||
-->
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
|
||||
<!-- Used for testing android tv on macos where impeller crashes the emulator -->
|
||||
<!-- <application>
|
||||
<meta-data android:name="io.flutter.embedding.android.EnableImpeller" android:value="false" />
|
||||
</application> -->
|
||||
</manifest>
|
||||
@@ -1,29 +1,46 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools" package="nl.jknaapen.fladder">
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="nl.jknaapen.fladder">
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_LOCAL_NETWORK" />
|
||||
<uses-permission android:name="android.permission.USE_BIOMETRIC" />
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK" />
|
||||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" />
|
||||
|
||||
<uses-feature android:name="android.hardware.touchscreen" android:required="false" />
|
||||
<uses-feature android:name="android.software.leanback" android:required="false" />
|
||||
<uses-feature
|
||||
android:name="android.hardware.touchscreen"
|
||||
android:required="false" />
|
||||
<uses-feature
|
||||
android:name="android.software.leanback"
|
||||
android:required="false" />
|
||||
|
||||
<application android:label="Fladder" android:name="${applicationName}" android:icon="@mipmap/ic_launcher" android:banner="@drawable/app_banner" android:usesCleartextTraffic="true" android:enableOnBackInvokedCallback="true" android:largeHeap="true">
|
||||
<application
|
||||
android:label="Fladder"
|
||||
android:name="${applicationName}"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:banner="@drawable/app_banner"
|
||||
android:usesCleartextTraffic="true"
|
||||
android:enableOnBackInvokedCallback="true"
|
||||
android:largeHeap="true">
|
||||
|
||||
<meta-data android:name="com.ryanheise.audioservice.notification_icon" android:resource="@drawable/ic_notification" />
|
||||
|
||||
<activity android:name=".MainActivity" android:exported="true" android:launchMode="singleTop" android:theme="@style/LaunchTheme" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" android:hardwareAccelerated="true" android:supportsPictureInPicture="true" android:windowSoftInputMode="adjustResize">
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="true"
|
||||
android:launchMode="singleTop"
|
||||
android:theme="@style/LaunchTheme"
|
||||
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
|
||||
android:hardwareAccelerated="true"
|
||||
android:windowSoftInputMode="adjustResize">
|
||||
<!-- Specifies an Android theme to apply to this Activity as soon as
|
||||
the Android process has started. This theme is visible to the user
|
||||
while the Flutter UI initializes. After that, this theme continues
|
||||
to determine the Window background behind the Flutter UI. -->
|
||||
<meta-data android:name="io.flutter.embedding.android.NormalTheme" android:resource="@style/NormalTheme" />
|
||||
<meta-data
|
||||
android:name="io.flutter.embedding.android.NormalTheme"
|
||||
android:resource="@style/NormalTheme" />
|
||||
|
||||
<!-- Launcher for phones/tablets -->
|
||||
<intent-filter>
|
||||
@@ -36,21 +53,27 @@
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LEANBACK_LAUNCHER" />
|
||||
</intent-filter>
|
||||
|
||||
<!-- Deep link scheme for AutoRoute (example: fladder://details?id=xyz) -->
|
||||
<meta-data android:name="flutter_deeplinking_enabled" android:value="false" />
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<data android:scheme="fladder" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity android:name=".VideoPlayerActivity" android:theme="@style/Theme.AppCompat.NoActionBar" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" android:hardwareAccelerated="true" android:supportsPictureInPicture="true" android:windowSoftInputMode="adjustResize" android:launchMode="singleTop" android:exported="true" />
|
||||
<activity
|
||||
android:name=".VideoPlayerActivity"
|
||||
android:theme="@style/Theme.AppCompat.NoActionBar"
|
||||
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
|
||||
android:hardwareAccelerated="true"
|
||||
android:supportsPictureInPicture="true"
|
||||
android:windowSoftInputMode="adjustResize"
|
||||
android:launchMode="singleTop"
|
||||
android:exported="true" />
|
||||
|
||||
<service android:name="androidx.work.impl.foreground.SystemForegroundService" android:foregroundServiceType="dataSync" tools:node="merge" />
|
||||
<service android:name="com.ryanheise.audioservice.AudioService" android:foregroundServiceType="mediaPlayback" android:exported="true" tools:ignore="Instantiatable">
|
||||
<service
|
||||
android:name="androidx.work.impl.foreground.SystemForegroundService"
|
||||
android:foregroundServiceType="dataSync"
|
||||
tools:node="merge" />
|
||||
<service
|
||||
android:name="com.ryanheise.audioservice.AudioService"
|
||||
android:foregroundServiceType="mediaPlayback"
|
||||
android:exported="true"
|
||||
tools:ignore="Instantiatable">
|
||||
<intent-filter>
|
||||
<action android:name="android.media.browse.MediaBrowserService" />
|
||||
</intent-filter>
|
||||
@@ -58,16 +81,17 @@
|
||||
|
||||
<!-- Don't delete the meta-data below.
|
||||
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
|
||||
<meta-data android:name="flutterEmbedding" android:value="2" />
|
||||
<meta-data
|
||||
android:name="flutterEmbedding"
|
||||
android:value="2" />
|
||||
|
||||
<receiver android:name="com.ryanheise.audioservice.MediaButtonReceiver" android:exported="true" tools:ignore="Instantiatable">
|
||||
<receiver
|
||||
android:name="com.ryanheise.audioservice.MediaButtonReceiver"
|
||||
android:exported="true"
|
||||
tools:ignore="Instantiatable">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MEDIA_BUTTON" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<provider android:name=".WallpaperFileProvider" android:authorities="${applicationId}.wallpaper_provider" android:exported="false" android:grantUriPermissions="true" tools:replace="android:authorities,android:name">
|
||||
<meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/wallpaper_file_paths" />
|
||||
</provider>
|
||||
</application>
|
||||
</manifest>
|
||||
@@ -1,8 +1,5 @@
|
||||
package nl.jknaapen.fladder
|
||||
|
||||
import BatteryOptimizationPigeon
|
||||
import FlutterError
|
||||
import LocalNetworkPermissionPigeon
|
||||
import NativeVideoActivity
|
||||
import PlayerSettingsPigeon
|
||||
import StartResult
|
||||
@@ -10,30 +7,15 @@ import TranslationsPigeon
|
||||
import VideoPlayerApi
|
||||
import VideoPlayerControlsCallback
|
||||
import VideoPlayerListenerCallback
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Intent
|
||||
import android.os.Build
|
||||
import android.os.PowerManager
|
||||
import android.net.Uri
|
||||
import android.util.Log
|
||||
import android.provider.Settings
|
||||
import androidx.activity.result.ActivityResultLauncher
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.core.content.FileProvider
|
||||
import com.ryanheise.audioservice.AudioServiceFragmentActivity
|
||||
import io.flutter.embedding.engine.FlutterEngine
|
||||
import nl.jknaapen.fladder.objects.PlayerSettingsObject
|
||||
import nl.jknaapen.fladder.objects.TranslationsMessenger
|
||||
import nl.jknaapen.fladder.objects.VideoPlayerObject
|
||||
import nl.jknaapen.fladder.utility.leanBackEnabled
|
||||
import androidx.core.net.toUri
|
||||
import nl.jknaapen.fladder.wallpaper.WallpaperApi
|
||||
import nl.jknaapen.fladder.wallpaper.WallpaperApiUtility
|
||||
import java.io.File
|
||||
import java.util.Objects
|
||||
|
||||
class WallpaperFileProvider : FileProvider()
|
||||
|
||||
class MainActivity : AudioServiceFragmentActivity(), NativeVideoActivity {
|
||||
private lateinit var videoPlayerLauncher: ActivityResultLauncher<Intent>
|
||||
@@ -47,10 +29,6 @@ class MainActivity : AudioServiceFragmentActivity(), NativeVideoActivity {
|
||||
flutterEngine.dartExecutor.binaryMessenger,
|
||||
this
|
||||
)
|
||||
WallpaperApi.setUp(
|
||||
flutterEngine.dartExecutor.binaryMessenger,
|
||||
WallpaperApiUtility(this, wallpaperLauncher)
|
||||
)
|
||||
VideoPlayerApi.setUp(
|
||||
flutterEngine.dartExecutor.binaryMessenger,
|
||||
videoPlayerHost.implementation
|
||||
@@ -69,27 +47,6 @@ class MainActivity : AudioServiceFragmentActivity(), NativeVideoActivity {
|
||||
api = PlayerSettingsObject
|
||||
)
|
||||
|
||||
BatteryOptimizationPigeon.setUp(
|
||||
flutterEngine.dartExecutor.binaryMessenger,
|
||||
api = object : BatteryOptimizationPigeon {
|
||||
override fun isIgnoringBatteryOptimizations(): Boolean {
|
||||
val pm = getSystemService(POWER_SERVICE) as PowerManager
|
||||
return pm.isIgnoringBatteryOptimizations(packageName)
|
||||
}
|
||||
|
||||
override fun openBatteryOptimizationSettings() {
|
||||
startActivity(Intent(Settings.ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS))
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
LocalNetworkPermissionPigeon.setUp(
|
||||
flutterEngine.dartExecutor.binaryMessenger,
|
||||
api = object : LocalNetworkPermissionPigeon {
|
||||
override fun getAndroidSdkInt(): Long = Build.VERSION.SDK_INT.toLong()
|
||||
}
|
||||
)
|
||||
|
||||
videoPlayerLauncher = registerForActivityResult(
|
||||
ActivityResultContracts.StartActivityForResult()
|
||||
) { result ->
|
||||
@@ -108,22 +65,12 @@ class MainActivity : AudioServiceFragmentActivity(), NativeVideoActivity {
|
||||
}
|
||||
}
|
||||
|
||||
override fun onNewIntent(intent: Intent) {
|
||||
super.onNewIntent(intent)
|
||||
// Ensure the Activity's intent is updated so Flutter (and plugins / AutoRoute) receive runtime deep-links.
|
||||
setIntent(intent)
|
||||
}
|
||||
|
||||
private val wallpaperLauncher = registerForActivityResult(
|
||||
ActivityResultContracts.StartActivityForResult()
|
||||
) { result ->
|
||||
// Handle the result of the wallpaper intent if needed
|
||||
}
|
||||
|
||||
override fun launchActivity(callback: (Result<StartResult>) -> Unit) {
|
||||
try {
|
||||
videoPlayerCallback = callback
|
||||
|
||||
val intent = Intent(this, VideoPlayerActivity::class.java)
|
||||
|
||||
videoPlayerLauncher.launch(intent)
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package nl.jknaapen.fladder
|
||||
|
||||
import android.graphics.PixelFormat
|
||||
import android.hardware.display.DisplayManager
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.view.WindowManager
|
||||
@@ -12,24 +11,15 @@ import androidx.annotation.OptIn
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.media3.common.util.UnstableApi
|
||||
import kotlinx.coroutines.launch
|
||||
import nl.jknaapen.fladder.composables.controls.CustomVideoControls
|
||||
import nl.jknaapen.fladder.composables.overlays.screensavers.ScreenSaver
|
||||
import nl.jknaapen.fladder.objects.VideoPlayerObject
|
||||
import nl.jknaapen.fladder.player.ExoPlayer
|
||||
import nl.jknaapen.fladder.utility.ScaledContent
|
||||
import nl.jknaapen.fladder.utility.applyRefreshRate
|
||||
import nl.jknaapen.fladder.utility.leanBackEnabled
|
||||
import nl.jknaapen.fladder.utility.resetRefreshRate
|
||||
import nl.jknaapen.fladder.utility.resetRefreshRateAndWait
|
||||
|
||||
class VideoPlayerActivity : ComponentActivity() {
|
||||
// Display mode active before refresh rate matching switched it; restored on exit.
|
||||
private var originalModeId: Int? = null
|
||||
private var finishingWithModeReset = false
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.O)
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
enableEdgeToEdge()
|
||||
@@ -50,50 +40,13 @@ class VideoPlayerActivity : ComponentActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun applyVideoRefreshRate(videoWidth: Int, videoHeight: Int, frameRate: Float) {
|
||||
val displayManager = getSystemService(DISPLAY_SERVICE) as DisplayManager
|
||||
val previousModeId = applyRefreshRate(window, displayManager, videoWidth, videoHeight, frameRate)
|
||||
// Keep the first captured mode across episode transitions so we restore the true original.
|
||||
if (previousModeId != null && originalModeId == null) {
|
||||
originalModeId = previousModeId
|
||||
}
|
||||
}
|
||||
|
||||
override fun finish() {
|
||||
// Restore the original display mode and let the HDMI handshake settle while the window
|
||||
// and video surface are still alive. Switching during teardown can leave pass-through
|
||||
// soundbars/AVRs with a black screen that needs a power cycle.
|
||||
val modeId = originalModeId
|
||||
if (modeId == null || finishingWithModeReset) {
|
||||
super.finish()
|
||||
return
|
||||
}
|
||||
finishingWithModeReset = true
|
||||
// Player may already be released when finishing via disposeActivity().
|
||||
runCatching { VideoPlayerObject.implementation.player?.playWhenReady = false }
|
||||
val displayManager = getSystemService(DISPLAY_SERVICE) as DisplayManager
|
||||
lifecycleScope.launch {
|
||||
resetRefreshRateAndWait(window, displayManager, modeId)
|
||||
originalModeId = null
|
||||
super.finish()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
VideoPlayerObject.implementation.pause()
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
// Fallback for destruction without finish(); normally the mode is already restored.
|
||||
if (originalModeId != null) {
|
||||
resetRefreshRate(window)
|
||||
}
|
||||
VideoPlayerObject.currentActivity = null
|
||||
}
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.O)
|
||||
@OptIn(UnstableApi::class)
|
||||
@Composable
|
||||
fun VideoPlayerScreen(
|
||||
@@ -101,12 +54,9 @@ fun VideoPlayerScreen(
|
||||
val leanBackEnabled = leanBackEnabled(LocalContext.current)
|
||||
ScreenSaver {
|
||||
ExoPlayer { player ->
|
||||
ScaledContent(
|
||||
scale = if (leanBackEnabled) 0.75f else 1f,
|
||||
fontScale = if (leanBackEnabled) 1.2f else 1f,
|
||||
) {
|
||||
ScaledContent(if (leanBackEnabled) 0.6f else 1f) {
|
||||
CustomVideoControls(player)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,93 +0,0 @@
|
||||
// Autogenerated from Pigeon (v30.0.2), do not edit directly.
|
||||
// See also: https://pub.dev/packages/pigeon
|
||||
@file:Suppress("UNCHECKED_CAST", "ArrayInDataClass")
|
||||
|
||||
|
||||
import android.util.Log
|
||||
import io.flutter.plugin.common.BasicMessageChannel
|
||||
import io.flutter.plugin.common.BinaryMessenger
|
||||
import io.flutter.plugin.common.EventChannel
|
||||
import io.flutter.plugin.common.MessageCodec
|
||||
import io.flutter.plugin.common.StandardMethodCodec
|
||||
import io.flutter.plugin.common.StandardMessageCodec
|
||||
import java.io.ByteArrayOutputStream
|
||||
import java.nio.ByteBuffer
|
||||
private object BatteryOptimizationPigeonPigeonUtils {
|
||||
|
||||
fun wrapResult(result: Any?): List<Any?> {
|
||||
return listOf(result)
|
||||
}
|
||||
|
||||
fun wrapError(exception: Throwable): List<Any?> {
|
||||
return if (exception is FlutterError) {
|
||||
listOf(
|
||||
exception.code,
|
||||
exception.message,
|
||||
exception.details
|
||||
)
|
||||
} else {
|
||||
listOf(
|
||||
exception.javaClass.simpleName,
|
||||
exception.toString(),
|
||||
"Cause: " + exception.cause + ", Stacktrace: " + Log.getStackTraceString(exception)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
private open class BatteryOptimizationPigeonPigeonCodec : StandardMessageCodec() {
|
||||
override fun readValueOfType(type: Byte, buffer: ByteBuffer): Any? {
|
||||
return super.readValueOfType(type, buffer)
|
||||
}
|
||||
override fun writeValue(stream: ByteArrayOutputStream, value: Any?) {
|
||||
super.writeValue(stream, value)
|
||||
}
|
||||
}
|
||||
|
||||
/** Generated interface from Pigeon that represents a handler of messages from Flutter. */
|
||||
interface BatteryOptimizationPigeon {
|
||||
fun isIgnoringBatteryOptimizations(): Boolean
|
||||
fun openBatteryOptimizationSettings()
|
||||
|
||||
companion object {
|
||||
/** The codec used by BatteryOptimizationPigeon. */
|
||||
val codec: MessageCodec<Any?> by lazy {
|
||||
BatteryOptimizationPigeonPigeonCodec()
|
||||
}
|
||||
/** Sets up an instance of `BatteryOptimizationPigeon` to handle messages through the `binaryMessenger`. */
|
||||
@JvmOverloads
|
||||
fun setUp(binaryMessenger: BinaryMessenger, api: BatteryOptimizationPigeon?, messageChannelSuffix: String = "") {
|
||||
val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else ""
|
||||
run {
|
||||
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.nl_jknaapen_fladder.settings.BatteryOptimizationPigeon.isIgnoringBatteryOptimizations$separatedMessageChannelSuffix", codec)
|
||||
if (api != null) {
|
||||
channel.setMessageHandler { _, reply ->
|
||||
val wrapped: List<Any?> = try {
|
||||
listOf(api.isIgnoringBatteryOptimizations())
|
||||
} catch (exception: Throwable) {
|
||||
BatteryOptimizationPigeonPigeonUtils.wrapError(exception)
|
||||
}
|
||||
reply.reply(wrapped)
|
||||
}
|
||||
} else {
|
||||
channel.setMessageHandler(null)
|
||||
}
|
||||
}
|
||||
run {
|
||||
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.nl_jknaapen_fladder.settings.BatteryOptimizationPigeon.openBatteryOptimizationSettings$separatedMessageChannelSuffix", codec)
|
||||
if (api != null) {
|
||||
channel.setMessageHandler { _, reply ->
|
||||
val wrapped: List<Any?> = try {
|
||||
api.openBatteryOptimizationSettings()
|
||||
listOf(null)
|
||||
} catch (exception: Throwable) {
|
||||
BatteryOptimizationPigeonPigeonUtils.wrapError(exception)
|
||||
}
|
||||
reply.reply(wrapped)
|
||||
}
|
||||
} else {
|
||||
channel.setMessageHandler(null)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
// Autogenerated from Pigeon (v30.0.2), do not edit directly.
|
||||
// Autogenerated from Pigeon (v26.1.0), do not edit directly.
|
||||
// See also: https://pub.dev/packages/pigeon
|
||||
@file:Suppress("UNCHECKED_CAST", "ArrayInDataClass")
|
||||
|
||||
@@ -33,150 +33,36 @@ private object PlayerSettingsHelperPigeonUtils {
|
||||
)
|
||||
}
|
||||
}
|
||||
fun doubleEquals(a: Double, b: Double): Boolean {
|
||||
// Normalize -0.0 to 0.0 and handle NaN equality.
|
||||
return (if (a == 0.0) 0.0 else a) == (if (b == 0.0) 0.0 else b) || (a.isNaN() && b.isNaN())
|
||||
}
|
||||
|
||||
fun floatEquals(a: Float, b: Float): Boolean {
|
||||
// Normalize -0.0 to 0.0 and handle NaN equality.
|
||||
return (if (a == 0.0f) 0.0f else a) == (if (b == 0.0f) 0.0f else b) || (a.isNaN() && b.isNaN())
|
||||
}
|
||||
|
||||
fun doubleHash(d: Double): Int {
|
||||
// Normalize -0.0 to 0.0 and handle NaN to ensure consistent hash codes.
|
||||
val normalized = if (d == 0.0) 0.0 else d
|
||||
val bits = java.lang.Double.doubleToLongBits(normalized)
|
||||
return (bits xor (bits ushr 32)).toInt()
|
||||
}
|
||||
|
||||
fun floatHash(f: Float): Int {
|
||||
// Normalize -0.0 to 0.0 and handle NaN to ensure consistent hash codes.
|
||||
val normalized = if (f == 0.0f) 0.0f else f
|
||||
return java.lang.Float.floatToIntBits(normalized)
|
||||
}
|
||||
|
||||
fun deepEquals(a: Any?, b: Any?): Boolean {
|
||||
if (a === b) {
|
||||
return true
|
||||
}
|
||||
if (a == null || b == null) {
|
||||
return false
|
||||
}
|
||||
if (a is ByteArray && b is ByteArray) {
|
||||
return a.contentEquals(b)
|
||||
return a.contentEquals(b)
|
||||
}
|
||||
if (a is IntArray && b is IntArray) {
|
||||
return a.contentEquals(b)
|
||||
return a.contentEquals(b)
|
||||
}
|
||||
if (a is LongArray && b is LongArray) {
|
||||
return a.contentEquals(b)
|
||||
return a.contentEquals(b)
|
||||
}
|
||||
if (a is DoubleArray && b is DoubleArray) {
|
||||
if (a.size != b.size) return false
|
||||
for (i in a.indices) {
|
||||
if (!doubleEquals(a[i], b[i])) return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
if (a is FloatArray && b is FloatArray) {
|
||||
if (a.size != b.size) return false
|
||||
for (i in a.indices) {
|
||||
if (!floatEquals(a[i], b[i])) return false
|
||||
}
|
||||
return true
|
||||
return a.contentEquals(b)
|
||||
}
|
||||
if (a is Array<*> && b is Array<*>) {
|
||||
if (a.size != b.size) return false
|
||||
for (i in a.indices) {
|
||||
if (!deepEquals(a[i], b[i])) return false
|
||||
}
|
||||
return true
|
||||
return a.size == b.size &&
|
||||
a.indices.all{ deepEquals(a[it], b[it]) }
|
||||
}
|
||||
if (a is List<*> && b is List<*>) {
|
||||
if (a.size != b.size) return false
|
||||
val iterA = a.iterator()
|
||||
val iterB = b.iterator()
|
||||
while (iterA.hasNext() && iterB.hasNext()) {
|
||||
if (!deepEquals(iterA.next(), iterB.next())) return false
|
||||
}
|
||||
return true
|
||||
return a.size == b.size &&
|
||||
a.indices.all{ deepEquals(a[it], b[it]) }
|
||||
}
|
||||
if (a is Map<*, *> && b is Map<*, *>) {
|
||||
if (a.size != b.size) return false
|
||||
for (entry in a) {
|
||||
val key = entry.key
|
||||
var found = false
|
||||
for (bEntry in b) {
|
||||
if (deepEquals(key, bEntry.key)) {
|
||||
if (deepEquals(entry.value, bEntry.value)) {
|
||||
found = true
|
||||
break
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!found) return false
|
||||
return a.size == b.size && a.all {
|
||||
(b as Map<Any?, Any?>).contains(it.key) &&
|
||||
deepEquals(it.value, b[it.key])
|
||||
}
|
||||
return true
|
||||
}
|
||||
if (a is Double && b is Double) {
|
||||
return doubleEquals(a, b)
|
||||
}
|
||||
if (a is Float && b is Float) {
|
||||
return floatEquals(a, b)
|
||||
}
|
||||
return a == b
|
||||
}
|
||||
|
||||
fun deepHash(value: Any?): Int {
|
||||
return when (value) {
|
||||
null -> 0
|
||||
is ByteArray -> value.contentHashCode()
|
||||
is IntArray -> value.contentHashCode()
|
||||
is LongArray -> value.contentHashCode()
|
||||
is DoubleArray -> {
|
||||
var result = 1
|
||||
for (item in value) {
|
||||
result = 31 * result + doubleHash(item)
|
||||
}
|
||||
result
|
||||
}
|
||||
is FloatArray -> {
|
||||
var result = 1
|
||||
for (item in value) {
|
||||
result = 31 * result + floatHash(item)
|
||||
}
|
||||
result
|
||||
}
|
||||
is Array<*> -> {
|
||||
var result = 1
|
||||
for (item in value) {
|
||||
result = 31 * result + deepHash(item)
|
||||
}
|
||||
result
|
||||
}
|
||||
is List<*> -> {
|
||||
var result = 1
|
||||
for (item in value) {
|
||||
result = 31 * result + deepHash(item)
|
||||
}
|
||||
result
|
||||
}
|
||||
is Map<*, *> -> {
|
||||
var result = 0
|
||||
for (entry in value) {
|
||||
result += ((deepHash(entry.key) * 31) xor deepHash(entry.value))
|
||||
}
|
||||
result
|
||||
}
|
||||
is Double -> doubleHash(value)
|
||||
is Float -> floatHash(value)
|
||||
else -> value.hashCode()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
enum class Screensaver(val raw: Int) {
|
||||
@@ -187,10 +73,8 @@ enum class Screensaver(val raw: Int) {
|
||||
BLACK(4);
|
||||
|
||||
companion object {
|
||||
private val pigeonValues = values()
|
||||
|
||||
fun ofRaw(raw: Int): Screensaver? {
|
||||
return pigeonValues.getOrNull(raw)
|
||||
return values().firstOrNull { it.raw == raw }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -205,10 +89,8 @@ enum class VideoPlayerFit(val raw: Int) {
|
||||
SCALE_DOWN(6);
|
||||
|
||||
companion object {
|
||||
private val pigeonValues = values()
|
||||
|
||||
fun ofRaw(raw: Int): VideoPlayerFit? {
|
||||
return pigeonValues.getOrNull(raw)
|
||||
return values().firstOrNull { it.raw == raw }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -220,10 +102,8 @@ enum class PlayerOrientations(val raw: Int) {
|
||||
LAND_SCAPE_RIGHT(3);
|
||||
|
||||
companion object {
|
||||
private val pigeonValues = values()
|
||||
|
||||
fun ofRaw(raw: Int): PlayerOrientations? {
|
||||
return pigeonValues.getOrNull(raw)
|
||||
return values().firstOrNull { it.raw == raw }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -234,10 +114,8 @@ enum class AutoNextType(val raw: Int) {
|
||||
SMART(2);
|
||||
|
||||
companion object {
|
||||
private val pigeonValues = values()
|
||||
|
||||
fun ofRaw(raw: Int): AutoNextType? {
|
||||
return pigeonValues.getOrNull(raw)
|
||||
return values().firstOrNull { it.raw == raw }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -250,10 +128,8 @@ enum class SegmentType(val raw: Int) {
|
||||
OUTRO(4);
|
||||
|
||||
companion object {
|
||||
private val pigeonValues = values()
|
||||
|
||||
fun ofRaw(raw: Int): SegmentType? {
|
||||
return pigeonValues.getOrNull(raw)
|
||||
return values().firstOrNull { it.raw == raw }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -261,14 +137,11 @@ enum class SegmentType(val raw: Int) {
|
||||
enum class SegmentSkip(val raw: Int) {
|
||||
ASK(0),
|
||||
SKIP(1),
|
||||
SKIP_ONCE(2),
|
||||
NONE(3);
|
||||
NONE(2);
|
||||
|
||||
companion object {
|
||||
private val pigeonValues = values()
|
||||
|
||||
fun ofRaw(raw: Int): SegmentSkip? {
|
||||
return pigeonValues.getOrNull(raw)
|
||||
return values().firstOrNull { it.raw == raw }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -284,9 +157,7 @@ data class PlayerSettings (
|
||||
val acceptedOrientations: List<PlayerOrientations>,
|
||||
val fillScreen: Boolean,
|
||||
val videoFit: VideoPlayerFit,
|
||||
val screensaver: Screensaver,
|
||||
val refreshRateSwitching: Boolean,
|
||||
val lowResourceMode: Boolean
|
||||
val screensaver: Screensaver
|
||||
)
|
||||
{
|
||||
companion object {
|
||||
@@ -301,9 +172,7 @@ data class PlayerSettings (
|
||||
val fillScreen = pigeonVar_list[7] as Boolean
|
||||
val videoFit = pigeonVar_list[8] as VideoPlayerFit
|
||||
val screensaver = pigeonVar_list[9] as Screensaver
|
||||
val refreshRateSwitching = pigeonVar_list[10] as Boolean
|
||||
val lowResourceMode = pigeonVar_list[11] as Boolean
|
||||
return PlayerSettings(enableTunneling, skipTypes, themeColor, skipForward, skipBackward, autoNextType, acceptedOrientations, fillScreen, videoFit, screensaver, refreshRateSwitching, lowResourceMode)
|
||||
return PlayerSettings(enableTunneling, skipTypes, themeColor, skipForward, skipBackward, autoNextType, acceptedOrientations, fillScreen, videoFit, screensaver)
|
||||
}
|
||||
}
|
||||
fun toList(): List<Any?> {
|
||||
@@ -318,76 +187,54 @@ data class PlayerSettings (
|
||||
fillScreen,
|
||||
videoFit,
|
||||
screensaver,
|
||||
refreshRateSwitching,
|
||||
lowResourceMode,
|
||||
)
|
||||
}
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (other == null || other.javaClass != javaClass) {
|
||||
if (other !is PlayerSettings) {
|
||||
return false
|
||||
}
|
||||
if (this === other) {
|
||||
return true
|
||||
}
|
||||
val other = other as PlayerSettings
|
||||
return PlayerSettingsHelperPigeonUtils.deepEquals(this.enableTunneling, other.enableTunneling) && PlayerSettingsHelperPigeonUtils.deepEquals(this.skipTypes, other.skipTypes) && PlayerSettingsHelperPigeonUtils.deepEquals(this.themeColor, other.themeColor) && PlayerSettingsHelperPigeonUtils.deepEquals(this.skipForward, other.skipForward) && PlayerSettingsHelperPigeonUtils.deepEquals(this.skipBackward, other.skipBackward) && PlayerSettingsHelperPigeonUtils.deepEquals(this.autoNextType, other.autoNextType) && PlayerSettingsHelperPigeonUtils.deepEquals(this.acceptedOrientations, other.acceptedOrientations) && PlayerSettingsHelperPigeonUtils.deepEquals(this.fillScreen, other.fillScreen) && PlayerSettingsHelperPigeonUtils.deepEquals(this.videoFit, other.videoFit) && PlayerSettingsHelperPigeonUtils.deepEquals(this.screensaver, other.screensaver) && PlayerSettingsHelperPigeonUtils.deepEquals(this.refreshRateSwitching, other.refreshRateSwitching) && PlayerSettingsHelperPigeonUtils.deepEquals(this.lowResourceMode, other.lowResourceMode)
|
||||
}
|
||||
return PlayerSettingsHelperPigeonUtils.deepEquals(toList(), other.toList()) }
|
||||
|
||||
override fun hashCode(): Int {
|
||||
var result = javaClass.hashCode()
|
||||
result = 31 * result + PlayerSettingsHelperPigeonUtils.deepHash(this.enableTunneling)
|
||||
result = 31 * result + PlayerSettingsHelperPigeonUtils.deepHash(this.skipTypes)
|
||||
result = 31 * result + PlayerSettingsHelperPigeonUtils.deepHash(this.themeColor)
|
||||
result = 31 * result + PlayerSettingsHelperPigeonUtils.deepHash(this.skipForward)
|
||||
result = 31 * result + PlayerSettingsHelperPigeonUtils.deepHash(this.skipBackward)
|
||||
result = 31 * result + PlayerSettingsHelperPigeonUtils.deepHash(this.autoNextType)
|
||||
result = 31 * result + PlayerSettingsHelperPigeonUtils.deepHash(this.acceptedOrientations)
|
||||
result = 31 * result + PlayerSettingsHelperPigeonUtils.deepHash(this.fillScreen)
|
||||
result = 31 * result + PlayerSettingsHelperPigeonUtils.deepHash(this.videoFit)
|
||||
result = 31 * result + PlayerSettingsHelperPigeonUtils.deepHash(this.screensaver)
|
||||
result = 31 * result + PlayerSettingsHelperPigeonUtils.deepHash(this.refreshRateSwitching)
|
||||
result = 31 * result + PlayerSettingsHelperPigeonUtils.deepHash(this.lowResourceMode)
|
||||
return result
|
||||
}
|
||||
override fun toString(): String {
|
||||
return "PlayerSettings(enableTunneling=$enableTunneling, skipTypes=$skipTypes, themeColor=$themeColor, skipForward=$skipForward, skipBackward=$skipBackward, autoNextType=$autoNextType, acceptedOrientations=$acceptedOrientations, fillScreen=$fillScreen, videoFit=$videoFit, screensaver=$screensaver, refreshRateSwitching=$refreshRateSwitching, lowResourceMode=$lowResourceMode)"
|
||||
}
|
||||
override fun hashCode(): Int = toList().hashCode()
|
||||
}
|
||||
private open class PlayerSettingsHelperPigeonCodec : StandardMessageCodec() {
|
||||
override fun readValueOfType(type: Byte, buffer: ByteBuffer): Any? {
|
||||
return when (type) {
|
||||
129.toByte() -> {
|
||||
(readValue(buffer) as Long?)?.let {
|
||||
return (readValue(buffer) as Long?)?.let {
|
||||
Screensaver.ofRaw(it.toInt())
|
||||
}
|
||||
}
|
||||
130.toByte() -> {
|
||||
(readValue(buffer) as Long?)?.let {
|
||||
return (readValue(buffer) as Long?)?.let {
|
||||
VideoPlayerFit.ofRaw(it.toInt())
|
||||
}
|
||||
}
|
||||
131.toByte() -> {
|
||||
(readValue(buffer) as Long?)?.let {
|
||||
return (readValue(buffer) as Long?)?.let {
|
||||
PlayerOrientations.ofRaw(it.toInt())
|
||||
}
|
||||
}
|
||||
132.toByte() -> {
|
||||
(readValue(buffer) as Long?)?.let {
|
||||
return (readValue(buffer) as Long?)?.let {
|
||||
AutoNextType.ofRaw(it.toInt())
|
||||
}
|
||||
}
|
||||
133.toByte() -> {
|
||||
(readValue(buffer) as Long?)?.let {
|
||||
return (readValue(buffer) as Long?)?.let {
|
||||
SegmentType.ofRaw(it.toInt())
|
||||
}
|
||||
}
|
||||
134.toByte() -> {
|
||||
(readValue(buffer) as Long?)?.let {
|
||||
return (readValue(buffer) as Long?)?.let {
|
||||
SegmentSkip.ofRaw(it.toInt())
|
||||
}
|
||||
}
|
||||
135.toByte() -> {
|
||||
(readValue(buffer) as? List<Any?>)?.let {
|
||||
return (readValue(buffer) as? List<Any?>)?.let {
|
||||
PlayerSettings.fromList(it)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Autogenerated from Pigeon (v30.0.2), do not edit directly.
|
||||
// Autogenerated from Pigeon (v26.1.0), do not edit directly.
|
||||
// See also: https://pub.dev/packages/pigeon
|
||||
@file:Suppress("UNCHECKED_CAST", "ArrayInDataClass")
|
||||
|
||||
@@ -234,104 +234,4 @@ class TranslationsPigeon(private val binaryMessenger: BinaryMessenger, private v
|
||||
}
|
||||
}
|
||||
}
|
||||
fun switchChannel(callback: (Result<String>) -> Unit)
|
||||
{
|
||||
val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else ""
|
||||
val channelName = "dev.flutter.pigeon.nl_jknaapen_fladder.settings.TranslationsPigeon.switchChannel$separatedMessageChannelSuffix"
|
||||
val channel = BasicMessageChannel<Any?>(binaryMessenger, channelName, codec)
|
||||
channel.send(null) {
|
||||
if (it is List<*>) {
|
||||
if (it.size > 1) {
|
||||
callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?)))
|
||||
} else if (it[0] == null) {
|
||||
callback(Result.failure(FlutterError("null-error", "Flutter api returned null value for non-null return value.", "")))
|
||||
} else {
|
||||
val output = it[0] as String
|
||||
callback(Result.success(output))
|
||||
}
|
||||
} else {
|
||||
callback(Result.failure(TranslationsPigeonPigeonUtils.createConnectionError(channelName)))
|
||||
}
|
||||
}
|
||||
}
|
||||
fun switchChannelDesc(programNameArg: String, channelNameArg: String, callback: (Result<String>) -> Unit)
|
||||
{
|
||||
val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else ""
|
||||
val channelName = "dev.flutter.pigeon.nl_jknaapen_fladder.settings.TranslationsPigeon.switchChannelDesc$separatedMessageChannelSuffix"
|
||||
val channel = BasicMessageChannel<Any?>(binaryMessenger, channelName, codec)
|
||||
channel.send(listOf(programNameArg, channelNameArg)) {
|
||||
if (it is List<*>) {
|
||||
if (it.size > 1) {
|
||||
callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?)))
|
||||
} else if (it[0] == null) {
|
||||
callback(Result.failure(FlutterError("null-error", "Flutter api returned null value for non-null return value.", "")))
|
||||
} else {
|
||||
val output = it[0] as String
|
||||
callback(Result.success(output))
|
||||
}
|
||||
} else {
|
||||
callback(Result.failure(TranslationsPigeonPigeonUtils.createConnectionError(channelName)))
|
||||
}
|
||||
}
|
||||
}
|
||||
fun watch(callback: (Result<String>) -> Unit)
|
||||
{
|
||||
val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else ""
|
||||
val channelName = "dev.flutter.pigeon.nl_jknaapen_fladder.settings.TranslationsPigeon.watch$separatedMessageChannelSuffix"
|
||||
val channel = BasicMessageChannel<Any?>(binaryMessenger, channelName, codec)
|
||||
channel.send(null) {
|
||||
if (it is List<*>) {
|
||||
if (it.size > 1) {
|
||||
callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?)))
|
||||
} else if (it[0] == null) {
|
||||
callback(Result.failure(FlutterError("null-error", "Flutter api returned null value for non-null return value.", "")))
|
||||
} else {
|
||||
val output = it[0] as String
|
||||
callback(Result.success(output))
|
||||
}
|
||||
} else {
|
||||
callback(Result.failure(TranslationsPigeonPigeonUtils.createConnectionError(channelName)))
|
||||
}
|
||||
}
|
||||
}
|
||||
fun now(callback: (Result<String>) -> Unit)
|
||||
{
|
||||
val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else ""
|
||||
val channelName = "dev.flutter.pigeon.nl_jknaapen_fladder.settings.TranslationsPigeon.now$separatedMessageChannelSuffix"
|
||||
val channel = BasicMessageChannel<Any?>(binaryMessenger, channelName, codec)
|
||||
channel.send(null) {
|
||||
if (it is List<*>) {
|
||||
if (it.size > 1) {
|
||||
callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?)))
|
||||
} else if (it[0] == null) {
|
||||
callback(Result.failure(FlutterError("null-error", "Flutter api returned null value for non-null return value.", "")))
|
||||
} else {
|
||||
val output = it[0] as String
|
||||
callback(Result.success(output))
|
||||
}
|
||||
} else {
|
||||
callback(Result.failure(TranslationsPigeonPigeonUtils.createConnectionError(channelName)))
|
||||
}
|
||||
}
|
||||
}
|
||||
fun decline(callback: (Result<String>) -> Unit)
|
||||
{
|
||||
val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else ""
|
||||
val channelName = "dev.flutter.pigeon.nl_jknaapen_fladder.settings.TranslationsPigeon.decline$separatedMessageChannelSuffix"
|
||||
val channel = BasicMessageChannel<Any?>(binaryMessenger, channelName, codec)
|
||||
channel.send(null) {
|
||||
if (it is List<*>) {
|
||||
if (it.size > 1) {
|
||||
callback(Result.failure(FlutterError(it[0] as String, it[1] as String, it[2] as String?)))
|
||||
} else if (it[0] == null) {
|
||||
callback(Result.failure(FlutterError("null-error", "Flutter api returned null value for non-null return value.", "")))
|
||||
} else {
|
||||
val output = it[0] as String
|
||||
callback(Result.success(output))
|
||||
}
|
||||
} else {
|
||||
callback(Result.failure(TranslationsPigeonPigeonUtils.createConnectionError(channelName)))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -23,15 +23,12 @@ import androidx.compose.ui.draw.alpha
|
||||
import androidx.compose.ui.draw.scale
|
||||
import androidx.compose.ui.focus.onFocusChanged
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.Shape
|
||||
import androidx.compose.ui.input.key.Key
|
||||
import androidx.compose.ui.input.key.KeyEventType
|
||||
import androidx.compose.ui.input.key.key
|
||||
import androidx.compose.ui.input.key.onKeyEvent
|
||||
import androidx.compose.ui.input.key.type
|
||||
import androidx.compose.ui.unit.Dp
|
||||
import androidx.compose.ui.unit.dp
|
||||
import nl.jknaapen.fladder.utility.conditional
|
||||
|
||||
@Composable
|
||||
internal fun CustomButton(
|
||||
@@ -39,14 +36,10 @@ internal fun CustomButton(
|
||||
onClick: () -> Unit,
|
||||
enabled: Boolean = true,
|
||||
enableScaledFocus: Boolean = false,
|
||||
clickAnimation: Boolean = true,
|
||||
backgroundColor: Color = Color.White.copy(alpha = 0.1f),
|
||||
foreGroundColor: Color = Color.White,
|
||||
backgroundFocusedColor: Color = Color.White,
|
||||
foreGroundFocusedColor: Color = Color.Black,
|
||||
shape: Shape = CircleShape,
|
||||
onFocused: ((Boolean) -> Unit)? = null,
|
||||
padding: Dp = 12.dp,
|
||||
icon: @Composable () -> Unit,
|
||||
) {
|
||||
val interactionSource = remember { MutableInteractionSource() }
|
||||
@@ -109,17 +102,9 @@ internal fun CustomButton(
|
||||
}
|
||||
return@onKeyEvent false
|
||||
}
|
||||
.conditional(
|
||||
condition = clickAnimation,
|
||||
{
|
||||
scale(animatedScale)
|
||||
}
|
||||
)
|
||||
.background(currentBackgroundColor, shape = shape)
|
||||
.onFocusChanged {
|
||||
isFocused = it.isFocused
|
||||
onFocused?.invoke(it.isFocused)
|
||||
}
|
||||
.scale(animatedScale)
|
||||
.background(currentBackgroundColor, shape = CircleShape)
|
||||
.onFocusChanged { isFocused = it.isFocused }
|
||||
.clickable(
|
||||
enabled = enabled,
|
||||
interactionSource = interactionSource,
|
||||
@@ -130,7 +115,7 @@ internal fun CustomButton(
|
||||
contentAlignment = Alignment.Center
|
||||
) {
|
||||
CompositionLocalProvider(LocalContentColor provides currentContentColor) {
|
||||
Box(modifier = Modifier.padding(padding)) {
|
||||
Box(modifier = Modifier.padding(12.dp)) {
|
||||
icon()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@ import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import coil3.compose.AsyncImage
|
||||
|
||||
@Composable
|
||||
@@ -45,9 +44,7 @@ fun ItemHeader(
|
||||
style = MaterialTheme.typography.headlineMedium.copy(
|
||||
color = Color.White,
|
||||
fontWeight = FontWeight.Bold
|
||||
),
|
||||
maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@ package nl.jknaapen.fladder.composables.controls
|
||||
|
||||
import MediaSegment
|
||||
import MediaSegmentType
|
||||
import TVGuideModel
|
||||
import android.os.Build
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.compose.animation.animateColorAsState
|
||||
import androidx.compose.animation.core.animateDpAsState
|
||||
import androidx.compose.foundation.background
|
||||
@@ -15,6 +15,7 @@ import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.RowScope
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.aspectRatio
|
||||
import androidx.compose.foundation.layout.fillMaxHeight
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
@@ -63,7 +64,6 @@ import androidx.compose.ui.layout.onGloballyPositioned
|
||||
import androidx.compose.ui.platform.LocalDensity
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.util.fastCoerceIn
|
||||
import androidx.media3.exoplayer.ExoPlayer
|
||||
@@ -82,173 +82,13 @@ import kotlin.time.Duration.Companion.seconds
|
||||
import kotlin.time.DurationUnit
|
||||
import kotlin.time.toDuration
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.O)
|
||||
@Composable
|
||||
internal fun ProgressBar(
|
||||
modifier: Modifier = Modifier,
|
||||
player: ExoPlayer,
|
||||
bottomControlFocusRequester: FocusRequester,
|
||||
onUserInteraction: () -> Unit = {}
|
||||
) {
|
||||
val tvGuide by VideoPlayerObject.tvGuide.collectAsState(null)
|
||||
|
||||
tvGuide?.let {
|
||||
TVProgressBar(
|
||||
modifier = modifier,
|
||||
player = player,
|
||||
tvGuide = it,
|
||||
bottomControlFocusRequester = bottomControlFocusRequester,
|
||||
onUserInteraction = onUserInteraction
|
||||
)
|
||||
} ?: run {
|
||||
StandardProgressBar(
|
||||
modifier = modifier,
|
||||
player = player,
|
||||
bottomControlFocusRequester = bottomControlFocusRequester,
|
||||
onUserInteraction = onUserInteraction
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
internal fun TVProgressBar(
|
||||
modifier: Modifier = Modifier,
|
||||
player: ExoPlayer,
|
||||
tvGuide: TVGuideModel,
|
||||
bottomControlFocusRequester: FocusRequester,
|
||||
onUserInteraction: () -> Unit = {}
|
||||
) {
|
||||
val playbackData by VideoPlayerObject.implementation.playbackData.collectAsState(null)
|
||||
val currentProgram = tvGuide.currentProgram
|
||||
|
||||
var displayDuration by remember { mutableLongStateOf(0L) }
|
||||
var displayPosition by remember { mutableLongStateOf(0L) }
|
||||
|
||||
LaunchedEffect(currentProgram) {
|
||||
while (true) {
|
||||
if (currentProgram != null && player.isPlaying) {
|
||||
val now = System.currentTimeMillis()
|
||||
val start = currentProgram.startMs
|
||||
val end = currentProgram.endMs
|
||||
|
||||
displayPosition = if (now < start) 0L else now - start
|
||||
displayDuration = end - start
|
||||
}
|
||||
delay(1000)
|
||||
}
|
||||
}
|
||||
|
||||
fun calculatedDateFromLong(ms: Long): String {
|
||||
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
val instant = java.time.Instant.ofEpochMilli(ms)
|
||||
val zoneId = java.time.ZoneId.systemDefault()
|
||||
java.time.format.DateTimeFormatter.ISO_OFFSET_DATE_TIME
|
||||
.withZone(zoneId)
|
||||
.format(instant)
|
||||
} else {
|
||||
val calendar = java.util.Calendar.getInstance()
|
||||
calendar.timeInMillis = ms
|
||||
val tz = calendar.timeZone
|
||||
val sdf = java.text.SimpleDateFormat(
|
||||
"yyyy-MM-dd'T'HH:mm:ssXXX",
|
||||
java.util.Locale.getDefault()
|
||||
)
|
||||
sdf.timeZone = tz
|
||||
sdf.format(calendar.time)
|
||||
}
|
||||
}
|
||||
|
||||
Column(
|
||||
verticalArrangement = Arrangement.spacedBy(4.dp, alignment = Alignment.CenterVertically)
|
||||
) {
|
||||
Row(
|
||||
horizontalArrangement = Arrangement.spacedBy(8.dp),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
) {
|
||||
currentProgram?.let { program ->
|
||||
Translate(
|
||||
{ Localized.endsAt(calculatedDateFromLong(program.endMs), it) },
|
||||
program.endMs
|
||||
) { endDateString ->
|
||||
val programLabel = listOf(
|
||||
program.name,
|
||||
endDateString
|
||||
).filterNot { it.isBlank() }.joinToString(separator = " - ")
|
||||
if (programLabel.isNotBlank()) {
|
||||
Text(
|
||||
text = programLabel,
|
||||
style = MaterialTheme.typography.titleMedium.copy(
|
||||
color = Color.White,
|
||||
fontWeight = FontWeight.Bold
|
||||
),
|
||||
modifier = Modifier.weight(1f),
|
||||
maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
VideoLabel(playbackData?.mediaInfo?.playbackType?.name?.capitalize)
|
||||
VideoLabel(playbackData?.mediaInfo?.videoInformation)
|
||||
}
|
||||
|
||||
Row(
|
||||
horizontalArrangement = Arrangement.spacedBy(
|
||||
12.dp,
|
||||
alignment = Alignment.CenterHorizontally
|
||||
),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
modifier = modifier.fillMaxWidth()
|
||||
) {
|
||||
val timeTextStyle = MaterialTheme.typography.titleMedium.copy(
|
||||
fontWeight = FontWeight.Bold
|
||||
)
|
||||
|
||||
val textWidth = measureTextWidth("-" + formatTime(displayDuration), timeTextStyle)
|
||||
|
||||
Text(
|
||||
formatTime(displayPosition),
|
||||
color = Color.White,
|
||||
modifier = Modifier.widthIn(min = textWidth),
|
||||
textAlign = TextAlign.Start,
|
||||
maxLines = 1,
|
||||
style = timeTextStyle
|
||||
)
|
||||
SimpleProgressBar(
|
||||
player,
|
||||
bottomControlFocusRequester,
|
||||
onUserInteraction,
|
||||
0L,
|
||||
false,
|
||||
duration = displayDuration,
|
||||
position = displayPosition,
|
||||
onTempPosChanged = {
|
||||
},
|
||||
onScrubbingChanged = {
|
||||
}
|
||||
)
|
||||
Text(
|
||||
"-" + formatTime(
|
||||
(displayDuration - displayPosition).fastCoerceIn(
|
||||
minimumValue = 0L,
|
||||
maximumValue = displayDuration
|
||||
)
|
||||
),
|
||||
color = Color.White,
|
||||
textAlign = TextAlign.End,
|
||||
modifier = Modifier.widthIn(min = textWidth),
|
||||
maxLines = 1,
|
||||
style = timeTextStyle
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
internal fun StandardProgressBar(
|
||||
modifier: Modifier = Modifier,
|
||||
player: ExoPlayer,
|
||||
bottomControlFocusRequester: FocusRequester,
|
||||
onUserInteraction: () -> Unit = {}
|
||||
) {
|
||||
val position by VideoPlayerObject.position.collectAsState(0L)
|
||||
val duration by VideoPlayerObject.duration.collectAsState(0L)
|
||||
@@ -303,15 +143,14 @@ internal fun StandardProgressBar(
|
||||
color = Color.White,
|
||||
fontWeight = FontWeight.Bold
|
||||
),
|
||||
modifier = Modifier.weight(1f),
|
||||
maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
VideoLabel(playableData?.mediaInfo?.playbackType?.name?.capitalize)
|
||||
VideoLabel(playableData?.mediaInfo?.videoInformation)
|
||||
Spacer(modifier = Modifier.weight(1f))
|
||||
|
||||
Videolabel(playableData?.mediaInfo?.playbackType?.name?.capitalize)
|
||||
Videolabel(playableData?.mediaInfo?.videoInformation)
|
||||
}
|
||||
Row(
|
||||
horizontalArrangement = Arrangement.spacedBy(
|
||||
@@ -342,8 +181,6 @@ internal fun StandardProgressBar(
|
||||
onUserInteraction,
|
||||
tempPosition,
|
||||
scrubbingTimeLine,
|
||||
duration = duration,
|
||||
position = position,
|
||||
onTempPosChanged = {
|
||||
tempPosition = it
|
||||
},
|
||||
@@ -369,7 +206,7 @@ internal fun StandardProgressBar(
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun VideoLabel(value: String?) {
|
||||
private fun Videolabel(value: String?) {
|
||||
if (value.isNullOrBlank()) return
|
||||
|
||||
Box(
|
||||
@@ -399,19 +236,14 @@ internal fun RowScope.SimpleProgressBar(
|
||||
onUserInteraction: () -> Unit,
|
||||
tempPosition: Long,
|
||||
scrubbingTimeLine: Boolean,
|
||||
duration: Long = 0L,
|
||||
position: Long = 0L,
|
||||
onTempPosChanged: (Long) -> Unit = {},
|
||||
onScrubbingChanged: (Boolean) -> Unit = {}
|
||||
) {
|
||||
val playbackData by VideoPlayerObject.implementation.playbackData.collectAsState()
|
||||
|
||||
var width by remember { mutableIntStateOf(0) }
|
||||
val playerPosition by VideoPlayerObject.position.collectAsState(0L)
|
||||
val playerDuration by VideoPlayerObject.duration.collectAsState(0L)
|
||||
|
||||
val effectiveDuration = if (duration > 0L) duration else playerDuration
|
||||
val effectivePosition = if (position > 0L || duration > 0L) position else playerPosition
|
||||
val position by VideoPlayerObject.position.collectAsState(0L)
|
||||
val duration by VideoPlayerObject.duration.collectAsState(0L)
|
||||
|
||||
val slideBarShape = RoundedCornerShape(size = 8.dp)
|
||||
|
||||
@@ -419,18 +251,12 @@ internal fun RowScope.SimpleProgressBar(
|
||||
|
||||
var internalTempPosition by remember { mutableLongStateOf(0L) }
|
||||
|
||||
val progress by remember(
|
||||
scrubbingTimeLine,
|
||||
tempPosition,
|
||||
effectivePosition,
|
||||
effectiveDuration
|
||||
) {
|
||||
val progress by remember(scrubbingTimeLine, tempPosition, position) {
|
||||
derivedStateOf {
|
||||
if (effectiveDuration <= 0L) return@derivedStateOf 0f
|
||||
if (scrubbingTimeLine) {
|
||||
tempPosition.toFloat() / effectiveDuration.toFloat()
|
||||
tempPosition.toFloat() / duration.toFloat()
|
||||
} else {
|
||||
effectivePosition.toFloat() / effectiveDuration.toFloat()
|
||||
position.toFloat() / duration.toFloat()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -448,8 +274,7 @@ internal fun RowScope.SimpleProgressBar(
|
||||
detectTapGestures { offset ->
|
||||
onUserInteraction()
|
||||
val clickRelativeOffset = offset.x / width.toFloat()
|
||||
val newPosition =
|
||||
effectiveDuration.milliseconds * clickRelativeOffset.toDouble()
|
||||
val newPosition = duration.milliseconds * clickRelativeOffset.toDouble()
|
||||
player.seekTo(newPosition.toLong(DurationUnit.MILLISECONDS))
|
||||
}
|
||||
}
|
||||
@@ -464,9 +289,8 @@ internal fun RowScope.SimpleProgressBar(
|
||||
onUserInteraction()
|
||||
change.consume()
|
||||
val relative = change.position.x / size.width.toFloat()
|
||||
internalTempPosition =
|
||||
(effectiveDuration.milliseconds * relative.toDouble())
|
||||
.toLong(DurationUnit.MILLISECONDS)
|
||||
internalTempPosition = (duration.milliseconds * relative.toDouble())
|
||||
.toLong(DurationUnit.MILLISECONDS)
|
||||
onTempPosChanged(
|
||||
internalTempPosition
|
||||
)
|
||||
@@ -514,7 +338,7 @@ internal fun RowScope.SimpleProgressBar(
|
||||
val density = LocalDensity.current
|
||||
|
||||
val mediaSegments = playbackData?.segments
|
||||
if (width > 0 && effectiveDuration.toDuration(DurationUnit.MILLISECONDS) > Duration.ZERO) {
|
||||
if (width > 0 && duration.toDuration(DurationUnit.MILLISECONDS) > Duration.ZERO) {
|
||||
mediaSegments?.forEach { segment ->
|
||||
val segStartMs = max(
|
||||
0.0,
|
||||
@@ -526,7 +350,7 @@ internal fun RowScope.SimpleProgressBar(
|
||||
segment.end.toDuration(DurationUnit.MILLISECONDS)
|
||||
.toDouble(DurationUnit.MILLISECONDS)
|
||||
)
|
||||
val durMs = effectiveDuration.toDouble().coerceAtLeast(1.0)
|
||||
val durMs = duration.toDouble().coerceAtLeast(1.0)
|
||||
|
||||
if (segStartMs >= durMs) return@forEach
|
||||
|
||||
@@ -557,19 +381,15 @@ internal fun RowScope.SimpleProgressBar(
|
||||
chapters.forEach { chapter ->
|
||||
val chapterDuration = chapter.time.toDuration(DurationUnit.SECONDS)
|
||||
.toDouble(DurationUnit.SECONDS)
|
||||
val isAfterCurrentPositon = chapterDuration > effectivePosition.toDouble()
|
||||
val isAfterCurrentPositon = chapterDuration > position.toDouble()
|
||||
val segStartMs = max(
|
||||
0.0,
|
||||
chapterDuration
|
||||
)
|
||||
|
||||
val durMs = effectiveDuration.toDouble().coerceAtLeast(1.0)
|
||||
val durMs = duration.toDouble().coerceAtLeast(1.0)
|
||||
val startPx = (width * (segStartMs / durMs)).toFloat()
|
||||
|
||||
val animatedChapterCircleHeight by animateDpAsState(
|
||||
if (thumbFocused) 1.dp else 6.dp,
|
||||
label = "Chapter height"
|
||||
)
|
||||
|
||||
Box(
|
||||
modifier = Modifier
|
||||
@@ -579,11 +399,12 @@ internal fun RowScope.SimpleProgressBar(
|
||||
.graphicsLayer {
|
||||
translationX = startPx
|
||||
}
|
||||
.width(6.dp)
|
||||
.height(animatedChapterCircleHeight)
|
||||
.padding(vertical = 0.5.dp)
|
||||
.fillMaxHeight()
|
||||
.aspectRatio(ratio = 1f)
|
||||
.background(
|
||||
color = if (isAfterCurrentPositon) Color.White.copy(
|
||||
alpha = 0.25f
|
||||
alpha = 0.15f
|
||||
) else MaterialTheme.colorScheme.onPrimary.copy(alpha = 0.7f),
|
||||
shape = CircleShape
|
||||
)
|
||||
@@ -629,7 +450,7 @@ internal fun RowScope.SimpleProgressBar(
|
||||
if (!state.isFocused) {
|
||||
onScrubbingChanged(false)
|
||||
} else {
|
||||
onTempPosChanged(effectivePosition)
|
||||
onTempPosChanged(position)
|
||||
}
|
||||
}
|
||||
.focusable(enabled = true)
|
||||
@@ -653,7 +474,7 @@ internal fun RowScope.SimpleProgressBar(
|
||||
speed++
|
||||
}
|
||||
if (!scrubbingTimeLine) {
|
||||
onTempPosChanged(effectivePosition)
|
||||
onTempPosChanged(position)
|
||||
onScrubbingChanged(true)
|
||||
player.pause()
|
||||
}
|
||||
@@ -674,7 +495,7 @@ internal fun RowScope.SimpleProgressBar(
|
||||
speed++
|
||||
}
|
||||
if (!scrubbingTimeLine) {
|
||||
onTempPosChanged(effectivePosition)
|
||||
onTempPosChanged(position)
|
||||
onScrubbingChanged(true)
|
||||
player.pause()
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package nl.jknaapen.fladder.composables.controls
|
||||
|
||||
import androidx.compose.animation.core.FastOutLinearInEasing
|
||||
import androidx.compose.animation.core.animateFloatAsState
|
||||
import androidx.compose.animation.core.animateFloat
|
||||
import androidx.compose.animation.core.infiniteRepeatable
|
||||
import androidx.compose.animation.core.rememberInfiniteTransition
|
||||
@@ -19,12 +18,13 @@ import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.rotate
|
||||
import androidx.compose.ui.draw.scale
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.graphicsLayer
|
||||
import androidx.compose.ui.unit.dp
|
||||
import io.github.rabehx.iconsax.Iconsax
|
||||
import io.github.rabehx.iconsax.outline.Refresh
|
||||
import nl.jknaapen.fladder.utility.visible
|
||||
import kotlin.math.absoluteValue
|
||||
import kotlin.time.DurationUnit
|
||||
import kotlin.time.toDuration
|
||||
@@ -34,15 +34,10 @@ internal fun BoxScope.SeekOverlay(
|
||||
modifier: Modifier = Modifier,
|
||||
value: Long = 0L,
|
||||
) {
|
||||
val alpha by animateFloatAsState(
|
||||
targetValue = if (value != 0L) 1f else 0f,
|
||||
label = "AlphaAnimation"
|
||||
)
|
||||
if (alpha == 0f) return
|
||||
|
||||
val infiniteTransition = rememberInfiniteTransition()
|
||||
|
||||
val rotation = infiniteTransition.animateFloat(
|
||||
val rotation by infiniteTransition.animateFloat(
|
||||
initialValue = 0f,
|
||||
targetValue = 360f,
|
||||
animationSpec = infiniteRepeatable(
|
||||
@@ -56,7 +51,7 @@ internal fun BoxScope.SeekOverlay(
|
||||
Box(
|
||||
modifier = modifier
|
||||
.align(Alignment.Center)
|
||||
.graphicsLayer { this.alpha = alpha }
|
||||
.visible(value != 0L)
|
||||
.wrapContentSize()
|
||||
.background(
|
||||
color = Color.Black.copy(alpha = 0.85f),
|
||||
@@ -70,7 +65,7 @@ internal fun BoxScope.SeekOverlay(
|
||||
modifier = Modifier
|
||||
.size(65.dp)
|
||||
.scale(scaleX = if (value < 0) 1f else -1f, scaleY = 1f)
|
||||
.graphicsLayer { rotationZ = -rotation.value },
|
||||
.rotate(-rotation),
|
||||
contentDescription = "SkipLogoRotating",
|
||||
tint = Color.White,
|
||||
|
||||
|
||||
@@ -25,7 +25,6 @@ import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.collectAsState
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateListOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
@@ -43,6 +42,7 @@ import nl.jknaapen.fladder.utility.defaultSelected
|
||||
import nl.jknaapen.fladder.utility.leanBackEnabled
|
||||
import kotlin.time.Duration.Companion.milliseconds
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.O)
|
||||
@Composable
|
||||
internal fun BoxScope.SegmentSkipOverlay(
|
||||
modifier: Modifier = Modifier,
|
||||
@@ -56,7 +56,6 @@ internal fun BoxScope.SegmentSkipOverlay(
|
||||
val segments = state?.segments ?: emptyList()
|
||||
val player = VideoPlayerObject.implementation.player
|
||||
val skipMap by PlayerSettingsObject.skipMap.collectAsState(mapOf())
|
||||
val skippedSegments = remember { mutableStateListOf<String>() }
|
||||
|
||||
LaunchedEffect(segments, skipMap) { }
|
||||
|
||||
@@ -66,21 +65,16 @@ internal fun BoxScope.SegmentSkipOverlay(
|
||||
|
||||
val segmentType = activeSegment?.type?.toSegment
|
||||
val skip = skipMap[segmentType]
|
||||
val currentSegmentId = activeSegment?.let { "${it.type}-${it.start}-${it.end}" }
|
||||
|
||||
fun skipSegment(segment: MediaSegment, segmentId: String) {
|
||||
fun skipSegment(segment: MediaSegment) {
|
||||
player.seekTo(segment.end + 250.milliseconds.inWholeMilliseconds)
|
||||
skippedSegments.add(segmentId)
|
||||
}
|
||||
|
||||
LaunchedEffect(activeSegment, position, skipMap) {
|
||||
if (skipMap.isEmpty()) return@LaunchedEffect
|
||||
if (activeSegment != null && currentSegmentId != null) {
|
||||
if (skip == SegmentSkip.SKIP || (skip == SegmentSkip.SKIP_ONCE && !skippedSegments.contains(
|
||||
currentSegmentId
|
||||
))
|
||||
) {
|
||||
skipSegment(activeSegment, currentSegmentId)
|
||||
if (activeSegment != null) {
|
||||
if (skip == SegmentSkip.SKIP) {
|
||||
skipSegment(activeSegment)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import androidx.compose.foundation.layout.fillMaxHeight
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.collectAsState
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.remember
|
||||
@@ -25,10 +26,9 @@ import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.zIndex
|
||||
import coil3.compose.AsyncImagePainter
|
||||
import coil3.compose.rememberAsyncImagePainter
|
||||
import coil3.imageLoader
|
||||
import coil3.request.ImageRequest
|
||||
import coil3.size.Size
|
||||
import coil3.toBitmap
|
||||
import kotlin.math.roundToInt
|
||||
import kotlin.time.Duration
|
||||
|
||||
private data class ThumbnailData(val tileUrl: String, val offset: Pair<Double, Double>)
|
||||
@@ -44,6 +44,16 @@ fun FilmstripTrickPlayOverlay(
|
||||
return
|
||||
}
|
||||
|
||||
val context = LocalContext.current
|
||||
LaunchedEffect(trickPlayModel) {
|
||||
trickPlayModel.images.forEach { imageUrl ->
|
||||
val request = ImageRequest.Builder(context)
|
||||
.data(imageUrl)
|
||||
.build()
|
||||
context.imageLoader.enqueue(request)
|
||||
}
|
||||
}
|
||||
|
||||
val uniqueThumbnails = remember(currentPosition, trickPlayModel, thumbnailsToShowOnEachSide) {
|
||||
val currentFrameIndex = (currentPosition.inWholeMilliseconds / trickPlayModel.interval)
|
||||
.toInt()
|
||||
@@ -140,19 +150,16 @@ private fun Thumbnail(
|
||||
offset: Pair<Double, Double>,
|
||||
) {
|
||||
val context = LocalContext.current
|
||||
val request = remember(tileUrl) {
|
||||
val painter = rememberAsyncImagePainter(
|
||||
ImageRequest.Builder(context)
|
||||
.data(tileUrl)
|
||||
.size(Size.ORIGINAL)
|
||||
.build()
|
||||
}
|
||||
val painter = rememberAsyncImagePainter(request)
|
||||
)
|
||||
val imageState by painter.state.collectAsState()
|
||||
val trickPlayTotalWidth = (trickPlayModel.width * trickPlayModel.tileWidth).toFloat()
|
||||
|
||||
Box(
|
||||
modifier = modifier
|
||||
.aspectRatio(trickPlayModel.width.toFloat() / trickPlayModel.height)
|
||||
.aspectRatio(16f / 9f)
|
||||
.clip(
|
||||
shape = RoundedCornerShape(12.dp)
|
||||
)
|
||||
@@ -160,18 +167,15 @@ private fun Thumbnail(
|
||||
when (val state = imageState) {
|
||||
is AsyncImagePainter.State.Success -> {
|
||||
val imageBitmap = state.result.image.toBitmap().asImageBitmap()
|
||||
|
||||
val trickPlayScalingFactor = state.result.image.width.toFloat() / trickPlayTotalWidth
|
||||
|
||||
val offsetX = (offset.first * trickPlayScalingFactor).roundToInt()
|
||||
val offsetY = (offset.second * trickPlayScalingFactor).roundToInt()
|
||||
val scaledWidth = (trickPlayModel.width * trickPlayScalingFactor).roundToInt()
|
||||
val scaledHeight = (trickPlayModel.height * trickPlayScalingFactor).roundToInt()
|
||||
Canvas(modifier = Modifier.matchParentSize()) {
|
||||
val (offsetX, offsetY) = offset
|
||||
drawImage(
|
||||
image = imageBitmap,
|
||||
srcOffset = IntOffset(offsetX, offsetY),
|
||||
srcSize = IntSize(scaledWidth, scaledHeight),
|
||||
srcOffset = IntOffset(offsetX.toInt(), offsetY.toInt()),
|
||||
srcSize = IntSize(
|
||||
trickPlayModel.width.toInt(),
|
||||
trickPlayModel.height.toInt()
|
||||
),
|
||||
dstSize = IntSize(size.width.toInt(), size.height.toInt())
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package nl.jknaapen.fladder.composables.controls
|
||||
|
||||
import android.os.Build
|
||||
import androidx.activity.compose.BackHandler
|
||||
import androidx.activity.compose.LocalActivity
|
||||
import androidx.annotation.OptIn
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.focusable
|
||||
@@ -48,7 +50,10 @@ import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.StrokeCap
|
||||
import androidx.compose.ui.input.key.Key
|
||||
import androidx.compose.ui.input.key.KeyEvent
|
||||
import androidx.compose.ui.input.key.KeyEventType
|
||||
import androidx.compose.ui.input.key.key
|
||||
import androidx.compose.ui.input.key.onKeyEvent
|
||||
import androidx.compose.ui.input.key.type
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.media3.common.util.UnstableApi
|
||||
@@ -61,7 +66,6 @@ import io.github.rabehx.iconsax.filled.Flash
|
||||
import io.github.rabehx.iconsax.filled.Forward
|
||||
import io.github.rabehx.iconsax.filled.Pause
|
||||
import io.github.rabehx.iconsax.filled.Play
|
||||
import io.github.rabehx.iconsax.filled.SliderVertical
|
||||
import io.github.rabehx.iconsax.filled.Subtitle
|
||||
import io.github.rabehx.iconsax.outline.CloseSquare
|
||||
import io.github.rabehx.iconsax.outline.Refresh
|
||||
@@ -75,12 +79,12 @@ import nl.jknaapen.fladder.objects.PlayerSettingsObject
|
||||
import nl.jknaapen.fladder.objects.VideoPlayerObject
|
||||
import nl.jknaapen.fladder.utility.ImmersiveSystemBars
|
||||
import nl.jknaapen.fladder.utility.defaultSelected
|
||||
import nl.jknaapen.fladder.utility.keyEvent
|
||||
import nl.jknaapen.fladder.utility.leanBackEnabled
|
||||
import nl.jknaapen.fladder.utility.visible
|
||||
import kotlin.time.Duration.Companion.seconds
|
||||
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.O)
|
||||
@OptIn(UnstableApi::class)
|
||||
@Composable
|
||||
fun CustomVideoControls(
|
||||
@@ -96,8 +100,6 @@ fun CustomVideoControls(
|
||||
|
||||
val interactionSource = remember { MutableInteractionSource() }
|
||||
|
||||
val isTVMode by VideoPlayerObject.implementation.isTVMode.collectAsState(false)
|
||||
|
||||
val activity = LocalActivity.current
|
||||
|
||||
val buffering by VideoPlayerObject.buffering.collectAsState(true)
|
||||
@@ -137,6 +139,7 @@ fun CustomVideoControls(
|
||||
val forwardSpeed by PlayerSettingsObject.forwardSpeed.collectAsState(30.seconds)
|
||||
val backwardSpeed by PlayerSettingsObject.backwardSpeed.collectAsState(15.seconds)
|
||||
|
||||
val position by VideoPlayerObject.position.collectAsState(0L)
|
||||
val player = VideoPlayerObject.implementation.player
|
||||
val lastSeekInteraction = remember { mutableLongStateOf(System.currentTimeMillis()) }
|
||||
|
||||
@@ -146,7 +149,7 @@ fun CustomVideoControls(
|
||||
LaunchedEffect(lastSeekInteraction.longValue) {
|
||||
delay(1.seconds)
|
||||
if (currentSkipTime == 0L) return@LaunchedEffect
|
||||
player?.let { it.seekTo(it.currentPosition + currentSkipTime) }
|
||||
player?.seekTo(position + currentSkipTime)
|
||||
currentSkipTime = 0L
|
||||
}
|
||||
|
||||
@@ -163,16 +166,18 @@ fun CustomVideoControls(
|
||||
bottomControlFocusRequester.requestFocus()
|
||||
}
|
||||
}
|
||||
.keyEvent { keyEvent: KeyEvent ->
|
||||
.onKeyEvent { keyEvent: KeyEvent ->
|
||||
if (keyEvent.type != KeyEventType.KeyDown) return@onKeyEvent false
|
||||
|
||||
when (keyEvent.key) {
|
||||
Key.MediaStop, Key.X -> {
|
||||
activity?.finish()
|
||||
return@keyEvent true
|
||||
return@onKeyEvent true
|
||||
}
|
||||
|
||||
Key.MediaPlay -> {
|
||||
player?.play()
|
||||
return@keyEvent true
|
||||
return@onKeyEvent true
|
||||
}
|
||||
|
||||
Key.MediaPlayPause -> {
|
||||
@@ -184,47 +189,46 @@ fun CustomVideoControls(
|
||||
it.play()
|
||||
}
|
||||
}
|
||||
return@keyEvent true
|
||||
|
||||
return@onKeyEvent true
|
||||
}
|
||||
|
||||
Key.MediaPause, Key.P -> {
|
||||
player?.pause()
|
||||
updateLastInteraction()
|
||||
return@keyEvent true
|
||||
return@onKeyEvent true
|
||||
}
|
||||
|
||||
Key.Back, Key.Escape, Key.ButtonB, Key.Backspace -> {
|
||||
if (showControls) {
|
||||
hideControls()
|
||||
return@keyEvent true
|
||||
return@onKeyEvent true
|
||||
} else {
|
||||
activity?.finish()
|
||||
return@keyEvent true
|
||||
return@onKeyEvent true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!showControls && !isTVMode) {
|
||||
if (!showControls) {
|
||||
when (keyEvent.key) {
|
||||
Key.DirectionLeft -> {
|
||||
currentSkipTime -= backwardSpeed.inWholeMilliseconds
|
||||
updateSeekInteraction()
|
||||
return@keyEvent true
|
||||
return@onKeyEvent true
|
||||
}
|
||||
|
||||
Key.DirectionRight -> {
|
||||
currentSkipTime += forwardSpeed.inWholeMilliseconds
|
||||
updateSeekInteraction()
|
||||
return@keyEvent true
|
||||
return@onKeyEvent true
|
||||
}
|
||||
}
|
||||
bottomControlFocusRequester.requestFocus()
|
||||
updateLastInteraction()
|
||||
return@keyEvent true
|
||||
return@onKeyEvent true
|
||||
} else {
|
||||
updateLastInteraction()
|
||||
return@keyEvent false
|
||||
return@onKeyEvent false
|
||||
}
|
||||
}
|
||||
.clickable(
|
||||
@@ -292,7 +296,7 @@ fun CustomVideoControls(
|
||||
Icon(
|
||||
Iconsax.Outline.CloseSquare,
|
||||
modifier = Modifier
|
||||
.size(42.dp)
|
||||
.size(38.dp)
|
||||
.focusable(false),
|
||||
contentDescription = "Close icon",
|
||||
tint = Color.White,
|
||||
@@ -419,8 +423,6 @@ fun PlaybackButtons(
|
||||
|
||||
val isPlaying = state?.playing ?: false
|
||||
|
||||
val isTVMode by VideoPlayerObject.implementation.isTVMode.collectAsState(false)
|
||||
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.padding(horizontal = 4.dp, vertical = 6.dp)
|
||||
@@ -431,38 +433,36 @@ fun PlaybackButtons(
|
||||
),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
) {
|
||||
if (!isTVMode) {
|
||||
CustomButton(
|
||||
onClick = { VideoPlayerObject.videoPlayerControls?.loadPreviousVideo {} },
|
||||
enabled = previousVideo != null,
|
||||
CustomButton(
|
||||
onClick = { VideoPlayerObject.videoPlayerControls?.loadPreviousVideo {} },
|
||||
enabled = previousVideo != null,
|
||||
) {
|
||||
Icon(
|
||||
Iconsax.Filled.Backward,
|
||||
contentDescription = previousVideo?.title,
|
||||
)
|
||||
}
|
||||
CustomButton(
|
||||
onClick = {
|
||||
player.seekTo(
|
||||
player.currentPosition - backwardSpeed.inWholeMilliseconds
|
||||
)
|
||||
},
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.wrapContentSize(),
|
||||
contentAlignment = Alignment.Center,
|
||||
) {
|
||||
Icon(
|
||||
Iconsax.Filled.Backward,
|
||||
contentDescription = previousVideo?.title,
|
||||
Iconsax.Outline.Refresh,
|
||||
modifier = Modifier.size(38.dp),
|
||||
contentDescription = "Backwards",
|
||||
)
|
||||
Text(
|
||||
"-${backwardSpeed.inWholeSeconds}",
|
||||
style = MaterialTheme.typography.bodySmall
|
||||
)
|
||||
}
|
||||
CustomButton(
|
||||
onClick = {
|
||||
player.seekTo(
|
||||
player.currentPosition - backwardSpeed.inWholeMilliseconds
|
||||
)
|
||||
},
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.wrapContentSize(),
|
||||
contentAlignment = Alignment.Center,
|
||||
) {
|
||||
Icon(
|
||||
Iconsax.Outline.Refresh,
|
||||
modifier = Modifier.size(42.dp),
|
||||
contentDescription = "Backwards",
|
||||
)
|
||||
Text(
|
||||
"-${backwardSpeed.inWholeSeconds}",
|
||||
style = MaterialTheme.typography.bodySmall
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
CustomButton(
|
||||
@@ -481,47 +481,45 @@ fun PlaybackButtons(
|
||||
) {
|
||||
Icon(
|
||||
if (isPlaying) Iconsax.Filled.Pause else Iconsax.Filled.Play,
|
||||
modifier = Modifier.size(45.dp),
|
||||
modifier = Modifier.size(40.dp),
|
||||
contentDescription = if (isPlaying) "Pause" else "Play",
|
||||
)
|
||||
}
|
||||
if (!isTVMode) {
|
||||
CustomButton(
|
||||
onClick = {
|
||||
player.seekTo(
|
||||
player.currentPosition + forwardSpeed.inWholeMilliseconds
|
||||
)
|
||||
},
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.wrapContentSize(),
|
||||
contentAlignment = Alignment.Center,
|
||||
) {
|
||||
Icon(
|
||||
Iconsax.Outline.Refresh,
|
||||
contentDescription = "Forward",
|
||||
modifier = Modifier
|
||||
.size(42.dp)
|
||||
.scale(scaleX = -1f, scaleY = 1f),
|
||||
)
|
||||
Text(
|
||||
forwardSpeed.inWholeSeconds.toString(),
|
||||
style = MaterialTheme.typography.bodySmall
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
CustomButton(
|
||||
onClick = { VideoPlayerObject.videoPlayerControls?.loadNextVideo {} },
|
||||
enabled = nextVideo != null,
|
||||
CustomButton(
|
||||
onClick = {
|
||||
player.seekTo(
|
||||
player.currentPosition + forwardSpeed.inWholeMilliseconds
|
||||
)
|
||||
},
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.wrapContentSize(),
|
||||
contentAlignment = Alignment.Center,
|
||||
) {
|
||||
Icon(
|
||||
Iconsax.Filled.Forward,
|
||||
contentDescription = nextVideo?.title,
|
||||
Iconsax.Outline.Refresh,
|
||||
contentDescription = "Forward",
|
||||
modifier = Modifier
|
||||
.size(38.dp)
|
||||
.scale(scaleX = -1f, scaleY = 1f),
|
||||
)
|
||||
Text(
|
||||
forwardSpeed.inWholeSeconds.toString(),
|
||||
style = MaterialTheme.typography.bodySmall
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
CustomButton(
|
||||
onClick = { VideoPlayerObject.videoPlayerControls?.loadNextVideo {} },
|
||||
enabled = nextVideo != null,
|
||||
) {
|
||||
Icon(
|
||||
Iconsax.Filled.Forward,
|
||||
contentDescription = nextVideo?.title,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -531,33 +529,29 @@ internal fun RowScope.LeftButtons(
|
||||
openPlaybackSpeedPicker: () -> Unit,
|
||||
) {
|
||||
val chapters by VideoPlayerObject.chapters.collectAsState(emptyList())
|
||||
val isTVMode by VideoPlayerObject.implementation.isTVMode.collectAsState(false)
|
||||
|
||||
|
||||
Row(
|
||||
modifier = Modifier.weight(1f),
|
||||
horizontalArrangement = Arrangement.spacedBy(12.dp, alignment = Alignment.Start)
|
||||
) {
|
||||
if (!isTVMode) {
|
||||
CustomButton(
|
||||
onClick = openChapterSelection,
|
||||
enabled = chapters?.isNotEmpty() == true
|
||||
) {
|
||||
Icon(
|
||||
Iconsax.Filled.Check,
|
||||
contentDescription = "Show chapters",
|
||||
)
|
||||
}
|
||||
CustomButton(
|
||||
onClick = openChapterSelection,
|
||||
enabled = chapters?.isNotEmpty() == true
|
||||
) {
|
||||
Icon(
|
||||
Iconsax.Filled.Check,
|
||||
contentDescription = "Show chapters",
|
||||
)
|
||||
}
|
||||
|
||||
CustomButton(
|
||||
onClick = openPlaybackSpeedPicker,
|
||||
enabled = true
|
||||
) {
|
||||
Icon(
|
||||
Iconsax.Filled.Flash,
|
||||
contentDescription = "Playback Speed",
|
||||
)
|
||||
}
|
||||
CustomButton(
|
||||
onClick = openPlaybackSpeedPicker,
|
||||
enabled = true
|
||||
) {
|
||||
Icon(
|
||||
Iconsax.Filled.Flash,
|
||||
contentDescription = "Playback Speed",
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -570,46 +564,31 @@ internal fun RowScope.RightButtons(
|
||||
val hasSubtitles by VideoPlayerObject.hasSubtracks.collectAsState(false)
|
||||
val hasAudioTracks by VideoPlayerObject.hasAudioTracks.collectAsState(false)
|
||||
|
||||
val isTVMode by VideoPlayerObject.implementation.isTVMode.collectAsState(false)
|
||||
|
||||
Row(
|
||||
modifier = Modifier.weight(1f),
|
||||
horizontalArrangement = Arrangement.spacedBy(12.dp, alignment = Alignment.End)
|
||||
) {
|
||||
if (isTVMode) {
|
||||
CustomButton(
|
||||
onClick = {
|
||||
VideoPlayerObject.toggleGuideVisibility()
|
||||
},
|
||||
) {
|
||||
Icon(
|
||||
Iconsax.Filled.SliderVertical,
|
||||
contentDescription = "TV Guide",
|
||||
)
|
||||
}
|
||||
} else {
|
||||
CustomButton(
|
||||
enabled = hasAudioTracks,
|
||||
onClick = {
|
||||
showAudioDialog.value = true
|
||||
},
|
||||
) {
|
||||
Icon(
|
||||
Iconsax.Filled.AudioSquare,
|
||||
contentDescription = "Audio Track",
|
||||
)
|
||||
}
|
||||
CustomButton(
|
||||
enabled = hasSubtitles,
|
||||
onClick = {
|
||||
showSubDialog.value = true
|
||||
},
|
||||
) {
|
||||
Icon(
|
||||
Iconsax.Filled.Subtitle,
|
||||
contentDescription = "Subtitles",
|
||||
)
|
||||
}
|
||||
CustomButton(
|
||||
enabled = hasAudioTracks,
|
||||
onClick = {
|
||||
showAudioDialog.value = true
|
||||
},
|
||||
) {
|
||||
Icon(
|
||||
Iconsax.Filled.AudioSquare,
|
||||
contentDescription = "Audio Track",
|
||||
)
|
||||
}
|
||||
CustomButton(
|
||||
enabled = hasSubtitles,
|
||||
onClick = {
|
||||
showSubDialog.value = true
|
||||
},
|
||||
) {
|
||||
Icon(
|
||||
Iconsax.Filled.Subtitle,
|
||||
contentDescription = "Subtitles",
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -59,7 +59,7 @@ import kotlin.time.toDuration
|
||||
@Composable
|
||||
internal fun NextUpOverlay(
|
||||
modifier: Modifier = Modifier,
|
||||
overlay: @Composable BoxScope.(showControls: Boolean) -> Unit,
|
||||
content: @Composable BoxScope.(Boolean) -> Unit,
|
||||
) {
|
||||
val nextVideo by VideoPlayerObject.nextUpVideo.collectAsState(null)
|
||||
|
||||
@@ -70,7 +70,7 @@ internal fun NextUpOverlay(
|
||||
return Box(
|
||||
modifier = Modifier.fillMaxSize()
|
||||
) {
|
||||
overlay(true)
|
||||
content(true)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ internal fun NextUpOverlay(
|
||||
}
|
||||
)
|
||||
) {
|
||||
overlay(!showNextUp)
|
||||
content(!showNextUp)
|
||||
}
|
||||
|
||||
Column(
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
package nl.jknaapen.fladder.composables.overlays.guide
|
||||
|
||||
import GuideChannel
|
||||
import GuideProgram
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material3.AlertDialog
|
||||
import androidx.compose.material3.Button
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.TextButton
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.unit.dp
|
||||
import nl.jknaapen.fladder.objects.Localized
|
||||
import nl.jknaapen.fladder.objects.Translate
|
||||
|
||||
@Composable
|
||||
fun ChannelSwitchConfirmDialog(
|
||||
show: Boolean,
|
||||
channel: GuideChannel?,
|
||||
program: GuideProgram?,
|
||||
onConfirm: () -> Unit,
|
||||
onDismiss: () -> Unit
|
||||
) {
|
||||
if (show && channel != null && program != null) {
|
||||
Translate(Localized::watch) { watch ->
|
||||
Translate(Localized::decline) { decline ->
|
||||
AlertDialog(
|
||||
onDismissRequest = onDismiss,
|
||||
title = {
|
||||
Translate(Localized::switchChannel) {
|
||||
Text(it)
|
||||
}
|
||||
},
|
||||
text = {
|
||||
Translate({
|
||||
Localized.switchChannelDesc(
|
||||
program.name,
|
||||
channel.name,
|
||||
it
|
||||
)
|
||||
}) {
|
||||
Text(it)
|
||||
}
|
||||
},
|
||||
confirmButton = {
|
||||
Button(onClick = onConfirm) {
|
||||
Text(watch)
|
||||
}
|
||||
},
|
||||
dismissButton = {
|
||||
TextButton(onClick = onDismiss) {
|
||||
Text(decline)
|
||||
}
|
||||
},
|
||||
shape = RoundedCornerShape(12.dp)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,100 +0,0 @@
|
||||
package nl.jknaapen.fladder.composables.overlays.guide
|
||||
|
||||
import GuideChannel
|
||||
import GuideProgram
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.fillMaxHeight
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material3.HorizontalDivider
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.unit.dp
|
||||
import coil3.compose.AsyncImage
|
||||
|
||||
@Composable
|
||||
fun GuideDetailView(
|
||||
modifier: Modifier = Modifier,
|
||||
currentChannel: GuideChannel?,
|
||||
activeProgram: GuideProgram?,
|
||||
) {
|
||||
Column(
|
||||
modifier = modifier
|
||||
.background(
|
||||
MaterialTheme.colorScheme.surface,
|
||||
shape = MaterialTheme.shapes.small
|
||||
)
|
||||
.fillMaxWidth(0.5f)
|
||||
.fillMaxHeight(0.5f)
|
||||
.padding(12.dp),
|
||||
verticalArrangement = Arrangement.spacedBy(8.dp),
|
||||
) {
|
||||
activeProgram?.let { program ->
|
||||
currentChannel?.let {
|
||||
Text(
|
||||
it.name,
|
||||
style = MaterialTheme.typography.titleLarge.copy(
|
||||
color = MaterialTheme.colorScheme.onSurface
|
||||
)
|
||||
)
|
||||
HorizontalDivider()
|
||||
}
|
||||
Row(
|
||||
horizontalArrangement = Arrangement.Start,
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
) {
|
||||
Text(
|
||||
program.name,
|
||||
style = MaterialTheme.typography.titleMedium.copy(
|
||||
color = MaterialTheme.colorScheme.onSurface
|
||||
)
|
||||
)
|
||||
if (program.subTitle?.lowercase() != program.name.lowercase()) {
|
||||
program.subTitle?.let {
|
||||
Text(
|
||||
" - $it",
|
||||
style = MaterialTheme.typography.titleSmall.copy(
|
||||
color = MaterialTheme.colorScheme.onSurface
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Row(
|
||||
modifier = Modifier.weight(1f),
|
||||
horizontalArrangement = Arrangement.spacedBy(12.dp),
|
||||
) {
|
||||
program.primaryPoster?.let { posterUrl ->
|
||||
AsyncImage(
|
||||
model = posterUrl,
|
||||
contentDescription = null,
|
||||
modifier = Modifier
|
||||
.height(150.dp)
|
||||
.clip(RoundedCornerShape(6.dp))
|
||||
)
|
||||
}
|
||||
program.overview?.let { overview ->
|
||||
Text(
|
||||
overview,
|
||||
style = MaterialTheme.typography.bodyMedium.copy(
|
||||
color = MaterialTheme.colorScheme.onSurface
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
} ?: run {
|
||||
Spacer(modifier = Modifier.weight(1f))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,312 +0,0 @@
|
||||
package nl.jknaapen.fladder.composables.overlays.guide
|
||||
|
||||
import GuideChannel
|
||||
import GuideProgram
|
||||
import androidx.activity.compose.BackHandler
|
||||
import androidx.compose.animation.core.animateFloatAsState
|
||||
import androidx.compose.foundation.ScrollState
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.horizontalScroll
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.BoxScope
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.width
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.LazyListState
|
||||
import androidx.compose.foundation.lazy.itemsIndexed
|
||||
import androidx.compose.foundation.lazy.rememberLazyListState
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.collectAsState
|
||||
import androidx.compose.runtime.derivedStateOf
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableLongStateOf
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.focus.FocusRequester
|
||||
import androidx.compose.ui.focus.focusRequester
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.input.key.Key
|
||||
import androidx.compose.ui.input.key.key
|
||||
import androidx.compose.ui.platform.LocalDensity
|
||||
import kotlinx.coroutines.delay
|
||||
import nl.jknaapen.fladder.composables.overlays.guide.GuideConstants.CHANNEL_WIDTH
|
||||
import nl.jknaapen.fladder.composables.overlays.guide.GuideConstants.TIME_LINE_HEIGHT
|
||||
import nl.jknaapen.fladder.composables.overlays.guide.GuideConstants.WIDTH_PER_MINUTE
|
||||
import nl.jknaapen.fladder.objects.VideoPlayerObject
|
||||
import nl.jknaapen.fladder.utility.conditional
|
||||
import nl.jknaapen.fladder.utility.keyEvent
|
||||
import nl.jknaapen.fladder.utility.visible
|
||||
import kotlin.time.Duration.Companion.minutes
|
||||
import kotlin.time.DurationUnit
|
||||
import kotlin.time.toDuration
|
||||
|
||||
@Composable
|
||||
fun GuideOverlay(
|
||||
modifier: Modifier = Modifier,
|
||||
overlay: @Composable BoxScope.(showControls: Boolean) -> Unit,
|
||||
) {
|
||||
val tvGuide by VideoPlayerObject.tvGuide.collectAsState()
|
||||
var channels by remember { mutableStateOf(tvGuide?.channels ?: emptyList()) }
|
||||
val showGuide by VideoPlayerObject.guideVisible.collectAsState(false)
|
||||
|
||||
BackHandler(
|
||||
enabled = showGuide
|
||||
) {
|
||||
if (showGuide) {
|
||||
VideoPlayerObject.guideVisible.value = false
|
||||
}
|
||||
}
|
||||
|
||||
val focusRequester = remember { FocusRequester() }
|
||||
|
||||
val startDate = tvGuide?.startMs ?: 0L
|
||||
val endDate = tvGuide?.endMs ?: 0L
|
||||
var now by remember { mutableLongStateOf(System.currentTimeMillis()) }
|
||||
|
||||
val isBuffering by VideoPlayerObject.buffering.collectAsState(true)
|
||||
|
||||
fun loadChannel(selectedChannel: GuideChannel) {
|
||||
if (isBuffering) return
|
||||
VideoPlayerObject.videoPlayerControls?.loadProgram(selectedChannel) {
|
||||
VideoPlayerObject.guideVisible.value = false
|
||||
}
|
||||
}
|
||||
|
||||
LaunchedEffect(key1 = showGuide) {
|
||||
while (showGuide) {
|
||||
now = System.currentTimeMillis()
|
||||
delay(1.minutes)
|
||||
}
|
||||
}
|
||||
|
||||
val currentProgram = tvGuide?.currentProgram
|
||||
var selectedProgram by remember { mutableStateOf<GuideProgram?>(null) }
|
||||
|
||||
val activeProgram by remember {
|
||||
derivedStateOf {
|
||||
selectedProgram ?: currentProgram
|
||||
}
|
||||
}
|
||||
|
||||
val currentChannel by remember { mutableStateOf(channels.firstOrNull { it.channelId == currentProgram?.channelId }) }
|
||||
|
||||
var showConfirmDialog by remember { mutableStateOf(false) }
|
||||
var pendingChannel by remember { mutableStateOf<GuideChannel?>(null) }
|
||||
var pendingProgram by remember { mutableStateOf<GuideProgram?>(null) }
|
||||
|
||||
val horizontalScrollState = rememberScrollState()
|
||||
val guideListState = rememberLazyListState()
|
||||
|
||||
val programFlatMap = remember(channels) {
|
||||
channels.flatMap { it.programs }
|
||||
}
|
||||
|
||||
val focusRequesters = remember(programFlatMap) {
|
||||
programFlatMap.associateWith { FocusRequester() }
|
||||
}
|
||||
|
||||
LaunchedEffect(showGuide) {
|
||||
if (!showGuide || currentProgram == null) return@LaunchedEffect
|
||||
focusRequesters.entries.firstOrNull { it.key.id == currentProgram.id }?.value?.let {
|
||||
delay(250)
|
||||
it.requestFocus()
|
||||
it.captureFocus()
|
||||
}
|
||||
}
|
||||
|
||||
val density = LocalDensity.current
|
||||
LaunchedEffect(key1 = showGuide) {
|
||||
val ap = activeProgram
|
||||
if (!showGuide || ap == null) return@LaunchedEffect
|
||||
|
||||
delay(250)
|
||||
|
||||
val widthPerMinutePx = with(density) { WIDTH_PER_MINUTE.toPx() }
|
||||
|
||||
val minutesFromStart = ((ap.startMs - startDate) / 60000.0).toFloat()
|
||||
val targetX = (minutesFromStart * widthPerMinutePx).toInt().coerceAtLeast(0)
|
||||
|
||||
val maxX = horizontalScrollState.maxValue
|
||||
val scrollToX = targetX.coerceIn(0, maxX)
|
||||
|
||||
val channelIndex = channels.indexOfFirst { it.channelId == ap.channelId }
|
||||
if (channelIndex >= 0) {
|
||||
horizontalScrollState.animateScrollTo(scrollToX)
|
||||
guideListState.animateScrollToItem(channelIndex + 1)
|
||||
}
|
||||
}
|
||||
|
||||
Box(
|
||||
modifier = modifier
|
||||
.fillMaxSize()
|
||||
.background(color = Color.Black)
|
||||
.focusRequester(focusRequester)
|
||||
.conditional(showGuide, modifier = {
|
||||
keyEvent { keyEvent ->
|
||||
when (keyEvent.key) {
|
||||
Key.Back, Key.Escape, Key.ButtonB, Key.Backspace -> {
|
||||
if (showGuide) {
|
||||
VideoPlayerObject.guideVisible.value = false
|
||||
return@keyEvent true
|
||||
} else {
|
||||
return@keyEvent false
|
||||
}
|
||||
}
|
||||
}
|
||||
return@keyEvent false
|
||||
}
|
||||
})
|
||||
) {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.visible(showGuide),
|
||||
) {
|
||||
GuideDetailView(
|
||||
modifier = Modifier.align(Alignment.End),
|
||||
currentChannel = currentChannel,
|
||||
activeProgram = activeProgram,
|
||||
)
|
||||
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.weight(1f)
|
||||
.fillMaxWidth(1f)
|
||||
) {
|
||||
GuideRows(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
channels = channels,
|
||||
currentChannel = currentChannel,
|
||||
startDate = startDate,
|
||||
endDate = endDate,
|
||||
horizontalScrollState = horizontalScrollState,
|
||||
focusRequesters = focusRequesters,
|
||||
listState = guideListState,
|
||||
now = now,
|
||||
onProgramSelected = { channel, program ->
|
||||
if (selectedProgram?.id == program.id && currentChannel?.channelId != program.channelId) {
|
||||
pendingChannel = channel
|
||||
pendingProgram = program
|
||||
showConfirmDialog = true
|
||||
}
|
||||
selectedProgram = program
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
val animatedSizeFraction by animateFloatAsState(
|
||||
if (showGuide) 0.5f else 1f,
|
||||
label = "guideSizeFraction"
|
||||
)
|
||||
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.fillMaxSize(animatedSizeFraction)
|
||||
.align(Alignment.TopStart)
|
||||
) {
|
||||
overlay(!showGuide)
|
||||
}
|
||||
|
||||
ChannelSwitchConfirmDialog(
|
||||
show = showConfirmDialog,
|
||||
channel = pendingChannel,
|
||||
program = pendingProgram,
|
||||
onConfirm = {
|
||||
pendingChannel?.let { channel ->
|
||||
loadChannel(channel)
|
||||
VideoPlayerObject.guideVisible.value = false
|
||||
}
|
||||
showConfirmDialog = false
|
||||
pendingChannel = null
|
||||
pendingProgram = null
|
||||
},
|
||||
onDismiss = {
|
||||
showConfirmDialog = false
|
||||
pendingChannel = null
|
||||
pendingProgram = null
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun GuideRows(
|
||||
modifier: Modifier = Modifier,
|
||||
currentChannel: GuideChannel? = null,
|
||||
channels: List<GuideChannel>,
|
||||
startDate: Long,
|
||||
endDate: Long,
|
||||
horizontalScrollState: ScrollState,
|
||||
focusRequesters: Map<GuideProgram, FocusRequester>,
|
||||
listState: LazyListState,
|
||||
now: Long = System.currentTimeMillis(),
|
||||
onProgramSelected: (GuideChannel, GuideProgram) -> Unit,
|
||||
) {
|
||||
val totalMinutes = remember(startDate, endDate) {
|
||||
(endDate - startDate).toDuration(unit = DurationUnit.MILLISECONDS).inWholeMinutes
|
||||
}
|
||||
val totalWidth = WIDTH_PER_MINUTE * totalMinutes.toFloat()
|
||||
|
||||
Box(modifier = modifier) {
|
||||
LazyColumn(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
state = listState
|
||||
) {
|
||||
stickyHeader {
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.height(TIME_LINE_HEIGHT)
|
||||
.fillMaxWidth()
|
||||
.background(MaterialTheme.colorScheme.surface)
|
||||
) {
|
||||
Spacer(modifier = Modifier.width(CHANNEL_WIDTH))
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.weight(1f)
|
||||
.horizontalScroll(horizontalScrollState)
|
||||
) {
|
||||
TimeLine(
|
||||
modifier = Modifier.width(totalWidth),
|
||||
startDate = startDate,
|
||||
endDate = endDate,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
itemsIndexed(channels) { _, channel ->
|
||||
GuideRow(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
channel = channel,
|
||||
currentChannel = currentChannel,
|
||||
startDate = startDate,
|
||||
horizontalScrollState = horizontalScrollState,
|
||||
focusRequesters = focusRequesters,
|
||||
totalWidth = totalWidth,
|
||||
onProgramSelected = onProgramSelected,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
NowIndicator(
|
||||
now = now,
|
||||
startDate = startDate,
|
||||
endDate = endDate,
|
||||
horizontalScrollState = horizontalScrollState,
|
||||
totalWidth = totalWidth,
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -1,307 +0,0 @@
|
||||
package nl.jknaapen.fladder.composables.overlays.guide
|
||||
|
||||
import GuideChannel
|
||||
import GuideProgram
|
||||
import androidx.compose.foundation.ScrollState
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.border
|
||||
import androidx.compose.foundation.horizontalScroll
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.aspectRatio
|
||||
import androidx.compose.foundation.layout.fillMaxHeight
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.offset
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.layout.width
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material3.CircularProgressIndicator
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.focus.FocusRequester
|
||||
import androidx.compose.ui.focus.focusRequester
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.Dp
|
||||
import androidx.compose.ui.unit.coerceAtLeast
|
||||
import androidx.compose.ui.unit.dp
|
||||
import coil3.compose.AsyncImage
|
||||
import nl.jknaapen.fladder.composables.controls.CustomButton
|
||||
import nl.jknaapen.fladder.objects.VideoPlayerObject
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Date
|
||||
import java.util.Locale
|
||||
import java.util.TimeZone
|
||||
import kotlin.time.DurationUnit
|
||||
import kotlin.time.toDuration
|
||||
import nl.jknaapen.fladder.composables.overlays.guide.GuideConstants.CHANNEL_HEIGHT
|
||||
import nl.jknaapen.fladder.composables.overlays.guide.GuideConstants.CHANNEL_WIDTH
|
||||
import nl.jknaapen.fladder.composables.overlays.guide.GuideConstants.WIDTH_PER_MINUTE
|
||||
|
||||
@Composable
|
||||
fun GuideRow(
|
||||
modifier: Modifier = Modifier,
|
||||
channel: GuideChannel,
|
||||
currentChannel: GuideChannel?,
|
||||
startDate: Long,
|
||||
horizontalScrollState: ScrollState,
|
||||
focusRequesters: Map<GuideProgram, FocusRequester>,
|
||||
totalWidth: Dp,
|
||||
onProgramSelected: (GuideChannel, GuideProgram) -> Unit,
|
||||
) {
|
||||
var programmes by remember { mutableStateOf(channel.programs) }
|
||||
var hasLoadedPrograms by remember { mutableStateOf(channel.programsLoaded) }
|
||||
|
||||
val localFocusRequesters = remember(programmes) {
|
||||
programmes.associateWith { FocusRequester() }
|
||||
}
|
||||
|
||||
LaunchedEffect(channel.channelId) {
|
||||
if (!hasLoadedPrograms) {
|
||||
VideoPlayerObject.videoPlayerControls?.fetchProgramsForChannel(channel.channelId) { programs ->
|
||||
programmes = programs.getOrNull() ?: emptyList()
|
||||
hasLoadedPrograms = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Row(
|
||||
modifier = modifier
|
||||
.height(CHANNEL_HEIGHT)
|
||||
.clip(MaterialTheme.shapes.small)
|
||||
) {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.height(CHANNEL_HEIGHT)
|
||||
.width(CHANNEL_WIDTH)
|
||||
.background(if (currentChannel?.channelId == channel.channelId) MaterialTheme.colorScheme.primaryContainer else MaterialTheme.colorScheme.surface),
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
verticalArrangement = Arrangement.Center,
|
||||
) {
|
||||
channel.logoUrl?.let {
|
||||
AsyncImage(
|
||||
model = it,
|
||||
contentDescription = null,
|
||||
modifier = Modifier
|
||||
.fillMaxHeight()
|
||||
.aspectRatio(ratio = 0.75f)
|
||||
.clip(RoundedCornerShape(6.dp))
|
||||
)
|
||||
}
|
||||
Text(
|
||||
channel.name,
|
||||
style = MaterialTheme.typography.bodyMedium.copy(
|
||||
color = MaterialTheme.colorScheme.onSurface
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.weight(1f)
|
||||
.horizontalScroll(horizontalScrollState)
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.height(CHANNEL_HEIGHT)
|
||||
.width(totalWidth)
|
||||
) {
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.clip(MaterialTheme.shapes.small)
|
||||
) {
|
||||
if (!hasLoadedPrograms) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.width(CHANNEL_WIDTH)
|
||||
.fillMaxHeight()
|
||||
.padding(4.dp),
|
||||
contentAlignment = Alignment.Center
|
||||
) {
|
||||
CircularProgressIndicator(modifier = Modifier.size(24.dp))
|
||||
}
|
||||
} else if (programmes.isEmpty()) {
|
||||
CustomButton(
|
||||
modifier = Modifier
|
||||
.width(CHANNEL_WIDTH)
|
||||
.fillMaxHeight()
|
||||
.padding(1.dp)
|
||||
.background(
|
||||
MaterialTheme.colorScheme.surfaceContainer,
|
||||
shape = MaterialTheme.shapes.small
|
||||
)
|
||||
.border(
|
||||
1.dp,
|
||||
Color.White.copy(alpha = 0.18f),
|
||||
MaterialTheme.shapes.small
|
||||
),
|
||||
onClick = { /* No action */ },
|
||||
shape = MaterialTheme.shapes.small,
|
||||
backgroundFocusedColor = Color.White.copy(alpha = 0.35f),
|
||||
foreGroundFocusedColor = MaterialTheme.colorScheme.onSurface,
|
||||
) {
|
||||
Text(
|
||||
"No programs",
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant
|
||||
)
|
||||
}
|
||||
} else {
|
||||
programmes.mapIndexed { index, program ->
|
||||
val offsetSinceStart = if (index == 0) {
|
||||
val minutes =
|
||||
(program.startMs - startDate).toDuration(unit = DurationUnit.MILLISECONDS).inWholeMinutes
|
||||
(WIDTH_PER_MINUTE * minutes.toFloat()).coerceAtLeast(0.dp)
|
||||
} else 0.dp
|
||||
|
||||
val previousSameProgram =
|
||||
programmes.getOrNull(index - 1)?.name == program.name
|
||||
|
||||
val visibleStart = maxOf(program.startMs, startDate)
|
||||
val visibleDuration =
|
||||
(program.endMs - visibleStart).toDuration(unit = DurationUnit.MILLISECONDS)
|
||||
val programWidth =
|
||||
WIDTH_PER_MINUTE * visibleDuration.inWholeMinutes.toFloat()
|
||||
|
||||
GuideProgram(
|
||||
program = program,
|
||||
programWidth = programWidth,
|
||||
offsetSinceStart = offsetSinceStart,
|
||||
previousSameProgram = previousSameProgram,
|
||||
focusRequester = localFocusRequesters[program]
|
||||
?: focusRequesters[program]
|
||||
?: FocusRequester(),
|
||||
onClick = {
|
||||
onProgramSelected(channel, program)
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun GuideProgram(
|
||||
modifier: Modifier = Modifier,
|
||||
program: GuideProgram,
|
||||
programWidth: Dp,
|
||||
offsetSinceStart: Dp,
|
||||
previousSameProgram: Boolean,
|
||||
focusRequester: FocusRequester,
|
||||
onClick: () -> Unit,
|
||||
) {
|
||||
val smallSize = programWidth < CHANNEL_WIDTH || program.primaryPoster.isNullOrBlank()
|
||||
val programColor = generateColorFromString(program.name)
|
||||
|
||||
CustomButton(
|
||||
modifier = modifier
|
||||
.padding(start = offsetSinceStart.coerceAtLeast(0.dp))
|
||||
.padding(1.dp)
|
||||
.focusRequester(focusRequester)
|
||||
.background(
|
||||
programColor.copy(alpha = 0.25f),
|
||||
shape = MaterialTheme.shapes.small,
|
||||
)
|
||||
.border(
|
||||
width = 1.dp,
|
||||
shape = MaterialTheme.shapes.small,
|
||||
color = programColor.copy(0.3f)
|
||||
)
|
||||
.width(programWidth)
|
||||
.clip(MaterialTheme.shapes.small)
|
||||
.fillMaxHeight(),
|
||||
shape = MaterialTheme.shapes.small,
|
||||
backgroundFocusedColor = Color.White.copy(alpha = 0.35f),
|
||||
foreGroundFocusedColor = MaterialTheme.colorScheme.onSurface,
|
||||
clickAnimation = false,
|
||||
padding = 0.dp,
|
||||
onClick = onClick,
|
||||
) {
|
||||
Row(
|
||||
horizontalArrangement = Arrangement.spacedBy(6.dp)
|
||||
) {
|
||||
if (!previousSameProgram && !smallSize) {
|
||||
program.primaryPoster.let {
|
||||
AsyncImage(
|
||||
model = it,
|
||||
contentDescription = null,
|
||||
modifier = Modifier
|
||||
.aspectRatio(ratio = 0.75f)
|
||||
.fillMaxHeight()
|
||||
.offset(x = (-2).dp)
|
||||
.clip(RoundedCornerShape(4.dp))
|
||||
)
|
||||
}
|
||||
}
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxHeight()
|
||||
.padding(horizontal = if (previousSameProgram || smallSize) 6.dp else 0.dp)
|
||||
.weight(1f),
|
||||
horizontalAlignment = Alignment.Start,
|
||||
verticalArrangement = Arrangement.Center,
|
||||
) {
|
||||
Text(
|
||||
program.name,
|
||||
style = MaterialTheme.typography.titleMedium,
|
||||
maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis
|
||||
)
|
||||
if (program.subTitle?.lowercase() != program.name.lowercase()) {
|
||||
program.subTitle?.let {
|
||||
Text(
|
||||
it,
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis
|
||||
)
|
||||
}
|
||||
}
|
||||
Row {
|
||||
val formatter = SimpleDateFormat(
|
||||
"HH:mm",
|
||||
Locale.getDefault()
|
||||
)
|
||||
formatter.timeZone = TimeZone.getDefault()
|
||||
val startDateTime = Date(program.startMs)
|
||||
val endDateTime = Date(program.endMs)
|
||||
Text(
|
||||
"${formatter.format(startDateTime)} - ${
|
||||
formatter.format(
|
||||
endDateTime
|
||||
)
|
||||
}",
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun generateColorFromString(input: String): Color {
|
||||
val hash = input.hashCode()
|
||||
val r = (hash and 0xFF0000) shr 16
|
||||
val g = (hash and 0x00FF00) shr 8
|
||||
val b = (hash and 0x0000FF)
|
||||
return Color(r, g, b)
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
package nl.jknaapen.fladder.composables.overlays.guide
|
||||
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
||||
object GuideConstants {
|
||||
val CHANNEL_HEIGHT = 70.dp
|
||||
val CHANNEL_WIDTH = 125.dp
|
||||
val WIDTH_PER_MINUTE = 6.dp
|
||||
val TIME_LINE_HEIGHT = 40.dp
|
||||
}
|
||||
@@ -1,91 +0,0 @@
|
||||
package nl.jknaapen.fladder.composables.overlays.guide
|
||||
|
||||
import androidx.compose.foundation.ScrollState
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.fillMaxHeight
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.offset
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.width
|
||||
import androidx.compose.foundation.layout.wrapContentSize
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.derivedStateOf
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clipToBounds
|
||||
import androidx.compose.ui.platform.LocalDensity
|
||||
import androidx.compose.ui.unit.Dp
|
||||
import androidx.compose.ui.unit.dp
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Date
|
||||
import java.util.Locale
|
||||
import java.util.TimeZone
|
||||
import nl.jknaapen.fladder.composables.overlays.guide.GuideConstants.CHANNEL_WIDTH
|
||||
import nl.jknaapen.fladder.composables.overlays.guide.GuideConstants.WIDTH_PER_MINUTE
|
||||
|
||||
@Composable
|
||||
fun NowIndicator(
|
||||
modifier: Modifier = Modifier,
|
||||
now: Long,
|
||||
startDate: Long,
|
||||
endDate: Long,
|
||||
horizontalScrollState: ScrollState,
|
||||
totalWidth: Dp,
|
||||
) {
|
||||
if (now !in startDate..endDate) return
|
||||
|
||||
val density = LocalDensity.current
|
||||
val scrollOffsetPx by remember {
|
||||
derivedStateOf { horizontalScrollState.value }
|
||||
}
|
||||
val scrollOffsetDp = with(density) { scrollOffsetPx.toDp() }
|
||||
val nowOffsetMinutes = ((now - startDate).toDouble() / 60000.0).toFloat()
|
||||
val rawNowX = (WIDTH_PER_MINUTE * nowOffsetMinutes) - scrollOffsetDp
|
||||
val nowXPosition = rawNowX.coerceIn(0.dp, totalWidth)
|
||||
|
||||
Row(
|
||||
modifier = modifier.fillMaxSize()
|
||||
) {
|
||||
Spacer(modifier = Modifier.width(CHANNEL_WIDTH))
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.width(totalWidth)
|
||||
.fillMaxHeight()
|
||||
.clipToBounds()
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.offset(x = nowXPosition + 4.dp, y = 0.dp)
|
||||
.align(Alignment.TopStart)
|
||||
.wrapContentSize()
|
||||
.background(
|
||||
MaterialTheme.colorScheme.primary,
|
||||
shape = MaterialTheme.shapes.small
|
||||
)
|
||||
) {
|
||||
val formatter = SimpleDateFormat("HH:mm", Locale.getDefault())
|
||||
formatter.timeZone = TimeZone.getDefault()
|
||||
Text(
|
||||
formatter.format(Date(now)),
|
||||
modifier = Modifier.padding(4.dp),
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
)
|
||||
}
|
||||
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.offset(x = nowXPosition)
|
||||
.fillMaxHeight()
|
||||
.width(2.dp)
|
||||
.background(MaterialTheme.colorScheme.primary)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
package nl.jknaapen.fladder.composables.overlays.guide
|
||||
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.fillMaxHeight
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.width
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.VerticalDivider
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.unit.dp
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Date
|
||||
import java.util.Locale
|
||||
import java.util.TimeZone
|
||||
import kotlin.time.DurationUnit
|
||||
import kotlin.time.toDuration
|
||||
import nl.jknaapen.fladder.composables.overlays.guide.GuideConstants.TIME_LINE_HEIGHT
|
||||
import nl.jknaapen.fladder.composables.overlays.guide.GuideConstants.WIDTH_PER_MINUTE
|
||||
|
||||
@Composable
|
||||
fun TimeLine(
|
||||
modifier: Modifier = Modifier,
|
||||
startDate: Long,
|
||||
endDate: Long,
|
||||
) {
|
||||
Row(
|
||||
modifier = modifier
|
||||
.height(TIME_LINE_HEIGHT + 4.dp)
|
||||
) {
|
||||
val totalDuration =
|
||||
(endDate - startDate).toDuration(unit = DurationUnit.MILLISECONDS)
|
||||
val totalMinutes = totalDuration.inWholeMinutes
|
||||
val formatter = SimpleDateFormat("HH:mm", Locale.getDefault())
|
||||
formatter.timeZone = TimeZone.getDefault()
|
||||
val stepSize: Long = 15
|
||||
for (minute in 0 until totalMinutes step stepSize) {
|
||||
val displayDate = Date(startDate + (minute * 60000))
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.width(WIDTH_PER_MINUTE * stepSize.toFloat())
|
||||
.fillMaxHeight(),
|
||||
horizontalArrangement = Arrangement.spacedBy(
|
||||
6.dp,
|
||||
Alignment.Start
|
||||
),
|
||||
verticalAlignment = Alignment.Bottom,
|
||||
) {
|
||||
VerticalDivider()
|
||||
Text(
|
||||
modifier = Modifier.padding(vertical = 3.dp),
|
||||
text = formatter.format(displayDate),
|
||||
style = MaterialTheme.typography.bodySmall.copy(
|
||||
color = MaterialTheme.colorScheme.onSurface
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
package nl.jknaapen.fladder.composables.overlays.screensavers
|
||||
|
||||
import Screensaver
|
||||
import android.os.Build
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.compose.animation.AnimatedVisibility
|
||||
import androidx.compose.animation.fadeIn
|
||||
import androidx.compose.animation.fadeOut
|
||||
@@ -26,12 +28,12 @@ import nl.jknaapen.fladder.objects.VideoPlayerObject
|
||||
import nl.jknaapen.fladder.utility.leanBackEnabled
|
||||
import kotlin.time.Duration.Companion.minutes
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.O)
|
||||
@Composable
|
||||
internal fun ScreenSaver(
|
||||
content: @Composable () -> Unit,
|
||||
) {
|
||||
val selectedType by PlayerSettingsObject.screenSaver.collectAsState(Screensaver.LOGO)
|
||||
val guideActive by VideoPlayerObject.guideVisible.collectAsState(false)
|
||||
|
||||
if (!leanBackEnabled(LocalContext.current) || selectedType == Screensaver.DISABLED) {
|
||||
content()
|
||||
@@ -57,7 +59,7 @@ internal fun ScreenSaver(
|
||||
}
|
||||
|
||||
LaunchedEffect(playerInactive, selectedType, lastInteraction.longValue) {
|
||||
if (playerInactive && !guideActive) {
|
||||
if (playerInactive) {
|
||||
delay(5.minutes)
|
||||
screenSaverActive = true
|
||||
} else {
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
package nl.jknaapen.fladder.composables.shared
|
||||
|
||||
|
||||
import android.os.Build
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableLongStateOf
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Modifier
|
||||
@@ -14,39 +15,41 @@ import androidx.compose.ui.graphics.Color
|
||||
import kotlinx.coroutines.delay
|
||||
import nl.jknaapen.fladder.objects.Localized
|
||||
import nl.jknaapen.fladder.objects.Translate
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Date
|
||||
import java.util.Locale
|
||||
import java.util.TimeZone
|
||||
import java.time.ZoneId
|
||||
import kotlin.time.Clock
|
||||
import kotlin.time.ExperimentalTime
|
||||
import kotlin.time.toJavaInstant
|
||||
|
||||
@OptIn(ExperimentalTime::class)
|
||||
@RequiresApi(Build.VERSION_CODES.O)
|
||||
@Composable
|
||||
internal fun CurrentTime(
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
var currentTimeMillis by remember { mutableLongStateOf(System.currentTimeMillis()) }
|
||||
val zone = ZoneId.systemDefault()
|
||||
|
||||
var currentTime by remember { mutableStateOf(Clock.System.now()) }
|
||||
|
||||
LaunchedEffect(Unit) {
|
||||
while (true) {
|
||||
currentTimeMillis = System.currentTimeMillis()
|
||||
val delayMs = 60_000L - (currentTimeMillis % 60_000L)
|
||||
currentTime = Clock.System.now()
|
||||
val delayMs = 60_000L - (currentTime.toEpochMilliseconds() % 60_000L)
|
||||
delay(delayMs)
|
||||
}
|
||||
}
|
||||
|
||||
val isoUtc = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.getDefault()).apply {
|
||||
timeZone = TimeZone.getTimeZone("UTC")
|
||||
}.format(Date(currentTimeMillis))
|
||||
val endZoned = currentTime.toJavaInstant().atZone(zone)
|
||||
|
||||
Translate(
|
||||
{ localeCode ->
|
||||
Localized.hoursAndMinutes(isoUtc, localeCode)
|
||||
{
|
||||
Localized.hoursAndMinutes(endZoned.toOffsetDateTime().toString(), it)
|
||||
},
|
||||
key = currentTimeMillis,
|
||||
key = currentTime,
|
||||
) { time ->
|
||||
Text(
|
||||
modifier = modifier,
|
||||
text = time,
|
||||
style = MaterialTheme.typography.displaySmall,
|
||||
style = MaterialTheme.typography.titleLarge,
|
||||
color = Color.White
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,75 +0,0 @@
|
||||
package nl.jknaapen.fladder.fake
|
||||
|
||||
import GuideChannel
|
||||
import GuideProgram
|
||||
import TVGuideModel
|
||||
import android.os.Build
|
||||
import androidx.annotation.RequiresApi
|
||||
import nl.jknaapen.fladder.utility.toEpochMillis
|
||||
import java.time.LocalDateTime
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.O)
|
||||
object FakeHelperObjects {
|
||||
private const val POSTER_URL =
|
||||
"https://www.originalfilmart.com/cdn/shop/files/harry_potter_and_the_sorcerers_stone_2001_original_film_art_5000x.webp?v=1684872812"
|
||||
|
||||
private const val CHANNEL_LOGO =
|
||||
"https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Flogos-world.net%2Fwp-content%2Fuploads%2F2021%2F02%2FComedy-Central-Logo.png&f=1&nofb=1&ipt=78f29573e1e410cc56ecd655b1ce12b9376d322fa8f4a35dd907c59168612ce9"
|
||||
|
||||
|
||||
val tvGuide by lazy {
|
||||
TVGuideModel(
|
||||
channels = channels,
|
||||
startMs = startDate.toEpochMillis(),
|
||||
endMs = startDate.plusHours(24).toEpochMillis(),
|
||||
currentProgram = channels.mapNotNull { channel ->
|
||||
channel.programs.find { program ->
|
||||
val nowMs = LocalDateTime.now().toEpochMillis()
|
||||
program.startMs <= nowMs && program.endMs > nowMs
|
||||
}
|
||||
}.randomOrNull()
|
||||
)
|
||||
}
|
||||
|
||||
val startDate: LocalDateTime by lazy {
|
||||
LocalDateTime.now().minusMinutes(15)
|
||||
}
|
||||
|
||||
val channels by lazy {
|
||||
List(25) { channelIndex ->
|
||||
GuideChannel(
|
||||
channelId = "ch-$channelIndex",
|
||||
name = "Channel ${channelIndex + 1}",
|
||||
logoUrl = CHANNEL_LOGO,
|
||||
programsLoaded = true,
|
||||
programs = run {
|
||||
val programList = mutableListOf<GuideProgram>()
|
||||
var lastEnd = startDate
|
||||
repeat(10) { programIndex ->
|
||||
val duration = listOf(30, 45, 60, 90).random()
|
||||
var programStart = lastEnd
|
||||
val programEnd = programStart.plusMinutes(duration.toLong())
|
||||
if (programIndex == 0 && channelIndex % 2 == 0) {
|
||||
// Make the first program of every other channel start earlier to simulate
|
||||
// currently running programs
|
||||
programStart = programStart.minusMinutes((15..90).random().toLong())
|
||||
}
|
||||
val program = GuideProgram(
|
||||
"prog${channelIndex}_$programIndex",
|
||||
"ch-$channelIndex",
|
||||
"Program ${(65 + (programIndex % 26)).toChar()}${programIndex + 1}",
|
||||
programStart.toEpochMillis(),
|
||||
programEnd.toEpochMillis(),
|
||||
POSTER_URL,
|
||||
"A fake program description.",
|
||||
"Subtitle ${(65 + (programIndex % 26)).toChar()}${programIndex + 1}"
|
||||
)
|
||||
programList.add(program)
|
||||
lastEnd = programEnd
|
||||
}
|
||||
programList
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,6 @@
|
||||
package nl.jknaapen.fladder.messengers
|
||||
|
||||
import PlayableData
|
||||
import SubtitleSettings
|
||||
import TVGuideModel
|
||||
import VideoPlayerApi
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
@@ -12,15 +10,7 @@ import androidx.media3.common.MediaItem
|
||||
import androidx.media3.common.MimeTypes
|
||||
import androidx.media3.common.Player
|
||||
import androidx.media3.exoplayer.ExoPlayer
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.asStateFlow
|
||||
import kotlinx.coroutines.flow.map
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
import nl.jknaapen.fladder.objects.PlayerSettingsObject
|
||||
import nl.jknaapen.fladder.objects.VideoPlayerObject
|
||||
import nl.jknaapen.fladder.utility.clearAudioTrack
|
||||
import nl.jknaapen.fladder.utility.clearSubtitleTrack
|
||||
@@ -36,12 +26,6 @@ class VideoPlayerImplementation(
|
||||
var player: ExoPlayer? = null
|
||||
val playbackData: MutableStateFlow<PlayableData?> = MutableStateFlow(null)
|
||||
|
||||
var subsInitialized = false
|
||||
|
||||
val isTVMode: Flow<Boolean> = playbackData.asStateFlow().map {
|
||||
it?.mediaInfo?.playbackType == PlaybackType.TV
|
||||
}
|
||||
|
||||
override fun sendPlayableModel(
|
||||
playableData: PlayableData,
|
||||
callback: (Result<Boolean>) -> Unit
|
||||
@@ -58,24 +42,6 @@ class VideoPlayerImplementation(
|
||||
}
|
||||
}
|
||||
|
||||
override fun sendTVGuideModel(guide: TVGuideModel, callback: (Result<Boolean>) -> Unit) {
|
||||
try {
|
||||
VideoPlayerObject.tvGuide.value = guide
|
||||
callback(Result.success(true))
|
||||
} catch (e: Exception) {
|
||||
println("Error sending TV guide model: $e")
|
||||
callback(Result.success(false))
|
||||
}
|
||||
}
|
||||
|
||||
override fun setSubtitleSettings(settings: SubtitleSettings) {
|
||||
try {
|
||||
PlayerSettingsObject.subtitleSettings.value = settings
|
||||
} catch (e: Exception) {
|
||||
println("Error setting subtitle settings: $e")
|
||||
}
|
||||
}
|
||||
|
||||
override fun open(url: String, play: Boolean, callback: (Result<Boolean>) -> Unit) {
|
||||
Handler(Looper.getMainLooper()).postDelayed(delayInMillis = 1.seconds.inWholeMilliseconds) {
|
||||
try {
|
||||
@@ -84,12 +50,8 @@ class VideoPlayerImplementation(
|
||||
VideoPlayerObject.setSubtitleTrackIndex(it.defaultSubtrack.toInt(), true)
|
||||
}
|
||||
|
||||
val isHls = url.contains("streamMode=hls", ignoreCase = true) || url.endsWith(
|
||||
".m3u8",
|
||||
ignoreCase = true
|
||||
)
|
||||
val subTitles = playbackData.value?.subtitleTracks ?: listOf()
|
||||
val mediaItemBuilder = MediaItem.Builder()
|
||||
val mediaItem = MediaItem.Builder()
|
||||
.setUri(url)
|
||||
.setTag(playbackData.value?.currentItem?.title)
|
||||
.setMediaId(playbackData.value?.currentItem?.id ?: "")
|
||||
@@ -102,14 +64,8 @@ class VideoPlayerImplementation(
|
||||
.build()
|
||||
}
|
||||
)
|
||||
.build()
|
||||
|
||||
if (isHls) {
|
||||
mediaItemBuilder.setMimeType(MimeTypes.APPLICATION_M3U8)
|
||||
}
|
||||
|
||||
val mediaItem = mediaItemBuilder.build()
|
||||
|
||||
player?.playWhenReady = false
|
||||
player?.stop()
|
||||
player?.clearMediaItems()
|
||||
player?.setMediaItem(mediaItem)
|
||||
@@ -119,27 +75,8 @@ class VideoPlayerImplementation(
|
||||
if (startPosition > 0L) {
|
||||
player?.seekTo(startPosition)
|
||||
}
|
||||
callback(Result.success(true))
|
||||
subsInitialized = false
|
||||
|
||||
// Apply refresh rate before starting playback so the mode switch doesn't interrupt video
|
||||
val activity = VideoPlayerObject.currentActivity
|
||||
if (PlayerSettingsObject.settings.value?.refreshRateSwitching == true && activity != null) {
|
||||
val data = playbackData.value
|
||||
val w = data?.videoWidth?.toInt()
|
||||
val h = data?.videoHeight?.toInt()
|
||||
val fps = data?.videoFrameRate?.toFloat()
|
||||
if (w != null && w > 0 && h != null && h > 0 && fps != null && fps > 0f) {
|
||||
CoroutineScope(Dispatchers.IO).launch {
|
||||
activity.applyVideoRefreshRate(w, h, fps)
|
||||
withContext(Dispatchers.Main) {
|
||||
player?.playWhenReady = play
|
||||
}
|
||||
}
|
||||
return@postDelayed
|
||||
}
|
||||
}
|
||||
player?.playWhenReady = play
|
||||
callback(Result.success(true))
|
||||
return@postDelayed
|
||||
} catch (e: Exception) {
|
||||
println("Error playing video $e")
|
||||
@@ -180,12 +117,11 @@ class VideoPlayerImplementation(
|
||||
|
||||
fun init(exoPlayer: ExoPlayer?) {
|
||||
player = exoPlayer
|
||||
subsInitialized = false
|
||||
//exoPlayer initializes after the playbackData is set for the first load
|
||||
playbackData.value?.let { playData ->
|
||||
VideoPlayerObject.setAudioTrackIndex(playData.defaultAudioTrack.toInt(), true)
|
||||
VideoPlayerObject.setSubtitleTrackIndex(playData.defaultSubtrack.toInt(), true)
|
||||
open(playData.url, true, callback = {})
|
||||
playbackData.value?.let {
|
||||
VideoPlayerObject.setAudioTrackIndex(it.defaultAudioTrack.toInt(), true)
|
||||
VideoPlayerObject.setSubtitleTrackIndex(it.defaultSubtrack.toInt(), true)
|
||||
open(it.url, true, callback = {})
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -198,10 +134,6 @@ fun guessSubtitleMimeType(fileName: String): String = when {
|
||||
}
|
||||
|
||||
fun ExoPlayer.properlySetSubAndAudioTracks(playableData: PlayableData) {
|
||||
if (playableData.mediaInfo.playbackType == PlaybackType.TV) {
|
||||
// In TV mode, do not set tracks here as they are handled differently
|
||||
return
|
||||
}
|
||||
try {
|
||||
val currentSubIndex = playableData.defaultSubtrack
|
||||
val indexOfSubtitleTrack =
|
||||
|
||||
@@ -4,7 +4,6 @@ import AutoNextType
|
||||
import PlayerSettings
|
||||
import PlayerSettingsPigeon
|
||||
import Screensaver
|
||||
import SubtitleSettings
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.map
|
||||
@@ -14,7 +13,6 @@ import kotlin.time.toDuration
|
||||
|
||||
object PlayerSettingsObject : PlayerSettingsPigeon {
|
||||
val settings: MutableStateFlow<PlayerSettings?> = MutableStateFlow(null)
|
||||
val subtitleSettings: MutableStateFlow<SubtitleSettings?> = MutableStateFlow(null)
|
||||
val skipMap = settings.map { it?.skipTypes ?: mapOf() }
|
||||
|
||||
val forwardSpeed =
|
||||
|
||||
@@ -34,5 +34,4 @@ internal fun Translate(
|
||||
}
|
||||
|
||||
content(value.orEmpty())
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,18 +1,22 @@
|
||||
package nl.jknaapen.fladder.objects
|
||||
|
||||
import PlaybackState
|
||||
import TVGuideModel
|
||||
import VideoPlayerControlsCallback
|
||||
import VideoPlayerListenerCallback
|
||||
import android.os.Build
|
||||
import androidx.annotation.RequiresApi
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.asStateFlow
|
||||
import kotlinx.coroutines.flow.combine
|
||||
import kotlinx.coroutines.flow.map
|
||||
import nl.jknaapen.fladder.VideoPlayerActivity
|
||||
import nl.jknaapen.fladder.fake.FakeHelperObjects
|
||||
import nl.jknaapen.fladder.messengers.VideoPlayerImplementation
|
||||
import nl.jknaapen.fladder.utility.InternalTrack
|
||||
import java.time.ZoneId
|
||||
import kotlin.time.Clock
|
||||
import kotlin.time.ExperimentalTime
|
||||
import kotlin.time.toJavaInstant
|
||||
|
||||
object VideoPlayerObject {
|
||||
val implementation: VideoPlayerImplementation = VideoPlayerImplementation()
|
||||
@@ -29,27 +33,17 @@ object VideoPlayerObject {
|
||||
|
||||
val nextUpVideo = implementation.playbackData.map { it?.nextVideo }
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.O)
|
||||
@OptIn(ExperimentalTime::class)
|
||||
val endTime = combine(position, duration) { pos, dur ->
|
||||
val nowMs = System.currentTimeMillis()
|
||||
val now = Clock.System.now().toJavaInstant()
|
||||
val zone = ZoneId.systemDefault()
|
||||
val remainingMs = (dur - pos).coerceAtLeast(0L)
|
||||
val endMs = nowMs + remainingMs
|
||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
|
||||
val instant = java.time.Instant.ofEpochMilli(endMs)
|
||||
val zoneId = java.time.ZoneId.systemDefault()
|
||||
java.time.format.DateTimeFormatter.ISO_OFFSET_DATE_TIME
|
||||
.withZone(zoneId)
|
||||
.format(instant)
|
||||
} else {
|
||||
val calendar = java.util.Calendar.getInstance()
|
||||
calendar.timeInMillis = endMs
|
||||
val tz = calendar.timeZone
|
||||
val sdf = java.text.SimpleDateFormat(
|
||||
"yyyy-MM-dd'T'HH:mm:ssXXX",
|
||||
java.util.Locale.getDefault()
|
||||
)
|
||||
sdf.timeZone = tz
|
||||
sdf.format(calendar.time)
|
||||
}
|
||||
val endInstant = now.plusMillis(remainingMs)
|
||||
|
||||
val endZoned = endInstant.atZone(zone)
|
||||
|
||||
endZoned.toOffsetDateTime().toString()
|
||||
}
|
||||
|
||||
val currentSubtitleTrackIndex =
|
||||
@@ -96,13 +90,5 @@ object VideoPlayerObject {
|
||||
|
||||
var videoPlayerListener: VideoPlayerListenerCallback? = null
|
||||
var videoPlayerControls: VideoPlayerControlsCallback? = null
|
||||
|
||||
var tvGuide = MutableStateFlow<TVGuideModel?>(null)
|
||||
val guideVisible = MutableStateFlow(false)
|
||||
|
||||
fun toggleGuideVisibility() {
|
||||
guideVisible.value = !guideVisible.value
|
||||
}
|
||||
|
||||
var currentActivity: VideoPlayerActivity? = null
|
||||
}
|
||||
@@ -2,8 +2,6 @@ package nl.jknaapen.fladder.player
|
||||
|
||||
import PlaybackState
|
||||
import android.app.ActivityManager
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.view.ViewGroup
|
||||
import android.view.WindowManager
|
||||
import androidx.activity.compose.LocalActivity
|
||||
@@ -24,7 +22,6 @@ import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.viewinterop.AndroidView
|
||||
import androidx.core.content.getSystemService
|
||||
import androidx.core.os.postDelayed
|
||||
import androidx.media3.common.AudioAttributes
|
||||
import androidx.media3.common.C
|
||||
import androidx.media3.common.Player
|
||||
@@ -33,7 +30,6 @@ import androidx.media3.common.Tracks
|
||||
import androidx.media3.common.util.UnstableApi
|
||||
import androidx.media3.datasource.DefaultDataSource
|
||||
import androidx.media3.datasource.DefaultHttpDataSource
|
||||
import androidx.media3.exoplayer.DefaultLoadControl
|
||||
import androidx.media3.exoplayer.DefaultRenderersFactory
|
||||
import androidx.media3.exoplayer.ExoPlayer
|
||||
import androidx.media3.exoplayer.source.DefaultMediaSourceFactory
|
||||
@@ -46,8 +42,6 @@ import androidx.media3.ui.PlayerView
|
||||
import io.github.peerless2012.ass.media.kt.buildWithAssSupport
|
||||
import io.github.peerless2012.ass.media.type.AssRenderType
|
||||
import kotlinx.coroutines.delay
|
||||
|
||||
import nl.jknaapen.fladder.composables.overlays.guide.GuideOverlay
|
||||
import nl.jknaapen.fladder.composables.overlays.NextUpOverlay
|
||||
import nl.jknaapen.fladder.messengers.properlySetSubAndAudioTracks
|
||||
import nl.jknaapen.fladder.objects.PlayerSettingsObject
|
||||
@@ -60,8 +54,6 @@ import kotlin.time.Duration.Companion.seconds
|
||||
|
||||
val LocalPlayer = compositionLocalOf<ExoPlayer?> { null }
|
||||
|
||||
private const val LOW_RESOURCE_BUFFER_BYTES = 64 * 1024 * 1024
|
||||
|
||||
@OptIn(UnstableApi::class)
|
||||
@Composable
|
||||
internal fun ExoPlayer(
|
||||
@@ -110,15 +102,7 @@ internal fun ExoPlayer(
|
||||
}
|
||||
|
||||
val exoPlayer = remember {
|
||||
val builder = ExoPlayer.Builder(context, renderersFactory)
|
||||
if (PlayerSettingsObject.settings.value?.lowResourceMode == true) {
|
||||
builder.setLoadControl(
|
||||
DefaultLoadControl.Builder()
|
||||
.setTargetBufferBytes(LOW_RESOURCE_BUFFER_BYTES)
|
||||
.build()
|
||||
)
|
||||
}
|
||||
builder
|
||||
ExoPlayer.Builder(context, renderersFactory)
|
||||
.setTrackSelector(trackSelector)
|
||||
.setMediaSourceFactory(DefaultMediaSourceFactory(dataSourceFactory, extractorsFactory))
|
||||
.setAudioAttributes(audioAttributes, true)
|
||||
@@ -129,7 +113,7 @@ internal fun ExoPlayer(
|
||||
context,
|
||||
renderersFactory = renderersFactory,
|
||||
extractorsFactory = extractorsFactory,
|
||||
renderType = AssRenderType.CUES
|
||||
renderType = AssRenderType.LEGACY
|
||||
)
|
||||
}
|
||||
|
||||
@@ -170,6 +154,7 @@ internal fun ExoPlayer(
|
||||
}
|
||||
|
||||
override fun onPlaybackStateChanged(playbackState: Int) {
|
||||
|
||||
videoHost.setPlaybackState(
|
||||
PlaybackState(
|
||||
position = exoPlayer.currentPosition,
|
||||
@@ -185,14 +170,7 @@ internal fun ExoPlayer(
|
||||
|
||||
override fun onEvents(player: Player, events: Player.Events) {
|
||||
super.onEvents(player, events)
|
||||
if (events.containsAny(
|
||||
Player.EVENT_POSITION_DISCONTINUITY,
|
||||
Player.EVENT_IS_PLAYING_CHANGED,
|
||||
Player.EVENT_TIMELINE_CHANGED,
|
||||
)
|
||||
) {
|
||||
updatePlaybackState()
|
||||
}
|
||||
updatePlaybackState()
|
||||
}
|
||||
|
||||
override fun onTracksChanged(tracks: Tracks) {
|
||||
@@ -200,22 +178,15 @@ internal fun ExoPlayer(
|
||||
val subTracks = exoPlayer.getSubtitleTracks()
|
||||
val audioTracks = exoPlayer.getAudioTracks()
|
||||
|
||||
val subsInitialized = VideoPlayerObject.implementation.subsInitialized
|
||||
|
||||
if (subTracks.isEmpty() && audioTracks.isEmpty()) return
|
||||
|
||||
if (!subsInitialized) {
|
||||
VideoPlayerObject.implementation.subsInitialized = true
|
||||
val playbackData = VideoPlayerObject.implementation.playbackData.value
|
||||
Handler(Looper.getMainLooper()).postDelayed(delayInMillis = 1.seconds.inWholeMilliseconds) {
|
||||
playbackData?.let {
|
||||
exoPlayer.properlySetSubAndAudioTracks(it)
|
||||
}
|
||||
VideoPlayerObject.exoSubTracks.value = subTracks
|
||||
VideoPlayerObject.exoAudioTracks.value = audioTracks
|
||||
if (subTracks != VideoPlayerObject.exoSubTracks.value || audioTracks != VideoPlayerObject.exoAudioTracks.value) {
|
||||
VideoPlayerObject.implementation.playbackData.value?.let {
|
||||
exoPlayer.properlySetSubAndAudioTracks(it)
|
||||
}
|
||||
VideoPlayerObject.exoSubTracks.value = subTracks
|
||||
VideoPlayerObject.exoAudioTracks.value = audioTracks
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
exoPlayer.addListener(listener)
|
||||
@@ -228,8 +199,6 @@ internal fun ExoPlayer(
|
||||
VideoPlayerObject.implementation.init(exoPlayer)
|
||||
onDispose {
|
||||
videoHost.videoPlayerControls?.onStop(callback = {})
|
||||
VideoPlayerObject.implementation.playbackData.value = null
|
||||
VideoPlayerObject.tvGuide.value = null
|
||||
VideoPlayerObject.implementation.init(null)
|
||||
exoPlayer.release()
|
||||
}
|
||||
@@ -239,93 +208,49 @@ internal fun ExoPlayer(
|
||||
val fillScreen by PlayerSettingsObject.fillScreen.collectAsState(false)
|
||||
val videoFit by PlayerSettingsObject.videoFit.collectAsState(AspectRatioFrameLayout.RESIZE_MODE_FIT)
|
||||
|
||||
val isTVPlayback by VideoPlayerObject.implementation.isTVMode.collectAsState(false)
|
||||
val nativeSubtitleSettings by PlayerSettingsObject.subtitleSettings.collectAsState(null)
|
||||
|
||||
@Composable
|
||||
fun createPlayer(showControls: Boolean) {
|
||||
AndroidView(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.background(color = Color.Black)
|
||||
.conditional(!fillScreen) {
|
||||
displayCutoutPadding()
|
||||
},
|
||||
factory = {
|
||||
PlayerView(it).apply {
|
||||
player = exoPlayer
|
||||
useController = false
|
||||
resizeMode = videoFit
|
||||
layoutParams = ViewGroup.LayoutParams(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
)
|
||||
keepScreenOn = false
|
||||
subtitleView?.apply {
|
||||
setStyle(
|
||||
CaptionStyleCompat(
|
||||
android.graphics.Color.WHITE,
|
||||
android.graphics.Color.TRANSPARENT,
|
||||
android.graphics.Color.TRANSPARENT,
|
||||
CaptionStyleCompat.EDGE_TYPE_OUTLINE,
|
||||
android.graphics.Color.BLACK,
|
||||
null
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
},
|
||||
update = { view ->
|
||||
nativeSubtitleSettings?.let { subtitleSettings ->
|
||||
view.subtitleView?.apply {
|
||||
setApplyEmbeddedFontSizes(false)
|
||||
|
||||
val frac =
|
||||
(subtitleSettings.fontSize / 1080.0).toFloat().coerceIn(0.01f, 1f)
|
||||
setFractionalTextSize(frac)
|
||||
|
||||
setBottomPaddingFraction(
|
||||
subtitleSettings.verticalOffset.toFloat().coerceIn(0f, 0.5f)
|
||||
)
|
||||
|
||||
setStyle(
|
||||
CaptionStyleCompat(
|
||||
subtitleSettings.color.toInt(),
|
||||
subtitleSettings.backgroundColor.toInt(),
|
||||
android.graphics.Color.TRANSPARENT,
|
||||
CaptionStyleCompat.EDGE_TYPE_OUTLINE,
|
||||
subtitleSettings.outlineColor.toInt(),
|
||||
if (subtitleSettings.fontWeight >= 700) android.graphics.Typeface.DEFAULT_BOLD else android.graphics.Typeface.DEFAULT
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
if (showControls)
|
||||
CompositionLocalProvider(LocalPlayer provides exoPlayer) {
|
||||
controls(exoPlayer)
|
||||
}
|
||||
}
|
||||
|
||||
AllowedOrientations(
|
||||
acceptedOrientations
|
||||
) {
|
||||
when (isTVPlayback) {
|
||||
true -> GuideOverlay(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
overlay = {
|
||||
createPlayer(showControls = it)
|
||||
}
|
||||
)
|
||||
|
||||
false -> NextUpOverlay(
|
||||
NextUpOverlay(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
) { showControls ->
|
||||
AndroidView(
|
||||
modifier = Modifier
|
||||
.fillMaxSize(),
|
||||
overlay = {
|
||||
createPlayer(showControls = it)
|
||||
.fillMaxSize()
|
||||
.background(color = Color.Black)
|
||||
.conditional(!fillScreen) {
|
||||
displayCutoutPadding()
|
||||
},
|
||||
factory = {
|
||||
PlayerView(it).apply {
|
||||
player = exoPlayer
|
||||
useController = false
|
||||
resizeMode = videoFit
|
||||
layoutParams = ViewGroup.LayoutParams(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
)
|
||||
keepScreenOn = false
|
||||
subtitleView?.apply {
|
||||
setStyle(
|
||||
CaptionStyleCompat(
|
||||
android.graphics.Color.WHITE,
|
||||
android.graphics.Color.TRANSPARENT,
|
||||
android.graphics.Color.TRANSPARENT,
|
||||
CaptionStyleCompat.EDGE_TYPE_OUTLINE,
|
||||
android.graphics.Color.BLACK,
|
||||
null
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
if (showControls)
|
||||
CompositionLocalProvider(LocalPlayer provides exoPlayer) {
|
||||
controls(exoPlayer)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
package nl.jknaapen.fladder.utility
|
||||
|
||||
import android.os.Build
|
||||
import androidx.annotation.RequiresApi
|
||||
import java.time.LocalDateTime
|
||||
import java.time.ZoneId
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.O)
|
||||
fun LocalDateTime.toEpochMillis(zone: ZoneId = ZoneId.systemDefault()): Long {
|
||||
return this.atZone(zone).toInstant().toEpochMilli()
|
||||
}
|
||||
@@ -1,11 +1,5 @@
|
||||
package nl.jknaapen.fladder.utility
|
||||
|
||||
import android.os.Build
|
||||
import java.time.LocalDateTime
|
||||
import java.time.ZoneId
|
||||
import java.time.format.DateTimeFormatter
|
||||
import java.util.Locale
|
||||
|
||||
fun formatTime(ms: Long): String {
|
||||
if (ms < 0) {
|
||||
return "0:00"
|
||||
@@ -15,14 +9,3 @@ fun formatTime(ms: Long): String {
|
||||
val seconds = totalSeconds % 60
|
||||
return "%d:%02d".format(minutes, seconds)
|
||||
}
|
||||
|
||||
fun formatTimeHMS(ms: Long): String {
|
||||
if (ms < 0) {
|
||||
return "0:00:00"
|
||||
}
|
||||
val totalSeconds = ms / 1000
|
||||
val hours = totalSeconds / 3600
|
||||
val minutes = (totalSeconds % 3600) / 60
|
||||
val seconds = totalSeconds % 60
|
||||
return "%d:%02d:%02d".format(hours, minutes, seconds)
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
package nl.jknaapen.fladder.utility
|
||||
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.input.key.Key
|
||||
import androidx.compose.ui.input.key.KeyEvent
|
||||
import androidx.compose.ui.input.key.KeyEventType
|
||||
import androidx.compose.ui.input.key.key
|
||||
import androidx.compose.ui.input.key.onKeyEvent
|
||||
import androidx.compose.ui.input.key.type
|
||||
|
||||
private val HANDLED_KEYS = setOf(
|
||||
Key.X,
|
||||
Key.P,
|
||||
Key.MediaStop,
|
||||
Key.MediaPlay,
|
||||
Key.MediaPlayPause,
|
||||
Key.MediaPause,
|
||||
Key.Back,
|
||||
Key.Escape,
|
||||
Key.ButtonB,
|
||||
Key.Backspace,
|
||||
Key.DirectionLeft,
|
||||
Key.DirectionRight,
|
||||
Key.DirectionUp,
|
||||
Key.DirectionDown,
|
||||
)
|
||||
|
||||
@Composable
|
||||
fun Modifier.keyEvent(
|
||||
additionalKeys: Set<Key> = emptySet(),
|
||||
onKeyEvent: (KeyEvent) -> Boolean
|
||||
): Modifier {
|
||||
val allKeys = HANDLED_KEYS + additionalKeys
|
||||
return this
|
||||
.onKeyEvent { keyEvent: KeyEvent ->
|
||||
val ignoreKeys =
|
||||
keyEvent.type != KeyEventType.KeyDown || !allKeys.contains(keyEvent.key)
|
||||
if (ignoreKeys) {
|
||||
return@onKeyEvent false
|
||||
}
|
||||
return@onKeyEvent onKeyEvent(keyEvent)
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,14 @@
|
||||
package nl.jknaapen.fladder.utility
|
||||
|
||||
import android.app.UiModeManager
|
||||
import android.content.Context
|
||||
import android.content.pm.PackageManager
|
||||
import android.content.res.Configuration
|
||||
import android.os.Build
|
||||
import androidx.annotation.RequiresApi
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.O)
|
||||
fun leanBackEnabled(context: Context): Boolean {
|
||||
val pm = context.packageManager
|
||||
if (pm.hasSystemFeature(PackageManager.FEATURE_LEANBACK)) {
|
||||
return true
|
||||
}
|
||||
|
||||
val uiModeManager = context.getSystemService(Context.UI_MODE_SERVICE) as UiModeManager
|
||||
return uiModeManager.currentModeType == Configuration.UI_MODE_TYPE_TELEVISION
|
||||
val leanBackEnabled = pm.hasSystemFeature(PackageManager.FEATURE_LEANBACK)
|
||||
val leanBackOnly = pm.hasSystemFeature(PackageManager.FEATURE_LEANBACK_ONLY)
|
||||
return leanBackEnabled || leanBackOnly
|
||||
}
|
||||
@@ -20,7 +20,6 @@ import androidx.compose.ui.focus.onFocusChanged
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.Shape
|
||||
import androidx.compose.ui.graphics.graphicsLayer
|
||||
import androidx.compose.ui.layout.layout
|
||||
import androidx.compose.ui.unit.Dp
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
||||
@@ -93,10 +92,7 @@ fun Modifier.defaultSelected(defaultSelected: Boolean): Modifier {
|
||||
* Conditional if modifier
|
||||
*/
|
||||
@Composable
|
||||
fun Modifier.conditional(
|
||||
condition: Boolean,
|
||||
modifier: @Composable Modifier.() -> Modifier
|
||||
): Modifier {
|
||||
fun Modifier.conditional(condition: Boolean, modifier: Modifier.() -> Modifier): Modifier {
|
||||
return if (condition) {
|
||||
then(modifier(Modifier))
|
||||
} else {
|
||||
@@ -126,16 +122,3 @@ fun Modifier.visible(
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
fun Modifier.offsetByPercent(x: Float = 1f, y: Float = 1f) = this.then(
|
||||
Modifier.layout { measurable, constraints ->
|
||||
val placeable = measurable.measure(constraints)
|
||||
layout(placeable.width, placeable.height) {
|
||||
placeable.placeRelative(
|
||||
x = (constraints.maxWidth * x).toInt(),
|
||||
y = (constraints.maxHeight * y).toInt()
|
||||
)
|
||||
}
|
||||
}
|
||||
)
|
||||
@@ -1,183 +0,0 @@
|
||||
package nl.jknaapen.fladder.utility
|
||||
|
||||
import android.hardware.display.DisplayManager
|
||||
import android.os.Build
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.util.Log
|
||||
import android.view.Display
|
||||
import android.view.Window
|
||||
import kotlinx.coroutines.CompletableDeferred
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.withContext
|
||||
import kotlinx.coroutines.withTimeoutOrNull
|
||||
import kotlin.math.roundToInt
|
||||
import kotlin.time.Duration.Companion.seconds
|
||||
|
||||
private const val TAG = "RefreshRateHelper"
|
||||
|
||||
/**
|
||||
* Switches the display to a mode matching the video, waiting for the switch to settle.
|
||||
* Returns the mode id that was active before the switch, or null if no switch was performed,
|
||||
* so the caller can restore it later via [resetRefreshRateAndWait].
|
||||
*/
|
||||
suspend fun applyRefreshRate(
|
||||
window: Window,
|
||||
displayManager: DisplayManager,
|
||||
videoWidth: Int,
|
||||
videoHeight: Int,
|
||||
frameRate: Float,
|
||||
): Int? = withContext(Dispatchers.IO) {
|
||||
val display = displayManager.getDisplay(Display.DEFAULT_DISPLAY)
|
||||
val displayModes = display.supportedModes
|
||||
.orEmpty()
|
||||
.map { RefreshRateDisplayMode(it) }
|
||||
.sortedWith(
|
||||
compareByDescending<RefreshRateDisplayMode> { it.physicalWidth * it.physicalHeight }
|
||||
.thenBy { it.refreshRateRounded }
|
||||
)
|
||||
|
||||
val currentMode = display.mode
|
||||
val targetMode = findDisplayMode(
|
||||
displayModes = displayModes,
|
||||
streamWidth = videoWidth,
|
||||
streamHeight = videoHeight,
|
||||
targetFrameRate = frameRate,
|
||||
)
|
||||
|
||||
Log.d(TAG, "Video: ${videoWidth}x${videoHeight} @ ${frameRate}fps — target mode: $targetMode, current: $currentMode")
|
||||
|
||||
if (targetMode == null || targetMode.modeId == currentMode.modeId) return@withContext null
|
||||
|
||||
switchModeAndWait(window, displayManager, display, targetMode.modeId, targetMode.refreshRate, currentMode)
|
||||
currentMode.modeId
|
||||
}
|
||||
|
||||
/**
|
||||
* Restores the display mode that was active before [applyRefreshRate], waiting for the switch
|
||||
* to settle. Must run while the window is still alive — switching during activity teardown
|
||||
* races the HDMI re-handshake and can black out pass-through audio chains.
|
||||
*/
|
||||
suspend fun resetRefreshRateAndWait(
|
||||
window: Window,
|
||||
displayManager: DisplayManager,
|
||||
originalModeId: Int,
|
||||
) = withContext(Dispatchers.IO) {
|
||||
val display = displayManager.getDisplay(Display.DEFAULT_DISPLAY)
|
||||
val currentMode = display.mode
|
||||
if (currentMode.modeId == originalModeId) return@withContext
|
||||
val targetMode = display.supportedModes.orEmpty().firstOrNull { it.modeId == originalModeId }
|
||||
?: return@withContext
|
||||
|
||||
Log.d(TAG, "Restoring display mode $targetMode, current: $currentMode")
|
||||
switchModeAndWait(window, displayManager, display, targetMode.modeId, targetMode.refreshRate, currentMode)
|
||||
}
|
||||
|
||||
private suspend fun switchModeAndWait(
|
||||
window: Window,
|
||||
displayManager: DisplayManager,
|
||||
display: Display,
|
||||
targetModeId: Int,
|
||||
targetRefreshRate: Float,
|
||||
currentMode: Display.Mode,
|
||||
) {
|
||||
val listener = DisplayChangeListener(display.displayId)
|
||||
displayManager.registerDisplayListener(listener, Handler(Looper.getMainLooper()))
|
||||
try {
|
||||
withContext(Dispatchers.Main) {
|
||||
val attrs = window.attributes
|
||||
attrs.preferredDisplayModeId = targetModeId
|
||||
window.attributes = attrs
|
||||
}
|
||||
withTimeoutOrNull(5.seconds) { listener.deferred.await() }
|
||||
} finally {
|
||||
displayManager.unregisterDisplayListener(listener)
|
||||
}
|
||||
|
||||
// Wait for non-seamless switches (https://developer.android.com/media/optimize/performance/frame-rate)
|
||||
val targetRateMillis = (targetRefreshRate * 1000).roundToInt()
|
||||
val currentRateMillis = (currentMode.refreshRate * 1000).roundToInt()
|
||||
val isSeamless = targetRateMillis == currentRateMillis ||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
||||
currentMode.alternativeRefreshRates
|
||||
.map { (it * 1000).roundToInt() }
|
||||
.any { it % targetRateMillis == 0 }
|
||||
} else {
|
||||
false
|
||||
}
|
||||
if (!isSeamless) {
|
||||
delay(2.seconds)
|
||||
}
|
||||
}
|
||||
|
||||
fun resetRefreshRate(window: Window) {
|
||||
val attrs = window.attributes
|
||||
attrs.preferredDisplayModeId = 0
|
||||
window.attributes = attrs
|
||||
}
|
||||
|
||||
private fun findDisplayMode(
|
||||
displayModes: List<RefreshRateDisplayMode>,
|
||||
streamWidth: Int,
|
||||
streamHeight: Int,
|
||||
targetFrameRate: Float,
|
||||
): RefreshRateDisplayMode? {
|
||||
val streamRate = (targetFrameRate * 1000).roundToInt()
|
||||
val candidates = displayModes
|
||||
.filter { it.physicalWidth >= streamWidth && it.physicalHeight >= streamHeight }
|
||||
.filter { frameRateMatches(it.refreshRateRounded, streamRate) }
|
||||
|
||||
// Exact resolution + exact frame rate
|
||||
return candidates.firstOrNull {
|
||||
it.physicalWidth == streamWidth && it.physicalHeight == streamHeight && it.refreshRateRounded == streamRate
|
||||
}
|
||||
// Next highest resolution + exact frame rate
|
||||
?: candidates.lastOrNull {
|
||||
it.physicalWidth >= streamWidth && it.physicalHeight >= streamHeight && it.refreshRateRounded == streamRate
|
||||
}
|
||||
// Exact resolution + acceptable frame rate
|
||||
?: candidates.lastOrNull {
|
||||
it.physicalWidth == streamWidth && it.physicalHeight == streamHeight
|
||||
}
|
||||
// Next highest resolution + acceptable frame rate
|
||||
?: candidates.lastOrNull {
|
||||
it.physicalWidth >= streamWidth && it.physicalHeight >= streamHeight
|
||||
}
|
||||
// Highest resolution at exact frame rate
|
||||
?: displayModes
|
||||
.filter { it.refreshRateRounded == streamRate }
|
||||
.maxByOrNull { it.physicalWidth * it.physicalHeight }
|
||||
// Fallback: highest resolution
|
||||
?: displayModes.maxByOrNull { it.physicalWidth * it.physicalHeight }
|
||||
}
|
||||
|
||||
private fun frameRateMatches(refreshRateRounded: Int, streamRate: Int): Boolean {
|
||||
return refreshRateRounded % streamRate == 0 ||
|
||||
refreshRateRounded == (streamRate * 2.5).roundToInt()
|
||||
}
|
||||
|
||||
data class RefreshRateDisplayMode(
|
||||
val modeId: Int,
|
||||
val physicalWidth: Int,
|
||||
val physicalHeight: Int,
|
||||
val refreshRate: Float,
|
||||
) {
|
||||
val refreshRateRounded: Int = (refreshRate * 1000).roundToInt()
|
||||
|
||||
constructor(mode: Display.Mode) : this(
|
||||
mode.modeId,
|
||||
mode.physicalWidth,
|
||||
mode.physicalHeight,
|
||||
mode.refreshRate,
|
||||
)
|
||||
}
|
||||
|
||||
private class DisplayChangeListener(val displayId: Int) : DisplayManager.DisplayListener {
|
||||
val deferred = CompletableDeferred<Unit>()
|
||||
override fun onDisplayAdded(displayId: Int) {}
|
||||
override fun onDisplayRemoved(displayId: Int) {}
|
||||
override fun onDisplayChanged(displayId: Int) {
|
||||
if (displayId == this.displayId) deferred.complete(Unit)
|
||||
}
|
||||
}
|
||||
@@ -8,14 +8,12 @@ import androidx.compose.ui.unit.Density
|
||||
@Composable
|
||||
fun ScaledContent(
|
||||
scale: Float,
|
||||
fontScale: Float,
|
||||
content: @Composable () -> Unit
|
||||
) {
|
||||
val density = LocalDensity.current
|
||||
CompositionLocalProvider(
|
||||
LocalDensity provides Density(
|
||||
density = density.density * scale,
|
||||
fontScale = density.fontScale * fontScale,
|
||||
)
|
||||
) {
|
||||
content()
|
||||
|
||||
@@ -1,95 +0,0 @@
|
||||
// Autogenerated from Pigeon (v30.0.2), do not edit directly.
|
||||
// See also: https://pub.dev/packages/pigeon
|
||||
@file:Suppress("UNCHECKED_CAST", "ArrayInDataClass")
|
||||
|
||||
package nl.jknaapen.fladder.wallpaper
|
||||
|
||||
import android.util.Log
|
||||
import io.flutter.plugin.common.BasicMessageChannel
|
||||
import io.flutter.plugin.common.BinaryMessenger
|
||||
import io.flutter.plugin.common.EventChannel
|
||||
import io.flutter.plugin.common.MessageCodec
|
||||
import io.flutter.plugin.common.StandardMethodCodec
|
||||
import io.flutter.plugin.common.StandardMessageCodec
|
||||
import java.io.ByteArrayOutputStream
|
||||
import java.nio.ByteBuffer
|
||||
private object WallpaperApiPigeonUtils {
|
||||
|
||||
fun wrapResult(result: Any?): List<Any?> {
|
||||
return listOf(result)
|
||||
}
|
||||
|
||||
fun wrapError(exception: Throwable): List<Any?> {
|
||||
return if (exception is WallpaperError) {
|
||||
listOf(
|
||||
exception.code,
|
||||
exception.message,
|
||||
exception.details
|
||||
)
|
||||
} else {
|
||||
listOf(
|
||||
exception.javaClass.simpleName,
|
||||
exception.toString(),
|
||||
"Cause: " + exception.cause + ", Stacktrace: " + Log.getStackTraceString(exception)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Error class for passing custom error details to Flutter via a thrown PlatformException.
|
||||
* @property code The error code.
|
||||
* @property message The error message.
|
||||
* @property details The error details. Must be a datatype supported by the api codec.
|
||||
*/
|
||||
class WallpaperError (
|
||||
val code: String,
|
||||
override val message: String? = null,
|
||||
val details: Any? = null
|
||||
) : RuntimeException()
|
||||
private open class WallpaperApiPigeonCodec : StandardMessageCodec() {
|
||||
override fun readValueOfType(type: Byte, buffer: ByteBuffer): Any? {
|
||||
return super.readValueOfType(type, buffer)
|
||||
}
|
||||
override fun writeValue(stream: ByteArrayOutputStream, value: Any?) {
|
||||
super.writeValue(stream, value)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** Generated interface from Pigeon that represents a handler of messages from Flutter. */
|
||||
interface WallpaperApi {
|
||||
fun openWallpaperPopup(filePath: String, callback: (Result<Boolean>) -> Unit)
|
||||
|
||||
companion object {
|
||||
/** The codec used by WallpaperApi. */
|
||||
val codec: MessageCodec<Any?> by lazy {
|
||||
WallpaperApiPigeonCodec()
|
||||
}
|
||||
/** Sets up an instance of `WallpaperApi` to handle messages through the `binaryMessenger`. */
|
||||
@JvmOverloads
|
||||
fun setUp(binaryMessenger: BinaryMessenger, api: WallpaperApi?, messageChannelSuffix: String = "") {
|
||||
val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else ""
|
||||
run {
|
||||
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.nl_jknaapen_fladder.wallpaper.WallpaperApi.openWallpaperPopup$separatedMessageChannelSuffix", codec)
|
||||
if (api != null) {
|
||||
channel.setMessageHandler { message, reply ->
|
||||
val args = message as List<Any?>
|
||||
val filePathArg = args[0] as String
|
||||
api.openWallpaperPopup(filePathArg) { result: Result<Boolean> ->
|
||||
val error = result.exceptionOrNull()
|
||||
if (error != null) {
|
||||
reply.reply(WallpaperApiPigeonUtils.wrapError(error))
|
||||
} else {
|
||||
val data = result.getOrNull()
|
||||
reply.reply(WallpaperApiPigeonUtils.wrapResult(data))
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
channel.setMessageHandler(null)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
package nl.jknaapen.fladder.wallpaper
|
||||
|
||||
import android.content.Intent
|
||||
import androidx.core.content.FileProvider
|
||||
import java.io.File
|
||||
|
||||
class WallpaperApiUtility(
|
||||
val applicationContext: android.content.Context,
|
||||
private val launcher: androidx.activity.result.ActivityResultLauncher<android.content.Intent>
|
||||
) : WallpaperApi {
|
||||
private var pendingCallback: ((Result<Boolean>) -> Unit)? = null
|
||||
|
||||
override fun openWallpaperPopup(filePath: String, callback: (Result<Boolean>) -> Unit) {
|
||||
this.pendingCallback = callback
|
||||
|
||||
try {
|
||||
val file = File(filePath)
|
||||
|
||||
val uri =
|
||||
FileProvider.getUriForFile(
|
||||
applicationContext,
|
||||
"${applicationContext.packageName}.wallpaper_provider",
|
||||
file
|
||||
)
|
||||
|
||||
val intent = Intent(Intent.ACTION_ATTACH_DATA).apply {
|
||||
addCategory(Intent.CATEGORY_DEFAULT)
|
||||
setDataAndType(uri, "image/*")
|
||||
putExtra("mimeType", "image/*")
|
||||
addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
|
||||
}
|
||||
|
||||
launcher.launch(android.content.Intent.createChooser(intent, "Set wallpaper as:"))
|
||||
} catch (e: Exception) {
|
||||
// Pigeon handles exceptions gracefully and passes them back to Dart
|
||||
throw WallpaperError("INTENT_ERROR", "Failed to launch intent: ${e.message}", null)
|
||||
}
|
||||
}
|
||||
|
||||
fun onResult(success: Boolean) {
|
||||
pendingCallback?.invoke(Result.success(success))
|
||||
pendingCallback = null
|
||||
}
|
||||
}
|
||||
@@ -1,76 +0,0 @@
|
||||
// Autogenerated from Pigeon (v30.0.2), do not edit directly.
|
||||
// See also: https://pub.dev/packages/pigeon
|
||||
@file:Suppress("UNCHECKED_CAST", "ArrayInDataClass")
|
||||
|
||||
|
||||
import android.util.Log
|
||||
import io.flutter.plugin.common.BasicMessageChannel
|
||||
import io.flutter.plugin.common.BinaryMessenger
|
||||
import io.flutter.plugin.common.EventChannel
|
||||
import io.flutter.plugin.common.MessageCodec
|
||||
import io.flutter.plugin.common.StandardMethodCodec
|
||||
import io.flutter.plugin.common.StandardMessageCodec
|
||||
import java.io.ByteArrayOutputStream
|
||||
import java.nio.ByteBuffer
|
||||
private object LocalNetworkPermissionPigeonPigeonUtils {
|
||||
|
||||
fun wrapResult(result: Any?): List<Any?> {
|
||||
return listOf(result)
|
||||
}
|
||||
|
||||
fun wrapError(exception: Throwable): List<Any?> {
|
||||
return if (exception is FlutterError) {
|
||||
listOf(
|
||||
exception.code,
|
||||
exception.message,
|
||||
exception.details
|
||||
)
|
||||
} else {
|
||||
listOf(
|
||||
exception.javaClass.simpleName,
|
||||
exception.toString(),
|
||||
"Cause: " + exception.cause + ", Stacktrace: " + Log.getStackTraceString(exception)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
private open class LocalNetworkPermissionPigeonPigeonCodec : StandardMessageCodec() {
|
||||
override fun readValueOfType(type: Byte, buffer: ByteBuffer): Any? {
|
||||
return super.readValueOfType(type, buffer)
|
||||
}
|
||||
override fun writeValue(stream: ByteArrayOutputStream, value: Any?) {
|
||||
super.writeValue(stream, value)
|
||||
}
|
||||
}
|
||||
|
||||
/** Generated interface from Pigeon that represents a handler of messages from Flutter. */
|
||||
interface LocalNetworkPermissionPigeon {
|
||||
fun getAndroidSdkInt(): Long
|
||||
|
||||
companion object {
|
||||
/** The codec used by LocalNetworkPermissionPigeon. */
|
||||
val codec: MessageCodec<Any?> by lazy {
|
||||
LocalNetworkPermissionPigeonPigeonCodec()
|
||||
}
|
||||
/** Sets up an instance of `LocalNetworkPermissionPigeon` to handle messages through the `binaryMessenger`. */
|
||||
@JvmOverloads
|
||||
fun setUp(binaryMessenger: BinaryMessenger, api: LocalNetworkPermissionPigeon?, messageChannelSuffix: String = "") {
|
||||
val separatedMessageChannelSuffix = if (messageChannelSuffix.isNotEmpty()) ".$messageChannelSuffix" else ""
|
||||
run {
|
||||
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.nl_jknaapen_fladder.settings.LocalNetworkPermissionPigeon.getAndroidSdkInt$separatedMessageChannelSuffix", codec)
|
||||
if (api != null) {
|
||||
channel.setMessageHandler { _, reply ->
|
||||
val wrapped: List<Any?> = try {
|
||||
listOf(api.getAndroidSdkInt())
|
||||
} catch (exception: Throwable) {
|
||||
LocalNetworkPermissionPigeonPigeonUtils.wrapError(exception)
|
||||
}
|
||||
reply.reply(wrapped)
|
||||
}
|
||||
} else {
|
||||
channel.setMessageHandler(null)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 888 B After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 624 B After Width: | Height: | Size: 897 B |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 12 KiB |
@@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<paths>
|
||||
<cache-path name="cache_images" path="." />
|
||||
</paths>
|
||||
@@ -5,11 +5,10 @@ allprojects {
|
||||
}
|
||||
}
|
||||
|
||||
def newBuildDir = rootProject.layout.buildDirectory.dir("../../build").get()
|
||||
rootProject.layout.buildDirectory.value(newBuildDir)
|
||||
rootProject.buildDir = "../build"
|
||||
|
||||
subprojects {
|
||||
project.layout.buildDirectory.value(newBuildDir.dir(project.name))
|
||||
project.buildDir = "${rootProject.buildDir}/${project.name}"
|
||||
}
|
||||
|
||||
subprojects {
|
||||
@@ -17,5 +16,5 @@ subprojects {
|
||||
}
|
||||
|
||||
tasks.register("clean", Delete) {
|
||||
delete rootProject.layout.buildDirectory
|
||||
delete rootProject.buildDir
|
||||
}
|
||||
@@ -0,0 +1,663 @@
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html lang="en">
|
||||
<head>
|
||||
<!-- Required meta tags -->
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
|
||||
<style type="text/css">
|
||||
/*! normalize.css v7.0.0 | MIT License | github.com/necolas/normalize.css */
|
||||
html {
|
||||
line-height: 1.15;
|
||||
-ms-text-size-adjust: 100%;
|
||||
-webkit-text-size-adjust: 100%
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0
|
||||
}
|
||||
|
||||
article, aside, footer, header, nav, section {
|
||||
display: block
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 2em;
|
||||
margin: .67em 0
|
||||
}
|
||||
|
||||
figcaption, figure, main {
|
||||
display: block
|
||||
}
|
||||
|
||||
figure {
|
||||
margin: 1em 40px
|
||||
}
|
||||
|
||||
hr {
|
||||
box-sizing: content-box;
|
||||
height: 0;
|
||||
overflow: visible
|
||||
}
|
||||
|
||||
pre {
|
||||
font-family: monospace, monospace;
|
||||
font-size: 1em
|
||||
}
|
||||
|
||||
a {
|
||||
background-color: transparent;
|
||||
-webkit-text-decoration-skip: objects
|
||||
}
|
||||
|
||||
abbr[title] {
|
||||
border-bottom: none;
|
||||
text-decoration: underline;
|
||||
text-decoration: underline dotted
|
||||
}
|
||||
|
||||
b, strong {
|
||||
font-weight: inherit
|
||||
}
|
||||
|
||||
b, strong {
|
||||
font-weight: bolder
|
||||
}
|
||||
|
||||
code, kbd, samp {
|
||||
font-family: monospace, monospace;
|
||||
font-size: 1em
|
||||
}
|
||||
|
||||
dfn {
|
||||
font-style: italic
|
||||
}
|
||||
|
||||
mark {
|
||||
background-color: #ff0;
|
||||
color: #000
|
||||
}
|
||||
|
||||
small {
|
||||
font-size: 80%
|
||||
}
|
||||
|
||||
sub, sup {
|
||||
font-size: 75%;
|
||||
line-height: 0;
|
||||
position: relative;
|
||||
vertical-align: baseline
|
||||
}
|
||||
|
||||
sub {
|
||||
bottom: -.25em
|
||||
}
|
||||
|
||||
sup {
|
||||
top: -.5em
|
||||
}
|
||||
|
||||
audio, video {
|
||||
display: inline-block
|
||||
}
|
||||
|
||||
audio:not([controls]) {
|
||||
display: none;
|
||||
height: 0
|
||||
}
|
||||
|
||||
img {
|
||||
border-style: none
|
||||
}
|
||||
|
||||
svg:not(:root) {
|
||||
overflow: hidden
|
||||
}
|
||||
|
||||
button, input, optgroup, select, textarea {
|
||||
font-family: sans-serif;
|
||||
font-size: 100%;
|
||||
line-height: 1.15;
|
||||
margin: 0
|
||||
}
|
||||
|
||||
button, input {
|
||||
overflow: visible
|
||||
}
|
||||
|
||||
button, select {
|
||||
text-transform: none
|
||||
}
|
||||
|
||||
[type=reset], [type=submit], button, html [type=button] {
|
||||
-webkit-appearance: button
|
||||
}
|
||||
|
||||
[type=button]::-moz-focus-inner, [type=reset]::-moz-focus-inner, [type=submit]::-moz-focus-inner, button::-moz-focus-inner {
|
||||
border-style: none;
|
||||
padding: 0
|
||||
}
|
||||
|
||||
[type=button]:-moz-focusring, [type=reset]:-moz-focusring, [type=submit]:-moz-focusring, button:-moz-focusring {
|
||||
outline: 1px dotted ButtonText
|
||||
}
|
||||
|
||||
fieldset {
|
||||
padding: .35em .75em .625em
|
||||
}
|
||||
|
||||
legend {
|
||||
box-sizing: border-box;
|
||||
color: inherit;
|
||||
display: table;
|
||||
max-width: 100%;
|
||||
padding: 0;
|
||||
white-space: normal
|
||||
}
|
||||
|
||||
progress {
|
||||
display: inline-block;
|
||||
vertical-align: baseline
|
||||
}
|
||||
|
||||
textarea {
|
||||
overflow: auto
|
||||
}
|
||||
|
||||
[type=checkbox], [type=radio] {
|
||||
box-sizing: border-box;
|
||||
padding: 0
|
||||
}
|
||||
|
||||
[type=number]::-webkit-inner-spin-button, [type=number]::-webkit-outer-spin-button {
|
||||
height: auto
|
||||
}
|
||||
|
||||
[type=search] {
|
||||
-webkit-appearance: textfield;
|
||||
outline-offset: -2px
|
||||
}
|
||||
|
||||
[type=search]::-webkit-search-cancel-button, [type=search]::-webkit-search-decoration {
|
||||
-webkit-appearance: none
|
||||
}
|
||||
|
||||
::-webkit-file-upload-button {
|
||||
-webkit-appearance: button;
|
||||
font: inherit
|
||||
}
|
||||
|
||||
details, menu {
|
||||
display: block
|
||||
}
|
||||
|
||||
summary {
|
||||
display: list-item
|
||||
}
|
||||
|
||||
canvas {
|
||||
display: inline-block
|
||||
}
|
||||
|
||||
template {
|
||||
display: none
|
||||
}
|
||||
|
||||
[hidden] {
|
||||
display: none
|
||||
}
|
||||
|
||||
/* configuration cache styles */
|
||||
|
||||
.report-wrapper {
|
||||
margin: 0;
|
||||
padding: 0 24px;
|
||||
}
|
||||
|
||||
.gradle-logo {
|
||||
width: 32px;
|
||||
height: 24px;
|
||||
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAYCAYAAACbU/80AAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAIKADAAQAAAABAAAAGAAAAAA915G0AAAD5klEQVRIDbVWC0xTZxT+emmhVUEeA1/ROh/tFAFFGK7oJisIKsNVoOwBbJPowEWHzikRxeiMRpwwjDWRBHQLIzOmiRhe22BT40TitiyaMBQFfMEeLMIEaSmk+/+rvd7be4no6Elu7n++c/5zzv845/wyOyG4iGyDgzCdNOPLM9W41n4bnmNUiHo5DNsz0hGsmcV6lbkyAOOWXJjrz4qWp1C4o3z/LqzWL4VcJB1FIHmZHn/f78a6pDcxbeIEfNvQiPwTZbDZBpC24zOEaGfDpTsgtZby6u+QlrubFWUY3nh6AH39/ahr/Bn1jZfxW3ML2js60dtvgbtcQVblj8CZM7A0PBSrol6Ft+c4KZ8iTB1nwN0//8IEP9/hA2i924Gir0/iq8oa/NvbJzLiDKiUSqTE6pGVbEBY4BxnsYAPSnwXTa3tLCZ5BF3dPdAkGNHzoFcwcaRMnC4CeZkZiAgKFE252nITC1Pew9Dj5GNEGgS4Rbb5eZ1Te7UXG6FLX4cV6zeh5kIDaDpSunL9Boyf5nLOpwT4Sx+BxWrFK8QAnTAapPRQwofcj86uLoG59cbVEOzA0NAQNh38Atn5RSjY8rFAmc/I3dyQvOx1PsSNVy7Roa3ajHDePbBYLSLn1MaGd5KFAXy07xAOl59C6elK+I73hIHcbGd6wXs8qkyH8FZcjLOI5X/9/TrOnLsAldJDUu4As1NToFFPe3IEpm/M2HigwCFnU6t4Zw6Ck1JhGRhgcXq5juXloKyqFnlHirmz5CaNcEAv59kSE9wVikcB3O78A/MSU0Fznk/H9+yAetJEnPr+B8RFLsLcGS8ia28+qQuX+WrPNNZOV+Nc6VH4+3iz89g0pEaLzRUiQ3LGDWsM8Qidq2WL0PGKKlgf74ZIeQTAfFJ6a44WIsDXh9OW/dPdY58aawC9KK6kpOgolO7JxViVSuBGXnvxksudZ5F0O5yzGYxMJnBOGaau4fnPU2RNAtCFBKFoa7akczaAptY2iWmjB33+yQa4kZwfjpi2ex3Dyf43vuAljWQ/4Btmei1WPj+q45hF4U+1J4fEizCEvNf0EWHoIW244sfzoN1RipaT2kDfdjfv3MNpojdISjmfIheE8Fnp8WR9vJ2Zr+O+bYUmO+kJ9KnIUtf9bnvY2x9wcqrrvnCJvfL8Tw4V9v9LU7PdKzJaoNdy645AR4ph1JMncZHRKrVvYyYY5kmP8iO1v2T3dk6HDtYmrgJtOnwKnaPFrg8z+BBX7QSgEyOPJfX9Qd9DFs40GgTOHbrBs2ch4bXFuEG2mmFkeD9hpUMk+NMXEe0TNtsg/Ly94DVurEAuxfwHC1WiVbe0U7MAAAAASUVORK5CYII=");
|
||||
background-size: contain;
|
||||
}
|
||||
|
||||
.header {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
padding: 24px 24px 0 24px;
|
||||
background-color: white;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.learn-more {
|
||||
margin-left: auto;
|
||||
align-self: center;
|
||||
font-size: 0.875rem;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 18px 0 24px 0;
|
||||
flex: 1 0 100%;
|
||||
}
|
||||
|
||||
.content {
|
||||
font-size: 0.875rem;
|
||||
padding: 240px 0 48px;
|
||||
overflow-x: auto;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.content ol:first-of-type {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.tree-btn {
|
||||
cursor: pointer;
|
||||
display: inline-block;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
background-size: contain;
|
||||
background-repeat: no-repeat;
|
||||
vertical-align: middle;
|
||||
margin-top: -0.2em;
|
||||
}
|
||||
|
||||
.tree-btn.collapsed {
|
||||
background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 192 512"><path d="M166.9 264.5l-117.8 116c-4.7 4.7-12.3 4.7-17 0l-7.1-7.1c-4.7-4.7-4.7-12.3 0-17L127.3 256 25.1 155.6c-4.7-4.7-4.7-12.3 0-17l7.1-7.1c4.7-4.7 12.3-4.7 17 0l117.8 116c4.6 4.7 4.6 12.3-.1 17z" fill="%23999999" stroke="%23999999"/></svg>');
|
||||
}
|
||||
|
||||
.tree-btn.expanded {
|
||||
background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 512"><path d="M119.5 326.9L3.5 209.1c-4.7-4.7-4.7-12.3 0-17l7.1-7.1c4.7-4.7 12.3-4.7 17 0L128 287.3l100.4-102.2c4.7-4.7 12.3-4.7 17 0l7.1 7.1c4.7 4.7 4.7 12.3 0 17L136.5 327c-4.7 4.6-12.3 4.6-17-.1z" fill="%23999999" stroke="%23999999"/></svg>');
|
||||
}
|
||||
|
||||
ul .tree-btn {
|
||||
margin-right: 3px;
|
||||
}
|
||||
|
||||
.leaf-icon {
|
||||
display: inline-block;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 512"><path d="M32 256 H224" stroke="%23999999" stroke-width="48" stroke-linecap="round"/></svg>');
|
||||
background-size: contain;
|
||||
background-repeat: no-repeat;
|
||||
vertical-align: middle;
|
||||
margin-top: -0.2em;
|
||||
}
|
||||
|
||||
.invisible-text {
|
||||
user-select: all; /* Allow the text to be selectable */
|
||||
color: transparent; /* Hide the text */
|
||||
text-indent: -9999px; /* Move the text out of view */
|
||||
position: relative;
|
||||
white-space: pre; /* Preserve meaningful whitespace in the invisible text for copying */
|
||||
}
|
||||
|
||||
.text-for-copy {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.enum-icon {
|
||||
display: inline-block;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024"><circle cx="512" cy="512" r="200" /></svg>');
|
||||
background-size: contain;
|
||||
background-repeat: no-repeat;
|
||||
vertical-align: middle;
|
||||
margin-inline-start: 0.5ex;
|
||||
margin-inline-end: 0.5ex;
|
||||
margin-top: -0.2em;
|
||||
}
|
||||
|
||||
.error-icon {
|
||||
display: inline-block;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><path d="M193.94 256L296.5 153.44l21.15-21.15c3.12-3.12 3.12-8.19 0-11.31l-22.63-22.63c-3.12-3.12-8.19-3.12-11.31 0L160 222.06 36.29 98.34c-3.12-3.12-8.19-3.12-11.31 0L2.34 120.97c-3.12 3.12-3.12 8.19 0 11.31L126.06 256 2.34 379.71c-3.12 3.12-3.12 8.19 0 11.31l22.63 22.63c3.12 3.12 8.19 3.12 11.31 0L160 289.94 262.56 392.5l21.15 21.15c3.12 3.12 8.19 3.12 11.31 0l22.63-22.63c3.12-3.12 3.12-8.19 0-11.31L193.94 256z" fill="%23FC461E" stroke="%23FC461E"/></svg>');
|
||||
background-size: contain;
|
||||
background-repeat: no-repeat;
|
||||
vertical-align: middle;
|
||||
margin-inline-start: 0.5ex;
|
||||
margin-inline-end: 0.5ex;
|
||||
margin-top: -0.2em;
|
||||
}
|
||||
|
||||
.advice-icon {
|
||||
display: inline-block;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
background-image: url('data:image/svg+xml;utf8,<svg width="800px" height="800px" viewBox="-4.93 0 122.88 122.88" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="enable-background:new 0 0 113.01 122.88" xml:space="preserve"><g><path d="M44.13,102.06c-1.14,0.03-2.14-0.81-2.3-1.96c-0.17-1.2,0.64-2.31,1.82-2.54c-1.3-7.37-4.85-11.43-8.6-15.72 c-2.92-3.34-5.95-6.81-8.34-11.92c-2.35-5.03-3.64-10.23-3.6-15.63c0.05-5.4,1.42-10.96,4.4-16.71c0.02-0.04,0.04-0.07,0.06-0.11 l0,0c3.91-6.62,9.38-11.04,15.47-13.52c5.11-2.09,10.66-2.8,16.1-2.3c5.42,0.5,10.73,2.2,15.37,4.94 c5.9,3.49,10.75,8.67,13.42,15.21c1.44,3.54,2.42,7.49,2.54,11.82c0.12,4.31-0.62,8.96-2.61,13.88 c-2.66,6.59-6.18,10.68-9.47,14.51c-3.03,3.53-5.85,6.81-7.42,11.84c0.89,0.21,1.59,0.94,1.73,1.9c0.17,1.24-0.7,2.39-1.94,2.56 l-0.77,0.11c-0.14,1.09-0.23,2.26-0.27,3.51l0.25-0.04c1.24-0.17,2.39,0.7,2.56,1.94c0.17,1.24-0.7,2.39-1.94,2.56l-0.78,0.11 c0.01,0.15,0.02,0.3,0.03,0.45l0,0c0.07,0.88,0.08,1.73,0.03,2.54l0.13-0.02c1.25-0.15,2.38,0.74,2.54,1.98 c0.15,1.25-0.74,2.38-1.98,2.54l-1.68,0.21c-1.2,3.11-3.34,5.48-5.87,6.94c-1.74,1.01-3.67,1.59-5.61,1.71 c-1.97,0.12-3.96-0.25-5.78-1.13c-2.08-1.02-3.94-2.71-5.29-5.14c-0.65-0.33-1.13-0.97-1.23-1.75c-0.04-0.31-0.01-0.61,0.07-0.89 c-0.39-1.16-0.68-2.43-0.87-3.83l-0.07,0.01c-1.24,0.17-2.39-0.7-2.56-1.94c-0.17-1.24,0.7-2.39,1.94-2.56l0.54-0.08 C44.19,104.32,44.18,103.16,44.13,102.06L44.13,102.06z M2.18,58.86C1.01,58.89,0.04,57.98,0,56.81c-0.04-1.17,0.88-2.14,2.05-2.18 l8.7-0.3c1.17-0.04,2.14,0.88,2.18,2.05c0.04,1.17-0.88,2.14-2.05,2.18L2.18,58.86L2.18,58.86z M110.68,50.25 c1.16-0.12,2.2,0.73,2.32,1.89c0.12,1.16-0.73,2.2-1.89,2.32l-8.66,0.91c-1.16,0.12-2.2-0.73-2.32-1.89 c-0.12-1.16,0.73-2.2,1.89-2.32L110.68,50.25L110.68,50.25z M94.91,14.78c0.65-0.97,1.96-1.23,2.93-0.58 c0.97,0.65,1.23,1.96,0.58,2.93l-4.84,7.24c-0.65,0.97-1.96,1.23-2.93,0.58c-0.97-0.65-1.23-1.96-0.58-2.93L94.91,14.78 L94.91,14.78z M57.63,2.06c0.03-1.17,1-2.09,2.16-2.06c1.17,0.03,2.09,1,2.06,2.16l-0.22,8.7c-0.03,1.17-1,2.09-2.16,2.06 c-1.17-0.03-2.09-1-2.06-2.16L57.63,2.06L57.63,2.06z M13.88,15.53c-0.86-0.8-0.9-2.14-0.11-2.99c0.8-0.86,2.14-0.9,2.99-0.11 l6.37,5.94c0.86,0.8,0.9,2.14,0.11,2.99c-0.8,0.86-2.14,0.9-2.99,0.11L13.88,15.53L13.88,15.53z M47.88,96.95l18.49-2.63 c1.59-6.7,5.05-10.73,8.8-15.08c3.08-3.58,6.36-7.4,8.76-13.34c1.76-4.35,2.41-8.43,2.31-12.19c-0.1-3.75-0.96-7.21-2.24-10.34 c-2.3-5.63-6.51-10.11-11.65-13.15c-4.11-2.43-8.8-3.94-13.59-4.37c-4.77-0.44-9.64,0.19-14.13,2.02 c-5.26,2.15-9.99,5.97-13.39,11.72c-2.64,5.12-3.86,10.02-3.9,14.73c-0.04,4.74,1.11,9.33,3.2,13.8c2.13,4.56,4.97,7.8,7.69,10.92 C42.47,83.9,46.48,88.49,47.88,96.95L47.88,96.95z M65.62,99.02l-17.27,2.45c0.05,1.1,0.07,2.25,0.05,3.47l17.05-2.42 C65.47,101.29,65.52,100.12,65.62,99.02L65.62,99.02z M48.49,109.52c0.12,0.92,0.3,1.76,0.53,2.54l16.55-2.04 c0.11-0.86,0.13-1.77,0.05-2.74l0,0l0-0.02l-0.01-0.17L48.49,109.52L48.49,109.52z M51.37,116.36c0.64,0.67,1.35,1.19,2.1,1.55 c1.15,0.56,2.42,0.79,3.67,0.72c1.29-0.08,2.57-0.47,3.74-1.15c1.1-0.64,2.09-1.53,2.88-2.65L51.37,116.36L51.37,116.36z"/></g></svg>');
|
||||
background-size: contain;
|
||||
background-repeat: no-repeat;
|
||||
vertical-align: middle;
|
||||
margin-inline-start: 0.5ex;
|
||||
margin-inline-end: 0.5ex;
|
||||
margin-top: -0.2em;
|
||||
}
|
||||
|
||||
.warning-icon {
|
||||
display: inline-block;
|
||||
width: 13px;
|
||||
height: 13px;
|
||||
background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path d="M270.2 160h35.5c3.4 0 6.1 2.8 6 6.2l-7.5 196c-.1 3.2-2.8 5.8-6 5.8h-20.5c-3.2 0-5.9-2.5-6-5.8l-7.5-196c-.1-3.4 2.6-6.2 6-6.2zM288 388c-15.5 0-28 12.5-28 28s12.5 28 28 28 28-12.5 28-28-12.5-28-28-28zm281.5 52L329.6 24c-18.4-32-64.7-32-83.2 0L6.5 440c-18.4 31.9 4.6 72 41.6 72H528c36.8 0 60-40 41.5-72zM528 480H48c-12.3 0-20-13.3-13.9-24l240-416c6.1-10.6 21.6-10.7 27.7 0l240 416c6.2 10.6-1.5 24-13.8 24z" fill="%23DEAD22" stroke="%23DEAD22"/></svg>');
|
||||
background-size: contain;
|
||||
background-repeat: no-repeat;
|
||||
vertical-align: middle;
|
||||
margin-inline-start: 0.3ex;
|
||||
margin-inline-end: 1.1ex;
|
||||
margin-top: -0.1em;
|
||||
}
|
||||
|
||||
.documentation-button {
|
||||
cursor: pointer;
|
||||
display: inline-block;
|
||||
width: 13px;
|
||||
height: 13px;
|
||||
background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M256 340c-15.464 0-28 12.536-28 28s12.536 28 28 28 28-12.536 28-28-12.536-28-28-28zm7.67-24h-16c-6.627 0-12-5.373-12-12v-.381c0-70.343 77.44-63.619 77.44-107.408 0-20.016-17.761-40.211-57.44-40.211-29.144 0-44.265 9.649-59.211 28.692-3.908 4.98-11.054 5.995-16.248 2.376l-13.134-9.15c-5.625-3.919-6.86-11.771-2.645-17.177C185.658 133.514 210.842 116 255.67 116c52.32 0 97.44 29.751 97.44 80.211 0 67.414-77.44 63.849-77.44 107.408V304c0 6.627-5.373 12-12 12zM256 40c118.621 0 216 96.075 216 216 0 119.291-96.61 216-216 216-119.244 0-216-96.562-216-216 0-119.203 96.602-216 216-216m0-32C119.043 8 8 119.083 8 256c0 136.997 111.043 248 248 248s248-111.003 248-248C504 119.083 392.957 8 256 8z" fill="%23999999" stroke="%23999999"/></svg>');
|
||||
background-size: contain;
|
||||
background-repeat: no-repeat;
|
||||
vertical-align: middle;
|
||||
margin-inline-start: 0.5ex;
|
||||
margin-inline-end: 0.5ex;
|
||||
margin-top: -0.2em;
|
||||
}
|
||||
|
||||
.documentation-button::selection {
|
||||
color: transparent;
|
||||
}
|
||||
|
||||
.documentation-button:hover {
|
||||
color: transparent;
|
||||
}
|
||||
|
||||
.copy-button {
|
||||
cursor: pointer;
|
||||
display: inline-block;
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M433.941 193.941l-51.882-51.882A48 48 0 0 0 348.118 128H320V80c0-26.51-21.49-48-48-48h-66.752C198.643 13.377 180.858 0 160 0s-38.643 13.377-45.248 32H48C21.49 32 0 53.49 0 80v288c0 26.51 21.49 48 48 48h80v48c0 26.51 21.49 48 48 48h224c26.51 0 48-21.49 48-48V227.882a48 48 0 0 0-14.059-33.941zm-22.627 22.627a15.888 15.888 0 0 1 4.195 7.432H352v-63.509a15.88 15.88 0 0 1 7.431 4.195l51.883 51.882zM160 30c9.941 0 18 8.059 18 18s-8.059 18-18 18-18-8.059-18-18 8.059-18 18-18zM48 384c-8.822 0-16-7.178-16-16V80c0-8.822 7.178-16 16-16h66.752c6.605 18.623 24.389 32 45.248 32s38.643-13.377 45.248-32H272c8.822 0 16 7.178 16 16v48H176c-26.51 0-48 21.49-48 48v208H48zm352 96H176c-8.822 0-16-7.178-16-16V176c0-8.822 7.178-16 16-16h144v72c0 13.2 10.8 24 24 24h72v208c0 8.822-7.178 16-16 16z" fill="%23999999" stroke="%23999999"/></svg>');
|
||||
background-size: contain;
|
||||
background-repeat: no-repeat;
|
||||
vertical-align: middle;
|
||||
margin-inline-start: 0.5ex;
|
||||
margin-top: -0.2em;
|
||||
}
|
||||
|
||||
.groups{
|
||||
display: flex;
|
||||
border-bottom: 1px solid #EDEEEF;
|
||||
flex: 1 0 100%;
|
||||
}
|
||||
|
||||
.uncategorized {
|
||||
display: flex;
|
||||
border-top: 4px solid #EDEEEF;
|
||||
flex: 1 0 100%;
|
||||
}
|
||||
|
||||
.group-selector {
|
||||
padding: 0 52px 24px 0;
|
||||
font-size: 0.9rem;
|
||||
font-weight: bold;
|
||||
color: #999999;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.group-selector__count {
|
||||
margin: 0 8px;
|
||||
border-radius: 8px;
|
||||
background-color: #999;
|
||||
color: #fff;
|
||||
padding: 1px 8px 2px;
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
|
||||
.group-selector--active {
|
||||
color: #02303A;
|
||||
cursor: auto;
|
||||
}
|
||||
|
||||
.group-selector--active .group-selector__count {
|
||||
background-color: #686868;
|
||||
}
|
||||
|
||||
.group-selector--disabled {
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.accordion-header {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.container {
|
||||
padding-left: 0.5em;
|
||||
padding-right: 0.5em;
|
||||
}
|
||||
|
||||
.stacktrace {
|
||||
border-radius: 4px;
|
||||
overflow-x: auto;
|
||||
padding: 0.5rem;
|
||||
margin-bottom: 0;
|
||||
min-width: 1000px;
|
||||
}
|
||||
|
||||
/* Lato (bold, regular) */
|
||||
@font-face {
|
||||
font-display: swap;
|
||||
font-family: Lato;
|
||||
font-weight: 500;
|
||||
font-style: normal;
|
||||
src: url("https://assets.gradle.com/lato/fonts/lato-semibold/lato-semibold.woff2") format("woff2"),
|
||||
url("https://assets.gradle.com/lato/fonts/lato-semibold/lato-semibold.woff") format("woff");
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-display: swap;
|
||||
font-family: Lato;
|
||||
font-weight: bold;
|
||||
font-style: normal;
|
||||
src: url("https://assets.gradle.com/lato/fonts/lato-bold/lato-bold.woff2") format("woff2"),
|
||||
url("https://assets.gradle.com/lato/fonts/lato-bold/lato-bold.woff") format("woff");
|
||||
}
|
||||
|
||||
* {
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
html,
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
html {
|
||||
font-family: "Lato", "Helvetica Neue", Arial, sans-serif;
|
||||
font-size: 16px;
|
||||
font-weight: 400;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
body {
|
||||
color: #02303A;
|
||||
background-color: #ffffff;
|
||||
-webkit-text-size-adjust: 100%;
|
||||
-ms-text-size-adjust: 100%;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
|
||||
|
||||
/* typography */
|
||||
h1, h2, h3, h4, h5, h6 {
|
||||
color: #02303A;
|
||||
text-rendering: optimizeLegibility;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-size: 1.125rem;
|
||||
}
|
||||
|
||||
h4, h5, h6 {
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
|
||||
h1 code {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
ul, ol, dl {
|
||||
list-style-position: outside;
|
||||
line-height: 1.6;
|
||||
padding: 0;
|
||||
margin: 0 0 0 20px;
|
||||
list-style-type: none;
|
||||
}
|
||||
|
||||
li {
|
||||
line-height: 2;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #1DA2BD;
|
||||
text-decoration: none;
|
||||
transition: all 0.3s ease, visibility 0s;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
color: #35c1e4;
|
||||
}
|
||||
|
||||
/* code */
|
||||
code, pre {
|
||||
font-family: Inconsolata, Monaco, "Courier New", monospace;
|
||||
font-style: normal;
|
||||
font-variant-ligatures: normal;
|
||||
font-variant-caps: normal;
|
||||
font-variant-numeric: normal;
|
||||
font-variant-east-asian: normal;
|
||||
font-weight: normal;
|
||||
font-stretch: normal;
|
||||
color: #686868;
|
||||
}
|
||||
|
||||
*:not(pre) > code {
|
||||
letter-spacing: 0;
|
||||
padding: 0.1em 0.5ex;
|
||||
text-rendering: optimizeSpeed;
|
||||
word-spacing: -0.15em;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
pre {
|
||||
font-size: 0.75rem;
|
||||
line-height: 1.8;
|
||||
margin-top: 0;
|
||||
margin-bottom: 1.5em;
|
||||
padding: 1rem;
|
||||
}
|
||||
|
||||
pre code {
|
||||
background-color: transparent;
|
||||
color: inherit;
|
||||
line-height: 1.8;
|
||||
font-size: 100%;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
a code {
|
||||
color: #1BA8CB;
|
||||
}
|
||||
|
||||
pre.code, pre.programlisting, pre.screen, pre.tt {
|
||||
background-color: #f7f7f8;
|
||||
border-radius: 4px;
|
||||
font-size: 1em;
|
||||
line-height: 1.45;
|
||||
margin-bottom: 1.25em;
|
||||
overflow-x: auto;
|
||||
padding: 1rem;
|
||||
}
|
||||
|
||||
li em, p em {
|
||||
padding: 0 1px;
|
||||
}
|
||||
|
||||
code em, tt em {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
code + .copy-button {
|
||||
margin-inline-start: 0.2ex;
|
||||
}
|
||||
|
||||
.java-exception {
|
||||
font-size: 0.75rem;
|
||||
padding-left: 24px;
|
||||
}
|
||||
|
||||
.java-exception ul {
|
||||
margin: 0;
|
||||
line-height: inherit;
|
||||
}
|
||||
|
||||
.java-exception code {
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
.java-exception-part-toggle {
|
||||
user-select: none;
|
||||
cursor: pointer;
|
||||
border-radius: 2px;
|
||||
padding: 0.1em 0.2em;
|
||||
background: azure;
|
||||
color: #686868;
|
||||
}
|
||||
|
||||
</style>
|
||||
<!-- Inconsolata is used as a default monospace font in the report. -->
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Inconsolata:400,700" />
|
||||
|
||||
<title>Gradle Configuration Cache</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="playground"></div>
|
||||
|
||||
<div class="report" id="report">
|
||||
Loading...
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
function configurationCacheProblems() { return (
|
||||
// begin-report-data
|
||||
{"diagnostics":[{"locations":[{"path":"settings file 'J:\\Personal\\Programming\\fladder\\android\\settings.gradle'","line":17}],"problem":[{"text":"Properties should be assigned using the 'propName = value' syntax. Setting a property via the Gradle-generated 'propName value' or 'propName(value)' syntax in Groovy DSL has been deprecated."}],"severity":"WARNING","problemDetails":[{"text":"This is scheduled to be removed in Gradle 10.0."}],"contextualLabel":"Properties should be assigned using the 'propName = value' syntax. Setting a property via the Gradle-generated 'propName value' or 'propName(value)' syntax in Groovy DSL has been deprecated.","documentationLink":"https://docs.gradle.org/8.13/userguide/upgrading_version_8.html#groovy_space_assignment_syntax","problemId":[{"name":"deprecation","displayName":"Deprecation"},{"name":"properties-should-be-assigned-using-the-propname-value-syntax-setting-a-property-via-the-gradle-generated-propname-value-or-propname-value-syntax-in-groovy-dsl","displayName":"Properties should be assigned using the 'propName = value' syntax. Setting a property via the Gradle-generated 'propName value' or 'propName(value)' syntax in Groovy DSL has been deprecated."}],"solutions":[[{"text":"Use assignment ('url = <value>') instead."}]]},{"locations":[{"path":"build file 'J:\\Personal\\Programming\\fladder\\android\\app\\build.gradle'","line":61}],"problem":[{"text":"Properties should be assigned using the 'propName = value' syntax. Setting a property via the Gradle-generated 'propName value' or 'propName(value)' syntax in Groovy DSL has been deprecated."}],"severity":"WARNING","problemDetails":[{"text":"This is scheduled to be removed in Gradle 10.0."}],"contextualLabel":"Properties should be assigned using the 'propName = value' syntax. Setting a property via the Gradle-generated 'propName value' or 'propName(value)' syntax in Groovy DSL has been deprecated.","documentationLink":"https://docs.gradle.org/8.13/userguide/upgrading_version_8.html#groovy_space_assignment_syntax","problemId":[{"name":"deprecation","displayName":"Deprecation"},{"name":"properties-should-be-assigned-using-the-propname-value-syntax-setting-a-property-via-the-gradle-generated-propname-value-or-propname-value-syntax-in-groovy-dsl","displayName":"Properties should be assigned using the 'propName = value' syntax. Setting a property via the Gradle-generated 'propName value' or 'propName(value)' syntax in Groovy DSL has been deprecated."}],"solutions":[[{"text":"Use assignment ('kotlinCompilerExtensionVersion = <value>') instead."}]]},{"locations":[{"path":"build file 'J:\\Personal\\Programming\\fladder\\android\\app\\build.gradle'","line":75}],"problem":[{"text":"Properties should be assigned using the 'propName = value' syntax. Setting a property via the Gradle-generated 'propName value' or 'propName(value)' syntax in Groovy DSL has been deprecated."}],"severity":"WARNING","problemDetails":[{"text":"This is scheduled to be removed in Gradle 10.0."}],"contextualLabel":"Properties should be assigned using the 'propName = value' syntax. Setting a property via the Gradle-generated 'propName value' or 'propName(value)' syntax in Groovy DSL has been deprecated.","documentationLink":"https://docs.gradle.org/8.13/userguide/upgrading_version_8.html#groovy_space_assignment_syntax","problemId":[{"name":"deprecation","displayName":"Deprecation"},{"name":"properties-should-be-assigned-using-the-propname-value-syntax-setting-a-property-via-the-gradle-generated-propname-value-or-propname-value-syntax-in-groovy-dsl","displayName":"Properties should be assigned using the 'propName = value' syntax. Setting a property via the Gradle-generated 'propName value' or 'propName(value)' syntax in Groovy DSL has been deprecated."}],"solutions":[[{"text":"Use assignment ('shrinkResources = <value>') instead."}]]},{"locations":[{"path":"build file 'J:\\Personal\\Programming\\fladder\\android\\app\\build.gradle'","line":77}],"problem":[{"text":"Properties should be assigned using the 'propName = value' syntax. Setting a property via the Gradle-generated 'propName value' or 'propName(value)' syntax in Groovy DSL has been deprecated."}],"severity":"WARNING","problemDetails":[{"text":"This is scheduled to be removed in Gradle 10.0."}],"contextualLabel":"Properties should be assigned using the 'propName = value' syntax. Setting a property via the Gradle-generated 'propName value' or 'propName(value)' syntax in Groovy DSL has been deprecated.","documentationLink":"https://docs.gradle.org/8.13/userguide/upgrading_version_8.html#groovy_space_assignment_syntax","problemId":[{"name":"deprecation","displayName":"Deprecation"},{"name":"properties-should-be-assigned-using-the-propname-value-syntax-setting-a-property-via-the-gradle-generated-propname-value-or-propname-value-syntax-in-groovy-dsl","displayName":"Properties should be assigned using the 'propName = value' syntax. Setting a property via the Gradle-generated 'propName value' or 'propName(vaLine truncated
|
||||
// end-report-data
|
||||
);}
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
!function(n,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["configuration-cache-report"]=t():n["configuration-cache-report"]=t()}(this,(()=>(({70:function(){void 0===ArrayBuffer.isView&&(ArrayBuffer.isView=function(n){return null!=n&&null!=n.__proto__&&n.__proto__.__proto__===Int8Array.prototype.__proto__}),void 0===Math.imul&&(Math.imul=function(n,t){return(4294901760&n)*(65535&t)+(65535&n)*(0|t)|0}),this["configuration-cache-report"]=function(n){"use strict";var t,r,i,e,u,o,f,s,c,a,h,l,_,v,d,g,w,b,p,m,k,y,q,B,C,x,j,P,I,S,z,E,T,L,N,A,M,F,D,O,R,H,$,G,U,V,Q,Z,Y,W,K,X,J,nn,tn,rn,en,un,on,fn,sn,cn,an,hn,ln,_n,vn,dn,gn,wn,bn,pn,mn,kn,yn,qn,Bn,Cn,xn,jn,Pn,In,Sn,zn=Math.imul,En=ArrayBuffer.isView;function Tn(n,t){if(!(t>=0))throw fu(ie("Requested element count "+t+" is less than zero."));return function(n,t){if(!(t>=0))throw fu(ie("Requested element count "+t+" is less than zero."));if(0===t)return pt();if(t>=n.length)return function(n){switch(n.length){case 0:return pt();case 1:return gr(n[0]);default:return function(n){return Ar(function(n){return new qt(n,!1)}(n))}(n)}}(n);if(1===t)return gr(n[0]);var r=0,i=Nr(),e=0,u=n.length;n:for(;e<u;){var o=n[e];if(e=e+1|0,i.d(o),(r=r+1|0)===t)break n}return i}(n,Wn(n.length-t|0,0))}function Ln(n,t,r,i,e,u,o){return t=t===A?", ":t,r=r===A?"":r,i=i===A?"":i,e=e===A?-1:e,u=u===A?"...":u,o=o===A?null:o,function(n,t,r,i,e,u,o,f){r=r===A?", ":r,i=i===A?"":i,e=e===A?"":e,u=u===A?-1:u,o=o===A?"...":o,f=f===A?null:f,t.e(i);var s=0,c=0,a=n.length;n:for(;c<a;){var h=n[c];if(c=c+1|0,(s=s+1|0)>1&&t.e(r),!(u<0||s<=u))break n;Qt(t,h,f)}return u>=0&&s>u&&t.e(o),t.e(e),t}(n,bi(),t,r,i,e,u,o).toString()}function Nn(n){return n.length-1|0}function An(n,t){if(null==t){var r=0,i=n.length-1|0;if(r<=i)do{var e=r;if(r=r+1|0,null==n[e])return e}while(r<=i)}else{var u=0,o=n.length-1|0;if(u<=o)do{var f=u;if(u=u+1|0,oe(t,n[f]))return f}while(u<=o)}return-1}function Mn(n,t,r,i,e,u,o){return t=t===A?", ":t,r=r===A?"":r,i=i===A?"":i,e=e===A?-1:e,u=u===A?"...":u,o=o===A?null:o,Fn(n,bi(),t,r,i,e,u,o).toString()}function Fn(n,t,r,i,e,u,o,f){r=r===A?", ":r,i=i===A?"":i,e=e===A?"":e,u=u===A?-1:u,o=o===A?"...":o,f=f===A?null:f,t.e(i);var s=0,c=n.f();n:for(;c.g();){var a=c.h();if((s=s+1|0)>1&&t.e(r),!(u<0||s<=u))break n;Qt(t,a,f)}return u>=0&&s>u&&t.e(o),t.e(e),t}function Dn(n){if(n.i())throw mu("List is empty.");return n.j(0)}function On(n){return new Yn(n)}function Rn(n){if(Ue(n,Ti)){var t;switch(n.k()){case 0:t=pt();break;case 1:t=gr(Ue(n,Ei)?n.j(0):n.f().h());break;default:t=Hn(n)}return t}return mt(Vn(n))}function Hn(n){return Ar(n)}function $n(n){if(Ue(n,Ti)&&n.k()<=1)return Rn(n);var t=Vn(n);return function(n){var t=(n.k()/2|0)-1|0;if(t<0)return lr();var r=kt(n),i=0;if(i<=t)do{var e=i;i=i+1|0;var u=n.j(e);n.f4(e,n.j(r)),n.f4(r,u),r=r-1|0}while(e!==t)}(t),t}function Gn(n,t){if(!(t>=0))throw fu(ie("Requested element count "+t+" is less than zero."));return function(n,t){if(!(t>=0))throw fu(ie("Requested element count "+t+" is less than zero."));if(0===t)return pt();if(Ue(n,Ti)){if(t>=n.k())return Rn(n);if(1===t)return gr(function(n){if(Ue(n,Ei))return Dn(n);var t=n.f();if(!t.g())throw mu("Collection is empty.");return t.h()}(n))}var r=0,i=Nr(),e=n.f();n:for(;e.g();){var u=e.h();if(i.d(u),(r=r+1|0)===t)break n}return mt(i)}(n,Wn(n.k()-t|0,0))}function Un(n,t){if(!(t>=0))throw fu(ie("Requested element count "+t+" is less than zero."));if(0===t)return pt();var r=n.k();if(t>=r)return Rn(n);if(1===t)return gr(Qn(n));var i=Nr();if(Ue(n,li)){var e=r-t|0;if(e<r)do{var u=e;e=e+1|0,i.d(n.j(u))}while(e<r)}else for(var o=n.l(r-t|0);o.g();){var f=o.h();i.d(f)}return i}function Vn(n){return Ue(n,Ti)?Hn(n):Zn(n,Lr())}function Qn(n){if(n.i())throw mu("List is empty.");return n.j(kt(n))}function Zn(n,t){for(var r=n.f();r.g();){var i=r.h();t.d(i)}return t}function Yn(n){this.n_1=n}function Wn(n,t){return n<t?t:n}function Kn(n,t){return n>t?t:n}function Xn(n,t){return Ut().q(n,t,-1)}function Jn(n,t){return new Et(n,t)}function nt(n){var t=n.f();if(!t.g())return pt();var r=t.h();if(!t.g())return gr(r);var i=Lr();for(i.d(r);t.g();)i.d(t.h());return i}function tt(n){this.r_1=n}function rt(n,t){this.s_1=n,this.t_1=t}function it(){}function et(n){this.x_1=n,this.w_1=0}function ut(n,t){this.a1_1=n,et.call(this,n),ft().b1(t,this.a1_1.k()),this.w_1=t}function ot(){t=this}function ft(){return null==t&&new ot,t}function st(){ft(),it.call(this)}function ct(n){this.h1_1=n}function at(n,t){return t===n?"(this Map)":Oi(t)}function ht(n,t){var r;n:{for(var i=n.o().f();i.g();){var e=i.h();if(oe(e.j1(),t)){r=e;break n}}r=null}return r}function lt(){r=this}function _t(){return null==r&&new lt,r}function vt(n){this.q1_1=n,it.call(this)}function dt(){_t(),this.n1_1=null,this.o1_1=null}function gt(){i=this}function wt(){return null==i&&new gt,i}function bt(n){return n.length>0?nu(n):pt()}function pt(){return null==e&&nLine truncated
|
||||
//# sourceMappingURL=configuration-cache-report.js.map
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,7 +1,3 @@
|
||||
org.gradle.jvmargs=-Xmx4G -XX:MaxMetaspaceSize=2G -XX:+HeapDumpOnOutOfMemoryError
|
||||
android.useAndroidX=true
|
||||
android.enableJetifier=true
|
||||
# This builtInKotlin flag was added automatically by Flutter migrator
|
||||
android.builtInKotlin=true
|
||||
# This newDsl flag was added automatically by Flutter migrator
|
||||
android.newDsl=false
|
||||
@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.5.0-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-all.zip
|
||||
@@ -7,7 +7,7 @@ pluginManagement {
|
||||
return flutterSdkPath
|
||||
}()
|
||||
|
||||
includeBuild(file("$flutterSdkPath/packages/flutter_tools/gradle").toPath().toRealPath().toAbsolutePath().toString())
|
||||
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
|
||||
|
||||
repositories {
|
||||
google()
|
||||
@@ -21,9 +21,9 @@ pluginManagement {
|
||||
|
||||
plugins {
|
||||
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
|
||||
id "com.android.application" version "9.3.1" apply false
|
||||
id "org.jetbrains.kotlin.android" version "2.4.20" apply false
|
||||
id "org.jetbrains.kotlin.plugin.compose" version "2.4.20" apply false
|
||||
id "com.android.application" version '8.12.2' apply false
|
||||
id "org.jetbrains.kotlin.android" version "2.1.0" apply false
|
||||
id "org.jetbrains.kotlin.plugin.compose" version "2.1.0" apply false
|
||||
}
|
||||
|
||||
include ":app"
|
||||
@@ -1,83 +1,54 @@
|
||||
targets:
|
||||
$default:
|
||||
sources:
|
||||
exclude:
|
||||
- lib/jellyseer/**
|
||||
- .fvm/**
|
||||
include:
|
||||
- lib/$lib$
|
||||
- "**/models/**.dart"
|
||||
- "**/models/**/**.dart"
|
||||
- "**/providers/**.dart"
|
||||
- "**/providers/**/**.dart"
|
||||
- lib/util/**.dart
|
||||
- lib/jellyfin/**.dart
|
||||
- lib/seerr/**.dart
|
||||
- "**/**_screen.dart"
|
||||
- "**/**_page.dart"
|
||||
- swagger/jellyfin-open-api.json
|
||||
- lib/routes/auto_router.dart
|
||||
- $package$
|
||||
- pubspec.yaml
|
||||
- lib/$lib$
|
||||
- "**/models/**.dart"
|
||||
- "**/models/**/**.dart"
|
||||
- "**/providers/**.dart"
|
||||
- "**/providers/**/**.dart"
|
||||
- lib/util/**.dart
|
||||
- lib/jellyfin/**.dart
|
||||
- "**/**_screen.dart"
|
||||
- "**/**_page.dart"
|
||||
- swagger/**
|
||||
- lib/routes/auto_router.dart
|
||||
- $package$
|
||||
builders:
|
||||
swagger_dart_code_generator:
|
||||
generate_for:
|
||||
- swagger/jellyfin-open-api.json
|
||||
auto_route_generator:auto_router_generator:
|
||||
options:
|
||||
input_folder: "swagger/"
|
||||
output_folder: "lib/jellyfin/"
|
||||
with_converter: true
|
||||
build_only_models: false
|
||||
with_base_url: false
|
||||
include_if_null: false
|
||||
chopper_generator:
|
||||
generate_for:
|
||||
- lib/jellyfin/jellyfin_open_api.swagger.dart
|
||||
- lib/seerr/**
|
||||
enable_cached_builds: true
|
||||
generate_for:
|
||||
- lib/routes/auto_router.dart
|
||||
auto_route_generator:auto_route_generator:
|
||||
options:
|
||||
header: "//Generated jellyfin api code"
|
||||
include_if_null: false
|
||||
json_serializable:
|
||||
generate_for:
|
||||
- lib/jellyfin/**
|
||||
- lib/models/**
|
||||
- lib/providers/**
|
||||
- lib/seerr/**
|
||||
- lib/util/**
|
||||
freezed:
|
||||
generate_for:
|
||||
- lib/models/**
|
||||
- lib/providers/**
|
||||
- lib/seerr/**
|
||||
- lib/util/**
|
||||
enable_cached_builds: true
|
||||
generate_for:
|
||||
- "**/**_screen.dart"
|
||||
- "**/**_page.dart"
|
||||
freezed|freezed:
|
||||
options:
|
||||
copy_with: false
|
||||
equal: false
|
||||
riverpod_generator:
|
||||
generate_for:
|
||||
- lib/providers/**
|
||||
tostring:
|
||||
generate_for:
|
||||
- "**/**.f.dart"
|
||||
- "**/**.g.dart"
|
||||
dart_mappable_builder:
|
||||
generate_for:
|
||||
- lib/models/**
|
||||
- lib/providers/**
|
||||
options:
|
||||
ignoreNull: true
|
||||
discriminatorKey: type
|
||||
generateMethods: [copy]
|
||||
drift_dev:preparing_builder:
|
||||
generate_for:
|
||||
- lib/models/syncing/**
|
||||
drift_dev:
|
||||
generate_for:
|
||||
- lib/models/syncing/**
|
||||
auto_route_generator:auto_route_generator:
|
||||
generate_for:
|
||||
- lib/**_screen.dart
|
||||
- lib/**_page.dart
|
||||
chopper_generator:
|
||||
options:
|
||||
enable_cached_builds: true
|
||||
auto_route_generator:auto_router_generator:
|
||||
generate_for:
|
||||
- lib/routes/auto_router.dart
|
||||
header: "//Generated jellyfin api code"
|
||||
include_if_null: false
|
||||
swagger_dart_code_generator:
|
||||
options:
|
||||
enable_cached_builds: true
|
||||
input_folder: "swagger/"
|
||||
output_folder: "lib/jellyfin/"
|
||||
generate_for: swagger/**
|
||||
with_converter: true
|
||||
build_only_models: false
|
||||
with_base_url: false
|
||||
include_if_null: false
|
||||
auto_apply: dependents
|
||||
@@ -1,5 +1,3 @@
|
||||
{
|
||||
"baseUrl": null,
|
||||
"seerrBaseUrl": null,
|
||||
"seerrHeader": null
|
||||
"baseUrl": null
|
||||
}
|
||||
@@ -1,11 +1,7 @@
|
||||
services:
|
||||
fladder:
|
||||
#Use "fladder-rootless" for rootless docker setups, otherwise use "fladder"
|
||||
image: ghcr.io/donutware/fladder:latest
|
||||
ports:
|
||||
- 80:80
|
||||
environment:
|
||||
- BASE_URL=https://server-url #OPTIONAL: Locks the Fladder front-end to a certain jellyfin server
|
||||
- SEERR_BASE_URL=https://seerr-url #OPTIONAL: Presets Seerr base URL
|
||||
- SEERR_HEADER={"key":"value"} #OPTIONAL: JSON object string of Seerr headers
|
||||
- FLADDER_WEBPATH=/ #OPTIONAL: Configures a subpath to run Fladder at
|
||||
@@ -1,73 +0,0 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
# Generate config.json from environment variables
|
||||
cat > /usr/share/nginx/html/assets/config/config.json <<EOF
|
||||
{
|
||||
"baseUrl": "$BASE_URL",
|
||||
"seerrBaseUrl": "$SEERR_BASE_URL"
|
||||
}
|
||||
EOF
|
||||
|
||||
# Normalize FLADDER_WEBPATH (e.g. /fladder/)
|
||||
WEBPATH=$(echo "${FLADDER_WEBPATH:-/}" | sed 's|^/*|/|; s|/*$|/|')
|
||||
|
||||
# Update base href in index.html (always at root of build/web)
|
||||
if [ -f "/usr/share/nginx/html/index.html" ]; then
|
||||
sed -i "s|<base href=\"[^\"]*\">|<base href=\"$WEBPATH\">|g" /usr/share/nginx/html/index.html
|
||||
fi
|
||||
|
||||
# Determine port (standard Nginx uses 80, rootless typically 8080)
|
||||
if [ "$(id -u)" = "0" ]; then
|
||||
PORT=80
|
||||
else
|
||||
PORT=8080
|
||||
fi
|
||||
|
||||
if [ "$WEBPATH" = "/" ]; then
|
||||
echo "Configuring Fladder at root path"
|
||||
cat > /etc/nginx/conf.d/default.conf <<EOF
|
||||
server {
|
||||
listen $PORT;
|
||||
listen [::]:$PORT;
|
||||
server_name localhost;
|
||||
|
||||
location / {
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
try_files \$uri \$uri/ /index.html;
|
||||
}
|
||||
}
|
||||
EOF
|
||||
else
|
||||
echo "Configuring Fladder on subpath: $WEBPATH"
|
||||
WEBPATH_NO_SLASH=$(echo "$WEBPATH" | sed 's|/*$||')
|
||||
|
||||
cat > /etc/nginx/conf.d/default.conf <<EOF
|
||||
server {
|
||||
listen $PORT;
|
||||
listen [::]:$PORT;
|
||||
server_name localhost;
|
||||
|
||||
# Handle the subpath
|
||||
location $WEBPATH {
|
||||
alias /usr/share/nginx/html/;
|
||||
index index.html;
|
||||
try_files \$uri \$uri/ $WEBPATH/index.html;
|
||||
}
|
||||
|
||||
# Redirect without trailing slash
|
||||
location = $WEBPATH_NO_SLASH {
|
||||
return 301 $WEBPATH;
|
||||
}
|
||||
|
||||
# Fallback for root or other paths
|
||||
location / {
|
||||
return 404;
|
||||
}
|
||||
}
|
||||
EOF
|
||||
fi
|
||||
|
||||
exec nginx -g "daemon off;"
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
See the full changelog at: https://github.com/DonutWare/Fladder/releases/tag/v0.10.3
|
||||
@@ -1 +0,0 @@
|
||||
See the full changelog at: https://github.com/DonutWare/Fladder/releases/tag/v0.12.0
|
||||
@@ -1,39 +0,0 @@
|
||||
Fladder is a modern, cross-platform Jellyfin client built with Flutter. Connect to your self-hosted Jellyfin server and enjoy your personal media library with a clean, responsive interface on any device.
|
||||
|
||||
<b>Playback</b>
|
||||
* Stream movies, TV shows, music, and more directly from your Jellyfin server
|
||||
* Direct play, transcoding, and offline (synced) playback support
|
||||
* Hardware-accelerated video playback
|
||||
* Media segment skipping (intro, credits, recap, and more)
|
||||
* Trickplay support for timeline scrubbing thumbnails
|
||||
* Background audio playback
|
||||
|
||||
<b>Library & Metadata</b>
|
||||
* Browse and search your entire media library
|
||||
* Manage metadata and artwork directly from the app
|
||||
* Jellyseerr / Overseerr integration for requesting new content
|
||||
* Server management tools (scan libraries, restart server, etc.)
|
||||
|
||||
<b>Multi-user & Profiles</b>
|
||||
* Add multiple user profiles or connect to different servers
|
||||
* Per-user app-lock with biometrics or passcode support
|
||||
* Sync watch progress and favorites across devices
|
||||
|
||||
<b>Offline Support</b>
|
||||
* Download movies and episodes for offline viewing
|
||||
* Keep playback progress synced when back online
|
||||
* Manage synced items from within the app
|
||||
|
||||
<b>Customization & UI</b>
|
||||
* Adaptive layout for phones, tablets, TV, and desktop
|
||||
* Dark and light mode with multiple color styles
|
||||
* Configurable home screen and dashboard
|
||||
* Keyboard shortcut support
|
||||
|
||||
<b>Other Features</b>
|
||||
* Comic book reader (CBZ / CBR formats)
|
||||
* Android TV / leanback support
|
||||
* Next-up overview when watching a queue
|
||||
* Background update notifications
|
||||
|
||||
Fladder requires a running Jellyfin server to connect to. It does not include any media content of its own.
|
||||
|
Before Width: | Height: | Size: 103 KiB |
|
Before Width: | Height: | Size: 639 KiB |
|
Before Width: | Height: | Size: 251 KiB |
|
Before Width: | Height: | Size: 579 KiB |
|
Before Width: | Height: | Size: 462 KiB |
|
Before Width: | Height: | Size: 535 KiB |
|
Before Width: | Height: | Size: 524 KiB |
|
Before Width: | Height: | Size: 166 KiB |
|
Before Width: | Height: | Size: 515 KiB |
|
Before Width: | Height: | Size: 412 KiB |
|
Before Width: | Height: | Size: 93 KiB |
@@ -1 +0,0 @@
|
||||
A cross-platform Jellyfin client for streaming your personal media library
|
||||
@@ -1 +0,0 @@
|
||||
Fladder
|
||||
@@ -2,9 +2,8 @@
|
||||
Name=Fladder
|
||||
StartupWMClass=nl.jknaapen.fladder
|
||||
Comment=A Simple Jellyfin Frontend built on top of Flutter.
|
||||
Exec=fladder %u
|
||||
Exec=Fladder
|
||||
Icon=nl.jknaapen.fladder
|
||||
Terminal=false
|
||||
Type=Application
|
||||
Categories=AudioVideo;Video;Player;
|
||||
MimeType=x-scheme-handler/fladder;
|
||||
Categories=Entertainment;
|
||||
@@ -1,93 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<component type="desktop-application">
|
||||
<id>nl.jknaapen.fladder</id>
|
||||
<metadata_license>CC0-1.0</metadata_license>
|
||||
<project_license>GPL-3.0-only</project_license>
|
||||
<name>Fladder</name>
|
||||
<summary>Cross-platform Jellyfin client</summary>
|
||||
|
||||
<branding>
|
||||
<color type="primary" scheme_preference="light">#5B364D</color>
|
||||
<color type="primary" scheme_preference="dark">#3A2101</color>
|
||||
</branding>
|
||||
|
||||
<description>
|
||||
<p>
|
||||
Fladder is a modern, cross-platform Jellyfin client that provides a seamless
|
||||
media streaming experience. Built with Flutter, it offers a beautiful and
|
||||
intuitive interface for accessing your Jellyfin media library.
|
||||
</p>
|
||||
<p>Features:</p>
|
||||
<ul>
|
||||
<li>Stream movies, TV shows, and music from your Jellyfin server</li>
|
||||
<li>Beautiful and responsive user interface</li>
|
||||
<li>Hardware-accelerated video playback</li>
|
||||
<li>Support for multiple profiles</li>
|
||||
<li>Offline media downloads</li>
|
||||
<li>Cross-platform compatibility</li>
|
||||
</ul>
|
||||
</description>
|
||||
|
||||
<launchable type="desktop-id">nl.jknaapen.fladder.desktop</launchable>
|
||||
|
||||
<screenshots>
|
||||
<screenshot type="default">
|
||||
<image>https://raw.githubusercontent.com/DonutWare/Fladder/develop/assets/marketing/screenshots/Tablet/Dashboard.png</image>
|
||||
<caption>Main dashboard</caption>
|
||||
</screenshot>
|
||||
<screenshot>
|
||||
<image>https://raw.githubusercontent.com/DonutWare/Fladder/develop/assets/marketing/screenshots/Tablet/Library.png</image>
|
||||
<caption>Media library view</caption>
|
||||
</screenshot>
|
||||
<screenshot>
|
||||
<image>https://raw.githubusercontent.com/DonutWare/Fladder/develop/assets/marketing/screenshots/Tablet/Details.png</image>
|
||||
<caption>Content details</caption>
|
||||
</screenshot>
|
||||
<screenshot>
|
||||
<image>https://raw.githubusercontent.com/DonutWare/Fladder/develop/assets/marketing/screenshots/Tablet/Player.png</image>
|
||||
<caption>Video player</caption>
|
||||
</screenshot>
|
||||
<screenshot>
|
||||
<image>https://raw.githubusercontent.com/DonutWare/Fladder/develop/assets/marketing/screenshots/Tablet/Library_Search.png</image>
|
||||
<caption>Library search</caption>
|
||||
</screenshot>
|
||||
</screenshots>
|
||||
|
||||
<url type="homepage">https://github.com/DonutWare/Fladder</url>
|
||||
<url type="bugtracker">https://github.com/DonutWare/Fladder/issues</url>
|
||||
<url type="vcs-browser">https://github.com/DonutWare/Fladder</url>
|
||||
|
||||
<developer id="nl.jknaapen">
|
||||
<name>DonutWare</name>
|
||||
</developer>
|
||||
|
||||
<content_rating type="oars-1.1">
|
||||
<content_attribute id="social-info">mild</content_attribute>
|
||||
</content_rating>
|
||||
|
||||
<releases>
|
||||
<release version="0.12.0" date="2026-11-15">
|
||||
<description>
|
||||
<p>See the full changelog at: https://github.com/DonutWare/Fladder/releases/tag/v0.12.0</p>
|
||||
</description>
|
||||
</release>
|
||||
</releases>
|
||||
|
||||
<requires>
|
||||
<internet>always</internet>
|
||||
</requires>
|
||||
|
||||
<categories>
|
||||
<category>AudioVideo</category>
|
||||
<category>Player</category>
|
||||
</categories>
|
||||
|
||||
<keywords>
|
||||
<keyword>jellyfin</keyword>
|
||||
<keyword>media</keyword>
|
||||
<keyword>streaming</keyword>
|
||||
<keyword>video</keyword>
|
||||
<keyword>audio</keyword>
|
||||
<keyword>music</keyword>
|
||||
</keywords>
|
||||
</component>
|
||||
@@ -1,13 +1,13 @@
|
||||
id: nl.jknaapen.fladder
|
||||
runtime: org.gnome.Platform
|
||||
runtime-version: "48"
|
||||
runtime-version: '48'
|
||||
sdk: org.gnome.Sdk
|
||||
|
||||
command: fladder
|
||||
command: Fladder
|
||||
add-extensions:
|
||||
org.freedesktop.Platform.ffmpeg-full:
|
||||
directory: lib/ffmpeg
|
||||
version: "24.08"
|
||||
version: '24.08'
|
||||
add-ld-path: .
|
||||
|
||||
cleanup-commands:
|
||||
@@ -35,8 +35,6 @@ finish-args:
|
||||
- --talk-name=org.freedesktop.PowerManagement
|
||||
- --talk-name=org.freedesktop.ScreenSaver
|
||||
- --talk-name=org.freedesktop.portal.*
|
||||
# Network state for connectivity_plus
|
||||
- --system-talk-name=org.freedesktop.NetworkManager
|
||||
|
||||
modules:
|
||||
- name: mpv
|
||||
@@ -109,14 +107,13 @@ modules:
|
||||
- /include
|
||||
sources:
|
||||
- type: archive
|
||||
# url: https://www.freedesktop.org/software/uchardet/releases/uchardet-0.0.8.tar.xz
|
||||
url: https://github.com/DonutWare/Fladder/raw/refs/heads/main/flatpak/uchardet-0.0.8.tar.xz
|
||||
url: https://www.freedesktop.org/software/uchardet/releases/uchardet-0.0.8.tar.xz
|
||||
sha256: e97a60cfc00a1c147a674b097bb1422abd9fa78a2d9ce3f3fdcc2e78a34ac5f0
|
||||
# x-checker-data:
|
||||
# type: html
|
||||
# url: https://www.freedesktop.org/software/uchardet/releases/
|
||||
# version-pattern: uchardet-(\d+\.\d+\.\d+)\.tar\.xz
|
||||
# url-template: https://www.freedesktop.org/software/uchardet/releases/uchardet-$version.tar.xz
|
||||
x-checker-data:
|
||||
type: html
|
||||
url: https://www.freedesktop.org/software/uchardet/releases/
|
||||
version-pattern: uchardet-(\d+\.\d+\.\d+)\.tar\.xz
|
||||
url-template: https://www.freedesktop.org/software/uchardet/releases/uchardet-$version.tar.xz
|
||||
- name: libplacebo
|
||||
buildsystem: meson
|
||||
config-opts:
|
||||
@@ -145,7 +142,7 @@ modules:
|
||||
build-commands:
|
||||
- mkdir -p /app/bin
|
||||
- cp -r build/linux/x64/release/bundle/* /app/bin/
|
||||
- chmod +x /app/bin/fladder
|
||||
- chmod +x /app/bin/Fladder
|
||||
- mkdir -p /app/share/applications
|
||||
- mkdir -p /app/share/icons/hicolor/scalable/apps
|
||||
- install -Dm644 flatpak/Fladder.desktop /app/share/applications/${FLATPAK_ID}.desktop
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg width="100%" height="100%" viewBox="0 0 800 800" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
|
||||
<g id="view-box" transform="matrix(33.333333,0,0,33.333333,28,-1)">
|
||||
<rect x="0" y="0" width="24" height="24" style="fill:none;"/>
|
||||
</g>
|
||||
<g id="Shape" transform="matrix(38.103503,0,0,38.103503,104.693083,56.014875)">
|
||||
<path d="M4.466,19.5C3.113,19.506 1.948,18.506 1.748,17.168L0.009,5.864C0.003,5.826 0,5.788 0,5.75C0,5.339 0.339,5 0.75,5C0.751,5 0.751,5 0.751,5L14.751,5C14.751,5 14.751,5 14.752,5C15.163,5 15.502,5.339 15.502,5.75C15.502,5.788 15.499,5.826 15.493,5.864L13.753,17.164C13.555,18.505 12.389,19.507 11.034,19.5L4.466,19.5ZM11.034,18C11.65,18.003 12.179,17.549 12.27,16.94L13.876,6.5L11.012,6.5L10.489,18L11.034,18ZM8.988,18L9.51,6.5L5.989,6.5L6.512,18L8.988,18ZM3.23,16.94C3.321,17.549 3.851,18.003 4.466,18L5.01,18L4.488,6.5L1.625,6.5L3.23,16.94Z" style="fill:white;fill-rule:nonzero;"/>
|
||||
</g>
|
||||
<g transform="matrix(1.051209,0,0,1.051209,-53.7391,-57.571725)">
|
||||
<path d="M169.261,274.018C161.752,261.535 157.506,247.213 157.506,232C157.506,184.748 198.954,145.506 251,145.506C259.827,145.506 268.364,146.641 276.446,148.753C282.976,145.819 289.896,143.561 297.11,142.074C317.144,92.614 366.391,57.506 424,57.506C459.344,57.506 491.555,70.722 515.786,92.354C520.599,91.72 525.511,91.392 530.5,91.392C574.505,91.392 612.451,116.83 630.03,153.424C665.338,169.475 690.057,205.544 690.057,247.5C690.057,254.696 689.328,261.72 687.944,268.499C686.281,276.644 679.116,282.494 670.803,282.494L184.252,282.494C178.114,282.494 172.425,279.277 169.261,274.018Z" style="fill:white;"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 103 KiB |