Skip to content

SharedPreferences typo: endQuietHour saved to wrong key #27

@davemac

Description

@davemac

Summary

In the options message handler, endQuietHour is saved to the wrong SharedPreferences key, causing it to never persist correctly.

Location

app/src/main/java/com/dan/eo1/MainActivity.java lines 703-704:

editor.putInt("startQuietHour", incomingStartQuietHour);
editor.putInt("startQuietHour", incomingEndQuietHour);  // BUG: should be "endQuietHour"

Both lines write to "startQuietHour". The second line should be:

editor.putInt("endQuietHour", incomingEndQuietHour);

Impact

When the app restarts, endQuietHour loads as the default value (-1) from line 159:

endQuietHour = settings.getInt("endQuietHour", -1);

This causes the reload condition on line 707 to frequently evaluate true even when it shouldn't:

if (incominginterval != interval || incomingStartQuietHour != startQuietHour || incomingEndQuietHour != endQuietHour) {
    // ...
    loadImagesFromFlickr();  // Unwanted reload!
}

Result: Using the options command (e.g., for brightness changes) often triggers an unwanted image reload with spinner, even when quiet hours haven't actually changed.

Fix

Change line 704 from:

editor.putInt("startQuietHour", incomingEndQuietHour);

To:

editor.putInt("endQuietHour", incomingEndQuietHour);

Environment

  • EO1 app version: 0.0.9
  • Discovered while building a web-based partner app replacement

Thanks for keeping EO1 devices alive! 🎨

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions