diff options
author | Arne Schwabe <arne@rfc2549.org> | 2012-05-06 20:06:30 +0200 |
---|---|---|
committer | Arne Schwabe <arne@rfc2549.org> | 2012-05-06 20:06:30 +0200 |
commit | 68b6a9dd0c60879e13f4bc75d9bd45f85d134939 (patch) | |
tree | facfc2f5cb82f36207862882d103111d1b936bab /src/de/blinkt/openvpn/LogWindow.java | |
parent | 7c020349d214a942293047954ce45aab04cc6420 (diff) |
- Ability to copy single log entries (issue #9)
- Remove dependency on JNI for all but early logging and opening tun
Diffstat (limited to 'src/de/blinkt/openvpn/LogWindow.java')
-rw-r--r-- | src/de/blinkt/openvpn/LogWindow.java | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/src/de/blinkt/openvpn/LogWindow.java b/src/de/blinkt/openvpn/LogWindow.java index f3809e27..3455e385 100644 --- a/src/de/blinkt/openvpn/LogWindow.java +++ b/src/de/blinkt/openvpn/LogWindow.java @@ -1,19 +1,17 @@ package de.blinkt.openvpn; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.nio.charset.Charset; import java.util.Vector; import android.app.AlertDialog; import android.app.AlertDialog.Builder; import android.app.ListActivity; +import android.content.ClipData; +import android.content.ClipboardManager; +import android.content.Context; import android.content.DialogInterface; -import android.content.Intent; import android.content.DialogInterface.OnClickListener; +import android.content.Intent; import android.database.DataSetObserver; -import android.net.Uri; import android.os.Bundle; import android.os.Handler; import android.os.Handler.Callback; @@ -23,6 +21,8 @@ import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; +import android.widget.AdapterView; +import android.widget.AdapterView.OnItemLongClickListener; import android.widget.ListAdapter; import android.widget.ListView; import android.widget.TextView; @@ -235,6 +235,20 @@ public class LogWindow extends ListActivity { super.onCreate(savedInstanceState); ListView lv = getListView(); + + lv.setOnItemLongClickListener(new OnItemLongClickListener() { + + @Override + public boolean onItemLongClick(AdapterView<?> parent, View view, + int position, long id) { + ClipboardManager clipboard = (ClipboardManager) + getSystemService(Context.CLIPBOARD_SERVICE); + ClipData clip = ClipData.newPlainText("Log Entry",((TextView) view).getText()); + clipboard.setPrimaryClip(clip); + Toast.makeText(getBaseContext(), R.string.copied_entry, Toast.LENGTH_SHORT).show(); + return true; + } + }); //lv.setTextFilterEnabled(true); ladapter = new LogWindowListAdapter(); lv.setAdapter(ladapter); |