Skip to content

Commit

Permalink
Artemis Messenger 5.3.2: Re-fixed player ship name bug
Browse files Browse the repository at this point in the history
  • Loading branch information
JordanLongstaff committed Jun 17, 2018
1 parent 311c530 commit 6d226a6
Show file tree
Hide file tree
Showing 10 changed files with 74 additions and 9 deletions.
6 changes: 3 additions & 3 deletions AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="artemis.messenger"
android:installLocation="preferExternal"
android:revisionCode="44"
android:versionCode="45"
android:versionName="5.3.1" >
android:revisionCode="45"
android:versionCode="46"
android:versionName="5.3.2" >

<uses-sdk
android:minSdkVersion="9"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Artemis Messenger 5.3.1
# Artemis Messenger 5.3.2

## What is Artemis Messenger?

Expand Down
6 changes: 3 additions & 3 deletions bin/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="artemis.messenger"
android:installLocation="preferExternal"
android:revisionCode="44"
android:versionCode="45"
android:versionName="5.3.1" >
android:revisionCode="45"
android:versionCode="46"
android:versionName="5.3.2" >

<uses-sdk
android:minSdkVersion="9"
Expand Down
Binary file modified bin/Artemis Messenger.apk
Binary file not shown.
Binary file modified bin/classes.dex
Binary file not shown.
Binary file modified bin/dexedLibs/appcompat_v7-c958b99d5111e7b7a41e540bcdbc30da.jar
Binary file not shown.
Binary file modified bin/resources.ap_
Binary file not shown.
2 changes: 1 addition & 1 deletion res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
<string name="basicsParagraph6">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.</string>
<string name="basicsParagraph5">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.</string>
<string name="helpTitle">Help</string>
<string name="appVersionText">Artemis Messenger 5.3.1</string>
<string name="appVersionText">Artemis Messenger 5.3.2</string>
<string name="specialThanks">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.</string>
<string name="licenseText">\u00A9 Copyright 2017.</string>
<string name="writtenBy">Written by Jordan Longstaff</string>
Expand Down
5 changes: 4 additions & 1 deletion src/artemis/messenger/ListActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
62 changes: 62 additions & 0 deletions src/artemis/messenger/RewardType.java
Original file line number Diff line number Diff line change
@@ -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);
}
}
}

0 comments on commit 6d226a6

Please sign in to comment.