|
|
|
@ -1469,16 +1469,36 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
|
|
|
|
values.get(name).add(id);
|
|
|
|
|
} else
|
|
|
|
|
values.get(name).remove(id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean getValue(String name, long id) {
|
|
|
|
|
if (values.containsKey(name))
|
|
|
|
|
return values.get(name).contains(id);
|
|
|
|
|
else if ("addresses".equals(name))
|
|
|
|
|
return !addresses;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setExpanded(TupleMessageEx message, boolean value) {
|
|
|
|
|
// Prevent flicker
|
|
|
|
|
if (value &&
|
|
|
|
|
message.accountProtocol != EntityAccount.TYPE_IMAP ||
|
|
|
|
|
(message.accountAutoSeen && !message.ui_seen && !message.folderReadOnly)) {
|
|
|
|
|
message.unseen = 0;
|
|
|
|
|
message.ui_seen = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
setValue("expanded", message.id, value);
|
|
|
|
|
|
|
|
|
|
if ("expanded".equals(name)) {
|
|
|
|
|
// Collapse other messages
|
|
|
|
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
|
|
|
|
boolean expand_all = prefs.getBoolean("expand_all", false);
|
|
|
|
|
boolean expand_one = prefs.getBoolean("expand_one", true);
|
|
|
|
|
if (!expand_all && expand_one) {
|
|
|
|
|
for (Long other : new ArrayList<>(values.get(name)))
|
|
|
|
|
for (Long other : new ArrayList<>(values.get("expanded")))
|
|
|
|
|
if (!other.equals(id)) {
|
|
|
|
|
values.get(name).remove(other);
|
|
|
|
|
values.get("expanded").remove(other);
|
|
|
|
|
int pos = adapter.getPositionForKey(other);
|
|
|
|
|
if (pos != RecyclerView.NO_POSITION)
|
|
|
|
|
adapter.notifyItemChanged(pos);
|
|
|
|
@ -1486,19 +1506,9 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
updateExpanded();
|
|
|
|
|
if (enabled)
|
|
|
|
|
if (value)
|
|
|
|
|
handleExpand(id);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean getValue(String name, long id) {
|
|
|
|
|
if (values.containsKey(name))
|
|
|
|
|
return values.get(name).contains(id);
|
|
|
|
|
else if ("addresses".equals(name))
|
|
|
|
|
return !addresses;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void setSize(long id, Float size) {
|
|
|
|
@ -3769,16 +3779,8 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
|
|
|
|
expand = messages.get(0);
|
|
|
|
|
|
|
|
|
|
if (expand != null &&
|
|
|
|
|
(expand.content || unmetered || (expand.size != null && expand.size < download))) {
|
|
|
|
|
// Prevent flicker
|
|
|
|
|
if (expand.accountProtocol != EntityAccount.TYPE_IMAP ||
|
|
|
|
|
(expand.accountAutoSeen && !expand.ui_seen && !expand.folderReadOnly)) {
|
|
|
|
|
expand.unseen = 0;
|
|
|
|
|
expand.ui_seen = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
iProperties.setValue("expanded", expand.id, true);
|
|
|
|
|
}
|
|
|
|
|
(expand.content || unmetered || (expand.size != null && expand.size < download)))
|
|
|
|
|
iProperties.setExpanded(expand, true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Auto expand all seen messages
|
|
|
|
@ -3786,7 +3788,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
|
|
|
|
if (expand_all)
|
|
|
|
|
for (TupleMessageEx message : messages)
|
|
|
|
|
if (message != null && message.ui_seen)
|
|
|
|
|
iProperties.setValue("expanded", message.id, true);
|
|
|
|
|
iProperties.setExpanded(message, true);
|
|
|
|
|
} else {
|
|
|
|
|
if (autoCloseCount > 0 && (autoclose || onclose != null)) {
|
|
|
|
|
int count = 0;
|
|
|
|
|