Improved error reporting

This commit is contained in:
M66B 2020-04-19 08:08:36 +02:00
parent f36fbe1544
commit a2b8feb836
1 changed files with 15 additions and 3 deletions

View File

@ -1132,7 +1132,6 @@ public class FragmentRule extends FragmentBase {
tvNoMessages.setVisibility(View.GONE);
rvMessage.setVisibility(View.GONE);
btnExecute.setVisibility(View.GONE);
pbWait.setVisibility(View.VISIBLE);
final Bundle args = new Bundle();
args.putLong("folder", folder);
@ -1197,6 +1196,16 @@ public class FragmentRule extends FragmentBase {
});
new SimpleTask<List<EntityMessage>>() {
@Override
protected void onPreExecute(Bundle args) {
pbWait.setVisibility(View.VISIBLE);
}
@Override
protected void onPostExecute(Bundle args) {
pbWait.setVisibility(View.GONE);
}
@Override
protected List<EntityMessage> onExecute(Context context, Bundle args) throws Throwable {
EntityRule rule = new EntityRule();
@ -1228,7 +1237,6 @@ public class FragmentRule extends FragmentBase {
protected void onExecuted(Bundle args, List<EntityMessage> messages) {
adapter.set(messages);
pbWait.setVisibility(View.GONE);
if (messages.size() > 0) {
rvMessage.setVisibility(View.VISIBLE);
btnExecute.setVisibility(View.VISIBLE);
@ -1238,6 +1246,10 @@ public class FragmentRule extends FragmentBase {
@Override
protected void onException(Bundle args, Throwable ex) {
if (ex instanceof IllegalArgumentException) {
tvNoMessages.setText(ex.getMessage());
tvNoMessages.setVisibility(View.VISIBLE);
} else
Log.unexpectedError(getParentFragmentManager(), ex);
}
}.execute(this, args, "rule:check");