Added cancel for file upload and fix crash when clicking on sent picture
This commit is contained in:
parent
a60126947e
commit
a2747d3734
2 changed files with 11 additions and 3 deletions
|
@ -105,6 +105,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
||||||
private LinphoneCoreListenerBase mListener;
|
private LinphoneCoreListenerBase mListener;
|
||||||
private ByteArrayOutputStream mDownloadedImageStream;
|
private ByteArrayOutputStream mDownloadedImageStream;
|
||||||
private int mDownloadedImageStreamSize;
|
private int mDownloadedImageStreamSize;
|
||||||
|
private LinphoneChatMessage currentMessageInFileTransferUploadState;
|
||||||
|
|
||||||
public static boolean isInstanciated() {
|
public static boolean isInstanciated() {
|
||||||
return instance != null;
|
return instance != null;
|
||||||
|
@ -173,9 +174,13 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
||||||
cancelUpload.setOnClickListener(new View.OnClickListener() {
|
cancelUpload.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
if (currentMessageInFileTransferUploadState != null) {
|
||||||
uploadLayout.setVisibility(View.GONE);
|
uploadLayout.setVisibility(View.GONE);
|
||||||
textLayout.setVisibility(View.VISIBLE);
|
textLayout.setVisibility(View.VISIBLE);
|
||||||
progressBar.setProgress(0);
|
progressBar.setProgress(0);
|
||||||
|
currentMessageInFileTransferUploadState.cancelFileTransfer();
|
||||||
|
currentMessageInFileTransferUploadState = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -507,6 +512,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
||||||
textLayout.setVisibility(View.GONE);
|
textLayout.setVisibility(View.GONE);
|
||||||
|
|
||||||
chatRoom.sendChatMessage(message);
|
chatRoom.sendChatMessage(message);
|
||||||
|
currentMessageInFileTransferUploadState = message;
|
||||||
} else {
|
} else {
|
||||||
Log.e("Error, bitmap factory can't read " + path);
|
Log.e("Error, bitmap factory can't read " + path);
|
||||||
}
|
}
|
||||||
|
@ -641,6 +647,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
||||||
uploadLayout.setVisibility(View.GONE);
|
uploadLayout.setVisibility(View.GONE);
|
||||||
textLayout.setVisibility(View.VISIBLE);
|
textLayout.setVisibility(View.VISIBLE);
|
||||||
progressBar.setProgress(0);
|
progressBar.setProgress(0);
|
||||||
|
currentMessageInFileTransferUploadState = null;
|
||||||
}
|
}
|
||||||
invalidate();
|
invalidate();
|
||||||
}
|
}
|
||||||
|
|
|
@ -200,6 +200,7 @@ public class BubbleChat {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
bm = BitmapFactory.decodeFile(appData);
|
bm = BitmapFactory.decodeFile(appData);
|
||||||
|
appData = "file://" + appData;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bm != null) {
|
if (bm != null) {
|
||||||
|
|
Loading…
Reference in a new issue