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.
This commit is contained in:
Tobias Brunner
2018-07-03 11:31:44 +02:00
parent 19c95c9bc4
commit 27cf3e666e
@@ -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