Merge UI code into async

This commit is contained in:
topjohnwu 2016-11-08 00:04:22 +08:00
parent 793269731d
commit 0a37d1c15c

View File

@ -57,7 +57,7 @@ public class LogFragment extends Fragment {
txtLog.setTextIsSelectable(true);
reloadErrorLog();
new LogManager().read();
return view;
}
@ -66,7 +66,7 @@ public class LogFragment extends Fragment {
public void onResume() {
super.onResume();
setHasOptionsMenu(true);
reloadErrorLog();
new LogManager().read();
}
@Override
@ -79,7 +79,7 @@ public class LogFragment extends Fragment {
mClickedMenuItem = item;
switch (item.getItemId()) {
case R.id.menu_refresh:
reloadErrorLog();
new LogManager().read();
return true;
case R.id.menu_send:
new LogManager().send();
@ -95,12 +95,6 @@ public class LogFragment extends Fragment {
}
}
private void reloadErrorLog() {
new LogManager().read();
svLog.post(() -> svLog.scrollTo(0, txtLog.getHeight()));
hsvLog.post(() -> hsvLog.scrollTo(0, 0));
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
@ -197,6 +191,8 @@ public class LogFragment extends Fragment {
txtLog.setText(R.string.log_is_empty);
else
txtLog.setText(llog);
svLog.post(() -> svLog.scrollTo(0, txtLog.getHeight()));
hsvLog.post(() -> hsvLog.scrollTo(0, 0));
break;
case 2:
bool = (boolean) o;