mirror of
https://github.com/M66B/FairEmail.git
synced 2024-12-26 09:47:13 +00:00
Refactoring
This commit is contained in:
parent
9c188ce73e
commit
6a3f908bc3
1 changed files with 16 additions and 13 deletions
|
@ -197,19 +197,22 @@ public class FragmentOrder extends FragmentBase {
|
||||||
final boolean reset = args.getBoolean("reset");
|
final boolean reset = args.getBoolean("reset");
|
||||||
final long[] ids = args.getLongArray("ids");
|
final long[] ids = args.getLongArray("ids");
|
||||||
|
|
||||||
final DB db = DB.getInstance(context);
|
DB db = DB.getInstance(context);
|
||||||
db.runInTransaction(new Runnable() {
|
try {
|
||||||
@Override
|
db.beginTransaction();
|
||||||
public void run() {
|
|
||||||
for (int i = 0; i < ids.length; i++)
|
for (int i = 0; i < ids.length; i++)
|
||||||
if (EntityAccount.class.getName().equals(clazz))
|
if (EntityAccount.class.getName().equals(clazz))
|
||||||
db.account().setAccountOrder(ids[i], reset ? null : i);
|
db.account().setAccountOrder(ids[i], reset ? null : i);
|
||||||
else if (TupleFolderSort.class.getName().equals(clazz))
|
else if (TupleFolderSort.class.getName().equals(clazz))
|
||||||
db.folder().setFolderOrder(ids[i], reset ? null : i);
|
db.folder().setFolderOrder(ids[i], reset ? null : i);
|
||||||
else
|
else
|
||||||
throw new IllegalArgumentException("Unknown class=" + clazz);
|
throw new IllegalArgumentException("Unknown class=" + clazz);
|
||||||
}
|
|
||||||
});
|
db.setTransactionSuccessful();
|
||||||
|
} finally {
|
||||||
|
db.endTransaction();
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue