mirror of
https://github.com/M66B/FairEmail.git
synced 2025-01-01 04:35:57 +00:00
Cleanup
This commit is contained in:
parent
ad07bda9d6
commit
68ae1dbafc
1 changed files with 0 additions and 53 deletions
|
@ -67,7 +67,6 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
|
||||||
private LayoutInflater inflater;
|
private LayoutInflater inflater;
|
||||||
private LifecycleOwner owner;
|
private LifecycleOwner owner;
|
||||||
private boolean show_hidden;
|
private boolean show_hidden;
|
||||||
private boolean reorder = false;
|
|
||||||
|
|
||||||
private long account;
|
private long account;
|
||||||
private int level;
|
private int level;
|
||||||
|
@ -372,9 +371,6 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onLongClick(View v) {
|
public boolean onLongClick(View v) {
|
||||||
if (reorder)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
int pos = getAdapterPosition();
|
int pos = getAdapterPosition();
|
||||||
if (pos == RecyclerView.NO_POSITION)
|
if (pos == RecyclerView.NO_POSITION)
|
||||||
return false;
|
return false;
|
||||||
|
@ -701,10 +697,6 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void setReorder(boolean reorder) {
|
|
||||||
this.reorder = reorder;
|
|
||||||
}
|
|
||||||
|
|
||||||
private class DiffCallback extends DiffUtil.Callback {
|
private class DiffCallback extends DiffUtil.Callback {
|
||||||
private List<TupleFolderEx> prev = new ArrayList<>();
|
private List<TupleFolderEx> prev = new ArrayList<>();
|
||||||
private List<TupleFolderEx> next = new ArrayList<>();
|
private List<TupleFolderEx> next = new ArrayList<>();
|
||||||
|
@ -749,51 +741,6 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
|
||||||
return items.size();
|
return items.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
void onMove(int from, int to) {
|
|
||||||
if (from < 0 || from >= items.size() ||
|
|
||||||
to < 0 || to >= items.size())
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (from < to)
|
|
||||||
for (int i = from; i < to; i++)
|
|
||||||
Collections.swap(items, i, i + 1);
|
|
||||||
else
|
|
||||||
for (int i = from; i > to; i--)
|
|
||||||
Collections.swap(items, i, i - 1);
|
|
||||||
notifyItemMoved(from, to);
|
|
||||||
|
|
||||||
List<Long> order = new ArrayList<>();
|
|
||||||
for (int i = 0; i < items.size(); i++)
|
|
||||||
order.add(items.get(i).id);
|
|
||||||
|
|
||||||
Bundle args = new Bundle();
|
|
||||||
args.putLongArray("order", Helper.toLongArray(order));
|
|
||||||
|
|
||||||
new SimpleTask<Void>() {
|
|
||||||
@Override
|
|
||||||
protected Void onExecute(Context context, Bundle args) {
|
|
||||||
final long[] order = args.getLongArray("order");
|
|
||||||
|
|
||||||
final DB db = DB.getInstance(context);
|
|
||||||
db.runInTransaction(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
for (int i = 0; i < order.length; i++)
|
|
||||||
db.folder().setFolderOrder(order[i], i);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onException(Bundle args, Throwable ex) {
|
|
||||||
Helper.unexpectedError(context, owner, ex);
|
|
||||||
|
|
||||||
}
|
|
||||||
}.execute(context, owner, args, "folders:order");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@NonNull
|
@NonNull
|
||||||
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
|
|
Loading…
Reference in a new issue