diff options
author | steckbrief <steckbrief@chefmail.de> | 2016-04-07 15:36:16 +0200 |
---|---|---|
committer | steckbrief <steckbrief@chefmail.de> | 2016-04-07 15:36:16 +0200 |
commit | 36f3bed2eccb3dfd5266304c482497eff0d25c7c (patch) | |
tree | a43598541a1a4ea92142d17e02c02033e49fa8a3 /src/main/java/de/thedevstack/conversationsplus/ui/LogCatOutputActivity.java | |
parent | 4ace80d39ade18934d310ba37559c9c7ec8004dd (diff) | |
parent | 8c3245dd1f257053b8ec2bf7c5e03a3a98b282c3 (diff) |
Merge remote-tracking branch 'remotes/origin/trz/rename' into trz/rebase
Conflicts:
src/main/java/de/thedevstack/conversationsplus/ui/LogCatOutputActivity.java
Diffstat (limited to 'src/main/java/de/thedevstack/conversationsplus/ui/LogCatOutputActivity.java')
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/ui/LogCatOutputActivity.java | 41 |
1 files changed, 35 insertions, 6 deletions
diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/LogCatOutputActivity.java b/src/main/java/de/thedevstack/conversationsplus/ui/LogCatOutputActivity.java index 52891a91..a1f99a48 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/LogCatOutputActivity.java +++ b/src/main/java/de/thedevstack/conversationsplus/ui/LogCatOutputActivity.java @@ -2,27 +2,56 @@ package de.thedevstack.conversationsplus.ui; import android.app.Activity; import android.os.Bundle; +import android.view.ContextMenu; +import android.view.MenuItem; +import android.view.View; +import android.widget.AdapterView; import android.widget.Button; import android.widget.ListView; import de.thedevstack.android.logcat.adapters.LogCatArrayAdapter; import de.thedevstack.android.logcat.tasks.ReadLogCatAsyncTask; -import de.thedevstack.android.logcat.ui.LogCatOutputCopyOnClickListener; +import de.thedevstack.conversationsplus.ui.listeners.LogCatOutputCopyOnClickListener; +import de.thedevstack.conversationsplus.utils.ClipboardUtil; + import eu.siacs.conversations.R; /** - * Created by tzur on 07.10.2015. + * Activity to display the logcat output. */ public class LogCatOutputActivity extends Activity { + /** + * List adapter containing the logcat entries. + */ + private LogCatArrayAdapter logCatArrayAdapter; + @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_logcatoutput); ListView lv = (ListView)findViewById(R.id.actLogInfoOutput); - LogCatArrayAdapter logCatOutputAdapter = new LogCatArrayAdapter(this, R.layout.list_item_logcatoutput); - lv.setAdapter(logCatOutputAdapter); - new ReadLogCatAsyncTask(logCatOutputAdapter).execute(); + this.logCatArrayAdapter = new LogCatArrayAdapter(this, R.layout.list_item_logcatoutput); + lv.setAdapter(this.logCatArrayAdapter); + new ReadLogCatAsyncTask(this.logCatArrayAdapter).execute(); Button copyButton = (Button) findViewById(R.id.actLogOutputCopyButton); - copyButton.setOnClickListener(new LogCatOutputCopyOnClickListener(this, logCatOutputAdapter, R.string.cplus_copied_to_clipboard, R.string.cplus_not_copied_to_clipboard_empty)); + copyButton.setOnClickListener(new LogCatOutputCopyOnClickListener(this.logCatArrayAdapter)); + registerForContextMenu(lv); + } + + @Override + public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { + super.onCreateContextMenu(menu, v, menuInfo); + menu.add(0, 123456789, 0, R.string.cplus_copy_item); + } + + @Override + public boolean onContextItemSelected(MenuItem item) { + if (123456789 == item.getItemId()) { + AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo(); + String itemText = this.logCatArrayAdapter.getItems().get(info.position); + ClipboardUtil.copyToClipboard(itemText); + return true; + } + return super.onContextItemSelected(item); } } |