aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authorblafoo <github@blafoo.de>2011-10-13 22:25:56 +0200
committerblafoo <github@blafoo.de>2011-10-13 23:29:21 +0200
commit6d6e123e432a509b879a27bb9d08f37d197ab5ec (patch)
tree2b9a4e64da51cdd611d232a53751dd3b2b039a9a /main
parentbb3ed391288dd80295c32da2baf1df89f562ed2d (diff)
downloadcgeo-6d6e123e432a509b879a27bb9d08f37d197ab5ec.zip
cgeo-6d6e123e432a509b879a27bb9d08f37d197ab5ec.tar.gz
cgeo-6d6e123e432a509b879a27bb9d08f37d197ab5ec.tar.bz2
Additional details introduced
Diffstat (limited to 'main')
-rw-r--r--main/res/layout/init.xml71
-rw-r--r--main/res/values-de/strings.xml4
-rw-r--r--main/res/values/strings.xml4
-rw-r--r--main/src/cgeo/geocaching/Settings.java23
-rw-r--r--main/src/cgeo/geocaching/activity/AbstractActivity.java2
-rw-r--r--main/src/cgeo/geocaching/activity/AbstractListActivity.java2
-rw-r--r--main/src/cgeo/geocaching/cgBase.java20
-rw-r--r--main/src/cgeo/geocaching/cgeoinit.java31
8 files changed, 109 insertions, 48 deletions
diff --git a/main/res/layout/init.xml b/main/res/layout/init.xml
index 40ba0ce..d55d9de 100644
--- a/main/res/layout/init.xml
+++ b/main/res/layout/init.xml
@@ -218,6 +218,56 @@
android:textColor="?text_color"
android:text="@string/init_sigautoinsert" />
</LinearLayout>
+ <RelativeLayout style="@style/separator_horizontal_layout" >
+ <View style="@style/separator_horizontal" />
+ <TextView style="@style/separator_horizontal_headline"
+ android:text="@string/init_details" />
+ </RelativeLayout>
+ <LinearLayout
+ android:layout_margin="3dip" android:padding="3dip" android:layout_width="fill_parent" android:orientation="vertical" android:layout_height="fill_parent">
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal" >
+ <CheckBox android:id="@+id/autoload"
+ 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_autoload" />
+ </LinearLayout>
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal" >
+ <CheckBox android:id="@+id/additionaldetails"
+ 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_additionaldetails" />
+ </LinearLayout>
+ </LinearLayout>
<!-- ** -->
<RelativeLayout style="@style/separator_horizontal_layout" >
<View style="@style/separator_horizontal" />
@@ -486,27 +536,6 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
- <CheckBox android:id="@+id/autoload"
- 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_autoload" />
- </LinearLayout>
- <LinearLayout
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:orientation="horizontal" >
<CheckBox android:id="@+id/livelist"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
diff --git a/main/res/values-de/strings.xml b/main/res/values-de/strings.xml
index 720ac2b..43373ec 100644
--- a/main/res/values-de/strings.xml
+++ b/main/res/values-de/strings.xml
@@ -380,6 +380,9 @@
<string name="init_signature_template_datetime">Datum &amp; Zeit</string>
<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>
<string name="init_address">Position am Startbildschirm anzeigen</string>
@@ -393,7 +396,6 @@
<string name="init_save_log_img">Logbilder abspeichern</string>
<string name="init_units">Imperiale Einheiten (Meilen/Fuß)</string>
<string name="init_nav">Google Navigation verwenden</string>
- <string name="init_autoload">Ausführliche Beschreibung automatisch laden</string>
<string name="init_livelist">Richtung zum Cache in der Cache-Liste anzeigen</string>
<string name="init_log_offline">Offline loggen (Dialog für Online-Log nicht anzeigen)</string>
<string name="init_browser">c:geo als normalen Internet-Browser tarnen</string>
diff --git a/main/res/values/strings.xml b/main/res/values/strings.xml
index d878a02..0d60c47 100644
--- a/main/res/values/strings.xml
+++ b/main/res/values/strings.xml
@@ -378,6 +378,9 @@
<string name="init_signature_template_datetime">Date &amp; Time</string>
<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_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>
<string name="init_address">Show address on mainscreen</string>
@@ -391,7 +394,6 @@
<string name="init_save_log_img">Save Images from Logs</string>
<string name="init_units">Use miles/feet\n(imperial units)</string>
<string name="init_nav">Use Google Navigation</string>
- <string name="init_autoload">Auto-loading long description</string>
<string name="init_log_offline">When logging, always log offline (don\'t show online log screen when logging, don\'t send the log online)</string>
<string name="init_livelist">Show direction to caches in its list</string>
<string name="init_browser">Identify c:geo as standard browser</string>
diff --git a/main/src/cgeo/geocaching/Settings.java b/main/src/cgeo/geocaching/Settings.java
index 777332d..7155477 100644
--- a/main/src/cgeo/geocaching/Settings.java
+++ b/main/src/cgeo/geocaching/Settings.java
@@ -47,6 +47,7 @@ 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_USE_ENGLISH = "useenglish";
private static final String KEY_AS_BROWSER = "asbrowser";
private static final String KEY_USE_COMPASS = "usecompass";
@@ -138,13 +139,9 @@ public final class Settings {
// this class is not to be instantiated;
}
- private static void setLanguage(boolean useEnglish) {
- Locale locale = Locale.getDefault();
- if (useEnglish) {
- locale = new Locale("en");
- }
+ public static void setLanguage(boolean useEnglish) {
final Configuration config = new Configuration();
- config.locale = locale;
+ config.locale = useEnglish ? new Locale("en") : Locale.getDefault();
final Resources resources = cgeoapplication.getInstance().getResources();
resources.updateConfiguration(config, resources.getDisplayMetrics());
}
@@ -557,6 +554,20 @@ public final class Settings {
});
}
+ public static boolean isAdditionalDetails() {
+ return sharedPrefs.getBoolean(KEY_ADDITIONAL_DETAILS, true);
+ }
+
+ public static void setAdditionalDetails(final boolean additionaldetails) {
+ editSharedSettings(new PrefRunnable() {
+
+ @Override
+ public void edit(Editor edit) {
+ edit.putBoolean(KEY_ADDITIONAL_DETAILS, additionaldetails);
+ }
+ });
+ }
+
public static boolean isLiveList() {
return 0 != sharedPrefs.getInt(KEY_LIVE_LIST, 1);
}
diff --git a/main/src/cgeo/geocaching/activity/AbstractActivity.java b/main/src/cgeo/geocaching/activity/AbstractActivity.java
index 2b3aede..7c127e9 100644
--- a/main/src/cgeo/geocaching/activity/AbstractActivity.java
+++ b/main/src/cgeo/geocaching/activity/AbstractActivity.java
@@ -76,6 +76,8 @@ public abstract class AbstractActivity extends Activity implements IAbstractActi
app = (cgeoapplication) this.getApplication();
prefs = getSharedPreferences(Settings.preferences, Context.MODE_PRIVATE);
base = new cgBase(app);
+
+ Settings.setLanguage(Settings.isUseEnglish());
}
public void addVisitMenu(Menu menu, cgCache cache) {
diff --git a/main/src/cgeo/geocaching/activity/AbstractListActivity.java b/main/src/cgeo/geocaching/activity/AbstractListActivity.java
index b947c2e..8984408 100644
--- a/main/src/cgeo/geocaching/activity/AbstractListActivity.java
+++ b/main/src/cgeo/geocaching/activity/AbstractListActivity.java
@@ -73,6 +73,8 @@ public abstract class AbstractListActivity extends ListActivity implements
app = (cgeoapplication) this.getApplication();
prefs = getSharedPreferences(Settings.preferences, Context.MODE_PRIVATE);
base = new cgBase(app);
+
+ Settings.setLanguage(Settings.isUseEnglish());
}
final public void setTitle(final String title) {
diff --git a/main/src/cgeo/geocaching/cgBase.java b/main/src/cgeo/geocaching/cgBase.java
index 6039587..899f806 100644
--- a/main/src/cgeo/geocaching/cgBase.java
+++ b/main/src/cgeo/geocaching/cgBase.java
@@ -1507,17 +1507,19 @@ public class cgBase {
}
}
- if (cache.coords != null) {
- cache.elevation = getElevation(cache.coords);
- }
+ if (Settings.isAdditionalDetails()) {
+ if (cache.coords != null) {
+ cache.elevation = getElevation(cache.coords);
+ }
- sendLoadProgressDetail(handler, R.string.cache_dialog_loading_details_status_gcvote);
+ sendLoadProgressDetail(handler, R.string.cache_dialog_loading_details_status_gcvote);
- final cgRating rating = GCVote.getRating(cache.guid, cache.geocode);
- if (rating != null) {
- cache.rating = rating.rating;
- cache.votes = rating.votes;
- cache.myVote = rating.myVote;
+ final cgRating rating = GCVote.getRating(cache.guid, cache.geocode);
+ if (rating != null) {
+ cache.rating = rating.rating;
+ cache.votes = rating.votes;
+ cache.myVote = rating.myVote;
+ }
}
cache.updated = System.currentTimeMillis();
diff --git a/main/src/cgeo/geocaching/cgeoinit.java b/main/src/cgeo/geocaching/cgeoinit.java
index 413e291..34a7a14 100644
--- a/main/src/cgeo/geocaching/cgeoinit.java
+++ b/main/src/cgeo/geocaching/cgeoinit.java
@@ -314,6 +314,27 @@ public class cgeoinit extends AbstractActivity {
}
});
+ // Cache details
+ final CheckBox autoloadButton = (CheckBox) findViewById(R.id.autoload);
+ autoloadButton.setChecked(Settings.isAutoLoadDescription());
+ autoloadButton.setOnClickListener(new View.OnClickListener() {
+
+ @Override
+ public void onClick(View v) {
+ Settings.setAutoLoadDesc(autoloadButton.isChecked());
+ }
+ });
+
+ final CheckBox additionalDetailsButton = (CheckBox) findViewById(R.id.additionaldetails);
+ additionalDetailsButton.setChecked(Settings.isAdditionalDetails());
+ additionalDetailsButton.setOnClickListener(new View.OnClickListener() {
+
+ @Override
+ public void onClick(View v) {
+ Settings.setAdditionalDetails(additionalDetailsButton.isChecked());
+ }
+ });
+
// Other settings
final CheckBox skinButton = (CheckBox) findViewById(R.id.skin);
skinButton.setChecked(Settings.isLightSkin());
@@ -419,16 +440,6 @@ public class cgeoinit extends AbstractActivity {
}
});
- final CheckBox autoloadButton = (CheckBox) findViewById(R.id.autoload);
- autoloadButton.setChecked(Settings.isAutoLoadDescription());
- autoloadButton.setOnClickListener(new View.OnClickListener() {
-
- @Override
- public void onClick(View v) {
- Settings.setAutoLoadDesc(autoloadButton.isChecked());
- }
- });
-
final CheckBox livelistButton = (CheckBox) findViewById(R.id.livelist);
livelistButton.setChecked(Settings.isLiveList());
livelistButton.setOnClickListener(new View.OnClickListener() {