diff options
author | Samuel Tardieu <sam@rfc1149.net> | 2015-03-08 11:42:27 +0100 |
---|---|---|
committer | Samuel Tardieu <sam@rfc1149.net> | 2015-03-08 11:42:27 +0100 |
commit | f41fe5e565b51211ef0453d8cb1d9f1ca4e6e43d (patch) | |
tree | b798c1ceb97b53cb552b5ac4a1e687a10a8ef95e /main | |
parent | 222b5c5ab47750e6776d4e500faff33d4a15af5b (diff) | |
download | cgeo-f41fe5e565b51211ef0453d8cb1d9f1ca4e6e43d.zip cgeo-f41fe5e565b51211ef0453d8cb1d9f1ca4e6e43d.tar.gz cgeo-f41fe5e565b51211ef0453d8cb1d9f1ca4e6e43d.tar.bz2 |
fix #4605: add a copy to clipboard button for system info
Diffstat (limited to 'main')
-rw-r--r-- | main/res/layout/about_system_page.xml | 6 | ||||
-rw-r--r-- | main/res/values/strings.xml | 1 | ||||
-rw-r--r-- | main/src/cgeo/geocaching/AboutActivity.java | 13 |
3 files changed, 19 insertions, 1 deletions
diff --git a/main/res/layout/about_system_page.xml b/main/res/layout/about_system_page.xml index 7c98ca6..0fd9624 100644 --- a/main/res/layout/about_system_page.xml +++ b/main/res/layout/about_system_page.xml @@ -11,6 +11,12 @@ android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical" > + <Button android:id="@+id/copy" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/copy_to_clipboard" + android:layout_gravity="center_horizontal" + android:padding="12dp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" diff --git a/main/res/values/strings.xml b/main/res/values/strings.xml index a287441..48b2a9b 100644 --- a/main/res/values/strings.xml +++ b/main/res/values/strings.xml @@ -862,6 +862,7 @@ <string name="search_history_cleared">History cleared</string> <string name="waypoint_coordinate_formats_plain">Plain</string> <string name="from_clipboard">From clipboard</string> + <string name="copy_to_clipboard">Copy to clipboard</string> <!-- visit --> <string name="visit_tweet">Post this find to Twitter</string> diff --git a/main/src/cgeo/geocaching/AboutActivity.java b/main/src/cgeo/geocaching/AboutActivity.java index 829d987..7ec74d7 100644 --- a/main/src/cgeo/geocaching/AboutActivity.java +++ b/main/src/cgeo/geocaching/AboutActivity.java @@ -13,6 +13,7 @@ import cgeo.geocaching.sensors.Sensors; import cgeo.geocaching.settings.Settings; import cgeo.geocaching.ui.AbstractCachingPageViewCreator; import cgeo.geocaching.ui.AnchorAwareLinkMovementMethod; +import cgeo.geocaching.utils.ClipboardUtils; import cgeo.geocaching.utils.ProcessUtils; import cgeo.geocaching.utils.Version; @@ -31,6 +32,7 @@ import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; +import android.widget.Button; import android.widget.ScrollView; import android.widget.TextView; @@ -104,14 +106,23 @@ public class AboutActivity extends AbstractViewPagerActivity<AboutActivity.Page> class SystemViewCreator extends AbstractCachingPageViewCreator<ScrollView> { @InjectView(R.id.system) protected TextView system; + @InjectView(R.id.copy) protected Button copy; @Override public ScrollView getDispatchedView(final ViewGroup parentView) { final ScrollView view = (ScrollView) getLayoutInflater().inflate(R.layout.about_system_page, parentView, false); ButterKnife.inject(this, view); - system.setText(systemInformation(AboutActivity.this)); + final String systemInfo = systemInformation(AboutActivity.this); + system.setText(systemInfo); system.setMovementMethod(AnchorAwareLinkMovementMethod.getInstance()); Compatibility.setTextIsSelectable(system, true); + copy.setOnClickListener(new OnClickListener() { + @Override + public void onClick(final View view) { + ClipboardUtils.copyToClipboard(systemInfo); + showShortToast(getString(R.string.clipboard_copy_ok)); + } + }); return view; } } |