Fix issue 1034 (received images can't be viewed in native gallery right after being downloaded)
This commit is contained in:
parent
5d9f5a3a7f
commit
24bf8520ed
2 changed files with 11 additions and 4 deletions
|
@ -392,7 +392,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
||||||
|
|
||||||
private void displayImageMessage(int id, Bitmap image, long time, boolean isIncoming, LinphoneChatMessage.State status, RelativeLayout layout, final String url, boolean show) {
|
private void displayImageMessage(int id, Bitmap image, long time, boolean isIncoming, LinphoneChatMessage.State status, RelativeLayout layout, final String url, boolean show) {
|
||||||
id = checkId(id);
|
id = checkId(id);
|
||||||
BubbleChat bubble = new BubbleChat(layout.getContext(), id, null, image, time, isIncoming, status, url, previousMessageID);
|
final BubbleChat bubble = new BubbleChat(layout.getContext(), id, null, image, time, isIncoming, status, url, previousMessageID);
|
||||||
if (!isIncoming) {
|
if (!isIncoming) {
|
||||||
lastSentMessageBubble = bubble;
|
lastSentMessageBubble = bubble;
|
||||||
}
|
}
|
||||||
|
@ -411,7 +411,8 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
||||||
final Bitmap bm = ChatFragment.downloadImage(url);
|
final Bitmap bm = ChatFragment.downloadImage(url);
|
||||||
if (bm != null) {
|
if (bm != null) {
|
||||||
if (useLinphoneMessageStorage) {
|
if (useLinphoneMessageStorage) {
|
||||||
saveImage(bm, finalId, null);
|
String newFileUrl = saveImage(bm, finalId, null);
|
||||||
|
bubble.updateUrl(newFileUrl);
|
||||||
} else {
|
} else {
|
||||||
LinphoneActivity.instance().getChatStorage().saveImage(finalId, bm);
|
LinphoneActivity.instance().getChatStorage().saveImage(finalId, bm);
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,9 +88,11 @@ public class BubbleChat {
|
||||||
private RelativeLayout view;
|
private RelativeLayout view;
|
||||||
private ImageView statusView;
|
private ImageView statusView;
|
||||||
private Button downloadOrShow;
|
private Button downloadOrShow;
|
||||||
|
private String imageUrl;
|
||||||
|
|
||||||
public BubbleChat(final Context context, int id, String message, Bitmap image, long time, boolean isIncoming, LinphoneChatMessage.State status, final String url, int previousID) {
|
public BubbleChat(final Context context, int id, String message, Bitmap image, long time, boolean isIncoming, LinphoneChatMessage.State status, String url, int previousID) {
|
||||||
view = new RelativeLayout(context);
|
view = new RelativeLayout(context);
|
||||||
|
imageUrl = url;
|
||||||
|
|
||||||
LayoutParams layoutParams = new LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
|
LayoutParams layoutParams = new LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
|
||||||
|
|
||||||
|
@ -156,7 +158,7 @@ public class BubbleChat {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||||
intent.setDataAndType(Uri.parse("file://" + url), "image/*");
|
intent.setDataAndType(Uri.parse("file://" + imageUrl), "image/*");
|
||||||
context.startActivity(intent);
|
context.startActivity(intent);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -292,4 +294,8 @@ public class BubbleChat {
|
||||||
downloadOrShow.setText(buttonName);
|
downloadOrShow.setText(buttonName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void updateUrl(String newFileUrl) {
|
||||||
|
imageUrl = newFileUrl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue