diff --git a/AndroidManifest.xml b/AndroidManifest.xml index e07486f..a84ff87 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -2,9 +2,9 @@ + android:revisionCode="45" + android:versionCode="46" + android:versionName="5.3.2" > + android:revisionCode="45" + android:versionCode="46" + android:versionName="5.3.2" > If you touch the Home button on your phone to return to your Home menu, Artemis Messenger will keep running in the background. It will continue to receive information about side missions, allies and stations via a Comms service. This information will be shown as notifications on your phone. If you click on one of those notifications, you will return to Artemis Messenger. When you want to leave Artemis Messenger, just hit the Back button on your phone. If your phone doesn\'t have a Back button, you can also press the Close button in the top-right corner of the screen. If the app is connected to a server, a dialog will appear asking if you want to close the connection; otherwise, no dialog will appear. Help - Artemis Messenger 5.3.1 + Artemis Messenger 5.3.2 Special thanks to Robert J. Walker for writing the IAN (Interface for Artemis Networking) library, without which this app could not exist. IAN is available on GitHub. \u00A9 Copyright 2017. Written by Jordan Longstaff diff --git a/src/artemis/messenger/ListActivity.java b/src/artemis/messenger/ListActivity.java index bc5c152..49fdc18 100644 --- a/src/artemis/messenger/ListActivity.java +++ b/src/artemis/messenger/ListActivity.java @@ -2085,7 +2085,10 @@ public boolean parseToDestination(String sender, String message) { if (!message.startsWith("Transfer")) return false; // Update last mission to make progress on a mission - missionShip = message.split(", ", 2)[1].split("\\. ", 2)[0]; + String[] messageParts = message.substring(0, message.length() - 1).split(", ", 2)[1].split("\\."); + missionShip = messageParts[0]; + for (int i = 1; i < messageParts.length - 1; i++) + missionShip += "." + messageParts[i]; // If progress was completion, do nothing (no other parsers) if (message.endsWith("!")) return true; diff --git a/src/artemis/messenger/RewardType.java b/src/artemis/messenger/RewardType.java new file mode 100644 index 0000000..051dc42 --- /dev/null +++ b/src/artemis/messenger/RewardType.java @@ -0,0 +1,62 @@ +package artemis.messenger; + +import android.content.Context; +import android.content.SharedPreferences; + +public enum RewardType { + BATTERY(R.string.batteryChargePref, R.string.batteryChargeKey, "batteries."), + PRODUCTION(R.string.prodSpeedPref, R.string.speedKey, "speed."), + NUCLEAR(R.string.nukePref, R.string.nuclearKey, "torpedoes."), + COOLANT(R.string.extraCoolantPref, R.string.extraCoolantKey, "coolant."), + SHIELD(R.string.shieldBoostPref, R.string.shieldKey, "generators."); + + private final int value, prefKey; + private final String keySet; + private String displayName; + + private boolean shown; + + RewardType(int v, int p, String... s) { + value = v; + prefKey = p; + String keys = ""; + for (String key: s) { + if (!keys.isEmpty()) keys += "^"; + keys += key; + } + keySet = keys; + shown = true; + } + + public static RewardType from(String key) { + for (RewardType type: values()) { + if (key.equals(type.displayName) || type.matches(key)) + return type; + } + + throw new RuntimeException("No RewardType conforms to " + key); + } + + public boolean matches(String key) { + return keySet.contains(key); + } + + public String getValue(Context context) { + return context.getString(value); + } + + public boolean isShown() { return shown; } + + public static void updateVisibility(SharedPreferences preferences) { + for (RewardType type: values()) { + type.shown = preferences.getBoolean(type.displayName, true); + } + } + + public static void initDisplayNames(Context context) { + for (RewardType type: values()) { + if (type.displayName != null) break; + type.displayName = context.getString(type.prefKey); + } + } +} \ No newline at end of file