Fix issue in display of messages when using liblinphone storage
This commit is contained in:
parent
e1153f938f
commit
679c89b2ea
1 changed files with 12 additions and 2 deletions
|
@ -365,7 +365,15 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
||||||
scrollToEnd();
|
scrollToEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int checkId(int id) {
|
||||||
|
if (id <= 0) {
|
||||||
|
return previousMessageID + 1;
|
||||||
|
}
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
private void displayMessage(int id, String message, String time, boolean isIncoming, LinphoneChatMessage.State status, RelativeLayout layout) {
|
private void displayMessage(int id, String message, String time, boolean isIncoming, LinphoneChatMessage.State status, RelativeLayout layout) {
|
||||||
|
id = checkId(id);
|
||||||
BubbleChat bubble = new BubbleChat(layout.getContext(), id, message, null, time, isIncoming, status, previousMessageID);
|
BubbleChat bubble = new BubbleChat(layout.getContext(), id, message, null, time, isIncoming, status, previousMessageID);
|
||||||
if (!isIncoming) {
|
if (!isIncoming) {
|
||||||
lastSentMessageBubble = bubble;
|
lastSentMessageBubble = bubble;
|
||||||
|
@ -377,13 +385,15 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
||||||
registerForContextMenu(v);
|
registerForContextMenu(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void displayImageMessage(final int id, Bitmap image, String time, boolean isIncoming, LinphoneChatMessage.State status, RelativeLayout layout, final String url) {
|
private void displayImageMessage(int id, Bitmap image, String time, boolean isIncoming, LinphoneChatMessage.State status, RelativeLayout layout, final String url) {
|
||||||
|
id = checkId(id);
|
||||||
BubbleChat bubble = new BubbleChat(layout.getContext(), id, null, image, time, isIncoming, status, previousMessageID);
|
BubbleChat bubble = new BubbleChat(layout.getContext(), id, null, image, time, isIncoming, status, previousMessageID);
|
||||||
if (!isIncoming) {
|
if (!isIncoming) {
|
||||||
lastSentMessageBubble = bubble;
|
lastSentMessageBubble = bubble;
|
||||||
}
|
}
|
||||||
|
|
||||||
final View v = bubble.getView();
|
final View v = bubble.getView();
|
||||||
|
final int finalId = id;
|
||||||
bubble.setDownloadImageButtonListener(new OnClickListener() {
|
bubble.setDownloadImageButtonListener(new OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
|
@ -392,7 +402,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
||||||
public void run() {
|
public void run() {
|
||||||
final Bitmap bm = ChatFragment.downloadImage(url);
|
final Bitmap bm = ChatFragment.downloadImage(url);
|
||||||
if (bm != null) {
|
if (bm != null) {
|
||||||
LinphoneActivity.instance().getChatStorage().saveImage(id, bm);
|
LinphoneActivity.instance().getChatStorage().saveImage(finalId, bm);
|
||||||
mHandler.post(new Runnable() {
|
mHandler.post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
Loading…
Reference in a new issue