Fix download image bug and update linphone
This commit is contained in:
parent
cfe67f88a4
commit
cd8efc50c3
2 changed files with 29 additions and 23 deletions
|
@ -136,27 +136,31 @@ public class BubbleChat implements LinphoneChatMessage.LinphoneChatMessageListen
|
||||||
ImageView imageView = (ImageView) view.findViewById(R.id.image);
|
ImageView imageView = (ImageView) view.findViewById(R.id.image);
|
||||||
|
|
||||||
String appData = message.getAppData();
|
String appData = message.getAppData();
|
||||||
if (appData == null || (!LinphoneManager.getInstance().isMessagePending(nativeMessage) &&
|
if(appData != null && !LinphoneManager.getInstance().isMessagePending(nativeMessage) &&
|
||||||
!nativeMessage.isOutgoing() && appData.contains(context.getString(R.string.temp_photo_name_with_date).split("%s")[0]))) {
|
!nativeMessage.isOutgoing() && appData.contains(context.getString(R.string.temp_photo_name_with_date).split("%s")[0])){
|
||||||
|
appData = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (appData == null ){
|
||||||
LinphoneManager.addListener(this);
|
LinphoneManager.addListener(this);
|
||||||
download.setVisibility(View.VISIBLE);
|
download.setVisibility(View.VISIBLE);
|
||||||
download.setOnClickListener(new OnClickListener() {
|
download.setOnClickListener(new OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
v.setEnabled(false);
|
v.setEnabled(false);
|
||||||
spinner.setVisibility(View.VISIBLE);
|
|
||||||
v.setVisibility(View.GONE);
|
v.setVisibility(View.GONE);
|
||||||
|
spinner.setVisibility(View.VISIBLE);
|
||||||
String filename = context.getString(R.string.temp_photo_name_with_date).replace("%s", String.valueOf(System.currentTimeMillis()));
|
String filename = context.getString(R.string.temp_photo_name_with_date).replace("%s", String.valueOf(System.currentTimeMillis()));
|
||||||
File file = new File(Environment.getExternalStorageDirectory(), filename);
|
File file = new File(Environment.getExternalStorageDirectory(), filename);
|
||||||
|
nativeMessage.setAppData(filename);
|
||||||
|
LinphoneManager.getInstance().addDownloadMessagePending(nativeMessage);
|
||||||
nativeMessage.setListener(LinphoneManager.getInstance());
|
nativeMessage.setListener(LinphoneManager.getInstance());
|
||||||
nativeMessage.setFileTransferFilepath(file.getPath());
|
nativeMessage.setFileTransferFilepath(file.getPath());
|
||||||
nativeMessage.downloadFile();
|
nativeMessage.downloadFile();
|
||||||
nativeMessage.setAppData(filename);
|
|
||||||
LinphoneManager.getInstance().addDownloadMessagePending(nativeMessage);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
if(LinphoneManager.getInstance().isMessagePending(nativeMessage)){
|
if (LinphoneManager.getInstance().isMessagePending(nativeMessage)) {
|
||||||
LinphoneManager.addListener(this);
|
LinphoneManager.addListener(this);
|
||||||
download.setEnabled(false);
|
download.setEnabled(false);
|
||||||
ProgressBar spinner = (ProgressBar) view.findViewById(R.id.spinner);
|
ProgressBar spinner = (ProgressBar) view.findViewById(R.id.spinner);
|
||||||
|
@ -165,6 +169,8 @@ public class BubbleChat implements LinphoneChatMessage.LinphoneChatMessageListen
|
||||||
} else {
|
} else {
|
||||||
LinphoneManager.removeListener(this);
|
LinphoneManager.removeListener(this);
|
||||||
imageView.setVisibility(View.VISIBLE);
|
imageView.setVisibility(View.VISIBLE);
|
||||||
|
download.setVisibility(View.GONE);
|
||||||
|
spinner.setVisibility(View.GONE);
|
||||||
loadBitmap(appData, imageView);
|
loadBitmap(appData, imageView);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 62c627111fe5458b2a11e84117dffdc0d0c18565
|
Subproject commit 68829aef4d4162fc9e9dcbecc86c6380d9999e39
|
Loading…
Reference in a new issue