diff options
| author | bananeweizen <bananeweizen@gmx.de> | 2011-08-19 07:37:53 +0200 |
|---|---|---|
| committer | bananeweizen <bananeweizen@gmx.de> | 2011-08-19 07:37:53 +0200 |
| commit | c33711b5b586232d53d87783979bc04b6f36ae07 (patch) | |
| tree | a25d305d7d14fef37541fc16ca045547dd4d1c60 /src/cgeo/geocaching/cgeovisit.java | |
| parent | b1fd19684fc84f681da836722d03ccc2751b9e10 (diff) | |
| download | cgeo-c33711b5b586232d53d87783979bc04b6f36ae07.zip cgeo-c33711b5b586232d53d87783979bc04b6f36ae07.tar.gz cgeo-c33711b5b586232d53d87783979bc04b6f36ae07.tar.bz2 | |
first part of #232, sub menu for state selection is still missing
Diffstat (limited to 'src/cgeo/geocaching/cgeovisit.java')
| -rw-r--r-- | src/cgeo/geocaching/cgeovisit.java | 44 |
1 files changed, 19 insertions, 25 deletions
diff --git a/src/cgeo/geocaching/cgeovisit.java b/src/cgeo/geocaching/cgeovisit.java index 8b6effd..9a5c1a0 100644 --- a/src/cgeo/geocaching/cgeovisit.java +++ b/src/cgeo/geocaching/cgeovisit.java @@ -28,6 +28,11 @@ import android.widget.TextView; import cgeo.geocaching.LogTemplateProvider.LogTemplate; public class cgeovisit extends cgLogForm { + static final String EXTRAS_FOUND = "found"; + static final String EXTRAS_TEXT = "text"; + static final String EXTRAS_GEOCODE = "geocode"; + static final String EXTRAS_ID = "id"; + private static final int MENU_SIGNATURE = 1; private static final int SUBMENU_VOTE = 2; @@ -121,7 +126,7 @@ public class cgeovisit extends cgLogForm { public void onClick(View view) { final Intent trackablesIntent = new Intent(cgeovisit.this, cgeotrackable.class); - trackablesIntent.putExtra("geocode", tbCode); + trackablesIntent.putExtra(EXTRAS_GEOCODE, tbCode); startActivity(trackablesIntent); } }); @@ -223,10 +228,10 @@ public class cgeovisit extends cgLogForm { // get parameters Bundle extras = getIntent().getExtras(); if (extras != null) { - cacheid = extras.getString("id"); - geocode = extras.getString("geocode"); - text = extras.getString("text"); - alreadyFound = extras.getBoolean("found"); + cacheid = extras.getString(EXTRAS_ID); + geocode = extras.getString(EXTRAS_GEOCODE); + text = extras.getString(EXTRAS_TEXT); + alreadyFound = extras.getBoolean(EXTRAS_FOUND); } if ((cacheid == null || cacheid.length() == 0) && geocode != null && geocode.length() > 0) { @@ -591,7 +596,14 @@ public class cgeovisit extends cgLogForm { if (save == null) { save = (Button) findViewById(R.id.save); } - save.setOnClickListener(new saveListener()); + save.setOnClickListener(new View.OnClickListener() { + + @Override + public void onClick(View v) { + String log = ((EditText) findViewById(R.id.log)).getText().toString(); + cache.logOffline(cgeovisit.this, log, date); + } + }); if (clear == null) { clear = (Button) findViewById(R.id.clear); @@ -673,25 +685,6 @@ public class cgeovisit extends cgLogForm { } } - private class saveListener implements View.OnClickListener { - - public void onClick(View arg0) { - String log = ((EditText) findViewById(R.id.log)).getText().toString(); - final boolean status = app.saveLogOffline(geocode, date.getTime(), typeSelected, log); - if (save == null) { - save = (Button) findViewById(R.id.save); - } - save.setOnClickListener(new saveListener()); - - if (status) { - showToast(res.getString(R.string.info_log_saved)); - app.saveVisitDate(geocode); - } else { - showToast(res.getString(R.string.err_log_post_failed)); - } - } - } - private class clearListener implements View.OnClickListener { public void onClick(View arg0) { @@ -862,4 +855,5 @@ public class cgeovisit extends cgLogForm { return 1000; } + }
\ No newline at end of file |
