Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -171,14 +171,14 @@ jobs:
name: mapping
path: ${{ env.mapping_file }}

- name: "Upload Mapping to Acrarium"
- name: "Create Version in Acrarium"
if: ${{ env.acra_id }}
continue-on-error: true
run: |
curl -m 120 \
echo -n "See GitHub Actions" | curl -m 120 \
-H "Content-Type: text/plain" \
-u "${{ secrets.ACRARIUM_USER }}:${{ secrets.ACRARIUM_PASS }}" \
--data-binary "@${{ env.mapping_file }}" \
--data-binary @- \
"${{ secrets.ACRARIUM_HOST }}/api/apps/${{ env.acra_id }}/version/upload/${{ github.run_number }}?name=${{ github.ref_name }}"

- name: "Upload APK to Artifacts"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,13 @@ suspend fun Context.downloadImage(remote: Remote): DownloadResult {
val requestBuilder = Request.Builder().url(remote.url)
val preferences = PreferenceManager.getDefaultSharedPreferences(this)
val wallpaperSource = preferences.getString("wallpaper_source", null)
if (remote.url == wallpaperSource) {
// Debug override: skip conditional headers so every update is a full
// download (200) and always runs scale/crop + setBitmap. Validators are
// still persisted for when the toggle is turned back off.
val disableCache = preferences.getBoolean("disable_cache", false)
if (disableCache) {
Log.d("downloadImage", "cache disabled - get ${remote.url} minus cache validators")
} else if (remote.url == wallpaperSource) {
remote.etag?.let { requestBuilder.header("If-None-Match", it) }
remote.lastModified?.let { requestBuilder.header("If-Modified-Since", it) }
} else {
Expand Down Expand Up @@ -486,14 +492,42 @@ suspend fun Context.downloadImage(remote: Remote): DownloadResult {
fun Context.setAutoCroppedWallpaper(imageFile: File): Boolean {
val wallpaperManager = WallpaperManager.getInstance(this)
val displayMetrics = resources.displayMetrics
val targetWidth = wallpaperManager.desiredMinimumWidth
var targetWidth = wallpaperManager.desiredMinimumWidth
.let { if (it > 0) it else displayMetrics.widthPixels }
val targetHeight = wallpaperManager.desiredMinimumHeight
.let { if (it > 0) it else displayMetrics.heightPixels }

val preferences = PreferenceManager.getDefaultSharedPreferences(this)
val cropWallpaper = preferences.getBoolean("crop_wallpaper", true)

// Optional cap for extra-wide parallax canvases: canvas no wider than
// factor x screen width, so the sliding window shows a larger fraction.
// Same cover-fill (no bars, parallax kept), just less hidden image and a
// smaller cover-crop on mismatched aspects (emulator at 2x: 2560->1440).
// Height is untouched. "0" (Off) keeps system behavior. New installs
// default Off; the short-lived boolean switch is migrated (true -> "2").
val widthFactor = run {
if (!preferences.contains("parallax_width_factor")) {
val legacy = try {
preferences.getBoolean("limit_parallax_width", false)
} catch (_: ClassCastException) {
false
}
preferences.edit {
putString("parallax_width_factor", if (legacy) "2" else "0")
remove("limit_parallax_width")
}
}
preferences.getString("parallax_width_factor", "0")?.toFloatOrNull() ?: 0f
}
if (widthFactor > 0f) {
val maxWidth = (displayMetrics.widthPixels * widthFactor).toInt()
if (maxWidth in 1..<targetWidth) {
Log.d("setAutoCroppedWallpaper", "capping targetWidth: $targetWidth -> $maxWidth (x$widthFactor)")
targetWidth = maxWidth
}
}

// Bound the longest side to 2x the largest target dimension, avoiding the
// full-resolution decode that can OOM or exceed the canvas bitmap limit.
val targetMax = maxOf(targetWidth, targetHeight) * 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ class SettingsFragment : PreferenceFragmentCompat() {
val updateType = findPreference<ListPreference>("set_screens")
updateType?.summaryProvider = ListPreference.SimpleSummaryProvider.getInstance()

// Parallax Width Factor
findPreference<ListPreference>("parallax_width_factor")?.summaryProvider =
ListPreference.SimpleSummaryProvider.getInstance()

// Update Interval
val workInterval = findPreference<ListPreference>("work_interval")
updateWorkIntervalSettings(workInterval?.value)
Expand Down
15 changes: 15 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,21 @@
<item>lock</item>
</string-array>

<string-array name="parallax_width_entries">
<item>Not Limited</item>
<item>1.25x Screen Width</item>
<item>1.5x Screen Width</item>
<item>2.0x Screen Width</item>
<item>2.5x Screen Width</item>
</string-array>
<string-array name="parallax_width_values">
<item>0</item>
<item>1.25</item>
<item>1.5</item>
<item>2</item>
<item>2.5</item>
</string-array>

<string-array name="widget_color_entries">
<item>White</item>
<item>Black</item>
Expand Down
17 changes: 17 additions & 0 deletions app/src/main/res/xml/preferences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@
android:defaultValue="true"
android:summary="Ensure Parallax Works"/>

<ListPreference
android:key="parallax_width_factor"
android:title="Limit Parallax Width"
android:icon="@drawable/md_view_timeline_24px"
android:defaultValue="0"
android:entries="@array/parallax_width_entries"
android:entryValues="@array/parallax_width_values"
android:dependency="crop_wallpaper"
tools:summary="Off" />

<ListPreference
android:key="set_screens"
android:title="Screens to Update"
Expand All @@ -43,6 +53,13 @@
android:icon="@drawable/md_signal_cellular_alt_24"
android:defaultValue="true"/>

<SwitchPreferenceCompat
android:key="disable_cache"
android:title="Disable HTTP Cache"
android:summary="Always Download Image"
android:icon="@drawable/md_cached_24px"
android:defaultValue="false" />

<Preference
android:key="battery_unrestricted"
android:title="Remove Background Restriction"
Expand Down
Loading