|
|
|
@ -119,6 +119,8 @@ public class FragmentAccount extends FragmentBase {
|
|
|
|
|
private Spinner spArchive;
|
|
|
|
|
private Spinner spTrash;
|
|
|
|
|
private Spinner spJunk;
|
|
|
|
|
|
|
|
|
|
private ArrayAdapter<EntityFolder> adapterSwipe;
|
|
|
|
|
private Spinner spLeft;
|
|
|
|
|
private Spinner spRight;
|
|
|
|
|
|
|
|
|
@ -371,8 +373,12 @@ public class FragmentAccount extends FragmentBase {
|
|
|
|
|
spArchive.setAdapter(adapter);
|
|
|
|
|
spTrash.setAdapter(adapter);
|
|
|
|
|
spJunk.setAdapter(adapter);
|
|
|
|
|
spLeft.setAdapter(adapter);
|
|
|
|
|
spRight.setAdapter(adapter);
|
|
|
|
|
|
|
|
|
|
adapterSwipe = new ArrayAdapter<>(getContext(), R.layout.spinner_item1, android.R.id.text1, new ArrayList<EntityFolder>());
|
|
|
|
|
adapterSwipe.setDropDownViewResource(R.layout.spinner_item1_dropdown);
|
|
|
|
|
|
|
|
|
|
spLeft.setAdapter(adapterSwipe);
|
|
|
|
|
spRight.setAdapter(adapterSwipe);
|
|
|
|
|
|
|
|
|
|
addBackPressedListener(new ActivityBase.IBackPressedListener() {
|
|
|
|
|
@Override
|
|
|
|
@ -654,19 +660,20 @@ public class FragmentAccount extends FragmentBase {
|
|
|
|
|
EntityFolder left = (EntityFolder) spLeft.getSelectedItem();
|
|
|
|
|
EntityFolder right = (EntityFolder) spRight.getSelectedItem();
|
|
|
|
|
|
|
|
|
|
if (drafts != null && drafts.type == null)
|
|
|
|
|
if (drafts != null && drafts.id == 0L)
|
|
|
|
|
drafts = null;
|
|
|
|
|
if (sent != null && sent.type == null)
|
|
|
|
|
if (sent != null && sent.id == 0L)
|
|
|
|
|
sent = null;
|
|
|
|
|
if (archive != null && archive.type == null)
|
|
|
|
|
if (archive != null && archive.id == 0L)
|
|
|
|
|
archive = null;
|
|
|
|
|
if (trash != null && trash.type == null)
|
|
|
|
|
if (trash != null && trash.id == 0L)
|
|
|
|
|
trash = null;
|
|
|
|
|
if (junk != null && junk.type == null)
|
|
|
|
|
if (junk != null && junk.id == 0L)
|
|
|
|
|
junk = null;
|
|
|
|
|
if (left != null && left.type == null)
|
|
|
|
|
|
|
|
|
|
if (left != null && left.id == 0L)
|
|
|
|
|
left = null;
|
|
|
|
|
if (right != null && right.type == null)
|
|
|
|
|
if (right != null && right.id == 0L)
|
|
|
|
|
right = null;
|
|
|
|
|
|
|
|
|
|
Bundle args = new Bundle();
|
|
|
|
@ -828,9 +835,9 @@ public class FragmentAccount extends FragmentBase {
|
|
|
|
|
if (!Objects.equals(ejunk == null ? null : ejunk.id, junk == null ? null : junk.id))
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
if (!Objects.equals(account.swipe_left, left == null ? null : left.id == null ? -1L : left.id))
|
|
|
|
|
if (!Objects.equals(account.swipe_left, left == null ? null : left.id))
|
|
|
|
|
return true;
|
|
|
|
|
if (!Objects.equals(account.swipe_right, right == null ? null : right.id == null ? -1L : right.id))
|
|
|
|
|
if (!Objects.equals(account.swipe_right, right == null ? null : right.id))
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
if (account.error != null)
|
|
|
|
@ -973,7 +980,7 @@ public class FragmentAccount extends FragmentBase {
|
|
|
|
|
folders.add(junk);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (left != null) {
|
|
|
|
|
if (left != null && left.id > 0) {
|
|
|
|
|
boolean found = false;
|
|
|
|
|
for (EntityFolder folder : folders)
|
|
|
|
|
if (left.name.equals(folder.name)) {
|
|
|
|
@ -986,7 +993,7 @@ public class FragmentAccount extends FragmentBase {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (right != null) {
|
|
|
|
|
if (right != null && right.id > 0) {
|
|
|
|
|
boolean found = false;
|
|
|
|
|
for (EntityFolder folder : folders)
|
|
|
|
|
if (right.name.equals(folder.name)) {
|
|
|
|
@ -1323,24 +1330,13 @@ public class FragmentAccount extends FragmentBase {
|
|
|
|
|
folders.add(folder);
|
|
|
|
|
|
|
|
|
|
EntityFolder none = new EntityFolder();
|
|
|
|
|
none.id = -1L;
|
|
|
|
|
none.id = 0L;
|
|
|
|
|
none.name = "-";
|
|
|
|
|
folders.add(0, none);
|
|
|
|
|
|
|
|
|
|
adapter.clear();
|
|
|
|
|
adapter.addAll(folders);
|
|
|
|
|
|
|
|
|
|
Long left = (account == null ? null : account.swipe_left);
|
|
|
|
|
Long right = (account == null ? null : account.swipe_right);
|
|
|
|
|
|
|
|
|
|
String leftDefault = EntityFolder.TRASH;
|
|
|
|
|
String rightDefault = EntityFolder.TRASH;
|
|
|
|
|
for (EntityFolder folder : folders)
|
|
|
|
|
if (EntityFolder.ARCHIVE.equals(folder.type)) {
|
|
|
|
|
rightDefault = folder.type;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (int pos = 0; pos < folders.size(); pos++) {
|
|
|
|
|
EntityFolder folder = folders.get(pos);
|
|
|
|
|
|
|
|
|
@ -1354,6 +1350,29 @@ public class FragmentAccount extends FragmentBase {
|
|
|
|
|
spTrash.setSelection(pos);
|
|
|
|
|
else if (EntityFolder.JUNK.equals(folder.type))
|
|
|
|
|
spJunk.setSelection(pos);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
EntityFolder ask = new EntityFolder();
|
|
|
|
|
ask.id = -1L;
|
|
|
|
|
ask.name = getString(R.string.title_ask_what);
|
|
|
|
|
folders.add(1, ask);
|
|
|
|
|
|
|
|
|
|
adapterSwipe.clear();
|
|
|
|
|
adapterSwipe.addAll(folders);
|
|
|
|
|
|
|
|
|
|
Long left = (account == null ? null : account.swipe_left);
|
|
|
|
|
Long right = (account == null ? null : account.swipe_right);
|
|
|
|
|
|
|
|
|
|
String leftDefault = EntityFolder.TRASH;
|
|
|
|
|
String rightDefault = EntityFolder.TRASH;
|
|
|
|
|
for (EntityFolder folder : folders)
|
|
|
|
|
if (EntityFolder.ARCHIVE.equals(folder.type)) {
|
|
|
|
|
rightDefault = folder.type;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (int pos = 0; pos < folders.size(); pos++) {
|
|
|
|
|
EntityFolder folder = folders.get(pos);
|
|
|
|
|
|
|
|
|
|
if (left == null ? (account == null && leftDefault.equals(folder.type)) : left.equals(folder.id))
|
|
|
|
|
spLeft.setSelection(pos);
|
|
|
|
|