Small improvements

pull/206/head
M66B 3 years ago
parent d91851f08c
commit 5ef3736f65

@ -2214,6 +2214,7 @@ public class Log {
try (OutputStream os = new BufferedOutputStream(new FileOutputStream(file))) { try (OutputStream os = new BufferedOutputStream(new FileOutputStream(file))) {
for (SimpleTask task : SimpleTask.getList()) for (SimpleTask task : SimpleTask.getList())
size += write(os, String.format("%s\r\n", task.toString())); size += write(os, String.format("%s\r\n", task.toString()));
size += write(os, "\r\n");
for (TwoStateOwner owner : TwoStateOwner.getList()) for (TwoStateOwner owner : TwoStateOwner.getList())
size += write(os, String.format("%s\r\n", owner.toString())); size += write(os, String.format("%s\r\n", owner.toString()));
} }

@ -45,10 +45,12 @@ public class TwoStateOwner implements LifecycleOwner {
private static DateFormat DTF = SimpleDateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT); private static DateFormat DTF = SimpleDateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT);
private static List<TwoStateOwner> list = new ArrayList<>(); private static final List<TwoStateOwner> list = new ArrayList<>();
static List<TwoStateOwner> getList() { static List<TwoStateOwner> getList() {
return list; synchronized (list) {
return new ArrayList<>(list);
}
} }
// https://developer.android.com/topic/libraries/architecture/lifecycle#lc // https://developer.android.com/topic/libraries/architecture/lifecycle#lc
@ -91,7 +93,7 @@ public class TwoStateOwner implements LifecycleOwner {
list.add(this); list.add(this);
} }
} else } else
Log.i(this + " not owned"); Log.e(this + " not owned");
} }
void start() { void start() {

Loading…
Cancel
Save