v0.4.0: bubble for Android 0.4.0 — an inverted (lighter) icon, chosen in Settings on both

The original icon is a little dark: resources/icon-inverted.png and
ic_launcher_inverted.png are its negative (alpha kept).

- Desktop: Settings → Appearance → Icon (Dark / Inverted), saved on click;
  sets the window icon and rewrites the launcher's installed copy
- Android: Settings → Icon; two launcher activity-aliases, one enabled
This commit is contained in:
2026-11-06 17:20:56 -08:00
parent 94188a42c7
commit e1bceb06a3
14 changed files with 127 additions and 12 deletions
@@ -0,0 +1,34 @@
package me.teafry.voipmessages;
import android.content.ComponentName;
import android.content.Context;
import android.content.pm.PackageManager;
/**
* The launcher icon: the dark original or its negative (lighter), like the
* desktop's Settings → Appearance → Icon. Each is its own launcher entry
* (activity-alias); the choice is which one is enabled, so the launcher
* itself remembers it.
*/
final class Icons {
private Icons() {}
private static ComponentName dark(Context c) {
return new ComponentName(c, "me.teafry.voipmessages.LauncherDark");
}
private static ComponentName inverted(Context c) {
return new ComponentName(c, "me.teafry.voipmessages.LauncherInverted");
}
static boolean isInverted(Context c) {
return c.getPackageManager().getComponentEnabledSetting(inverted(c)) == PackageManager.COMPONENT_ENABLED_STATE_ENABLED;
}
static void setInverted(Context c, boolean on) {
PackageManager pm = c.getPackageManager();
// The new entry first, so there's never a moment with no icon at all.
pm.setComponentEnabledSetting(on ? inverted(c) : dark(c), PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP);
pm.setComponentEnabledSetting(on ? dark(c) : inverted(c), PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);
}
}