mirror of
https://github.com/M66B/FairEmail.git
synced 2024-12-27 10:17:18 +00:00
Fixed crash
This commit is contained in:
parent
228fa30aab
commit
ceff530cf5
1 changed files with 48 additions and 26 deletions
|
@ -192,20 +192,22 @@ public class FragmentMessage extends FragmentEx {
|
||||||
fab.setOnClickListener(new View.OnClickListener() {
|
fab.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
tvCount.setTag(tvCount.getVisibility());
|
|
||||||
tvError.setTag(tvError.getVisibility());
|
|
||||||
tvCc.setTag(grpAddresses.getVisibility());
|
|
||||||
rvAttachment.setTag(grpAddresses.getVisibility());
|
|
||||||
|
|
||||||
free = true;
|
free = true;
|
||||||
getActivity().invalidateOptionsMenu();
|
getActivity().invalidateOptionsMenu();
|
||||||
grpHeader.setVisibility(free ? View.GONE : View.VISIBLE);
|
|
||||||
grpAddresses.setVisibility(View.GONE);
|
grpHeader.setVisibility(View.GONE);
|
||||||
grpAttachments.setVisibility(View.GONE);
|
|
||||||
tvCount.setVisibility(View.GONE);
|
|
||||||
tvError.setVisibility(View.GONE);
|
|
||||||
vSeparatorBody.setVisibility(View.GONE);
|
vSeparatorBody.setVisibility(View.GONE);
|
||||||
fab.setVisibility(View.GONE);
|
fab.setVisibility(View.GONE);
|
||||||
|
|
||||||
|
tvCount.setTag(tvCount.getVisibility());
|
||||||
|
tvCc.setTag(grpAddresses.getVisibility());
|
||||||
|
rvAttachment.setTag(grpAttachments.getVisibility());
|
||||||
|
tvError.setTag(tvError.getVisibility());
|
||||||
|
|
||||||
|
tvCount.setVisibility(View.GONE);
|
||||||
|
grpAddresses.setVisibility(View.GONE);
|
||||||
|
grpAttachments.setVisibility(View.GONE);
|
||||||
|
tvError.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -215,13 +217,16 @@ public class FragmentMessage extends FragmentEx {
|
||||||
if (free && isVisible()) {
|
if (free && isVisible()) {
|
||||||
free = false;
|
free = false;
|
||||||
getActivity().invalidateOptionsMenu();
|
getActivity().invalidateOptionsMenu();
|
||||||
grpHeader.setVisibility(free ? View.GONE : View.VISIBLE);
|
|
||||||
grpAddresses.setVisibility((int) tvCc.getTag());
|
grpHeader.setVisibility(View.VISIBLE);
|
||||||
rvAttachment.setVisibility((int) rvAttachment.getTag());
|
|
||||||
tvCount.setVisibility((int) tvCount.getTag());
|
|
||||||
tvError.setVisibility((int) tvError.getTag());
|
|
||||||
vSeparatorBody.setVisibility(View.VISIBLE);
|
vSeparatorBody.setVisibility(View.VISIBLE);
|
||||||
fab.setVisibility(View.VISIBLE);
|
fab.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
|
tvCount.setVisibility((int) tvCount.getTag());
|
||||||
|
grpAddresses.setVisibility((int) tvCc.getTag());
|
||||||
|
grpAttachments.setVisibility((int) rvAttachment.getTag());
|
||||||
|
tvError.setVisibility((int) tvError.getTag());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -279,8 +284,12 @@ public class FragmentMessage extends FragmentEx {
|
||||||
public void onSaveInstanceState(Bundle outState) {
|
public void onSaveInstanceState(Bundle outState) {
|
||||||
super.onSaveInstanceState(outState);
|
super.onSaveInstanceState(outState);
|
||||||
outState.putBoolean("free", free);
|
outState.putBoolean("free", free);
|
||||||
outState.putInt("addresses", grpAddresses.getVisibility());
|
if (free) {
|
||||||
outState.putInt("attachments", rvAttachment.getVisibility());
|
outState.putInt("tag_count", (int) tvCount.getTag());
|
||||||
|
outState.putInt("tag_cc", (int) tvCc.getTag());
|
||||||
|
outState.putInt("tag_attachment", (int) rvAttachment.getTag());
|
||||||
|
outState.putInt("tag_error", (int) tvError.getTag());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -322,8 +331,12 @@ public class FragmentMessage extends FragmentEx {
|
||||||
tvError.setText(message.error);
|
tvError.setText(message.error);
|
||||||
} else {
|
} else {
|
||||||
free = savedInstanceState.getBoolean("free");
|
free = savedInstanceState.getBoolean("free");
|
||||||
grpAddresses.setTag(savedInstanceState.getInt("addresses"));
|
if (free) {
|
||||||
rvAttachment.setTag(savedInstanceState.getInt("attachments"));
|
tvCount.setTag(savedInstanceState.getInt("tag_count"));
|
||||||
|
tvCc.setTag(savedInstanceState.getInt("tag_cc"));
|
||||||
|
rvAttachment.setTag(savedInstanceState.getInt("tag_attachment"));
|
||||||
|
tvError.setTag(savedInstanceState.getInt("tag_error"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
|
@ -358,6 +371,22 @@ public class FragmentMessage extends FragmentEx {
|
||||||
tvFrom.setTextColor(colorUnseen);
|
tvFrom.setTextColor(colorUnseen);
|
||||||
tvTime.setTextColor(colorUnseen);
|
tvTime.setTextColor(colorUnseen);
|
||||||
|
|
||||||
|
pbWait.setVisibility(View.GONE);
|
||||||
|
|
||||||
|
grpHeader.setVisibility(free ? View.GONE : View.VISIBLE);
|
||||||
|
vSeparatorBody.setVisibility(free ? View.GONE : View.VISIBLE);
|
||||||
|
fab.setVisibility(free ? View.GONE : View.VISIBLE);
|
||||||
|
|
||||||
|
if (free) {
|
||||||
|
tvCount.setVisibility((int) tvCount.getTag());
|
||||||
|
grpAddresses.setVisibility((int) tvCc.getTag());
|
||||||
|
grpAttachments.setVisibility((int) rvAttachment.getTag());
|
||||||
|
tvError.setVisibility((int) tvError.getTag());
|
||||||
|
} else {
|
||||||
|
tvCount.setVisibility(!free && message.count > 1 ? View.VISIBLE : View.GONE);
|
||||||
|
tvError.setVisibility(free || message.error == null ? View.GONE : View.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
db.folder().liveFolders(message.account).removeObservers(getViewLifecycleOwner());
|
db.folder().liveFolders(message.account).removeObservers(getViewLifecycleOwner());
|
||||||
db.folder().liveFolders(message.account).observe(getViewLifecycleOwner(), new Observer<List<TupleFolderEx>>() {
|
db.folder().liveFolders(message.account).observe(getViewLifecycleOwner(), new Observer<List<TupleFolderEx>>() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -397,13 +426,6 @@ public class FragmentMessage extends FragmentEx {
|
||||||
bottom_navigation.setVisibility(View.VISIBLE);
|
bottom_navigation.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
pbWait.setVisibility(View.GONE);
|
|
||||||
grpHeader.setVisibility(free ? View.GONE : View.VISIBLE);
|
|
||||||
if (free)
|
|
||||||
grpAddresses.setVisibility(View.GONE);
|
|
||||||
tvCount.setVisibility(!free && message.count > 1 ? View.VISIBLE : View.GONE);
|
|
||||||
tvError.setVisibility(free || message.error == null ? View.GONE : View.VISIBLE);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue