Refactoring

This commit is contained in:
M66B 2022-04-16 20:39:46 +02:00
parent 67d5cb97e3
commit 74fa856ff0
1 changed files with 68 additions and 68 deletions

View File

@ -6527,7 +6527,18 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
return; return;
} }
SimpleTask<Void> move = new SimpleTask<Void>() { String title = getString(R.string.title_move_undo, getNames(result, true), result.size());
((ActivityView) activity).undo(title, args, taskUndoMove, taskUndoShow);
}
@Override
protected void onException(Bundle args, Throwable ex) {
Log.unexpectedError(getParentFragmentManager(), ex);
}
}.execute(this, args, "undo:hide");
}
private static final SimpleTask<Void> taskUndoMove = new SimpleTask<Void>() {
@Override @Override
protected Void onExecute(Context context, Bundle args) { protected Void onExecute(Context context, Bundle args) {
ArrayList<MessageTarget> result = args.getParcelableArrayList("result"); ArrayList<MessageTarget> result = args.getParcelableArrayList("result");
@ -6563,7 +6574,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
} }
}; };
SimpleTask<Void> show = new SimpleTask<Void>() { private static final SimpleTask<Void> taskUndoShow = new SimpleTask<Void>() {
@Override @Override
protected Void onExecute(Context context, Bundle args) { protected Void onExecute(Context context, Bundle args) {
ArrayList<MessageTarget> result = args.getParcelableArrayList("result"); ArrayList<MessageTarget> result = args.getParcelableArrayList("result");
@ -6594,17 +6605,6 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
} }
}; };
String title = getString(R.string.title_move_undo, getNames(result, true), result.size());
((ActivityView) activity).undo(title, args, move, show);
}
@Override
protected void onException(Bundle args, Throwable ex) {
Log.unexpectedError(getParentFragmentManager(), ex);
}
}.execute(this, args, "undo:hide");
}
private static String getNames(ArrayList<MessageTarget> result, boolean dest) { private static String getNames(ArrayList<MessageTarget> result, boolean dest) {
boolean across = false; boolean across = false;
for (MessageTarget target : result) for (MessageTarget target : result)