Allow server search in other account/folder

pull/210/head
M66B 2 years ago
parent f8431041d3
commit b901fde5f2

@ -1584,15 +1584,15 @@ public class FragmentMessages extends FragmentBase
fabSearch.setOnClickListener(new View.OnClickListener() { fabSearch.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
if (folder > 0) { if (folder > 0 && !server) {
search(getContext(), getViewLifecycleOwner(), getParentFragmentManager(), search(getContext(), getViewLifecycleOwner(), getParentFragmentManager(),
account, folder, true, criteria); account, folder, true, criteria);
return; return;
} }
Bundle args = new Bundle(); Bundle args = new Bundle();
args.putLong("account", account); args.putLong("account", server ? -1L : account);
args.putLong("folder", folder); args.putLong("folder", server ? -1L : folder);
new SimpleTask<List<EntityAccount>>() { new SimpleTask<List<EntityAccount>>() {
@Override @Override
@ -1610,7 +1610,7 @@ public class FragmentMessages extends FragmentBase
result.add(account); result.add(account);
} }
if (folder > 0) { if (fid > 0) {
EntityFolder folder = db.folder().getFolder(fid); EntityFolder folder = db.folder().getFolder(fid);
if (folder != null) if (folder != null)
args.putString("folderName", folder.getDisplayName(context)); args.putString("folderName", folder.getDisplayName(context));
@ -1626,7 +1626,7 @@ public class FragmentMessages extends FragmentBase
protected void onExecuted(Bundle args, List<EntityAccount> accounts) { protected void onExecuted(Bundle args, List<EntityAccount> accounts) {
if (accounts.size() == 1) { if (accounts.size() == 1) {
EntityAccount account = accounts.get(0); EntityAccount account = accounts.get(0);
if (account.isGmail()) if (account.isGmail() && !server)
searchArchive(account.id); searchArchive(account.id);
else else
searchAccount(account.id); searchAccount(account.id);
@ -1656,7 +1656,7 @@ public class FragmentMessages extends FragmentBase
long account = intent.getLongExtra("account", -1); long account = intent.getLongExtra("account", -1);
boolean gmail = intent.getBooleanExtra("gmail", false); boolean gmail = intent.getBooleanExtra("gmail", false);
if (gmail) if (gmail && !server)
searchArchive(account); searchArchive(account);
else else
searchAccount(account); searchAccount(account);
@ -1776,24 +1776,29 @@ public class FragmentMessages extends FragmentBase
else else
fabCompose.hide(); fabCompose.hide();
if (viewType == AdapterMessage.ViewType.SEARCH && criteria != null && !server) { if (viewType != AdapterMessage.ViewType.SEARCH ||
if (criteria.with_hidden || criteria == null ||
criteria.with_encrypted || criteria.with_hidden ||
criteria.with_attachments || criteria.with_encrypted ||
criteria.with_notes || criteria.with_attachments ||
criteria.with_types != null) { criteria.with_notes ||
fabSearch.hide(); criteria.with_types != null) {
fabSearch.hide();
if (animator != null && animator.isStarted())
animator.end();
} else {
fabSearch.setBackgroundTintList(ColorStateList.valueOf(
Helper.resolveColor(getContext(), server
? R.attr.colorSeparator
: R.attr.colorFabBackground)));
fabSearch.show();
if (server) {
if (animator != null && animator.isStarted()) if (animator != null && animator.isStarted())
animator.end(); animator.end();
} else { } else {
fabSearch.show();
if (animator != null && !animator.isStarted()) if (animator != null && !animator.isStarted())
animator.start(); animator.start();
} }
} else {
fabSearch.hide();
if (animator != null && animator.isStarted())
animator.end();
} }
fabMore.hide(); fabMore.hide();

Loading…
Cancel
Save