diff options
author | Samuel Tardieu <sam@rfc1149.net> | 2011-10-25 00:44:18 +0200 |
---|---|---|
committer | Samuel Tardieu <sam@rfc1149.net> | 2011-10-25 00:48:07 +0200 |
commit | 9b1d6f0bb7badaceb71a4b898b36bdc30ab48a00 (patch) | |
tree | 426cb1f074226e72762c5443457f330e3066ec7b | |
parent | 83ba46de1e195e8c93452b237df4855cfa76ae69 (diff) | |
download | cgeo-9b1d6f0bb7badaceb71a4b898b36bdc30ab48a00.zip cgeo-9b1d6f0bb7badaceb71a4b898b36bdc30ab48a00.tar.gz cgeo-9b1d6f0bb7badaceb71a4b898b36bdc30ab48a00.tar.bz2 |
Add separate settings for elevation and vote data
-rw-r--r-- | main/res/layout/init.xml | 27 | ||||
-rw-r--r-- | main/res/values-de/strings.xml | 1 | ||||
-rw-r--r-- | main/res/values-fr/strings.xml | 5 | ||||
-rw-r--r-- | main/res/values/strings.xml | 3 | ||||
-rw-r--r-- | main/src/cgeo/geocaching/Settings.java | 25 | ||||
-rw-r--r-- | main/src/cgeo/geocaching/cgBase.java | 7 | ||||
-rw-r--r-- | main/src/cgeo/geocaching/cgeoinit.java | 18 |
7 files changed, 68 insertions, 18 deletions
diff --git a/main/res/layout/init.xml b/main/res/layout/init.xml index d55d9de..910db5b 100644 --- a/main/res/layout/init.xml +++ b/main/res/layout/init.xml @@ -250,7 +250,7 @@ android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" > - <CheckBox android:id="@+id/additionaldetails" + <CheckBox android:id="@+id/ratingwanted" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" @@ -265,8 +265,29 @@ android:paddingRight="3dip" android:textSize="14dip" android:textColor="?text_color" - android:text="@string/init_additionaldetails" /> - </LinearLayout> + android:text="@string/init_ratingwanted" /> + </LinearLayout> + <LinearLayout + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:orientation="horizontal" > + <CheckBox android:id="@+id/elevationwanted" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentLeft="true" + android:layout_gravity="left" + android:padding="1px" + android:gravity="center" /> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center_vertical" + android:gravity="left" + android:paddingRight="3dip" + android:textSize="14dip" + android:textColor="?text_color" + android:text="@string/init_elevationwanted" /> + </LinearLayout> </LinearLayout> <!-- ** --> <RelativeLayout style="@style/separator_horizontal_layout" > diff --git a/main/res/values-de/strings.xml b/main/res/values-de/strings.xml index 403576b..1bf423f 100644 --- a/main/res/values-de/strings.xml +++ b/main/res/values-de/strings.xml @@ -363,7 +363,6 @@ <string name="init_signature_template_user">Benutzer</string> <string name="init_signature_template_number">Nummer</string> <string name="init_details">Cache Details</string> - <string name="init_additionaldetails">Zusätzliche Cache Details wie Bewertung, Höhe etc. laden</string> <string name="init_autoload">Ausführliche Beschreibung automatisch laden</string> <string name="init_other">Weitere Optionen</string> <string name="init_skin">Helle Oberfläche (Neustart erforderlich)</string> diff --git a/main/res/values-fr/strings.xml b/main/res/values-fr/strings.xml index 40b9b7d..fd1cbe6 100644 --- a/main/res/values-fr/strings.xml +++ b/main/res/values-fr/strings.xml @@ -364,6 +364,10 @@ <string name="init_signature_template_datetime">Date & Heure</string> <string name="init_signature_template_user">Utilisateur</string> <string name="init_signature_template_number">Nombre</string> + <string name="init_details">Détails des caches</string> + <string name="init_ratingwanted">Charger la note depuis GCvote.com</string> + <string name="init_elevationwanted">Charger l\'altitude de la cache</string> + <string name="init_autoload">Afficher automatiquement les descriptions longues</string> <string name="init_other">Autres options</string> <string name="init_skin">Aspect sobre (nécessite le redémarrage de c:geo)</string> <string name="init_address">Afficher l\'adresse sur l\'accueil</string> @@ -377,7 +381,6 @@ <string name="init_save_log_img">Sauver les images des visites</string> <string name="init_units">Utiliser des unités de distance impériales</string> <string name="init_nav">Utiliser Google Navigation</string> - <string name="init_autoload">Chargement automatique des descriptions longues</string> <string name="init_log_offline">Toujours utiliser le mode hors-ligne, même si connecté.</string> <string name="init_livelist">Afficher la direction des caches dans les listes</string> <string name="init_browser">Identifier c:geo comme navigateur standard</string> diff --git a/main/res/values/strings.xml b/main/res/values/strings.xml index 5f0a1a2..1c30cef 100644 --- a/main/res/values/strings.xml +++ b/main/res/values/strings.xml @@ -365,7 +365,8 @@ <string name="init_signature_template_user">User</string> <string name="init_signature_template_number">Number</string> <string name="init_details">Cache details</string> - <string name="init_additionaldetails">Load additional details like rating, elevation etc.</string> + <string name="init_ratingwanted">Load cache rating from GCvote.com</string> + <string name="init_elevationwanted">Load cache elevation data</string> <string name="init_autoload">Auto-loading long description</string> <string name="init_other">Other options</string> <string name="init_skin">Light skin\n(needs restart of c:geo)</string> diff --git a/main/src/cgeo/geocaching/Settings.java b/main/src/cgeo/geocaching/Settings.java index 6b7d7c4..4da2314 100644 --- a/main/src/cgeo/geocaching/Settings.java +++ b/main/src/cgeo/geocaching/Settings.java @@ -45,7 +45,8 @@ public final class Settings { private static final String KEY_TWITTER_TOKEN_PUBLIC = "tokenpublic"; private static final String KEY_VERSION = "version"; private static final String KEY_LOAD_DESCRIPTION = "autoloaddesc"; - private static final String KEY_ADDITIONAL_DETAILS = "additionaldetails"; + private static final String KEY_RATING_WANTED = "ratingwanted"; + private static final String KEY_ELEVATION_WANTED = "elevationwanted"; private static final String KEY_USE_ENGLISH = "useenglish"; private static final String KEY_AS_BROWSER = "asbrowser"; private static final String KEY_USE_COMPASS = "usecompass"; @@ -569,16 +570,30 @@ public final class Settings { }); } - public static boolean isAdditionalDetails() { - return sharedPrefs.getBoolean(KEY_ADDITIONAL_DETAILS, true); + public static boolean isRatingWanted() { + return sharedPrefs.getBoolean(KEY_RATING_WANTED, true); } - public static void setAdditionalDetails(final boolean additionaldetails) { + public static void setRatingWanted(final boolean ratingWanted) { editSharedSettings(new PrefRunnable() { @Override public void edit(Editor edit) { - edit.putBoolean(KEY_ADDITIONAL_DETAILS, additionaldetails); + edit.putBoolean(KEY_RATING_WANTED, ratingWanted); + } + }); + } + + public static boolean isElevationWanted() { + return sharedPrefs.getBoolean(KEY_ELEVATION_WANTED, true); + } + + public static void setElevationWanted(final boolean elevationWanted) { + editSharedSettings(new PrefRunnable() { + + @Override + public void edit(Editor edit) { + edit.putBoolean(KEY_ELEVATION_WANTED, elevationWanted); } }); } diff --git a/main/src/cgeo/geocaching/cgBase.java b/main/src/cgeo/geocaching/cgBase.java index 0cff355..108b431 100644 --- a/main/src/cgeo/geocaching/cgBase.java +++ b/main/src/cgeo/geocaching/cgBase.java @@ -884,7 +884,7 @@ public class cgBase { } } - if (Settings.isAdditionalDetails()) { + if (Settings.isRatingWanted()) { // get ratings if (guids.size() > 0) { Log.i(Settings.tag, "Trying to get ratings for " + cids.size() + " caches"); @@ -1441,8 +1441,7 @@ public class cgBase { sendLoadProgressDetail(handler, R.string.cache_dialog_loading_details_status_logs); loadLogsFromDetails(page, cache); - if (Settings.isAdditionalDetails()) { - + if (Settings.isElevationWanted()) { if (CancellableHandler.isCancelled(handler)) { return; } @@ -1450,7 +1449,9 @@ public class cgBase { if (cache.coords != null) { cache.elevation = getElevation(cache.coords); } + } + if (Settings.isRatingWanted()) { if (CancellableHandler.isCancelled(handler)) { return; } diff --git a/main/src/cgeo/geocaching/cgeoinit.java b/main/src/cgeo/geocaching/cgeoinit.java index 34a7a14..8391f15 100644 --- a/main/src/cgeo/geocaching/cgeoinit.java +++ b/main/src/cgeo/geocaching/cgeoinit.java @@ -325,13 +325,23 @@ public class cgeoinit extends AbstractActivity { } }); - final CheckBox additionalDetailsButton = (CheckBox) findViewById(R.id.additionaldetails); - additionalDetailsButton.setChecked(Settings.isAdditionalDetails()); - additionalDetailsButton.setOnClickListener(new View.OnClickListener() { + final CheckBox ratingWantedButton = (CheckBox) findViewById(R.id.ratingwanted); + ratingWantedButton.setChecked(Settings.isRatingWanted()); + ratingWantedButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - Settings.setAdditionalDetails(additionalDetailsButton.isChecked()); + Settings.setRatingWanted(ratingWantedButton.isChecked()); + } + }); + + final CheckBox elevationWantedButton = (CheckBox) findViewById(R.id.elevationwanted); + elevationWantedButton.setChecked(Settings.isElevationWanted()); + elevationWantedButton.setOnClickListener(new View.OnClickListener() { + + @Override + public void onClick(View v) { + Settings.setElevationWanted(elevationWantedButton.isChecked()); } }); |