fix thumbnail click handling when batch selecting

Closes #4118
// FREEBIE
This commit is contained in:
Jake McGinty 2015-09-24 15:55:17 -07:00 committed by Moxie Marlinspike
parent ffae7a24f7
commit 14f7c2d7a1
1 changed files with 9 additions and 7 deletions

View File

@ -67,6 +67,7 @@ public class ThumbnailView extends FrameLayout {
inflate(context, R.layout.thumbnail_view, this);
radius = getResources().getDimensionPixelSize(R.dimen.message_bubble_corner_radius);
image = (ImageView) findViewById(R.id.thumbnail_image);
setOnClickListener(new ThumbnailClickDispatcher());
if (attrs != null) {
TypedArray typedArray = context.getTheme().obtainStyledAttributes(attrs, R.styleable.ThumbnailView, 0, 0);
@ -75,6 +76,12 @@ public class ThumbnailView extends FrameLayout {
}
}
@Override public void setClickable(boolean clickable) {
super.setClickable(clickable);
image.setClickable(clickable);
transferControls.setClickable(clickable);
}
@Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
super.onLayout(changed, left, top, right, bottom);
if (removeButton != null) {
@ -138,12 +145,6 @@ public class ThumbnailView extends FrameLayout {
this.slide = slide;
loadInto(slide, masterSecret, image);
if (this.slide.getTransferProgress() == PartDatabase.TRANSFER_PROGRESS_DONE) {
setOnClickListener(new ThumbnailClickDispatcher());
} else {
setOnClickListener(null);
}
if (!hideControls) {
getTransferControls().setSlide(slide);
getTransferControls().setDownloadClickListener(new DownloadClickDispatcher());
@ -291,7 +292,8 @@ public class ThumbnailView extends FrameLayout {
public void onClick(View view) {
if (thumbnailClickListener != null &&
slide != null &&
slide.getPart().getDataUri() != null)
slide.getPart().getDataUri() != null &&
slide.getTransferProgress() == PartDatabase.TRANSFER_PROGRESS_DONE)
{
thumbnailClickListener.onClick(view, slide);
}