From: Tobias Brunner Date: Fri, 29 Jun 2018 10:50:31 +0000 (+0200) Subject: android: Show date/thread prefix in log view if we have enough space X-Git-Tag: 5.7.0dr5~20^2~4 X-Git-Url: http://git.ipfire.org/?p=thirdparty%2Fstrongswan.git;a=commitdiff_plain;h=27cf3e666e40ef1571e5454daf313376a15a225d android: Show date/thread prefix in log view if we have enough space 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. --- diff --git a/src/frontends/android/app/src/main/java/org/strongswan/android/ui/LogFragment.java b/src/frontends/android/app/src/main/java/org/strongswan/android/ui/LogFragment.java index f68d0c617e..2dda82a57f 100644 --- a/src/frontends/android/app/src/main/java/org/strongswan/android/ui/LogFragment.java +++ b/src/frontends/android/app/src/main/java/org/strongswan/android/ui/LogFragment.java @@ -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