Skip to content

Commit

Permalink
fix 1.1.3 release
Browse files Browse the repository at this point in the history
  • Loading branch information
grote committed Jul 1, 2016
1 parent 1dee4e0 commit 2dd9b88
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ allprojects {

android {
defaultConfig {
versionCode 37
versionCode 38
versionName "1.1.3"

compileSdkVersion 24
Expand Down
2 changes: 1 addition & 1 deletion res/xml/changelog_master.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<changelog>

<release version="1.1.3" versioncode="37">
<release version="1.1.3" versioncode="38">
<change>Remember selected means of transports for each network (Thanks kas70!)</change>
<change>Fix problem with NVV/RMV network</change>
<change>Prevent crash when turning screen during trip search</change>
Expand Down
20 changes: 10 additions & 10 deletions src/de/grobox/liberario/Preferences.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import android.support.annotation.Nullable;
import android.util.Log;

import java.io.Serializable;
import java.util.EnumSet;
import java.util.HashSet;
import java.util.Set;
Expand All @@ -33,18 +32,17 @@

public class Preferences {

public final static String PREFS = "LiberarioPrefs";
private final static String PREFS = "LiberarioPrefs";
public final static String SHOW_ADV_DIRECTIONS = "ShowAdvDirections";
public final static String SORT_RECENT_TRIPS_COUNT = "SortRecentTripsCount";
public final static String THEME = "pref_key_theme";
public final static String LANGUAGE = "pref_key_language";
public final static String WALK_SPEED = "pref_key_walk_speed";
public final static String OPTIMIZE = "pref_key_optimize";
public final static String EXIT_ON_BACK = "pref_key_exit_app_on_back_press";

private final static String WALK_SPEED = "pref_key_walk_speed";
private final static String OPTIMIZE = "pref_key_optimize";
private final static String EXIT_ON_BACK = "pref_key_exit_app_on_back_press";
private final static String SELECTED_PRODUCTS = "_selected_products";

public static String getNetwork(Context context, int i) {
private static String getNetwork(Context context, int i) {
SharedPreferences settings = context.getSharedPreferences(PREFS, Context.MODE_PRIVATE);

String str = "";
Expand Down Expand Up @@ -103,12 +101,13 @@ public static void setPref(Context context, String pref, boolean value) {
SharedPreferences.Editor editor = settings.edit();

editor.putBoolean(pref, value);
editor.commit();
editor.apply();
}

public static EnumSet<Product> getProducts(Context context) {
// check if there's a preference for selected products for the current network
TransportNetwork current_network = getTransportNetwork(context);
if (current_network == null) return EnumSet.allOf(Product.class);
String network_pref = current_network.getId().toString() + SELECTED_PRODUCTS;
SharedPreferences sp = context.getSharedPreferences(PREFS, Context.MODE_PRIVATE);
// get the selected products from the pref
Expand All @@ -131,12 +130,13 @@ public static void setProducts(Context context, EnumSet<Product> products) {
if(products.size() == Product.values().length) return;
// get the current network
TransportNetwork current_network = getTransportNetwork(context);
if (current_network == null) return;
String network_id = current_network.getId().toString();
SharedPreferences sp = context.getSharedPreferences(PREFS, Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sp.edit();
String network_pref = network_id + SELECTED_PRODUCTS;
// store the selected products in a string set
Set<String> product_set = new HashSet<String>();
Set<String> product_set = new HashSet<>();
for(Product p : products) {
product_set.add(p.toString());
}
Expand Down Expand Up @@ -164,7 +164,7 @@ public static void setNetworkId(Context context, NetworkId id) {
editor.putString("NetworkId2", id1);
editor.putString("NetworkId", id.name());

editor.commit();
editor.apply();
}

public static boolean darkThemeEnabled(Context context) {
Expand Down

0 comments on commit 2dd9b88

Please sign in to comment.