aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--main/res/layout/cacheview_description.xml13
-rw-r--r--main/res/layout/editor.xml25
-rw-r--r--main/res/values-de/strings.xml4
-rw-r--r--main/res/values/strings.xml4
-rw-r--r--main/src/cgeo/geocaching/CacheDetailActivity.java33
-rw-r--r--main/src/cgeo/geocaching/ui/EditorDialog.java59
6 files changed, 122 insertions, 16 deletions
diff --git a/main/res/layout/cacheview_description.xml b/main/res/layout/cacheview_description.xml
index c985bfb..7cbcbe0 100644
--- a/main/res/layout/cacheview_description.xml
+++ b/main/res/layout/cacheview_description.xml
@@ -110,8 +110,7 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="12dip"
- android:orientation="vertical"
- android:visibility="gone" >
+ android:orientation="vertical" >
<RelativeLayout style="@style/separator_horizontal_layout" >
@@ -129,8 +128,14 @@
android:linksClickable="true"
android:textColor="?text_color"
android:textColorLink="?text_color_link"
- android:textSize="14dip"
- android:visibility="gone" />
+ android:textSize="14dip" />
+ <Button
+ android:id="@+id/edit_personalnote"
+ style="@style/button_small"
+ android:layout_marginBottom="36dip"
+ android:layout_marginTop="12dip"
+ android:text="@string/cache_personal_note_edit" />
+
</LinearLayout>
</LinearLayout>
diff --git a/main/res/layout/editor.xml b/main/res/layout/editor.xml
new file mode 100644
index 0000000..88b1b10
--- /dev/null
+++ b/main/res/layout/editor.xml
@@ -0,0 +1,25 @@
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/linearLayout1"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:background="?background_color" >
+
+ <EditText
+ android:id="@+id/editorEditText"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:inputType="textMultiLine"
+ android:scrollbars="vertical" >
+
+ <requestFocus />
+ </EditText>
+
+ <Button style="@style/button_full"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:id="@+id/editorSave"
+ android:text="@string/editor_save" />
+
+</LinearLayout>
diff --git a/main/res/values-de/strings.xml b/main/res/values-de/strings.xml
index f811f44..21627af 100644
--- a/main/res/values-de/strings.xml
+++ b/main/res/values-de/strings.xml
@@ -500,6 +500,7 @@
<string name="cache_log_images_title">Logbild</string>
<string name="cache_log_image_default_title">Bild</string>
<string name="cache_personal_note">Persönliche Notiz</string>
+ <string name="cache_personal_note_edit">Bearbeiten</string>
<string name="cache_description">Beschreibung</string>
<string name="cache_description_long">Ausführliche Beschreibung</string>
<string name="cache_description_table_note">Diese Beschreibung enthält Tabellenelemente, die evtl. nur auf Geocaching.com korrekt angezeigt werden.</string>
@@ -599,6 +600,9 @@
<string name="cache_image_open_browser">Im Browser öffnen</string>
<string name="cache_share_field">Weiterleiten</string>
<string name="cache_time_full_hours">Uhr</string>
+
+ <!-- editor dialog -->
+ <string name="editor_save">Speichern</string>
<!-- file list base -->
<string name="file_searching_in">Suche nach Dateien\nin</string>
diff --git a/main/res/values/strings.xml b/main/res/values/strings.xml
index 6735730..1663574 100644
--- a/main/res/values/strings.xml
+++ b/main/res/values/strings.xml
@@ -510,6 +510,7 @@
<string name="cache_log_images_title">Log images</string>
<string name="cache_log_image_default_title">Photo</string>
<string name="cache_personal_note">Personal note</string>
+ <string name="cache_personal_note_edit">Edit</string>
<string name="cache_description">Description</string>
<string name="cache_description_long">Long Description</string>
<string name="cache_description_table_note">Description contains table formatting which may need to be viewed at geocaching.com to be seen correctly.</string>
@@ -610,6 +611,9 @@
<string name="cache_share_field">Share</string>
<string name="cache_time_full_hours">o\'clock</string>
+ <!-- editor dialog -->
+ <string name="editor_save">Save</string>
+
<!-- file list base -->
<string name="file_searching_in">Searching for files\nin</string>
<string name="file_searching_sdcard_in">No files found in default folders:\n%1$s\n\nSearching whole SD card for files:\n</string>
diff --git a/main/src/cgeo/geocaching/CacheDetailActivity.java b/main/src/cgeo/geocaching/CacheDetailActivity.java
index 93566c2..993e6a0 100644
--- a/main/src/cgeo/geocaching/CacheDetailActivity.java
+++ b/main/src/cgeo/geocaching/CacheDetailActivity.java
@@ -18,6 +18,7 @@ import cgeo.geocaching.network.HtmlImage;
import cgeo.geocaching.network.Parameters;
import cgeo.geocaching.ui.CacheDetailsCreator;
import cgeo.geocaching.ui.DecryptTextClickListener;
+import cgeo.geocaching.ui.EditorDialog;
import cgeo.geocaching.ui.Formatter;
import cgeo.geocaching.ui.LoggingUI;
import cgeo.geocaching.utils.BaseUtils;
@@ -1896,18 +1897,26 @@ public class CacheDetailActivity extends AbstractActivity {
}
// cache personal note
- if (StringUtils.isNotBlank(cache.getPersonalNote())) {
- ((LinearLayout) view.findViewById(R.id.personalnote_box)).setVisibility(View.VISIBLE);
-
- TextView personalNoteText = (TextView) view.findViewById(R.id.personalnote);
- personalNoteText.setVisibility(View.VISIBLE);
- personalNoteText.setText(cache.getPersonalNote(), TextView.BufferType.SPANNABLE);
- personalNoteText.setMovementMethod(LinkMovementMethod.getInstance());
- registerForContextMenu(personalNoteText);
- }
- else {
- ((LinearLayout) view.findViewById(R.id.personalnote_box)).setVisibility(View.GONE);
- }
+ final TextView personalNoteText = (TextView) view.findViewById(R.id.personalnote);
+ personalNoteText.setText(cache.getPersonalNote(), TextView.BufferType.SPANNABLE);
+ personalNoteText.setMovementMethod(LinkMovementMethod.getInstance());
+ registerForContextMenu(personalNoteText);
+ final Button personalNoteEdit = (Button) view.findViewById(R.id.edit_personalnote);
+ personalNoteEdit.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ EditorDialog editor = new EditorDialog(CacheDetailActivity.this, personalNoteText.getText());
+ editor.setOnEditorUpdate(new EditorDialog.EditorUpdate() {
+ @Override
+ public void update(CharSequence editorText) {
+ personalNoteText.setText(editorText);
+ cache.setPersonalNote(editorText.toString());
+ app.saveCache(cache, EnumSet.of(SaveFlag.SAVE_DB));
+ }
+ });
+ editor.show();
+ }
+ });
// cache hint and spoiler images
if (StringUtils.isNotBlank(cache.getHint()) || CollectionUtils.isNotEmpty(cache.getSpoilers())) {
diff --git a/main/src/cgeo/geocaching/ui/EditorDialog.java b/main/src/cgeo/geocaching/ui/EditorDialog.java
new file mode 100644
index 0000000..50b3e27
--- /dev/null
+++ b/main/src/cgeo/geocaching/ui/EditorDialog.java
@@ -0,0 +1,59 @@
+package cgeo.geocaching.ui;
+
+import cgeo.geocaching.CacheDetailActivity;
+import cgeo.geocaching.R;
+
+import android.app.Dialog;
+import android.os.Bundle;
+import android.view.View;
+import android.view.ViewGroup.LayoutParams;
+import android.view.Window;
+import android.widget.Button;
+import android.widget.EditText;
+
+public class EditorDialog extends Dialog {
+
+ private CharSequence editorText;
+ private EditorUpdate editorUpdate;
+
+ public EditorDialog(CacheDetailActivity cacheDetailActivity, CharSequence editable) {
+ super(cacheDetailActivity);
+ this.editorText = editable;
+ }
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ requestWindowFeature(Window.FEATURE_NO_TITLE);
+ setContentView(R.layout.editor);
+
+ final EditText editText = (EditText) findViewById(R.id.editorEditText);
+ editText.setText(editorText);
+
+ final Button buttonSave = (Button) findViewById(R.id.editorSave);
+ buttonSave.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ editorUpdate.update(editText.getEditableText());
+ EditorDialog.this.hide();
+ }
+ });
+ }
+
+ public interface EditorUpdate {
+ public void update(CharSequence editorText);
+ }
+
+ public void setOnEditorUpdate(EditorUpdate editorUpdate) {
+ this.editorUpdate = editorUpdate;
+
+ }
+
+ @Override
+ public void show() {
+ super.show();
+ getWindow().setLayout(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
+ }
+
+}