Automattic / simplenote-android

Simplenote for Android
https://simplenote.com
GNU General Public License v2.0
1.75k stars 299 forks source link

Add custom icon preference for sustainers #1645

Closed roundhill closed 3 months ago

roundhill commented 3 months ago

Fix

This PR adds a new preference in the settings for sustainers to set a green app icon:

Changing the icon is kind of a pain on Android involving activity-alias to use a different drawable for the (gulp) main activity. From my testing it is working pretty well but does crash the app when you swap out the activities.

I also couldn't get the "New Note" shortcut to work, so just left that out when switching to the activity-alias.

Test

long now = System.currentTimeMillis();
try {
    Preferences preferences = mPreferencesBucket.get(Preferences.PREFERENCES_OBJECT_KEY);
    preferences.setActiveSubscription(now);
} catch (BucketObjectMissingException e) {
    throw new RuntimeException(e);
}

Release

These changes do not require release notes.

dangermattic commented 3 months ago
1 Error
:no_entry_sign: Please add tests for class IntentUtils (or add unit-tests-exemption label to ignore this).
2 Warnings
:warning: strings.xml files should only be updated on release branches, when the translations are downloaded by our automation.
:warning: PR is not assigned to a milestone.

Generated by :no_entry_sign: Danger

wpmobilebot commented 3 months ago

📲 You can test the changes from this Pull Request in Simplenote Android by scanning the QR code below to install the corresponding build.

App Name Simplenote Android
Build TypeDebug
Commit783b4bdb08c6518ec0610fe82e02a88d50e6b6f2
Direct Downloadsimplenote-android-prototype-build-pr1645-783b4bd-018ebf72-8f5e-4628-9180-38ef7c5b036f.apk
khaykov commented 3 months ago

Thanks, @roundhill ! It mostly works well, but I found a couple of issues :)

roundhill commented 3 months ago
  • After you toggle the switch, app does not restart automatically on devices with API 26 (and maybe other).

I think it does do it but it takes a while (at least on the emulator it does). I've updated the requirement to show the switch to API 28 because I was getting an exception that I couldn't track down: Unexpected null component name or activity info: ComponentInfo{com.automattic.simplenote.debug/com.automattic.simplenote.NotesActivity}, null. The exception went away on API 28 and above.

  • After switching to sustainer icon, if you open a note from widget and press Up Arrow, the app closes instead of navigating to main activity.

This should be fixed now.