Fix stack overflow on SGS3 while sending picture in chat from camera
This commit is contained in:
parent
f06c2bfc28
commit
2af4ad6119
1 changed files with 23 additions and 6 deletions
|
@ -123,8 +123,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
||||||
private OnGlobalLayoutListener keyboardListener;
|
private OnGlobalLayoutListener keyboardListener;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
Bundle savedInstanceState) {
|
|
||||||
sipUri = getArguments().getString("SipUri");
|
sipUri = getArguments().getString("SipUri");
|
||||||
String displayName = getArguments().getString("DisplayName");
|
String displayName = getArguments().getString("DisplayName");
|
||||||
String pictureUri = getArguments().getString("PictureUri");
|
String pictureUri = getArguments().getString("PictureUri");
|
||||||
|
@ -198,10 +197,29 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Workaround for SGS3 issue
|
||||||
|
if (savedInstanceState != null) {
|
||||||
|
fileToUploadPath = savedInstanceState.getString("fileToUploadPath");
|
||||||
|
}
|
||||||
|
if (fileToUploadPath != null || imageToUpload != null) {
|
||||||
|
sendImage.post(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
sendImage.showContextMenu();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSaveInstanceState(Bundle outState) {
|
||||||
|
outState.putString("fileToUploadPath", fileToUploadPath);
|
||||||
|
super.onSaveInstanceState(outState);
|
||||||
|
}
|
||||||
|
|
||||||
private void addVirtualKeyboardVisiblityListener() {
|
private void addVirtualKeyboardVisiblityListener() {
|
||||||
keyboardListener = new OnGlobalLayoutListener() {
|
keyboardListener = new OnGlobalLayoutListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -683,14 +701,13 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showPopupMenuAskingImageSize(String filePath, Bitmap image) {
|
@SuppressLint("NewApi")
|
||||||
|
private void showPopupMenuAskingImageSize(final String filePath, final Bitmap image) {
|
||||||
fileToUploadPath = filePath;
|
fileToUploadPath = filePath;
|
||||||
imageToUpload = image;
|
imageToUpload = image;
|
||||||
try {
|
try {
|
||||||
sendImage.showContextMenu();
|
sendImage.showContextMenu();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) { e.printStackTrace(); };
|
||||||
showPopupMenuAskingImageSize(filePath, image);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void uploadAndSendImage(final String filePath, final Bitmap image, final ImageSize size) {
|
private void uploadAndSendImage(final String filePath, final Bitmap image, final ImageSize size) {
|
||||||
|
|
Loading…
Reference in a new issue