Fix issue #369 - Spoiler removed when adding a media

This commit is contained in:
Thomas 2022-10-26 10:25:04 +02:00
parent d76d6990fd
commit 6bc184d49c
2 changed files with 11 additions and 2 deletions

View file

@ -109,6 +109,7 @@ public class Status implements Serializable, Cloneable {
public transient boolean setCursorToEnd = false;
public transient int cursorPosition = 0;
public transient boolean submitted = false;
public transient boolean spoilerChecked = false;
public enum PositionFetchMore {
TOP,

View file

@ -1229,11 +1229,19 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
holder.binding.buttonVisibility.setImageResource(R.drawable.ic_compose_visibility_public);
statusDraft.visibility = MastodonHelper.visibility.PUBLIC.name();
});
if (statusDraft.spoilerChecked) {
holder.binding.contentSpoiler.setVisibility(View.VISIBLE);
} else {
holder.binding.contentSpoiler.setVisibility(View.GONE);
}
holder.binding.buttonSensitive.setOnClickListener(v -> {
if (holder.binding.contentSpoiler.getVisibility() == View.VISIBLE)
if (holder.binding.contentSpoiler.getVisibility() == View.VISIBLE) {
statusDraft.spoilerChecked = false;
holder.binding.contentSpoiler.setVisibility(View.GONE);
else
} else {
holder.binding.contentSpoiler.setVisibility(View.VISIBLE);
statusDraft.spoilerChecked = true;
}
});
//Last compose drawer
buttonVisibility(holder);