Fixed expanded state

This commit is contained in:
M66B 2019-05-31 09:37:28 +02:00
parent fd8e202e59
commit ea385e9788
1 changed files with 10 additions and 4 deletions

View File

@ -876,10 +876,9 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
values.get(name).remove(id);
if ("expanded".equals(name)) {
updateExpanded();
if (enabled)
handleExpand(id);
ibDown.setVisibility(values.get(name).size() > 0 ? View.VISIBLE : View.GONE);
ibUp.setVisibility(values.get(name).size() > 0 ? View.VISIBLE : View.GONE);
}
}
@ -2089,6 +2088,8 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
loadMessages(false);
updateExpanded();
if (selectionTracker != null && selectionTracker.hasSelection())
fabMore.show();
else
@ -2917,6 +2918,12 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
return false;
}
private void updateExpanded() {
boolean expanded = (values.containsKey("expanded") && values.get("expanded").size() > 0);
ibDown.setVisibility(expanded ? View.VISIBLE : View.GONE);
ibUp.setVisibility(expanded ? View.VISIBLE : View.GONE);
}
private void handleExpand(long id) {
Bundle args = new Bundle();
args.putLong("id", id);
@ -3226,8 +3233,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
boolean collapse = prefs.getBoolean("collapse", false);
if ((count == 1 && collapse) || count > 1) {
values.get("expanded").clear();
ibDown.setVisibility(View.GONE);
ibUp.setVisibility(View.GONE);
updateExpanded();
adapter.notifyDataSetChanged();
return true;
}