Hide inline attachments while composing

This commit is contained in:
M66B 2019-02-05 08:39:31 +00:00
parent 977b52e5eb
commit ad938572c3
3 changed files with 4 additions and 3 deletions

View File

@ -793,7 +793,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
bindAttachments(message, attachments);
}
};
liveAttachments = db.attachment().liveAttachments(message.id);
liveAttachments = db.attachment().liveAttachments(message.id, true);
liveAttachments.observe(owner, observerAttachments);
// Setup actions

View File

@ -30,8 +30,9 @@ import androidx.room.Query;
public interface DaoAttachment {
@Query("SELECT * FROM attachment" +
" WHERE message = :message" +
" AND (:inline OR disposition <> 'inline')" +
" ORDER BY sequence")
LiveData<List<EntityAttachment>> liveAttachments(long message);
LiveData<List<EntityAttachment>> liveAttachments(long message, boolean inline);
@Query("SELECT ifnull(MAX(sequence), 0)" +
" FROM attachment" +

View File

@ -1808,7 +1808,7 @@ public class FragmentCompose extends FragmentBase {
DB db = DB.getInstance(getContext());
db.attachment().liveAttachments(result.draft.id).observe(getViewLifecycleOwner(),
db.attachment().liveAttachments(result.draft.id, false).observe(getViewLifecycleOwner(),
new Observer<List<EntityAttachment>>() {
private int last_available = 0;