From 3bf5905bc010368a55d89228f15fed85902e79c9 Mon Sep 17 00:00:00 2001 From: Margaux Clerc Date: Tue, 12 May 2015 17:33:43 +0200 Subject: [PATCH 1/9] Fix delete contact and bubble chat --- src/org/linphone/EditContactFragment.java | 36 ++++++++++++----------- src/org/linphone/ui/BubbleChat.java | 14 ++++----- 2 files changed, 26 insertions(+), 24 deletions(-) diff --git a/src/org/linphone/EditContactFragment.java b/src/org/linphone/EditContactFragment.java index 4200ac548..ca62beb4f 100644 --- a/src/org/linphone/EditContactFragment.java +++ b/src/org/linphone/EditContactFragment.java @@ -482,25 +482,27 @@ public class EditContactFragment extends Fragment { } public void delete() { - if (isSipAddress) { - if(contact.hasFriends()) { - ContactsManager.getInstance().removeFriend(oldNumberOrAddress); + if(contact != null) { + if (isSipAddress) { + if (contact.hasFriends()) { + ContactsManager.getInstance().removeFriend(oldNumberOrAddress); + } else { + Compatibility.deleteSipAddressFromContact(ops, oldNumberOrAddress, String.valueOf(contactID)); + } + if (getResources().getBoolean(R.bool.use_linphone_tag)) { + Compatibility.deleteLinphoneContactTag(ops, oldNumberOrAddress, contactsManager.findRawLinphoneContactID(String.valueOf(contactID))); + } } else { - Compatibility.deleteSipAddressFromContact(ops, oldNumberOrAddress, String.valueOf(contactID)); + String select = ContactsContract.Data.CONTACT_ID + "=? AND " + + ContactsContract.Data.MIMETYPE + "='" + ContactsContract.CommonDataKinds.Phone.CONTENT_ITEM_TYPE + "' AND " + + ContactsContract.CommonDataKinds.Phone.NUMBER + "=?"; + String[] args = new String[]{String.valueOf(contactID), oldNumberOrAddress}; + + ops.add(ContentProviderOperation.newDelete(ContactsContract.Data.CONTENT_URI) + .withSelection(select, args) + .build() + ); } - if (getResources().getBoolean(R.bool.use_linphone_tag)) { - Compatibility.deleteLinphoneContactTag(ops, oldNumberOrAddress, contactsManager.findRawLinphoneContactID(String.valueOf(contactID))); - } - } else { - String select = ContactsContract.Data.CONTACT_ID + "=? AND " - + ContactsContract.Data.MIMETYPE + "='" + ContactsContract.CommonDataKinds.Phone.CONTENT_ITEM_TYPE + "' AND " - + ContactsContract.CommonDataKinds.Phone.NUMBER + "=?"; - String[] args = new String[] { String.valueOf(contactID), oldNumberOrAddress }; - - ops.add(ContentProviderOperation.newDelete(ContactsContract.Data.CONTENT_URI) - .withSelection(select, args) - .build() - ); } } diff --git a/src/org/linphone/ui/BubbleChat.java b/src/org/linphone/ui/BubbleChat.java index b75169fd7..8a16c3313 100644 --- a/src/org/linphone/ui/BubbleChat.java +++ b/src/org/linphone/ui/BubbleChat.java @@ -174,15 +174,15 @@ public class BubbleChat { bm = BitmapFactory.decodeFile(appData); appData = "file://" + appData; } - - if (bm.getWidth() > bm.getHeight() && bm.getWidth() > SIZE_MAX) { - bm = Bitmap.createScaledBitmap(bm, SIZE_MAX, (SIZE_MAX * bm.getHeight()) / bm.getWidth(), false); - } else if (bm.getHeight() > bm.getWidth() && bm.getHeight() > SIZE_MAX) { - - bm = Bitmap.createScaledBitmap(bm, (SIZE_MAX * bm.getWidth()) / bm.getHeight(), SIZE_MAX, false); - } if (bm != null) { + if (bm.getWidth() > bm.getHeight() && bm.getWidth() > SIZE_MAX) { + bm = Bitmap.createScaledBitmap(bm, SIZE_MAX, (SIZE_MAX * bm.getHeight()) / bm.getWidth(), false); + } else if (bm.getHeight() > bm.getWidth() && bm.getHeight() > SIZE_MAX) { + + bm = Bitmap.createScaledBitmap(bm, (SIZE_MAX * bm.getWidth()) / bm.getHeight(), SIZE_MAX, false); + } + imageView.setImageBitmap(bm); imageView.setTag(appData); imageView.setOnClickListener(new OnClickListener() { From 7702f7567adb4a501a8a5f7f2f58773e5f0f07a6 Mon Sep 17 00:00:00 2001 From: Margaux Clerc Date: Tue, 12 May 2015 17:33:59 +0200 Subject: [PATCH 2/9] Rotate camera image send --- src/org/linphone/ChatFragment.java | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/org/linphone/ChatFragment.java b/src/org/linphone/ChatFragment.java index 8f7c9d192..dbe0b6ef9 100644 --- a/src/org/linphone/ChatFragment.java +++ b/src/org/linphone/ChatFragment.java @@ -22,9 +22,8 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; -import java.security.Timestamp; +import android.graphics.Matrix; import java.util.ArrayList; -import java.util.Calendar; import java.util.List; @@ -43,6 +42,8 @@ import org.linphone.core.LinphoneCoreListenerBase; import org.linphone.mediastream.Log; import org.linphone.ui.AvatarWithShadow; import org.linphone.ui.BubbleChat; + +import android.media.ExifInterface; import android.support.v4.content.CursorLoader; import android.annotation.SuppressLint; @@ -558,6 +559,26 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC bm = Bitmap.createScaledBitmap(bm, (SIZE_MAX * bm.getWidth()) / bm.getHeight(), SIZE_MAX, false); } + // Rotate the bitmap if possible/needed, using EXIF data + Log.w(path); + try { + if (path != null) { + ExifInterface exif = new ExifInterface(path); + int pictureOrientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, 0); + Matrix matrix = new Matrix(); + if (pictureOrientation == 6) { + matrix.postRotate(90); + } else if (pictureOrientation == 3) { + matrix.postRotate(180); + } else if (pictureOrientation == 8) { + matrix.postRotate(270); + } + bm = Bitmap.createBitmap(bm, 0, 0, bm.getWidth(), bm.getHeight(), matrix, true); + } + } catch (Exception e) { + e.printStackTrace(); + } + ByteArrayOutputStream stream = new ByteArrayOutputStream(); bm.compress(Bitmap.CompressFormat.PNG, 100, stream); byte[] byteArray = stream.toByteArray(); From 37ee0296ec8ff67fb095026de8a5057468e75a9f Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 13 May 2015 12:12:23 +0200 Subject: [PATCH 3/9] Updated liblinphone --- submodules/linphone | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submodules/linphone b/submodules/linphone index f1b42dc29..3b9a71708 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit f1b42dc2995fa4f934c4313e94aca0bc63d58c7a +Subproject commit 3b9a717089de8d5ff5412021b2ce194c66013443 From c3122702f7d1ca69496f92b4a1a5d299b51fcdae Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Thu, 14 May 2015 08:54:47 +0200 Subject: [PATCH 4/9] add wrapper for multicast call param --- .../src/org/linphone/tester/Tester.java | 2 ++ .../src/org/linphone/tester/WrapperTester.java | 17 ++++++++++++++++- submodules/linphone | 2 +- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/liblinphone_tester/src/org/linphone/tester/Tester.java b/liblinphone_tester/src/org/linphone/tester/Tester.java index 5359cf58a..aeae460a2 100644 --- a/liblinphone_tester/src/org/linphone/tester/Tester.java +++ b/liblinphone_tester/src/org/linphone/tester/Tester.java @@ -40,6 +40,8 @@ public class Tester { //Main library try { System.loadLibrary("linphone-" + abi); + System.loadLibrary("linphone_tester-" + abi); + Log.i("LinphoneCoreFactoryImpl","Loading done with " + abi); libLoaded=true; break; diff --git a/liblinphone_tester/src/org/linphone/tester/WrapperTester.java b/liblinphone_tester/src/org/linphone/tester/WrapperTester.java index e9ea4b869..f0c17300f 100644 --- a/liblinphone_tester/src/org/linphone/tester/WrapperTester.java +++ b/liblinphone_tester/src/org/linphone/tester/WrapperTester.java @@ -1,5 +1,6 @@ package org.linphone.tester; +import org.linphone.core.LinphoneCallParams; import org.linphone.core.LinphoneCore; import org.linphone.core.LinphoneCoreFactory; import org.linphone.core.LinphoneCoreListenerBase; @@ -19,6 +20,7 @@ public class WrapperTester extends AndroidTestCase { LinphoneCore mCore; @Override protected void runTest() throws Throwable { + //multicast begin mCore.enableAudioMulticast(true); Assert.assertEquals(true, mCore.audioMulticastEnabled()); mCore.enableAudioMulticast(false); @@ -29,6 +31,18 @@ public class WrapperTester extends AndroidTestCase { mCore.enableVideoMulticast(false); Assert.assertEquals(false, mCore.videoMulticastEnabled()); + LinphoneCallParams params = mCore.createDefaultCallParameters(); + params.enableAudioMulticast(true); + Assert.assertEquals(true, params.audioMulticastEnabled()); + params.enableAudioMulticast(false); + Assert.assertEquals(false, params.audioMulticastEnabled()); + + params.enableVideoMulticast(true); + Assert.assertEquals(true, params.videoMulticastEnabled()); + params.enableVideoMulticast(false); + Assert.assertEquals(false, params.videoMulticastEnabled()); + + String ip = "224.3.2.1"; mCore.setAudioMulticastAddr(ip); Assert.assertEquals(ip, mCore.getAudioMulticastAddr()); @@ -42,7 +56,8 @@ public class WrapperTester extends AndroidTestCase { mCore.setVideoMulticastTtl(4); Assert.assertEquals(4, mCore.getVideoMulticastTtl()); - + //multicast end + //Test setPrimaryContact String address = "Linphone Android "; mCore.setPrimaryContact(address); diff --git a/submodules/linphone b/submodules/linphone index 3b9a71708..38ff54a6b 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit 3b9a717089de8d5ff5412021b2ce194c66013443 +Subproject commit 38ff54a6bf747b07e3062de6af02d066ba66ca87 From 130932b98bcacd355b7a6842ca6d963d5c9461c4 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Thu, 14 May 2015 14:34:44 +0200 Subject: [PATCH 5/9] update linphone for SDP offer answer bug --- submodules/linphone | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submodules/linphone b/submodules/linphone index 38ff54a6b..028fe6666 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit 38ff54a6bf747b07e3062de6af02d066ba66ca87 +Subproject commit 028fe666625d1c020030987a8751ebda8ac5fb34 From 28a6f800a5a6a946b2ec353489742244bde4af20 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Fri, 15 May 2015 15:01:34 +0200 Subject: [PATCH 6/9] Fix issue with upload image --- src/org/linphone/ChatFragment.java | 13 ++++++++----- submodules/linphone | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/org/linphone/ChatFragment.java b/src/org/linphone/ChatFragment.java index dbe0b6ef9..cd00aa263 100644 --- a/src/org/linphone/ChatFragment.java +++ b/src/org/linphone/ChatFragment.java @@ -552,10 +552,9 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC protected byte[] doInBackground(Bitmap... params) { Bitmap bm = params[0]; - if (bm.getWidth() > bm.getHeight() && bm.getWidth() > SIZE_MAX) { + if (bm.getWidth() >= bm.getHeight() && bm.getWidth() > SIZE_MAX) { bm = Bitmap.createScaledBitmap(bm, SIZE_MAX, (SIZE_MAX * bm.getHeight()) / bm.getWidth(), false); - } else if (bm.getHeight() > bm.getWidth() && bm.getHeight() > SIZE_MAX) { - + } else if (bm.getHeight() >= bm.getWidth() && bm.getHeight() > SIZE_MAX) { bm = Bitmap.createScaledBitmap(bm, (SIZE_MAX * bm.getWidth()) / bm.getHeight(), SIZE_MAX, false); } @@ -762,8 +761,12 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC if (mUploadingImageStream != null && size > 0) { byte[] data = new byte[size]; int read = mUploadingImageStream.read(data, 0, size); - bufferToFill.setContent(data); - bufferToFill.setSize(read); + if (read > 0) { + bufferToFill.setContent(data); + bufferToFill.setSize(read); + } else { + Log.e("Error, upload task asking for more bytes(" + size + ") than available (" + mUploadingImageStream.available() + ")"); + } } } diff --git a/submodules/linphone b/submodules/linphone index 028fe6666..8eb0f91a9 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit 028fe666625d1c020030987a8751ebda8ac5fb34 +Subproject commit 8eb0f91a9291964781db0658e6cd25a4b1f54a98 From 617beb7db6525e47b7f59de0e99405c7a8016c62 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Fri, 15 May 2015 17:39:11 +0200 Subject: [PATCH 7/9] Load bitmaps in background in chat in order to make UI smoother --- src/org/linphone/ChatFragment.java | 4 +- src/org/linphone/ui/BubbleChat.java | 161 ++++++++++++++++++++++------ 2 files changed, 128 insertions(+), 37 deletions(-) diff --git a/src/org/linphone/ChatFragment.java b/src/org/linphone/ChatFragment.java index cd00aa263..08e7e9395 100644 --- a/src/org/linphone/ChatFragment.java +++ b/src/org/linphone/ChatFragment.java @@ -283,7 +283,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC topBar.setVisibility(View.GONE); } contactPicture.setVisibility(View.GONE); - scrollToEnd(); + //scrollToEnd(); } public void hideKeyboardVisibleMode() { @@ -292,7 +292,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC if (isOrientationLandscape && topBar != null) { topBar.setVisibility(View.VISIBLE); } - scrollToEnd(); + //scrollToEnd(); } class ChatMessageAdapter extends BaseAdapter { diff --git a/src/org/linphone/ui/BubbleChat.java b/src/org/linphone/ui/BubbleChat.java index 8a16c3313..7bd8513c6 100644 --- a/src/org/linphone/ui/BubbleChat.java +++ b/src/org/linphone/ui/BubbleChat.java @@ -19,6 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ import java.io.FileNotFoundException; import java.io.IOException; +import java.lang.ref.WeakReference; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.HashMap; @@ -33,9 +34,13 @@ import org.linphone.mediastream.Log; import android.annotation.SuppressLint; import android.content.Context; import android.content.Intent; +import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.BitmapFactory; +import android.graphics.drawable.BitmapDrawable; +import android.graphics.drawable.Drawable; import android.net.Uri; +import android.os.AsyncTask; import android.provider.MediaStore; import android.text.Html; import android.text.Spannable; @@ -95,7 +100,8 @@ public class BubbleChat { private ImageView statusView; private LinphoneChatMessage nativeMessage; private LinphoneChatMessage.LinphoneChatMessageListener fileTransferListener; - private static final int SIZE_MAX = 2048; + private Context mContext; + private static final int SIZE_MAX = 512; @SuppressLint("InflateParams") public BubbleChat(final Context context, LinphoneChatMessage message, LinphoneChatMessage.LinphoneChatMessageListener listener) { @@ -104,6 +110,7 @@ public class BubbleChat { } nativeMessage = message; fileTransferListener = listener; + mContext = context; view = new RelativeLayout(context); LayoutParams layoutParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); @@ -160,40 +167,7 @@ public class BubbleChat { }); } else { imageView.setVisibility(View.VISIBLE); - - Bitmap bm = null; - if (appData.startsWith("content")) { - try { - bm = MediaStore.Images.Media.getBitmap(context.getContentResolver(), Uri.parse(appData)); - } catch (FileNotFoundException e) { - Log.e(e); - } catch (IOException e) { - Log.e(e); - } - } else { - bm = BitmapFactory.decodeFile(appData); - appData = "file://" + appData; - } - - if (bm != null) { - if (bm.getWidth() > bm.getHeight() && bm.getWidth() > SIZE_MAX) { - bm = Bitmap.createScaledBitmap(bm, SIZE_MAX, (SIZE_MAX * bm.getHeight()) / bm.getWidth(), false); - } else if (bm.getHeight() > bm.getWidth() && bm.getHeight() > SIZE_MAX) { - - bm = Bitmap.createScaledBitmap(bm, (SIZE_MAX * bm.getWidth()) / bm.getHeight(), SIZE_MAX, false); - } - - imageView.setImageBitmap(bm); - imageView.setTag(appData); - imageView.setOnClickListener(new OnClickListener() { - @Override - public void onClick(View v) { - Intent intent = new Intent(Intent.ACTION_VIEW); - intent.setDataAndType(Uri.parse((String)v.getTag()), "image/*"); - context.startActivity(intent); - } - }); - } + loadBitmap(appData, imageView); } } else { TextView msgView = (TextView) layout.findViewById(R.id.message); @@ -340,4 +314,121 @@ public class BubbleChat { public int getId() { return nativeMessage.getStorageId(); } + + public void loadBitmap(String path, ImageView imageView) { + if (cancelPotentialWork(path, imageView)) { + BitmapWorkerTask task = new BitmapWorkerTask(imageView); + Bitmap defaultBitmap = BitmapFactory.decodeResource(mContext.getResources(), R.drawable.chat_photo_default); + final AsyncBitmap asyncBitmap = new AsyncBitmap(mContext.getResources(), defaultBitmap, task); + imageView.setImageDrawable(asyncBitmap); + task.execute(path); + } + } + + private class BitmapWorkerTask extends AsyncTask { + private final WeakReference imageViewReference; + public String path; + + public BitmapWorkerTask(ImageView imageView) { + path = null; + // Use a WeakReference to ensure the ImageView can be garbage collected + imageViewReference = new WeakReference(imageView); + } + + // Decode image in background. + @Override + protected Bitmap doInBackground(String... params) { + path = params[0]; + Bitmap bm = null; + + if (path.startsWith("content")) { + try { + bm = MediaStore.Images.Media.getBitmap(mContext.getContentResolver(), Uri.parse(path)); + } catch (FileNotFoundException e) { + Log.e(e); + } catch (IOException e) { + Log.e(e); + } + } else { + bm = BitmapFactory.decodeFile(path); + path = "file://" + path; + } + + if (bm != null) { + if (bm.getWidth() >= bm.getHeight() && bm.getWidth() > SIZE_MAX) { + bm = Bitmap.createScaledBitmap(bm, SIZE_MAX, (SIZE_MAX * bm.getHeight()) / bm.getWidth(), false); + } else if (bm.getHeight() >= bm.getWidth() && bm.getHeight() > SIZE_MAX) { + bm = Bitmap.createScaledBitmap(bm, (SIZE_MAX * bm.getWidth()) / bm.getHeight(), SIZE_MAX, false); + } + } + return bm; + } + + // Once complete, see if ImageView is still around and set bitmap. + @Override + protected void onPostExecute(Bitmap bitmap) { + if (isCancelled()) { + bitmap = null; + } + + if (imageViewReference != null && bitmap != null) { + final ImageView imageView = imageViewReference.get(); + final BitmapWorkerTask bitmapWorkerTask = getBitmapWorkerTask(imageView); + if (this == bitmapWorkerTask && imageView != null) { + imageView.setImageBitmap(bitmap); + imageView.setTag(path); + imageView.setOnClickListener(new OnClickListener() { + @Override + public void onClick(View v) { + Intent intent = new Intent(Intent.ACTION_VIEW); + intent.setDataAndType(Uri.parse((String)v.getTag()), "image/*"); + mContext.startActivity(intent); + } + }); + } + } + } + } + + static class AsyncBitmap extends BitmapDrawable { + private final WeakReference bitmapWorkerTaskReference; + + public AsyncBitmap(Resources res, Bitmap bitmap, BitmapWorkerTask bitmapWorkerTask) { + super(res, bitmap); + bitmapWorkerTaskReference = new WeakReference(bitmapWorkerTask); + } + + public BitmapWorkerTask getBitmapWorkerTask() { + return bitmapWorkerTaskReference.get(); + } + } + + public static boolean cancelPotentialWork(String path, ImageView imageView) { + final BitmapWorkerTask bitmapWorkerTask = getBitmapWorkerTask(imageView); + + if (bitmapWorkerTask != null) { + final String bitmapData = bitmapWorkerTask.path; + // If bitmapData is not yet set or it differs from the new data + if (bitmapData == null || bitmapData != path) { + // Cancel previous task + bitmapWorkerTask.cancel(true); + } else { + // The same work is already in progress + return false; + } + } + // No task associated with the ImageView, or an existing task was cancelled + return true; + } + + private static BitmapWorkerTask getBitmapWorkerTask(ImageView imageView) { + if (imageView != null) { + final Drawable drawable = imageView.getDrawable(); + if (drawable instanceof AsyncBitmap) { + final AsyncBitmap asyncDrawable = (AsyncBitmap) drawable; + return asyncDrawable.getBitmapWorkerTask(); + } + } + return null; + } } From b6771b24dc5c4fe7f29bc52226ff478543aa2a56 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Mon, 18 May 2015 11:02:44 +0200 Subject: [PATCH 8/9] Improved scrollToEnd and thumbnail bitmap for chat view --- res/layout/chat.xml | 1 + src/org/linphone/ChatFragment.java | 9 +-------- src/org/linphone/ui/BubbleChat.java | 7 ++++--- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/res/layout/chat.xml b/res/layout/chat.xml index a3a38ce09..33cf7b76b 100644 --- a/res/layout/chat.xml +++ b/res/layout/chat.xml @@ -187,6 +187,7 @@ android:layout_height="match_parent" android:divider="@android:color/transparent" android:stackFromBottom="true" + android:transcriptMode="alwaysScroll" android:cacheColorHint="@color/transparent" android:dividerHeight="1dp" android:layout_above="@id/remoteComposing" diff --git a/src/org/linphone/ChatFragment.java b/src/org/linphone/ChatFragment.java index 08e7e9395..1cc46c137 100644 --- a/src/org/linphone/ChatFragment.java +++ b/src/org/linphone/ChatFragment.java @@ -210,7 +210,6 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC LinphoneAddress from = cr.getPeerAddress(); if (from.asStringUriOnly().equals(sipUri)) { invalidate(); - scrollToEnd(); } } @@ -507,9 +506,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC } invalidate(); - Log.i("Sent message current status: " + message.getStatus()); - scrollToEnd(); } else if (!isNetworkReachable && LinphoneActivity.isInstanciated()) { LinphoneActivity.instance().displayCustomToast(getString(R.string.error_network_unreachable), Toast.LENGTH_LONG); } @@ -618,6 +615,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC private void invalidate() { adapter.refreshHistory(); adapter.notifyDataSetChanged(); + chatRoom.markAsRead(); } private void resendMessage(int id) { @@ -635,11 +633,6 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC } } - private void scrollToEnd() { - messagesList.smoothScrollToPosition(messagesList.getCount()); - chatRoom.markAsRead(); - } - private void copyTextMessageToClipboard(int id) { String msg = LinphoneActivity.instance().getChatStorage().getTextMessageForId(chatRoom, id); if (msg != null) { diff --git a/src/org/linphone/ui/BubbleChat.java b/src/org/linphone/ui/BubbleChat.java index 7bd8513c6..7ff74ef65 100644 --- a/src/org/linphone/ui/BubbleChat.java +++ b/src/org/linphone/ui/BubbleChat.java @@ -39,6 +39,7 @@ import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; +import android.media.ThumbnailUtils; import android.net.Uri; import android.os.AsyncTask; import android.provider.MediaStore; @@ -343,7 +344,7 @@ public class BubbleChat { if (path.startsWith("content")) { try { - bm = MediaStore.Images.Media.getBitmap(mContext.getContentResolver(), Uri.parse(path)); + bm = MediaStore.Images.Media.getBitmap(mContext.getContentResolver(), Uri.parse(path)); } catch (FileNotFoundException e) { Log.e(e); } catch (IOException e) { @@ -356,9 +357,9 @@ public class BubbleChat { if (bm != null) { if (bm.getWidth() >= bm.getHeight() && bm.getWidth() > SIZE_MAX) { - bm = Bitmap.createScaledBitmap(bm, SIZE_MAX, (SIZE_MAX * bm.getHeight()) / bm.getWidth(), false); + bm = ThumbnailUtils.extractThumbnail(bm, SIZE_MAX, (SIZE_MAX * bm.getHeight()) / bm.getWidth()); } else if (bm.getHeight() >= bm.getWidth() && bm.getHeight() > SIZE_MAX) { - bm = Bitmap.createScaledBitmap(bm, (SIZE_MAX * bm.getWidth()) / bm.getHeight(), SIZE_MAX, false); + bm = ThumbnailUtils.extractThumbnail(bm, (SIZE_MAX * bm.getWidth()) / bm.getHeight(), SIZE_MAX); } } return bm; From 5f9d4461955bfe167eb8fe11cb963465e42f6c54 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Tue, 19 May 2015 11:56:06 +0200 Subject: [PATCH 9/9] Improved release procedure --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 68175f4e8..eb69db45e 100644 --- a/Makefile +++ b/Makefile @@ -474,7 +474,7 @@ release: update-project patch -p1 < release.patch cat ant.properties | grep version.name > default.properties $(ANT) release - git checkout HEAD AndroidManifest.xml + patch -Rp1 < release.patch run-linphone: ant run