aboutsummaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--libs/thedevstacklogcat/src/main/java/de/thedevstack/android/logcat/adapters/LogCatArrayAdapter.java8
-rw-r--r--libs/thedevstacklogcat/src/main/java/de/thedevstack/android/logcat/ui/LogCatOutputCopyOnClickListener.java48
2 files changed, 6 insertions, 50 deletions
diff --git a/libs/thedevstacklogcat/src/main/java/de/thedevstack/android/logcat/adapters/LogCatArrayAdapter.java b/libs/thedevstacklogcat/src/main/java/de/thedevstack/android/logcat/adapters/LogCatArrayAdapter.java
index c8a96ea3..eb4efc98 100644
--- a/libs/thedevstacklogcat/src/main/java/de/thedevstack/android/logcat/adapters/LogCatArrayAdapter.java
+++ b/libs/thedevstacklogcat/src/main/java/de/thedevstack/android/logcat/adapters/LogCatArrayAdapter.java
@@ -116,7 +116,11 @@ public class LogCatArrayAdapter extends ArrayAdapter<String> {
logcatItems.remove(object);
}
- public ArrayList<String> getItems() {
- return this.logcatItems;
+ /**
+ * Returns an unmodifiable copy of the log cat entries.
+ * @return UnmodifiableList of logcat entries.
+ */
+ public List<String> getItems() {
+ return Collections.unmodifiableList(this.logcatItems);
}
}
diff --git a/libs/thedevstacklogcat/src/main/java/de/thedevstack/android/logcat/ui/LogCatOutputCopyOnClickListener.java b/libs/thedevstacklogcat/src/main/java/de/thedevstack/android/logcat/ui/LogCatOutputCopyOnClickListener.java
deleted file mode 100644
index 1be04c9c..00000000
--- a/libs/thedevstacklogcat/src/main/java/de/thedevstack/android/logcat/ui/LogCatOutputCopyOnClickListener.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package de.thedevstack.android.logcat.ui;
-
-import android.content.ClipData;
-import android.content.ClipboardManager;
-import android.content.Context;
-import android.view.View;
-import android.widget.Toast;
-
-import java.util.ArrayList;
-
-import de.thedevstack.android.logcat.Logging;
-import de.thedevstack.android.logcat.adapters.LogCatArrayAdapter;
-
-/**
- * Created by tzur on 20.11.2015.
- */
-public class LogCatOutputCopyOnClickListener implements View.OnClickListener {
- private final LogCatArrayAdapter logCatOutputAdapter;
- private final Context context;
- private final int resIdLogcatCopied;
- private final int resIdLogcatNotCopied;
-
- public LogCatOutputCopyOnClickListener(Context context, LogCatArrayAdapter logCatOutputAdapter, int resIdLogcatCopied, int resIdLogcatNotCopied) {
- this.logCatOutputAdapter = logCatOutputAdapter;
- this.context = context;
- this.resIdLogcatCopied = resIdLogcatCopied;
- this.resIdLogcatNotCopied = resIdLogcatNotCopied;
- }
-
- @Override
- public void onClick(View v) {
- Logging.d("copylogcat", "Start Copying log cat");
- ArrayList<String> items = this.logCatOutputAdapter.getItems();
- if (null != items && !items.isEmpty()) {
- StringBuilder sb = new StringBuilder();
- for (String item : items) {
- sb.append(item);
- sb.append("\n");
- }
- ClipboardManager clipboard = (ClipboardManager) this.context.getSystemService(Context.CLIPBOARD_SERVICE);
- ClipData clip = ClipData.newPlainText("c+logcat", sb.toString());
- clipboard.setPrimaryClip(clip);
- Toast.makeText(this.context, this.context.getText(this.resIdLogcatCopied), Toast.LENGTH_LONG).show();
- } else {
- Toast.makeText(this.context, this.context.getText(this.resIdLogcatNotCopied), Toast.LENGTH_LONG).show();
- }
- }
-}