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:
@@ -35,12 +35,25 @@
|
||||
android:name="me.teafry.voipmessages.MainActivity"
|
||||
android:exported="true"
|
||||
android:launchMode="singleTask"
|
||||
android:windowSoftInputMode="adjustResize|stateHidden">
|
||||
android:windowSoftInputMode="adjustResize|stateHidden" />
|
||||
<!-- The launcher entry, one per icon: Settings → Icon enables one and
|
||||
disables the other (Icons.java). -->
|
||||
<activity-alias android:name="me.teafry.voipmessages.LauncherDark"
|
||||
android:targetActivity="me.teafry.voipmessages.MainActivity"
|
||||
android:icon="@drawable/ic_launcher" android:exported="true" android:enabled="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</activity-alias>
|
||||
<activity-alias android:name="me.teafry.voipmessages.LauncherInverted"
|
||||
android:targetActivity="me.teafry.voipmessages.MainActivity"
|
||||
android:icon="@drawable/ic_launcher_inverted" android:exported="true" android:enabled="false">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity-alias>
|
||||
<activity android:name="me.teafry.voipmessages.ChatActivity" android:exported="false"
|
||||
android:windowSoftInputMode="adjustResize" />
|
||||
<activity android:name="me.teafry.voipmessages.NewChatActivity" android:exported="false"
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -81,6 +81,18 @@ public final class SettingsActivity extends BaseActivity {
|
||||
notify.setOnCheckedChangeListener((v, on) -> Config.prefs(c).edit().putBoolean("notifications", on).apply());
|
||||
box.addView(notify);
|
||||
|
||||
section("Icon");
|
||||
boolean inv = Icons.isInverted(c);
|
||||
row("Launcher icon", inv ? "Inverted (lighter)" : "Dark", v -> {
|
||||
new AlertDialog.Builder(c).setTitle("Launcher icon")
|
||||
.setSingleChoiceItems(new String[] {"Dark", "Inverted (lighter)"}, inv ? 1 : 0, (d, i) -> {
|
||||
if ((i == 1) != inv) Icons.setInverted(c, i == 1);
|
||||
d.dismiss();
|
||||
changed();
|
||||
}).show();
|
||||
});
|
||||
note("The home screen can take a few seconds to show the new one.");
|
||||
|
||||
section("Accounts");
|
||||
Config cfg = Config.get(c);
|
||||
kv("voip.ms", cfg.voipUser == null ? "Not set up" : Sync.voipError != null ? "⚠ " + Sync.voipError : cfg.voipUser);
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 60 KiB |
+2
-2
@@ -26,8 +26,8 @@ import sys
|
||||
import zipfile
|
||||
from pathlib import Path
|
||||
|
||||
VERSION_NAME = "0.3.0"
|
||||
VERSION_CODE = 3
|
||||
VERSION_NAME = "0.4.0"
|
||||
VERSION_CODE = 4
|
||||
|
||||
PACKAGE = "me.teafry.voipmessages"
|
||||
DEV_PACKAGE = PACKAGE + ".dev"
|
||||
|
||||
Reference in New Issue
Block a user