From 06dc99f6576d730a62fdd1cc035f249bcbe7ea4e Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Thu, 23 Jul 2015 16:06:19 +0200 Subject: [PATCH 01/14] update both linphone&belle-sip submodules --- submodules/belle-sip | 2 +- submodules/linphone | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/submodules/belle-sip b/submodules/belle-sip index 580012c55..703848fb1 160000 --- a/submodules/belle-sip +++ b/submodules/belle-sip @@ -1 +1 @@ -Subproject commit 580012c556ba0e4d0f09bf3f182cdf55e030f215 +Subproject commit 703848fb1496c5a372c8a8f04447cd25fbb626cf diff --git a/submodules/linphone b/submodules/linphone index 157c61d2f..da686748e 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit 157c61d2f5e6b476e8150cfff64e2142795e6d8a +Subproject commit da686748e33407b52d6628a7a068e3d3e084ff9c From 98516d9367dfbf6ea2f4e523bbafba4c96bd2775 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Mon, 27 Jul 2015 20:42:53 +0200 Subject: [PATCH 02/14] update both belle-sip&linphone --- submodules/belle-sip | 2 +- submodules/linphone | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/submodules/belle-sip b/submodules/belle-sip index 703848fb1..7ec48ad64 160000 --- a/submodules/belle-sip +++ b/submodules/belle-sip @@ -1 +1 @@ -Subproject commit 703848fb1496c5a372c8a8f04447cd25fbb626cf +Subproject commit 7ec48ad644bbb7906e2f06e8abde5633b52f1926 diff --git a/submodules/linphone b/submodules/linphone index da686748e..441696255 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit da686748e33407b52d6628a7a068e3d3e084ff9c +Subproject commit 4416962557c9cd90c6cb22efd06f73d9155a4f8a From cf0865c4bef629b5ff19122235bfee01f8a36e8f Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Tue, 4 Aug 2015 20:48:04 +0200 Subject: [PATCH 03/14] update linphone & belle-sip --- submodules/belle-sip | 2 +- submodules/linphone | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/submodules/belle-sip b/submodules/belle-sip index 7ec48ad64..91ae7c164 160000 --- a/submodules/belle-sip +++ b/submodules/belle-sip @@ -1 +1 @@ -Subproject commit 7ec48ad644bbb7906e2f06e8abde5633b52f1926 +Subproject commit 91ae7c164d9d20fd36657943a0aba807b4dfeb4f diff --git a/submodules/linphone b/submodules/linphone index 441696255..a235dd681 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit 4416962557c9cd90c6cb22efd06f73d9155a4f8a +Subproject commit a235dd6815db3f13e6c530fc970bdb07d5b62dbb From 92553424098520fa5d7985fc3a3a500387c32a6b Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Wed, 5 Aug 2015 15:53:39 +0200 Subject: [PATCH 04/14] update linphone --- submodules/linphone | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submodules/linphone b/submodules/linphone index a235dd681..098ddaead 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit a235dd6815db3f13e6c530fc970bdb07d5b62dbb +Subproject commit 098ddaead686928c735c05c2c808600eef55ae0b From a8679f992b79b0ab207d4a5b29174af6ce76e0bd Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 5 Aug 2015 17:05:38 +0200 Subject: [PATCH 05/14] Fixed linphone-android-sdk jar generation (was missing a few classes from xmlrpc library) --- custom_rules.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_rules.xml b/custom_rules.xml index bbf9ae858..a2c77ff6a 100644 --- a/custom_rules.xml +++ b/custom_rules.xml @@ -134,7 +134,7 @@ + includes="org/linphone/mediastream/**/*.class org/linphone/core/**/*.class org/linphone/**/*.class de/timroes/axmlrpc/**/*.class de/timroes/base64/Base64.class"/> From 4da94806563be74755154ba2b08ae5bbaa3e28fc Mon Sep 17 00:00:00 2001 From: Margaux Clerc Date: Tue, 4 Aug 2015 15:49:56 +0200 Subject: [PATCH 06/14] Fix null pointer exception --- src/org/linphone/LinphonePreferences.java | 26 +++++++++++++++-------- src/org/linphone/setup/SetupActivity.java | 3 +++ 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/src/org/linphone/LinphonePreferences.java b/src/org/linphone/LinphonePreferences.java index 2d45d9c73..a627312a1 100644 --- a/src/org/linphone/LinphonePreferences.java +++ b/src/org/linphone/LinphonePreferences.java @@ -430,8 +430,10 @@ public class LinphonePreferences { prxCfg.setIdentity(identity); prxCfg.done(); - info.setUsername(username); - saveAuthInfo(info); + if(info != null) { + info.setUsername(username); + saveAuthInfo(info); + } } catch (LinphoneCoreException e) { e.printStackTrace(); } @@ -468,8 +470,10 @@ public class LinphonePreferences { public void setAccountUserId(int n, String userId) { LinphoneAuthInfo info = getClonedAuthInfo(n); - info.setUserId(userId); - saveAuthInfo(info); + if(info != null) { + info.setUserId(userId); + saveAuthInfo(info); + } } public String getAccountUserId(int n) { @@ -479,8 +483,10 @@ public class LinphonePreferences { public void setAccountPassword(int n, String password) { LinphoneAuthInfo info = getClonedAuthInfo(n); - info.setPassword(password); - saveAuthInfo(info); + if(info != null) { + info.setPassword(password); + saveAuthInfo(info); + } } public String getAccountPassword(int n) { @@ -492,8 +498,10 @@ public class LinphonePreferences { try { LinphoneAuthInfo authInfo = getClonedAuthInfo(n); - authInfo.setDomain(domain); - saveAuthInfo(authInfo); + if(authInfo != null) { + authInfo.setDomain(domain); + saveAuthInfo(authInfo); + } LinphoneProxyConfig prxCfg = getProxyConfig(n); prxCfg.edit(); @@ -1026,7 +1034,7 @@ public class LinphonePreferences { } public boolean isAutoStartEnabled() { - return getConfig().getBool("app", "auto_start", false); + return getConfig().getBool("app", "auto_start", true); } public void setAutoStart(boolean autoStartEnabled) { diff --git a/src/org/linphone/setup/SetupActivity.java b/src/org/linphone/setup/SetupActivity.java index bba6e8292..a2f5bfedb 100644 --- a/src/org/linphone/setup/SetupActivity.java +++ b/src/org/linphone/setup/SetupActivity.java @@ -309,6 +309,9 @@ public class SetupActivity extends FragmentActivity implements OnClickListener { username = username.substring(4); } + if (username.contains("@")) + username = username.split("@")[0]; + if(domain.startsWith("sip:")) { domain = domain.substring(4); } From 023d7844f09368286190221c4b9c040ece3509ef Mon Sep 17 00:00:00 2001 From: Margaux Clerc Date: Wed, 5 Aug 2015 11:19:30 +0200 Subject: [PATCH 07/14] Hide keyboard --- src/org/linphone/AccountPreferencesFragment.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/org/linphone/AccountPreferencesFragment.java b/src/org/linphone/AccountPreferencesFragment.java index bf2ea3bfe..866647565 100644 --- a/src/org/linphone/AccountPreferencesFragment.java +++ b/src/org/linphone/AccountPreferencesFragment.java @@ -35,6 +35,7 @@ import android.preference.Preference.OnPreferenceClickListener; import android.preference.PreferenceCategory; import android.preference.PreferenceScreen; import android.text.InputType; +import android.view.WindowManager; /** * @author Sylvain Berfini @@ -65,7 +66,9 @@ public class AccountPreferencesFragment extends PreferencesListFragment { } else { manageAccountPreferencesFields(screen); } - + + // Force hide keyboard + getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); } public static boolean isEditTextEmpty(String s){ From d3b2d6c2aa14c0455913103873f13a1979a1bae3 Mon Sep 17 00:00:00 2001 From: Margaux Clerc Date: Wed, 5 Aug 2015 11:19:44 +0200 Subject: [PATCH 08/14] Fix error --- src/org/linphone/StatusFragment.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/org/linphone/StatusFragment.java b/src/org/linphone/StatusFragment.java index e6f997b2c..584f3c491 100644 --- a/src/org/linphone/StatusFragment.java +++ b/src/org/linphone/StatusFragment.java @@ -554,6 +554,9 @@ public class StatusFragment extends Fragment { CheckBox checkBox = (CheckBox) v; if (checkBox.isChecked()) { String tag = (String) checkBox.getTag(); + if(tag.startsWith("sip:")) { + tag = tag.substring(4); + } String sipAddress = tag.split(":")[0]; int accountPosition = Integer.parseInt(tag.split(":")[1]); From b5d499799a01448a1ecd1de4a8626f6704ce1bf4 Mon Sep 17 00:00:00 2001 From: Margaux Clerc Date: Mon, 10 Aug 2015 16:45:43 +0200 Subject: [PATCH 09/14] Update download/upload images outside the chatfragment --- src/org/linphone/ChatFragment.java | 99 +++++++++------------- src/org/linphone/LinphoneManager.java | 117 +++++++++++++++++++++++++- src/org/linphone/ui/BubbleChat.java | 47 +++++++---- 3 files changed, 181 insertions(+), 82 deletions(-) diff --git a/src/org/linphone/ChatFragment.java b/src/org/linphone/ChatFragment.java index d5049aa98..0189ba6c5 100644 --- a/src/org/linphone/ChatFragment.java +++ b/src/org/linphone/ChatFragment.java @@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.File; -import java.io.IOException; + import android.graphics.Matrix; import java.util.ArrayList; import java.util.List; @@ -31,7 +31,6 @@ import org.linphone.compatibility.Compatibility; import org.linphone.core.LinphoneAddress; import org.linphone.core.LinphoneBuffer; import org.linphone.core.LinphoneChatMessage; -import org.linphone.core.LinphoneChatMessage.LinphoneChatMessageListener; import org.linphone.core.LinphoneChatRoom; import org.linphone.core.LinphoneContent; import org.linphone.core.LinphoneCore; @@ -85,7 +84,7 @@ import android.widget.RelativeLayout; import android.widget.TextView; import android.widget.Toast; -public class ChatFragment extends Fragment implements OnClickListener, LinphoneChatMessageListener { +public class ChatFragment extends Fragment implements OnClickListener, LinphoneChatMessage.LinphoneChatMessageListener { private static ChatFragment instance; private static final int ADD_PHOTO = 1337; @@ -113,9 +112,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC private ChatMessageAdapter adapter; private LinphoneCoreListenerBase mListener; - private ByteArrayOutputStream mDownloadedImageStream; private ByteArrayInputStream mUploadingImageStream; - private int mDownloadedImageStreamSize; private LinphoneChatMessage currentMessageInFileTransferUploadState; public static boolean isInstanciated() { @@ -127,7 +124,8 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC super.onCreate(savedInstanceState); instance = this; View view = inflater.inflate(R.layout.chat, container, false); - + + LinphoneManager.addListener(this); // Retain the fragment across configuration changes setRetainInstance(true); @@ -194,6 +192,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC progressBar.setProgress(0); currentMessageInFileTransferUploadState.cancelFileTransfer(); currentMessageInFileTransferUploadState = null; + LinphoneManager.getInstance().setUploadPendingFileMessage(null); } } }); @@ -283,7 +282,6 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC topBar.setVisibility(View.GONE); } contactPicture.setVisibility(View.GONE); - //scrollToEnd(); } public void hideKeyboardVisibleMode() { @@ -292,7 +290,6 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC if (isOrientationLandscape && topBar != null) { topBar.setVisibility(View.VISIBLE); } - //scrollToEnd(); } class ChatMessageAdapter extends BaseAdapter { @@ -327,7 +324,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC public View getView(int position, View convertView, ViewGroup parent) { LinphoneChatMessage message = history[position]; - BubbleChat bubble = new BubbleChat(context, message, ChatFragment.this); + BubbleChat bubble = new BubbleChat(context, message); View v = bubble.getView(); registerForContextMenu(v); @@ -453,6 +450,8 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC lc.removeListener(mListener); } + LinphoneManager.removeListener(this); + onSaveInstanceState(getArguments()); //Hide keybord @@ -479,6 +478,29 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC LinphoneActivity.instance().updateChatFragment(this); } + LinphoneManager.addListener(this); + + final LinphoneChatMessage msg = LinphoneManager.getInstance().getMessageUploadPending(); + if(msg != null){ + uploadLayout.setVisibility(View.VISIBLE); + textLayout.setVisibility(View.GONE); + if(msg.getFileTransferInformation() != null){ + progressBar.setProgress(msg.getFileTransferInformation().getRealSize()); + } + + cancelUpload.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + uploadLayout.setVisibility(View.GONE); + textLayout.setVisibility(View.VISIBLE); + progressBar.setProgress(0); + msg.cancelFileTransfer(); + LinphoneManager.getInstance().setUploadPendingFileMessage(null); + + } + }); + } + String draft = getArguments().getString("messageDraft"); message.setText(draft); @@ -504,13 +526,14 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC if (chatRoom != null && messageToSend != null && messageToSend.length() > 0 && isNetworkReachable) { LinphoneChatMessage message = chatRoom.createLinphoneChatMessage(messageToSend); - message.setListener(this); chatRoom.sendChatMessage(message); if (LinphoneActivity.isInstanciated()) { LinphoneActivity.instance().onMessageSent(sipUri, messageToSend); } + message.setListener(LinphoneManager.getInstance()); + invalidate(); Log.i("Sent message current status: " + message.getStatus()); } else if (!isNetworkReachable && LinphoneActivity.isInstanciated()) { @@ -600,9 +623,12 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC content.setName(fileName); LinphoneChatMessage message = chatRoom.createFileTransferMessage(content); - message.setListener(ChatFragment.this); + message.setListener(LinphoneManager.getInstance()); message.setAppData(path); - + + LinphoneManager.getInstance().setUploadPendingFileMessage(message); + LinphoneManager.getInstance().setUploadingImageStream(mUploadingImageStream); + chatRoom.sendChatMessage(message); currentMessageInFileTransferUploadState = message; } @@ -703,32 +729,6 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC @Override public void onLinphoneChatMessageStateChanged(LinphoneChatMessage msg, State state) { - if (LinphoneActivity.isInstanciated() && state != LinphoneChatMessage.State.InProgress) { - if (msg != null) { - LinphoneActivity.instance().onMessageStateChanged(sipUri, msg.getText(), state.toInt()); - } - invalidate(); - } - - if (state == State.FileTransferDone) { - if (mDownloadedImageStream != null) { - byte[] bytes = mDownloadedImageStream.toByteArray(); - Bitmap bm = BitmapFactory.decodeByteArray(bytes, 0, mDownloadedImageStreamSize); - - String path = msg.getExternalBodyUrl(); - String fileName = path.substring(path.lastIndexOf("/") + 1); - String url = MediaStore.Images.Media.insertImage(getActivity().getContentResolver(), bm, fileName, null); - if (url != null) { - msg.setAppData(url); - } - - mDownloadedImageStream = null; - mDownloadedImageStreamSize = 0; - } else if (mUploadingImageStream != null) { - mUploadingImageStream = null; - } - } - if (state == State.FileTransferDone || state == State.FileTransferError) { uploadLayout.setVisibility(View.GONE); textLayout.setVisibility(View.VISIBLE); @@ -740,33 +740,10 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC @Override public void onLinphoneChatMessageFileTransferReceived(LinphoneChatMessage msg, LinphoneContent content, LinphoneBuffer buffer) { - if (mDownloadedImageStream == null) { - mDownloadedImageStream = new ByteArrayOutputStream(); - mDownloadedImageStreamSize = 0; - } - - if (buffer != null && buffer.getSize() > 0) { - try { - mDownloadedImageStream.write(buffer.getContent()); - mDownloadedImageStreamSize += buffer.getSize(); - } catch (IOException e) { - Log.e(e); - } - } } @Override public void onLinphoneChatMessageFileTransferSent(LinphoneChatMessage msg, LinphoneContent content, int offset, int size, LinphoneBuffer bufferToFill) { - if (mUploadingImageStream != null && size > 0) { - byte[] data = new byte[size]; - int read = mUploadingImageStream.read(data, 0, size); - if (read > 0) { - bufferToFill.setContent(data); - bufferToFill.setSize(read); - } else { - Log.e("Error, upload task asking for more bytes(" + size + ") than available (" + mUploadingImageStream.available() + ")"); - } - } } @Override diff --git a/src/org/linphone/LinphoneManager.java b/src/org/linphone/LinphoneManager.java index 028b13fcc..bfba1f193 100644 --- a/src/org/linphone/LinphoneManager.java +++ b/src/org/linphone/LinphoneManager.java @@ -22,13 +22,17 @@ import static android.media.AudioManager.MODE_RINGTONE; import static android.media.AudioManager.STREAM_RING; import static android.media.AudioManager.STREAM_VOICE_CALL; +import java.io.ByteArrayInputStream; import java.io.File; import java.io.FileInputStream; +import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.nio.ByteBuffer; +import java.util.ArrayList; import java.util.HashSet; +import java.util.List; import java.util.Set; import java.util.Timer; import java.util.TimerTask; @@ -36,6 +40,7 @@ import java.util.TimerTask; import org.linphone.compatibility.Compatibility; import org.linphone.core.CallDirection; import org.linphone.core.LinphoneAddress; +import org.linphone.core.LinphoneBuffer; import org.linphone.core.LinphoneCall; import org.linphone.core.LinphoneCall.State; import org.linphone.core.LinphoneCallParams; @@ -88,10 +93,12 @@ import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.net.Uri; import android.os.Build; +import android.os.Environment; import android.os.Handler; import android.os.PowerManager; import android.os.PowerManager.WakeLock; import android.os.Vibrator; +import android.provider.MediaStore; import android.provider.Settings; import android.provider.Settings.SettingNotFoundException; import android.telephony.TelephonyManager; @@ -116,7 +123,7 @@ import android.widget.Toast; * @author Guillaume Beraudo * */ -public class LinphoneManager implements LinphoneCoreListener { +public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessage.LinphoneChatMessageListener { private static LinphoneManager instance; private Context mServiceContext; @@ -133,9 +140,21 @@ public class LinphoneManager implements LinphoneCoreListener { private ConnectivityManager mConnectivityManager; private Handler mHandler = new Handler(); private WakeLock mIncallWakeLock; + private static List mPendingChatFileMessage; + private static LinphoneChatMessage mUploadPendingFileMessage; public String wizardLoginViewDomain = null; + private static List simpleListeners = new ArrayList(); + public static void addListener(LinphoneChatMessage.LinphoneChatMessageListener listener) { + if (!simpleListeners.contains(listener)) { + simpleListeners.add(listener); + } + } + public static void removeListener(LinphoneChatMessage.LinphoneChatMessageListener listener) { + simpleListeners.remove(listener); + } + protected LinphoneManager(final Context c) { sExited = false; mServiceContext = c; @@ -156,6 +175,7 @@ public class LinphoneManager implements LinphoneCoreListener { mPowerManager = (PowerManager) c.getSystemService(Context.POWER_SERVICE); mConnectivityManager = (ConnectivityManager) c.getSystemService(Context.CONNECTIVITY_SERVICE); mR = c.getResources(); + mPendingChatFileMessage = new ArrayList(); } private static final int LINPHONE_VOLUME_STREAM = STREAM_VOICE_CALL; @@ -170,6 +190,7 @@ public class LinphoneManager implements LinphoneCoreListener { private final String mPauseSoundFile; private final String mChatDatabaseFile; private final String mErrorToneFile; + private ByteArrayInputStream mUploadingImageStream; private Timer mTimer; @@ -213,6 +234,98 @@ public class LinphoneManager implements LinphoneCoreListener { return instance; } + public void addDownloadMessagePending(LinphoneChatMessage message){ + synchronized (mPendingChatFileMessage) { + mPendingChatFileMessage.add(message); + } + } + + public boolean isMessagePending(LinphoneChatMessage message){ + boolean messagePending = false; + synchronized (mPendingChatFileMessage) { + for (LinphoneChatMessage chat : mPendingChatFileMessage) { + if (chat.getStorageId() == message.getStorageId()) { + messagePending = true; + break; + } + } + } + return messagePending; + } + + public void removePendingMessage(LinphoneChatMessage message){ + synchronized (mPendingChatFileMessage) { + for (LinphoneChatMessage chat : mPendingChatFileMessage) { + if (chat.getStorageId() == message.getStorageId()) { + mPendingChatFileMessage.remove(chat); + } + break; + } + } + } + + public void setUploadPendingFileMessage(LinphoneChatMessage message){ + mUploadPendingFileMessage = message; + } + + public LinphoneChatMessage getMessageUploadPending(){ + return mUploadPendingFileMessage; + } + + public void setUploadingImageStream(ByteArrayInputStream array){ + this.mUploadingImageStream = array; + } + + + @Override + public void onLinphoneChatMessageStateChanged(LinphoneChatMessage msg, LinphoneChatMessage.State state) { + if (state == LinphoneChatMessage.State.FileTransferDone) { + if(msg.isOutgoing() && mUploadingImageStream != null){ + mUploadPendingFileMessage = null; + mUploadingImageStream = null; + } else { + File file = new File(Environment.getExternalStorageDirectory(), msg.getFileTransferInformation().getName()); + try { + String url = MediaStore.Images.Media.insertImage(getContext().getContentResolver(), file.getPath(), msg.getFileTransferInformation().getName(), null); + msg.setAppData(url); + file.delete(); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } + removePendingMessage(msg); + } + } + + for (LinphoneChatMessage.LinphoneChatMessageListener l: simpleListeners) { + l.onLinphoneChatMessageStateChanged(msg, state); + } + } + + @Override + public void onLinphoneChatMessageFileTransferReceived(LinphoneChatMessage msg, LinphoneContent content, LinphoneBuffer buffer) { + } + + @Override + public void onLinphoneChatMessageFileTransferSent(LinphoneChatMessage msg, LinphoneContent content, int offset, int size, LinphoneBuffer bufferToFill) { + if (mUploadingImageStream != null && size > 0) { + byte[] data = new byte[size]; + int read = mUploadingImageStream.read(data, 0, size); + if (read > 0) { + bufferToFill.setContent(data); + bufferToFill.setSize(read); + } else { + Log.e("Error, upload task asking for more bytes(" + size + ") than available (" + mUploadingImageStream.available() + ")"); + } + } + } + + @Override + public void onLinphoneChatMessageFileTransferProgressChanged(LinphoneChatMessage msg, LinphoneContent content, int offset, int total) { + for (LinphoneChatMessage.LinphoneChatMessageListener l: simpleListeners) { + l.onLinphoneChatMessageFileTransferProgressChanged(msg, content, offset, total); + } + } + private boolean isPresenceModelActivitySet() { LinphoneCore lc = getLcIfManagerNotDestroyedOrNull(); if (isInstanciated() && lc != null) { @@ -331,7 +444,6 @@ public class LinphoneManager implements LinphoneCoreListener { LinphoneManager.getLc().setVideoDevice(camId); } - public static interface AddressType { void setText(CharSequence s); CharSequence getText(); @@ -1097,7 +1209,6 @@ public class LinphoneManager implements LinphoneCoreListener { return distanceInCm < threshold; } - private static boolean sLastProximitySensorValueNearby; private static Set sProximityDependentActivities = new HashSet(); private static SensorEventListener sProximitySensorListener = new SensorEventListener() { diff --git a/src/org/linphone/ui/BubbleChat.java b/src/org/linphone/ui/BubbleChat.java index 7ff74ef65..8090d5b68 100644 --- a/src/org/linphone/ui/BubbleChat.java +++ b/src/org/linphone/ui/BubbleChat.java @@ -17,6 +17,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.lang.ref.WeakReference; @@ -25,6 +26,7 @@ import java.util.Calendar; import java.util.HashMap; import java.util.Map.Entry; +import org.linphone.LinphoneManager; import org.linphone.R; import org.linphone.core.LinphoneChatMessage; import org.linphone.core.LinphoneChatMessage.State; @@ -42,6 +44,7 @@ import android.graphics.drawable.Drawable; import android.media.ThumbnailUtils; import android.net.Uri; import android.os.AsyncTask; +import android.os.Environment; import android.provider.MediaStore; import android.text.Html; import android.text.Spannable; @@ -100,17 +103,15 @@ public class BubbleChat { private RelativeLayout view; private ImageView statusView; private LinphoneChatMessage nativeMessage; - private LinphoneChatMessage.LinphoneChatMessageListener fileTransferListener; private Context mContext; private static final int SIZE_MAX = 512; @SuppressLint("InflateParams") - public BubbleChat(final Context context, LinphoneChatMessage message, LinphoneChatMessage.LinphoneChatMessageListener listener) { + public BubbleChat(final Context context, LinphoneChatMessage message) { if (message == null) { return; } nativeMessage = message; - fileTransferListener = listener; mContext = context; view = new RelativeLayout(context); @@ -153,22 +154,32 @@ public class BubbleChat { String appData = message.getAppData(); if (appData == null) { - download.setVisibility(View.VISIBLE); - download.setOnClickListener(new OnClickListener() { - @Override - public void onClick(View v) { - v.setEnabled(false); - ProgressBar spinner = (ProgressBar) view.findViewById(R.id.spinner); - spinner.setVisibility(View.VISIBLE); - v.setVisibility(View.GONE); + if(LinphoneManager.getInstance().isMessagePending(nativeMessage)){ + download.setEnabled(false); + ProgressBar spinner = (ProgressBar) layout.findViewById(R.id.spinner); + spinner.setVisibility(View.VISIBLE); + download.setVisibility(View.GONE); + } else { + download.setVisibility(View.VISIBLE); + download.setOnClickListener(new OnClickListener() { + @Override + public void onClick(View v) { + v.setEnabled(false); + ProgressBar spinner = (ProgressBar) view.findViewById(R.id.spinner); + spinner.setVisibility(View.VISIBLE); + v.setVisibility(View.GONE); - nativeMessage.setListener(fileTransferListener); - nativeMessage.downloadFile(); - } - }); + File file = new File(Environment.getExternalStorageDirectory(), nativeMessage.getFileTransferInformation().getName()); + nativeMessage.setListener(LinphoneManager.getInstance()); + nativeMessage.setFileTransferFilepath(file.getPath()); + nativeMessage.downloadFile(); + LinphoneManager.getInstance().addDownloadMessagePending(nativeMessage); + } + }); + } } else { - imageView.setVisibility(View.VISIBLE); - loadBitmap(appData, imageView); + imageView.setVisibility(View.VISIBLE); + loadBitmap(appData, imageView); } } else { TextView msgView = (TextView) layout.findViewById(R.id.message); @@ -325,7 +336,7 @@ public class BubbleChat { task.execute(path); } } - + private class BitmapWorkerTask extends AsyncTask { private final WeakReference imageViewReference; public String path; From 6f005e7e0d39aec78b70a2e49d2ecc7f21bbb3db Mon Sep 17 00:00:00 2001 From: Margaux Clerc Date: Tue, 11 Aug 2015 14:28:37 +0200 Subject: [PATCH 10/14] Improve chat view and download images --- res/layout/chat_bubble_incoming.xml | 7 ++- src/org/linphone/ChatFragment.java | 17 +++++- src/org/linphone/ui/BubbleChat.java | 85 ++++++++++++++--------------- 3 files changed, 60 insertions(+), 49 deletions(-) diff --git a/res/layout/chat_bubble_incoming.xml b/res/layout/chat_bubble_incoming.xml index 97a41d860..6eb6418f8 100644 --- a/res/layout/chat_bubble_incoming.xml +++ b/res/layout/chat_bubble_incoming.xml @@ -32,10 +32,11 @@ + android:layout_height="5dp" /> emoticons = new HashMap(); static { emoticons.put(":)", R.drawable.emo_im_happy); @@ -99,12 +98,13 @@ public class BubbleChat { emoticons.put(":'(", R.drawable.emo_im_crying); emoticons.put("$.$", R.drawable.emo_im_money_mouth); } - - private RelativeLayout view; + + private LinearLayout view; private ImageView statusView; private LinphoneChatMessage nativeMessage; private Context mContext; private static final int SIZE_MAX = 512; + private ProgressBar spinner; @SuppressLint("InflateParams") public BubbleChat(final Context context, LinphoneChatMessage message) { @@ -113,50 +113,29 @@ public class BubbleChat { } nativeMessage = message; mContext = context; - - view = new RelativeLayout(context); - LayoutParams layoutParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); - - if (message.isOutgoing()) { - layoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); - view.setBackgroundResource(R.drawable.chat_bubble_outgoing); - } - else { - layoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT); - view.setBackgroundResource(R.drawable.chat_bubble_incoming); - } - layoutParams.setMargins(10, 0, 10, 0); - - view.setId(message.getStorageId()); - view.setLayoutParams(layoutParams); - - LinearLayout layout; - if (context.getResources().getBoolean(R.bool.display_time_aside)) { - if (message.isOutgoing()) { - layout = (LinearLayout) LayoutInflater.from(context).inflate(R.layout.chat_bubble_alt_outgoing, null); - } else { - layout = (LinearLayout) LayoutInflater.from(context).inflate(R.layout.chat_bubble_alt_incoming, null); - } - } else { - if (message.isOutgoing()) { - layout = (LinearLayout) LayoutInflater.from(context).inflate(R.layout.chat_bubble_outgoing, null); - } else { - layout = (LinearLayout) LayoutInflater.from(context).inflate(R.layout.chat_bubble_incoming, null); - } - } + if (message.isOutgoing()) { + view = (LinearLayout) LayoutInflater.from(context).inflate(R.layout.chat_bubble_outgoing, null); + view.setBackgroundResource(R.drawable.chat_bubble_outgoing); + } else { + view = (LinearLayout) LayoutInflater.from(context).inflate(R.layout.chat_bubble_incoming, null); + view.setBackgroundResource(R.drawable.chat_bubble_incoming); + } + + spinner = (ProgressBar) view.findViewById(R.id.spinner); String externalBodyUrl = message.getExternalBodyUrl(); LinphoneContent fileTransferContent = message.getFileTransferInformation(); if (externalBodyUrl != null || fileTransferContent != null) { - Button download = (Button) layout.findViewById(R.id.download); - ImageView imageView = (ImageView) layout.findViewById(R.id.image); + Button download = (Button) view.findViewById(R.id.download); + ImageView imageView = (ImageView) view.findViewById(R.id.image); String appData = message.getAppData(); if (appData == null) { + LinphoneManager.addListener(this); if(LinphoneManager.getInstance().isMessagePending(nativeMessage)){ download.setEnabled(false); - ProgressBar spinner = (ProgressBar) layout.findViewById(R.id.spinner); + ProgressBar spinner = (ProgressBar) view.findViewById(R.id.spinner); spinner.setVisibility(View.VISIBLE); download.setVisibility(View.GONE); } else { @@ -165,7 +144,6 @@ public class BubbleChat { @Override public void onClick(View v) { v.setEnabled(false); - ProgressBar spinner = (ProgressBar) view.findViewById(R.id.spinner); spinner.setVisibility(View.VISIBLE); v.setVisibility(View.GONE); @@ -178,11 +156,12 @@ public class BubbleChat { }); } } else { + LinphoneManager.removeListener(this); imageView.setVisibility(View.VISIBLE); loadBitmap(appData, imageView); } } else { - TextView msgView = (TextView) layout.findViewById(R.id.message); + TextView msgView = (TextView) view.findViewById(R.id.message); if (msgView != null) { Spanned text = null; String msg = message.getText(); @@ -199,11 +178,11 @@ public class BubbleChat { } } - TextView timeView = (TextView) layout.findViewById(R.id.time); + TextView timeView = (TextView) view.findViewById(R.id.time); timeView.setText(timestampToHumanDate(context, message.getTime())); LinphoneChatMessage.State status = message.getStatus(); - statusView = (ImageView) layout.findViewById(R.id.status); + statusView = (ImageView) view.findViewById(R.id.status); if (statusView != null) { if (status == LinphoneChatMessage.State.Delivered) { statusView.setImageResource(R.drawable.chat_message_delivered); @@ -214,7 +193,7 @@ public class BubbleChat { } } - view.addView(layout); + //view.addView(layout); } public void updateStatusView() { @@ -443,4 +422,22 @@ public class BubbleChat { } return null; } + + @Override + public void onLinphoneChatMessageStateChanged(LinphoneChatMessage msg, State state) { + } + + @Override + public void onLinphoneChatMessageFileTransferReceived(LinphoneChatMessage msg, LinphoneContent content, LinphoneBuffer buffer) { + } + + @Override + public void onLinphoneChatMessageFileTransferSent(LinphoneChatMessage msg, LinphoneContent content, int offset, int size, LinphoneBuffer bufferToFill) { + } + + @Override + public void onLinphoneChatMessageFileTransferProgressChanged(LinphoneChatMessage msg, LinphoneContent content, int offset, int total) { + if(nativeMessage.getStorageId() == msg.getStorageId()) + spinner.setProgress(offset * 100 / total); + } } From a0738ca90d029664105dc010c453ffc5a28f4c0e Mon Sep 17 00:00:00 2001 From: Margaux Clerc Date: Tue, 11 Aug 2015 16:32:34 +0200 Subject: [PATCH 11/14] Fix error reason for call and proxy config --- res/values/strings.xml | 3 +++ .../linphone/AccountPreferencesFragment.java | 2 +- src/org/linphone/LinphoneActivity.java | 26 ++++++++++++++++--- src/org/linphone/setup/SetupActivity.java | 2 ++ 4 files changed, 28 insertions(+), 5 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index baf5f687c..2e18cc8f6 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -374,6 +374,9 @@ Incompatible media parameters Your correspondent has low bandwidth, video can\'t be started Network is unreachable + Bad credentials + Unauthorized + Network error Today Yesterday Missed diff --git a/src/org/linphone/AccountPreferencesFragment.java b/src/org/linphone/AccountPreferencesFragment.java index 866647565..e95ab392a 100644 --- a/src/org/linphone/AccountPreferencesFragment.java +++ b/src/org/linphone/AccountPreferencesFragment.java @@ -499,7 +499,7 @@ public class AccountPreferencesFragment extends PreferencesListFragment { } catch (LinphoneCoreException e) { e.printStackTrace(); } - + LinphoneActivity.instance().isNewProxyConfig(); LinphoneManager.getLc().refreshRegisters(); } } diff --git a/src/org/linphone/LinphoneActivity.java b/src/org/linphone/LinphoneActivity.java index c505e7792..2668ba3da 100644 --- a/src/org/linphone/LinphoneActivity.java +++ b/src/org/linphone/LinphoneActivity.java @@ -43,6 +43,7 @@ import org.linphone.core.LinphoneCoreException; import org.linphone.core.LinphoneCoreFactory; import org.linphone.core.LinphoneCoreListenerBase; import org.linphone.core.LinphoneProxyConfig; +import org.linphone.core.Reason; import org.linphone.mediastream.Log; import org.linphone.setup.RemoteProvisioningLoginActivity; import org.linphone.setup.SetupActivity; @@ -104,6 +105,7 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene private Fragment dialerFragment, messageListFragment, friendStatusListenerFragment; private ChatFragment chatFragment; private SavedState dialerSavedState; + private boolean newProxyConfig; private boolean isAnimationDisabled = false, preferLinphoneContacts = false; private OrientationEventListener mOrientationHelper; private LinphoneCoreListenerBase mListener; @@ -198,6 +200,19 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene lc.removeAuthInfo(authInfo); } } + + if(state.equals(RegistrationState.RegistrationFailed) && newProxyConfig) { + newProxyConfig = false; + if (proxy.getError() == Reason.BadCredentials) { + displayCustomToast(getString(R.string.error_bad_credentials), Toast.LENGTH_LONG); + } + if (proxy.getError() == Reason.Unauthorized) { + displayCustomToast(getString(R.string.error_unauthorized), Toast.LENGTH_LONG); + } + if (proxy.getError() == Reason.IOError) { + displayCustomToast(getString(R.string.error_io_error), Toast.LENGTH_LONG); + } + } } @Override @@ -212,11 +227,11 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene } } else if (state == State.CallEnd || state == State.Error || state == State.CallReleased) { // Convert LinphoneCore message for internalization - if (message != null && message.equals("Call declined.")) { + if (message != null && call.getReason() == Reason.Declined) { displayCustomToast(getString(R.string.error_call_declined), Toast.LENGTH_LONG); - } else if (message != null && message.equals("Not Found")) { + } else if (message != null && call.getReason() == Reason.NotFound) { displayCustomToast(getString(R.string.error_user_not_found), Toast.LENGTH_LONG); - } else if (message != null && message.equals("Unsupported media type")) { + } else if (message != null && call.getReason() == Reason.Media) { displayCustomToast(getString(R.string.error_incompatible_media), Toast.LENGTH_LONG); } else if (message != null && state == State.Error) { displayCustomToast(getString(R.string.error_unknown) + " - " + message, Toast.LENGTH_LONG); @@ -259,7 +274,6 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene updateAnimationsState(); } - private void initButtons() { menu = (LinearLayout) findViewById(R.id.menu); mark = (LinearLayout) findViewById(R.id.mark); @@ -322,6 +336,10 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene findViewById(R.id.fragmentContainer).setPadding(0, LinphoneUtils.pixelsToDpi(getResources(), 40), 0, 0); } + public void isNewProxyConfig(){ + newProxyConfig = true; + } + private void changeCurrentFragment(FragmentsAvailable newFragmentType, Bundle extras) { changeCurrentFragment(newFragmentType, extras, false); } diff --git a/src/org/linphone/setup/SetupActivity.java b/src/org/linphone/setup/SetupActivity.java index a2f5bfedb..4cfce5d42 100644 --- a/src/org/linphone/setup/SetupActivity.java +++ b/src/org/linphone/setup/SetupActivity.java @@ -17,6 +17,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +import org.linphone.LinphoneActivity; import org.linphone.LinphoneManager; import org.linphone.LinphonePreferences; import org.linphone.LinphonePreferences.AccountBuilder; @@ -405,6 +406,7 @@ public class SetupActivity extends FragmentActivity implements OnClickListener { public void success() { mPrefs.firstLaunchSuccessful(); + LinphoneActivity.instance().isNewProxyConfig(); setResult(Activity.RESULT_OK); finish(); } From 7d7b7b7139dd65d5060c84700db81c7a5c664f33 Mon Sep 17 00:00:00 2001 From: Margaux Clerc Date: Wed, 12 Aug 2015 17:55:55 +0200 Subject: [PATCH 12/14] Fix crash text received Change echo calibration wizard --- src/org/linphone/ContactsManager.java | 7 +++++-- src/org/linphone/LinphoneManager.java | 5 ----- .../linphone/setup/EchoCancellerCalibrationFragment.java | 9 ++++----- src/org/linphone/setup/SetupActivity.java | 2 +- submodules/linphone | 2 +- tests/src/org/linphone/test/LinphoneTestManager.java | 7 ------- 6 files changed, 11 insertions(+), 21 deletions(-) diff --git a/src/org/linphone/ContactsManager.java b/src/org/linphone/ContactsManager.java index 6bd632f84..18bb50e09 100644 --- a/src/org/linphone/ContactsManager.java +++ b/src/org/linphone/ContactsManager.java @@ -92,8 +92,11 @@ public class ContactsManager { initializeContactManager(context,contentResolver); Account newAccount = new Account(context.getString(R.string.sync_account_name), context.getString(R.string.sync_account_type)); AccountManager accountManager = (AccountManager) context.getSystemService(context.ACCOUNT_SERVICE); - accountManager.addAccountExplicitly(newAccount, null, null); - mAccount = newAccount; + if(accountManager.addAccountExplicitly(newAccount, null, null)){ + mAccount = newAccount; + } else { + mAccount = null; + } } public String getDisplayName(String firstName, String lastName) { diff --git a/src/org/linphone/LinphoneManager.java b/src/org/linphone/LinphoneManager.java index bfba1f193..4450add06 100644 --- a/src/org/linphone/LinphoneManager.java +++ b/src/org/linphone/LinphoneManager.java @@ -800,11 +800,6 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag public void notifyPresenceReceived(LinphoneCore lc, LinphoneFriend lf) { } - public void textReceived(LinphoneCore lc, LinphoneChatRoom cr, - LinphoneAddress from, String message) { - //deprecated - } - @Override public void dtmfReceived(LinphoneCore lc, LinphoneCall call, int dtmf) { Log.d("DTMF received: " + dtmf); diff --git a/src/org/linphone/setup/EchoCancellerCalibrationFragment.java b/src/org/linphone/setup/EchoCancellerCalibrationFragment.java index a347a5f3e..d3e317da4 100644 --- a/src/org/linphone/setup/EchoCancellerCalibrationFragment.java +++ b/src/org/linphone/setup/EchoCancellerCalibrationFragment.java @@ -81,8 +81,6 @@ public class EchoCancellerCalibrationFragment extends Fragment { return view; } - - public void enableEcCalibrationResultSending(boolean enabled) { mSendEcCalibrationResult = enabled; } @@ -111,9 +109,10 @@ public class EchoCancellerCalibrationFragment extends Fragment { } }; - Log.i("Add echo canceller calibration result: manufacturer=" + Build.MANUFACTURER + " model=" + Build.MODEL + " status=" + status + " delay=" + delayMs + "ms"); - client.callAsync(listener, "add_ec_calibration_result", Build.MANUFACTURER, Build.MODEL, status.toString(), delayMs); - } + Boolean hasBuiltInEchoCanceler = LinphoneManager.getLc().hasBuiltInEchoCanceler(); + Log.i("Add echo canceller calibration result: manufacturer=" + Build.MANUFACTURER + " model=" + Build.MODEL + " status=" + status + " delay=" + delayMs + "ms" + " hasBuiltInEchoCanceler " + hasBuiltInEchoCanceler); + client.callAsync(listener, "add_ec_calibration_result", Build.MANUFACTURER, Build.MODEL, status.toString(), delayMs, hasBuiltInEchoCanceler); + } catch(Exception ex) {} } } diff --git a/src/org/linphone/setup/SetupActivity.java b/src/org/linphone/setup/SetupActivity.java index 4cfce5d42..62c70abc2 100644 --- a/src/org/linphone/setup/SetupActivity.java +++ b/src/org/linphone/setup/SetupActivity.java @@ -224,7 +224,7 @@ public class SetupActivity extends FragmentActivity implements OnClickListener { cancel.setEnabled(false); } else { if (mPrefs.isFirstLaunch()) { - mPrefs.setEchoCancellation(LinphoneManager.getLc().needsEchoCanceler()); + mPrefs.setEchoCancellation(LinphoneManager.getLc().hasBuiltInEchoCanceler()); } success(); } diff --git a/submodules/linphone b/submodules/linphone index 098ddaead..075f13f23 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit 098ddaead686928c735c05c2c808600eef55ae0b +Subproject commit 075f13f233c21caec79ca0e3ed3796f0e0082e4f diff --git a/tests/src/org/linphone/test/LinphoneTestManager.java b/tests/src/org/linphone/test/LinphoneTestManager.java index 9fc68ab95..3d06e9c7b 100644 --- a/tests/src/org/linphone/test/LinphoneTestManager.java +++ b/tests/src/org/linphone/test/LinphoneTestManager.java @@ -338,13 +338,6 @@ public class LinphoneTestManager implements LinphoneCoreListener{ } - @Override - public void textReceived(LinphoneCore lc, LinphoneChatRoom cr, - LinphoneAddress from, String message) { - // TODO Auto-generated method stub - - } - @Override public void messageReceived(LinphoneCore lc, LinphoneChatRoom cr, LinphoneChatMessage message) { From c054e6bcf8f7d001316a40ed62bf04f1cf1c3705 Mon Sep 17 00:00:00 2001 From: Margaux Clerc Date: Thu, 13 Aug 2015 16:16:59 +0200 Subject: [PATCH 13/14] Fix error status bar and progress bar in chat room --- src/org/linphone/ChatFragment.java | 6 ++++-- src/org/linphone/LinphoneManager.java | 2 +- src/org/linphone/StatusFragment.java | 12 ++++++++---- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/org/linphone/ChatFragment.java b/src/org/linphone/ChatFragment.java index 54ea5f3eb..412df96c7 100644 --- a/src/org/linphone/ChatFragment.java +++ b/src/org/linphone/ChatFragment.java @@ -66,7 +66,6 @@ import android.text.Editable; import android.text.InputType; import android.text.TextWatcher; import android.view.ContextMenu; -import android.view.Gravity; import android.view.LayoutInflater; import android.view.MenuItem; import android.view.View; @@ -467,6 +466,10 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC onSaveInstanceState(getArguments()); + uploadLayout.setVisibility(View.GONE); + textLayout.setVisibility(View.VISIBLE); + progressBar.setProgress(0); + //Hide keybord InputMethodManager imm = (InputMethodManager)getActivity().getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(message.getWindowToken(), 0); @@ -519,7 +522,6 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC remoteComposing.setVisibility(chatRoom.isRemoteComposing() ? View.VISIBLE : View.GONE); dispayMessageList(); - super.onResume(); } diff --git a/src/org/linphone/LinphoneManager.java b/src/org/linphone/LinphoneManager.java index 4450add06..65515b557 100644 --- a/src/org/linphone/LinphoneManager.java +++ b/src/org/linphone/LinphoneManager.java @@ -279,7 +279,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag @Override public void onLinphoneChatMessageStateChanged(LinphoneChatMessage msg, LinphoneChatMessage.State state) { - if (state == LinphoneChatMessage.State.FileTransferDone) { + if (state == LinphoneChatMessage.State.FileTransferDone || state == LinphoneChatMessage.State.FileTransferError) { if(msg.isOutgoing() && mUploadingImageStream != null){ mUploadPendingFileMessage = null; mUploadingImageStream = null; diff --git a/src/org/linphone/StatusFragment.java b/src/org/linphone/StatusFragment.java index 584f3c491..c2e1d6059 100644 --- a/src/org/linphone/StatusFragment.java +++ b/src/org/linphone/StatusFragment.java @@ -119,10 +119,14 @@ public class StatusFragment extends Fragment { if (!isAttached || !LinphoneService.isReady()) { return; } - if (lc.getDefaultProxyConfig().equals(proxy)) { - statusLed.setImageResource(getStatusIconResource(state, true)); - statusText.setText(getStatusIconText(state)); - } + + if (lc.getDefaultProxyConfig() != null && lc.getDefaultProxyConfig().equals(proxy)) { + statusLed.setImageResource(getStatusIconResource(state, true)); + statusText.setText(getStatusIconText(state)); + } else if(lc.getDefaultProxyConfig() == null) { + statusLed.setImageResource(getStatusIconResource(state, true)); + statusText.setText(getStatusIconText(state)); + } try { if (getResources().getBoolean(R.bool.lock_statusbar)) { From 2f57f9a6c962c11df655cd73b4ae3e13e7cd0358 Mon Sep 17 00:00:00 2001 From: Margaux Clerc Date: Fri, 14 Aug 2015 09:44:04 +0200 Subject: [PATCH 14/14] Fix bubble chat delete --- src/org/linphone/ChatFragment.java | 1 - src/org/linphone/ui/BubbleChat.java | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/org/linphone/ChatFragment.java b/src/org/linphone/ChatFragment.java index 412df96c7..aa4c66f16 100644 --- a/src/org/linphone/ChatFragment.java +++ b/src/org/linphone/ChatFragment.java @@ -600,7 +600,6 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC } // Rotate the bitmap if possible/needed, using EXIF data - Log.w(path); try { if (path != null) { ExifInterface exif = new ExifInterface(path); diff --git a/src/org/linphone/ui/BubbleChat.java b/src/org/linphone/ui/BubbleChat.java index 55eeaa5bb..64a19d38f 100644 --- a/src/org/linphone/ui/BubbleChat.java +++ b/src/org/linphone/ui/BubbleChat.java @@ -122,6 +122,8 @@ public class BubbleChat implements LinphoneChatMessage.LinphoneChatMessageListen view.setBackgroundResource(R.drawable.chat_bubble_incoming); } + view.setId(message.getStorageId()); + spinner = (ProgressBar) view.findViewById(R.id.spinner); String externalBodyUrl = message.getExternalBodyUrl();