|
|
@ -81,6 +81,7 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
|
|
|
|
private boolean primary;
|
|
|
|
private boolean primary;
|
|
|
|
private boolean show_compact;
|
|
|
|
private boolean show_compact;
|
|
|
|
private boolean show_hidden;
|
|
|
|
private boolean show_hidden;
|
|
|
|
|
|
|
|
private boolean show_flagged;
|
|
|
|
private boolean subscribed_only;
|
|
|
|
private boolean subscribed_only;
|
|
|
|
private IFolderSelectedListener listener;
|
|
|
|
private IFolderSelectedListener listener;
|
|
|
|
|
|
|
|
|
|
|
@ -128,9 +129,13 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
|
|
|
|
private ImageView ivSync;
|
|
|
|
private ImageView ivSync;
|
|
|
|
|
|
|
|
|
|
|
|
private TextView tvKeywords;
|
|
|
|
private TextView tvKeywords;
|
|
|
|
|
|
|
|
private TextView tvFlagged;
|
|
|
|
|
|
|
|
private ImageView ibFlagged;
|
|
|
|
|
|
|
|
|
|
|
|
private TextView tvError;
|
|
|
|
private TextView tvError;
|
|
|
|
private Button btnHelp;
|
|
|
|
private Button btnHelp;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Group grpFlagged;
|
|
|
|
private Group grpExtended;
|
|
|
|
private Group grpExtended;
|
|
|
|
|
|
|
|
|
|
|
|
private TwoStateOwner powner = new TwoStateOwner(owner, "FolderPopup");
|
|
|
|
private TwoStateOwner powner = new TwoStateOwner(owner, "FolderPopup");
|
|
|
@ -162,15 +167,23 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
|
|
|
|
ivSync = itemView.findViewById(R.id.ivSync);
|
|
|
|
ivSync = itemView.findViewById(R.id.ivSync);
|
|
|
|
|
|
|
|
|
|
|
|
tvKeywords = itemView.findViewById(R.id.tvKeywords);
|
|
|
|
tvKeywords = itemView.findViewById(R.id.tvKeywords);
|
|
|
|
|
|
|
|
tvFlagged = itemView.findViewById(R.id.tvFlagged);
|
|
|
|
|
|
|
|
ibFlagged = itemView.findViewById(R.id.ibFlagged);
|
|
|
|
|
|
|
|
|
|
|
|
tvError = itemView.findViewById(R.id.tvError);
|
|
|
|
tvError = itemView.findViewById(R.id.tvError);
|
|
|
|
btnHelp = itemView.findViewById(R.id.btnHelp);
|
|
|
|
btnHelp = itemView.findViewById(R.id.btnHelp);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
grpFlagged = itemView.findViewById(R.id.grpFlagged);
|
|
|
|
grpExtended = itemView.findViewById(R.id.grpExtended);
|
|
|
|
grpExtended = itemView.findViewById(R.id.grpExtended);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void wire() {
|
|
|
|
private void wire() {
|
|
|
|
view.setOnClickListener(this);
|
|
|
|
view.setOnClickListener(this);
|
|
|
|
ibExpander.setOnClickListener(this);
|
|
|
|
ibExpander.setOnClickListener(this);
|
|
|
|
|
|
|
|
if (tvFlagged != null)
|
|
|
|
|
|
|
|
tvFlagged.setOnClickListener(this);
|
|
|
|
|
|
|
|
if (ibFlagged != null)
|
|
|
|
|
|
|
|
ibFlagged.setOnClickListener(this);
|
|
|
|
if (listener == null)
|
|
|
|
if (listener == null)
|
|
|
|
view.setOnLongClickListener(this);
|
|
|
|
view.setOnLongClickListener(this);
|
|
|
|
if (btnHelp != null)
|
|
|
|
if (btnHelp != null)
|
|
|
@ -180,6 +193,10 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
|
|
|
|
private void unwire() {
|
|
|
|
private void unwire() {
|
|
|
|
view.setOnClickListener(null);
|
|
|
|
view.setOnClickListener(null);
|
|
|
|
ibExpander.setOnClickListener(null);
|
|
|
|
ibExpander.setOnClickListener(null);
|
|
|
|
|
|
|
|
if (tvFlagged != null)
|
|
|
|
|
|
|
|
tvFlagged.setOnClickListener(null);
|
|
|
|
|
|
|
|
if (ibFlagged != null)
|
|
|
|
|
|
|
|
ibFlagged.setOnClickListener(null);
|
|
|
|
if (listener == null)
|
|
|
|
if (listener == null)
|
|
|
|
view.setOnLongClickListener(null);
|
|
|
|
view.setOnLongClickListener(null);
|
|
|
|
if (btnHelp != null)
|
|
|
|
if (btnHelp != null)
|
|
|
@ -327,14 +344,19 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
|
|
|
|
folder.synchronize && folder.initialize != 0 && !EntityFolder.OUTBOX.equals(folder.type)
|
|
|
|
folder.synchronize && folder.initialize != 0 && !EntityFolder.OUTBOX.equals(folder.type)
|
|
|
|
? textColorPrimary : textColorSecondary));
|
|
|
|
? textColorPrimary : textColorSecondary));
|
|
|
|
|
|
|
|
|
|
|
|
tvKeywords.setText(TextUtils.join(" ", folder.keywords));
|
|
|
|
tvKeywords.setText(debug ? TextUtils.join(" ", folder.keywords) : null);
|
|
|
|
tvKeywords.setVisibility(debug && folder.keywords.length > 0 ? View.VISIBLE : View.GONE);
|
|
|
|
tvKeywords.setVisibility(
|
|
|
|
|
|
|
|
show_flagged || (debug && folder.keywords.length > 0)
|
|
|
|
|
|
|
|
? View.VISIBLE : View.GONE);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tvFlagged.setText(NF.format(folder.flagged));
|
|
|
|
|
|
|
|
|
|
|
|
tvError.setText(folder.error);
|
|
|
|
tvError.setText(folder.error);
|
|
|
|
tvError.setVisibility(folder.error != null ? View.VISIBLE : View.GONE);
|
|
|
|
tvError.setVisibility(folder.error != null ? View.VISIBLE : View.GONE);
|
|
|
|
if (btnHelp != null)
|
|
|
|
if (btnHelp != null)
|
|
|
|
btnHelp.setVisibility(folder.error == null ? View.GONE : View.VISIBLE);
|
|
|
|
btnHelp.setVisibility(folder.error == null ? View.GONE : View.VISIBLE);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
grpFlagged.setVisibility(show_compact || !show_flagged ? View.GONE : View.VISIBLE);
|
|
|
|
grpExtended.setVisibility(show_compact ? View.GONE : View.VISIBLE);
|
|
|
|
grpExtended.setVisibility(show_compact ? View.GONE : View.VISIBLE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -352,23 +374,29 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
|
|
|
|
if (folder.tbd != null)
|
|
|
|
if (folder.tbd != null)
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
if (view.getId() == R.id.ibExpander)
|
|
|
|
switch (view.getId()) {
|
|
|
|
onCollapse(folder);
|
|
|
|
case R.id.ibExpander:
|
|
|
|
else if (folder.selectable) {
|
|
|
|
onCollapse(folder);
|
|
|
|
if (listener == null) {
|
|
|
|
break;
|
|
|
|
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(context);
|
|
|
|
case R.id.tvFlagged:
|
|
|
|
lbm.sendBroadcast(
|
|
|
|
case R.id.ibFlagged:
|
|
|
|
new Intent(ActivityView.ACTION_VIEW_MESSAGES)
|
|
|
|
onFlagged(folder);
|
|
|
|
.putExtra("account", folder.account)
|
|
|
|
break;
|
|
|
|
.putExtra("folder", folder.id)
|
|
|
|
default:
|
|
|
|
.putExtra("type", folder.type));
|
|
|
|
if (listener == null) {
|
|
|
|
} else {
|
|
|
|
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(context);
|
|
|
|
if (folder.read_only)
|
|
|
|
lbm.sendBroadcast(
|
|
|
|
return;
|
|
|
|
new Intent(ActivityView.ACTION_VIEW_MESSAGES)
|
|
|
|
if (disabledIds.contains(folder.id))
|
|
|
|
.putExtra("account", folder.account)
|
|
|
|
return;
|
|
|
|
.putExtra("folder", folder.id)
|
|
|
|
listener.onFolderSelected(folder);
|
|
|
|
.putExtra("type", folder.type));
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
|
|
|
|
if (folder.read_only)
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (disabledIds.contains(folder.id))
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
listener.onFolderSelected(folder);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -403,6 +431,19 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
|
|
|
|
}.execute(context, owner, args, "folder:collapse");
|
|
|
|
}.execute(context, owner, args, "folder:collapse");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void onFlagged(TupleFolderEx folder) {
|
|
|
|
|
|
|
|
BoundaryCallbackMessages.SearchCriteria criteria = new BoundaryCallbackMessages.SearchCriteria();
|
|
|
|
|
|
|
|
criteria.in_senders = false;
|
|
|
|
|
|
|
|
criteria.in_recipients = false;
|
|
|
|
|
|
|
|
criteria.in_subject = false;
|
|
|
|
|
|
|
|
criteria.in_keywords = false;
|
|
|
|
|
|
|
|
criteria.in_message = false;
|
|
|
|
|
|
|
|
criteria.with_flagged = true;
|
|
|
|
|
|
|
|
FragmentMessages.search(
|
|
|
|
|
|
|
|
context, owner, parentFragment.getParentFragmentManager(),
|
|
|
|
|
|
|
|
folder.account, folder.id, false, criteria);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public boolean onLongClick(View v) {
|
|
|
|
public boolean onLongClick(View v) {
|
|
|
|
int pos = getAdapterPosition();
|
|
|
|
int pos = getAdapterPosition();
|
|
|
@ -741,16 +782,17 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
AdapterFolder(Fragment parentFragment, long account, boolean primary, boolean show_compact, boolean show_hidden, IFolderSelectedListener listener) {
|
|
|
|
AdapterFolder(Fragment parentFragment, long account, boolean primary, boolean show_compact, boolean show_hidden, boolean show_flagged, IFolderSelectedListener listener) {
|
|
|
|
this(parentFragment.getContext(), parentFragment.getViewLifecycleOwner(), account, primary, show_compact, show_hidden, listener);
|
|
|
|
this(parentFragment.getContext(), parentFragment.getViewLifecycleOwner(), account, primary, show_compact, show_hidden, show_flagged, listener);
|
|
|
|
this.parentFragment = parentFragment;
|
|
|
|
this.parentFragment = parentFragment;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
AdapterFolder(Context context, LifecycleOwner owner, long account, boolean primary, boolean show_compact, boolean show_hidden, IFolderSelectedListener listener) {
|
|
|
|
AdapterFolder(Context context, LifecycleOwner owner, long account, boolean primary, boolean show_compact, boolean show_hidden, boolean show_flagged, IFolderSelectedListener listener) {
|
|
|
|
this.account = account;
|
|
|
|
this.account = account;
|
|
|
|
this.primary = primary;
|
|
|
|
this.primary = primary;
|
|
|
|
this.show_compact = show_compact;
|
|
|
|
this.show_compact = show_compact;
|
|
|
|
this.show_hidden = show_hidden;
|
|
|
|
this.show_hidden = show_hidden;
|
|
|
|
|
|
|
|
this.show_flagged = show_flagged;
|
|
|
|
this.listener = listener;
|
|
|
|
this.listener = listener;
|
|
|
|
|
|
|
|
|
|
|
|
this.context = context;
|
|
|
|
this.context = context;
|
|
|
@ -800,6 +842,13 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void setShowFlagged(boolean show_flagged) {
|
|
|
|
|
|
|
|
if (this.show_flagged != show_flagged) {
|
|
|
|
|
|
|
|
this.show_flagged = show_flagged;
|
|
|
|
|
|
|
|
notifyDataSetChanged();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void setSubscribedOnly(boolean subscribed_only) {
|
|
|
|
void setSubscribedOnly(boolean subscribed_only) {
|
|
|
|
if (this.subscribed_only != subscribed_only) {
|
|
|
|
if (this.subscribed_only != subscribed_only) {
|
|
|
|
this.subscribed_only = subscribed_only;
|
|
|
|
this.subscribed_only = subscribed_only;
|
|
|
|