|
|
@ -200,31 +200,39 @@ public class FragmentMessage extends FragmentEx {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
fab.setOnClickListener(new View.OnClickListener() {
|
|
|
|
fab.setOnClickListener(new View.OnClickListener() {
|
|
|
|
private boolean addresses;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void onClick(View view) {
|
|
|
|
public void onClick(View view) {
|
|
|
|
free = (top_navigation.getVisibility() != View.GONE);
|
|
|
|
tvCount.setTag(tvCount.getVisibility());
|
|
|
|
|
|
|
|
tvError.setTag(tvError.getVisibility());
|
|
|
|
|
|
|
|
tvCc.setTag(grpAddresses.getVisibility());
|
|
|
|
|
|
|
|
rvAttachment.setTag(grpAddresses.getVisibility());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
free = true;
|
|
|
|
getActivity().invalidateOptionsMenu();
|
|
|
|
getActivity().invalidateOptionsMenu();
|
|
|
|
grpHeader.setVisibility(free ? View.GONE : View.VISIBLE);
|
|
|
|
grpHeader.setVisibility(free ? View.GONE : View.VISIBLE);
|
|
|
|
if (free) {
|
|
|
|
grpAddresses.setVisibility(View.GONE);
|
|
|
|
tvCount.setTag(tvCount.getVisibility());
|
|
|
|
grpAttachments.setVisibility(View.GONE);
|
|
|
|
tvError.setTag(tvError.getVisibility());
|
|
|
|
tvCount.setVisibility(View.GONE);
|
|
|
|
fab.setImageResource(R.drawable.baseline_fullscreen_exit_24);
|
|
|
|
tvError.setVisibility(View.GONE);
|
|
|
|
addresses = (grpAddresses.getVisibility() != View.GONE);
|
|
|
|
fab.setVisibility(View.GONE);
|
|
|
|
grpAddresses.setVisibility(View.GONE);
|
|
|
|
}
|
|
|
|
grpAttachments.setVisibility(View.GONE);
|
|
|
|
});
|
|
|
|
tvCount.setVisibility(View.GONE);
|
|
|
|
|
|
|
|
tvError.setVisibility(View.GONE);
|
|
|
|
((ActivityBase) getActivity()).addBackPressedListener(new ActivityBase.IBackPressedListener() {
|
|
|
|
} else {
|
|
|
|
@Override
|
|
|
|
fab.setImageResource(R.drawable.baseline_fullscreen_24);
|
|
|
|
public boolean onBackPressed() {
|
|
|
|
if (addresses)
|
|
|
|
if (free && isVisible()) {
|
|
|
|
grpAddresses.setVisibility(View.VISIBLE);
|
|
|
|
free = false;
|
|
|
|
if (rvAttachment.getAdapter().getItemCount() > 0)
|
|
|
|
getActivity().invalidateOptionsMenu();
|
|
|
|
grpAttachments.setVisibility(View.VISIBLE);
|
|
|
|
grpHeader.setVisibility(free ? View.GONE : View.VISIBLE);
|
|
|
|
tvCount.setVisibility((int) tvCount.getVisibility());
|
|
|
|
grpAddresses.setVisibility((int) tvCc.getTag());
|
|
|
|
tvError.setVisibility((int) tvError.getVisibility());
|
|
|
|
rvAttachment.setVisibility((int) rvAttachment.getTag());
|
|
|
|
|
|
|
|
tvCount.setVisibility((int) tvCount.getTag());
|
|
|
|
|
|
|
|
tvError.setVisibility((int) tvError.getTag());
|
|
|
|
|
|
|
|
fab.setVisibility(View.VISIBLE);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
@ -259,6 +267,7 @@ public class FragmentMessage extends FragmentEx {
|
|
|
|
grpMessage.setVisibility(View.GONE);
|
|
|
|
grpMessage.setVisibility(View.GONE);
|
|
|
|
tvCount.setVisibility(View.GONE);
|
|
|
|
tvCount.setVisibility(View.GONE);
|
|
|
|
tvError.setVisibility(View.GONE);
|
|
|
|
tvError.setVisibility(View.GONE);
|
|
|
|
|
|
|
|
fab.setVisibility(View.GONE);
|
|
|
|
pbWait.setVisibility(View.VISIBLE);
|
|
|
|
pbWait.setVisibility(View.VISIBLE);
|
|
|
|
|
|
|
|
|
|
|
|
rvAttachment.setHasFixedSize(false);
|
|
|
|
rvAttachment.setHasFixedSize(false);
|
|
|
@ -272,7 +281,15 @@ public class FragmentMessage extends FragmentEx {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
|
|
|
|
public void onSaveInstanceState(Bundle outState) {
|
|
|
|
|
|
|
|
outState.putBoolean("free", free);
|
|
|
|
|
|
|
|
outState.putInt("addresses", grpAddresses.getVisibility());
|
|
|
|
|
|
|
|
outState.putInt("attachments", rvAttachment.getVisibility());
|
|
|
|
|
|
|
|
super.onSaveInstanceState(outState);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void onActivityCreated(@Nullable final Bundle savedInstanceState) {
|
|
|
|
super.onActivityCreated(savedInstanceState);
|
|
|
|
super.onActivityCreated(savedInstanceState);
|
|
|
|
|
|
|
|
|
|
|
|
// Get arguments
|
|
|
|
// Get arguments
|
|
|
@ -376,11 +393,20 @@ public class FragmentMessage extends FragmentEx {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (savedInstanceState != null) {
|
|
|
|
|
|
|
|
free = savedInstanceState.getBoolean("free");
|
|
|
|
|
|
|
|
grpAddresses.setTag(savedInstanceState.getInt("addresses"));
|
|
|
|
|
|
|
|
rvAttachment.setTag(savedInstanceState.getInt("attachments"));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pbWait.setVisibility(View.GONE);
|
|
|
|
pbWait.setVisibility(View.GONE);
|
|
|
|
grpHeader.setVisibility(View.VISIBLE);
|
|
|
|
grpHeader.setVisibility(free ? View.GONE : View.VISIBLE);
|
|
|
|
|
|
|
|
if (free)
|
|
|
|
|
|
|
|
grpAddresses.setVisibility(View.GONE);
|
|
|
|
grpMessage.setVisibility(View.VISIBLE);
|
|
|
|
grpMessage.setVisibility(View.VISIBLE);
|
|
|
|
tvCount.setVisibility(message.count > 1 ? View.VISIBLE : View.GONE);
|
|
|
|
tvCount.setVisibility(!free && message.count > 1 ? View.VISIBLE : View.GONE);
|
|
|
|
tvError.setVisibility(message.error == null ? View.GONE : View.VISIBLE);
|
|
|
|
tvError.setVisibility(free || message.error == null ? View.GONE : View.VISIBLE);
|
|
|
|
|
|
|
|
fab.setVisibility(free ? View.GONE : View.VISIBLE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|