diff options
| author | Samuel Tardieu <sam@rfc1149.net> | 2012-03-31 21:50:19 +0200 |
|---|---|---|
| committer | Samuel Tardieu <sam@rfc1149.net> | 2012-03-31 21:53:37 +0200 |
| commit | 9792488b75259be9da33a06b942f7b391d7a4d35 (patch) | |
| tree | 5ae61c62b316f4642c67b3dd3c721dc8da184d98 | |
| parent | 78eba983f784fe2e68e512ad6b466d5798545d24 (diff) | |
| download | cgeo-9792488b75259be9da33a06b942f7b391d7a4d35.zip cgeo-9792488b75259be9da33a06b942f7b391d7a4d35.tar.gz cgeo-9792488b75259be9da33a06b942f7b391d7a4d35.tar.bz2 | |
Fix #1301: add a new Debug settings to log debug information
| -rw-r--r-- | main/res/layout/init.xml | 40 | ||||
| -rw-r--r-- | main/res/values/strings.xml | 7 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/Settings.java | 12 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/cgeoinit.java | 11 |
4 files changed, 67 insertions, 3 deletions
diff --git a/main/res/layout/init.xml b/main/res/layout/init.xml index e9d28a6..dd2ed0d 100644 --- a/main/res/layout/init.xml +++ b/main/res/layout/init.xml @@ -869,6 +869,46 @@ android:textColorLink="?text_color_link" android:linksClickable="true" android:text="@string/init_backup_note" /> +<!-- ** --> + <RelativeLayout style="@style/separator_horizontal_layout" > + <View style="@style/separator_horizontal" /> + <TextView + style="@style/separator_horizontal_headline" + android:text="@string/init_debug_title" /> + </RelativeLayout> + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginLeft="10dip" + android:layout_marginRight="10dip" + android:layout_marginBottom="5dip" + android:layout_gravity="left" + android:padding="3dip" + android:textSize="14dip" + android:textColor="?text_color" + android:textColorLink="?text_color_link" + android:linksClickable="true" + android:text="@string/init_debug_note" /> + <LinearLayout + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:orientation="horizontal" > + <CheckBox android:id="@+id/debug" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + 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_debug" /> + </LinearLayout> </LinearLayout> </ScrollView> </LinearLayout> diff --git a/main/res/values/strings.xml b/main/res/values/strings.xml index 5606309..7cdf974 100644 --- a/main/res/values/strings.xml +++ b/main/res/values/strings.xml @@ -1,4 +1,4 @@ -<?xml version="1.0" encoding="UTF-8"?> +<?xml version="1.0" encoding="UTF-8"?> <resources> <string name="app_name">c:geo</string> <string name="app_name_compass">c:geo compass</string> @@ -422,7 +422,10 @@ <string name="init_default_navigation_tool_description">Here you can select your preferred navigation tool.</string> <string name="init_default_navigation_tool_select">Select tool</string> <string name="init_default_navigation_tool_2_description">Here you can select your second preferred navigation tool. It\'s activated by long clicking the navigation icon next to the title of the cache.</string> - + <string name="init_debug_title">Debug information</string> + <string name="init_debug_note">c:geo can generate a lot of debugging information. While this information is generally not useful for c:geo users, developers may need to generate this information in order to analyze a bug. In this case, they will ask you to check the box below and send them the log file.</string> + <string name="init_debug">Generate debug information</string> + <!-- map sources --> <string-array name="map_sources"> <item>@string/map_source_google_map</item> diff --git a/main/src/cgeo/geocaching/Settings.java b/main/src/cgeo/geocaching/Settings.java index 8149787..0f1cbcf 100644 --- a/main/src/cgeo/geocaching/Settings.java +++ b/main/src/cgeo/geocaching/Settings.java @@ -79,6 +79,7 @@ public final class Settings { private static final String KEY_DEFAULT_NAVIGATION_TOOL = "defaultNavigationTool"; private static final String KEY_DEFAULT_NAVIGATION_TOOL_2 = "defaultNavigationTool2"; private static final String KEY_LIVE_MAP_STRATEGY = "livemapstrategy"; + private static final String KEY_DEBUG = "debug"; private final static int unitsMetric = 1; private final static int unitsImperial = 2; @@ -1016,7 +1017,16 @@ public final class Settings { } public static boolean isDebug() { - return true; + return sharedPrefs.getBoolean(KEY_DEBUG, false); + } + + public static void setDebug(final boolean debug) { + editSharedSettings(new PrefRunnable() { + + @Override public void edit(Editor edit) { + edit.putBoolean(KEY_DEBUG, debug); + } + }); } } diff --git a/main/src/cgeo/geocaching/cgeoinit.java b/main/src/cgeo/geocaching/cgeoinit.java index 5ddc7df..cb5808f 100644 --- a/main/src/cgeo/geocaching/cgeoinit.java +++ b/main/src/cgeo/geocaching/cgeoinit.java @@ -669,6 +669,17 @@ public class cgeoinit extends AbstractActivity { refreshBackupLabel(); + // Debug settings + final CheckBox debugButton = (CheckBox) findViewById(R.id.debug); + debugButton.setChecked(Settings.isDebug()); + debugButton.setOnClickListener(new View.OnClickListener() { + + @Override + public void onClick(View v) { + Settings.setDebug(!Settings.isDebug()); + debugButton.setChecked(Settings.isDebug()); + } + }); } private void initMapfileEdittext(boolean setFocus) { |
