]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
android: Show date/thread prefix in log view if we have enough space
authorTobias Brunner <tobias@strongswan.org>
Fri, 29 Jun 2018 10:50:31 +0000 (12:50 +0200)
committerTobias Brunner <tobias@strongswan.org>
Tue, 3 Jul 2018 09:31:44 +0000 (11:31 +0200)
This is the case for tablets or even phones in landscape orientation.
600dp is the breaking point for small tablets according to Google's
docs.

src/frontends/android/app/src/main/java/org/strongswan/android/ui/LogFragment.java

index f68d0c617e05a3b299cfa5939d20b7cc1fc67897..2dda82a57fbc37887d0eebfe0e1266d91d2924a4 100644 (file)
@@ -120,7 +120,7 @@ public class LogFragment extends Fragment implements Runnable
 
        /**
         * Write the given log line to the TextView. We strip the prefix off to save
-        * some space (it is not that helpful for regular users anyway).
+        * some space in narrow views (it is not that helpful for regular users anyway).
         *
         * @param lines log lines to log
         */
@@ -132,8 +132,12 @@ public class LogFragment extends Fragment implements Runnable
                        {
                                mLogView.beginBatchEdit();
                                for (String line : lines)
-                               {       /* strip off prefix (month=3, day=2, time=8, thread=2, spaces=3) */
-                                       mLogView.append((line.length() > 18 ? line.substring(18) : line) + '\n');
+                               {
+                                       if (getResources().getConfiguration().screenWidthDp < 600)
+                                       {       /* strip off prefix (month=3, day=2, time=8, thread=2, spaces=3) */
+                                               line = line.length() > 18 ? line.substring(18) : line;
+                                       }
+                                       mLogView.append(line + '\n');
                                }
                                mLogView.endBatchEdit();
                                /* calling autoScroll() directly does not work, probably because content