[android] Add gap between attached image previews

parent 9eacbfa6
......@@ -10,12 +10,12 @@ import android.view.View;
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
import org.briarproject.briar.R;
import org.briarproject.briar.android.util.UiUtils;
import static org.briarproject.briar.android.conversation.ImageAdapter.isBottomRow;
import static org.briarproject.briar.android.conversation.ImageAdapter.isLeft;
import static org.briarproject.briar.android.conversation.ImageAdapter.isTopRow;
import static org.briarproject.briar.android.conversation.ImageAdapter.singleInRow;
import static org.briarproject.briar.android.util.UiUtils.isRtl;
@NotNullByDefault
class ImageItemDecoration extends ItemDecoration {
......@@ -35,7 +35,7 @@ class ImageItemDecoration extends ItemDecoration {
border = realBorderSize / 2;
// find out if we are showing a RTL language
isRtl = UiUtils.isRtl(ctx);
isRtl = isRtl(ctx);
}
@Override
......
......@@ -48,6 +48,7 @@ public class ImagePreview extends ConstraintLayout {
// find list
imageList = findViewById(R.id.imageList);
imageList.addItemDecoration(new ImagePreviewDecoration(context));
// set cancel listener
findViewById(R.id.imageCancelButton).setOnClickListener(view -> {
......
package org.briarproject.briar.android.view;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Rect;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.RecyclerView.ItemDecoration;
import android.support.v7.widget.RecyclerView.State;
import android.view.View;
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
import org.briarproject.briar.R;
@NotNullByDefault
class ImagePreviewDecoration extends ItemDecoration {
private final int border;
ImagePreviewDecoration(Context ctx) {
Resources res = ctx.getResources();
border = res.getDimensionPixelSize(R.dimen.message_bubble_border);
}
@Override
public void getItemOffsets(Rect outRect, View view, RecyclerView parent,
State state) {
if (state.getItemCount() == parent.getChildAdapterPosition(view) + 1) {
// no decoration for last item in the list
return;
}
outRect.right = border;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment