From 44bb61e2816c7aa3dd57eba0bb6ec73baac6d5bf Mon Sep 17 00:00:00 2001 From: Nick Bradbury Date: Mon, 11 Aug 2014 10:58:19 -0400 Subject: [PATCH] Rewrote the AppLog viewer to use a ListView+adapter --- .../org/wordpress/android/util/AppLog.java | 21 +++++++------------ 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/WordPressUtils/src/main/java/org/wordpress/android/util/AppLog.java b/WordPressUtils/src/main/java/org/wordpress/android/util/AppLog.java index f2fff1b2ef4a..292c974ec7fa 100644 --- a/WordPressUtils/src/main/java/org/wordpress/android/util/AppLog.java +++ b/WordPressUtils/src/main/java/org/wordpress/android/util/AppLog.java @@ -17,6 +17,7 @@ public class AppLog { // T for Tag public enum T {READER, EDITOR, MEDIA, NUX, API, STATS, UTILS, NOTIFS, DB, POSTS, COMMENTS, THEMES, TESTS, PROFILING, SIMPERIUM} public static final String TAG = "WordPress"; + public static final int HEADER_LINE_COUNT = 2; private static boolean mEnableRecording = false; @@ -170,24 +171,18 @@ private static String getHTMLStringStackTrace(Throwable throwable) { /* * returns entire log as html for display (see AppLogViewerActivity) */ - public static String toHtml(Context context) { - StringBuilder sb = new StringBuilder(); + public static ArrayList toHtmlList(Context context) { + ArrayList items = new ArrayList(); - // add version & device info - sb.append("WordPress Android version: " + ProfilingUtils.getVersionName(context)).append("
") - .append("Android device name: " + DeviceUtils.getInstance().getDeviceName(context)).append("
"); + // add version & device info - be sure to change HEADER_LINE_COUNT if additional lines are added + items.add("WordPress Android version: " + ProfilingUtils.getVersionName(context) + ""); + items.add("Android device name: " + DeviceUtils.getInstance().getDeviceName(context) + ""); Iterator it = mLogEntries.iterator(); - int lineNum = 1; while (it.hasNext()) { - sb.append("") - .append(String.format("%02d", lineNum)) - .append(" ") - .append(it.next().toHtml()) - .append("
"); - lineNum++; + items.add(it.next().toHtml()); } - return sb.toString(); + return items; }