diff options
| author | rsudev <rasch@munin-soft.de> | 2012-10-27 00:17:31 +0200 |
|---|---|---|
| committer | rsudev <rasch@munin-soft.de> | 2012-11-03 23:24:18 +0100 |
| commit | f5343eac8a433b198d47057a112e4c92486906b3 (patch) | |
| tree | f4eda41be808315c30768ffc362689dec62fda72 /main/src/cgeo/geocaching/SettingsActivity.java | |
| parent | c942e65f13579e96ef528f8a7641f3571ce963dd (diff) | |
| download | cgeo-f5343eac8a433b198d47057a112e4c92486906b3.zip cgeo-f5343eac8a433b198d47057a112e4c92486906b3.tar.gz cgeo-f5343eac8a433b198d47057a112e4c92486906b3.tar.bz2 | |
Implements #1676, custom themes
- Adds the selection of a base folder for map themes to settings
- Reworks the map menu to allow selection of a custom theme
- Implements a reusable version of listDir to get a list of files
Diffstat (limited to 'main/src/cgeo/geocaching/SettingsActivity.java')
| -rw-r--r-- | main/src/cgeo/geocaching/SettingsActivity.java | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/main/src/cgeo/geocaching/SettingsActivity.java b/main/src/cgeo/geocaching/SettingsActivity.java index b0870a4..8e14c47 100644 --- a/main/src/cgeo/geocaching/SettingsActivity.java +++ b/main/src/cgeo/geocaching/SettingsActivity.java @@ -59,6 +59,7 @@ public class SettingsActivity extends AbstractActivity { private final static int SELECT_MAPFILE_REQUEST = 1; private final static int SELECT_GPX_EXPORT_REQUEST = 2; private final static int SELECT_GPX_IMPORT_REQUEST = 3; + private final static int SELECT_THEMEFOLDER_REQUEST = 4; private ProgressDialog loginDialog = null; @@ -581,6 +582,20 @@ public class SettingsActivity extends AbstractActivity { } }); + // Theme folder settings + initThemefolderEdittext(false); + + Button selectThemefolder = (Button) findViewById(R.id.select_themefolder); + selectThemefolder.setOnClickListener(new View.OnClickListener() { + + @Override + public void onClick(View v) { + Intent dirChooser = new Intent(SettingsActivity.this, SimpleDirChooser.class); + dirChooser.putExtra(SimpleDirChooser.START_DIR, Settings.getCustomRenderThemeBasefolder()); + startActivityForResult(dirChooser, SELECT_THEMEFOLDER_REQUEST); + } + }); + // GPX Export directory final EditText gpxExportDir = (EditText) findViewById(R.id.gpx_exportdir); gpxExportDir.setText(Settings.getGpxExportDir()); @@ -743,6 +758,14 @@ public class SettingsActivity extends AbstractActivity { } } + private void initThemefolderEdittext(boolean setFocus) { + EditText themeFileEdit = (EditText) findViewById(R.id.themefolder); + themeFileEdit.setText(Settings.getCustomRenderThemeBasefolder()); + if (setFocus) { + themeFileEdit.requestFocus(); + } + } + /** * @param view * unused here but needed since this method is referenced from XML layout @@ -968,6 +991,15 @@ public class SettingsActivity extends AbstractActivity { } }); } + if (requestCode == SELECT_THEMEFOLDER_REQUEST) { + checkDirectory(resultCode, data, R.id.themefolder, new RunnableWithArgument<String>() { + + @Override + public void run(String directory) { + Settings.setCustomRenderThemeBasefolder(directory); + } + }); + } } private void checkDirectory(int resultCode, Intent data, int textField, RunnableWithArgument<String> runnableSetDir) { |
