Merge branch 'feature/release-4.1' into feature/release-4.1-new-chat-bubbles

This commit is contained in:
Sylvain Berfini 2018-11-26 16:11:32 +01:00
commit 8d10836a59
18 changed files with 185 additions and 164 deletions

View file

@ -27,6 +27,18 @@ ln -s <path to linphone-sdk>/linphone-sdk/build/linphone-sdk/bin/outputs/aar/lin
4. Rebuild the app in Android Studio.
## Native debugging
1. Install LLDB from SDK Tools in Android-studio.
2. In Android-studio go to Run->Edit Configurations->Debugger.
3. Select 'Dual' or 'Native' and add the path to linphone-sdk libraries.
4. Open native file and put your breakpoint on it.
5. Debug app.
## Create an apk with a different package name
Before the 4.1 release, there were a lot of files to edit to change the package name.

View file

@ -5,7 +5,7 @@ def getPackageName() {
}
def firebaseEnabled() {
File googleFile = new File('google-services.json')
File googleFile = new File('app/google-services.json')
return googleFile.exists()
}
@ -15,10 +15,6 @@ def isLocalAarAvailable() {
return debugAar.exists() || releaseAar.exists()
}
if (firebaseEnabled()) {
apply plugin: 'com.google.gms.google-services'
}
///// Exclude Files /////
def excludeFiles = []
@ -51,7 +47,7 @@ android {
defaultConfig {
minSdkVersion 21
targetSdkVersion 28
versionCode 4103
versionCode 4104
versionName "4.1"
applicationId getPackageName()
multiDexEnabled true
@ -122,4 +118,7 @@ dependencies {
releaseImplementation "org.linphone:liblinphone-sdk:${android.defaultConfig.versionName}"
debugImplementation "org.linphone:liblinphone-sdk:${android.defaultConfig.versionName}-DEBUG"
}
}
if (firebaseEnabled()) {
apply plugin: 'com.google.gms.google-services'
}

View file

@ -136,7 +136,8 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
private TextView missedCalls, missedChats;
private RelativeLayout contacts, history, dialer, chat;
private View contacts_selected, history_selected, dialer_selected, chat_selected;
private RelativeLayout mTopBar;
private LinearLayout mTopBar;
private TextView mTopBarTitle;
private ImageView cancel;
private FragmentsAvailable pendingFragmentTransaction, currentFragment, leftFragment;
private Fragment fragment;
@ -303,6 +304,7 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
private void initButtons() {
mTabBar = findViewById(R.id.footer);
mTopBar = findViewById(R.id.top_bar);
mTopBarTitle = findViewById(R.id.top_bar_title);
cancel = findViewById(R.id.cancel);
cancel.setOnClickListener(this);
@ -847,6 +849,16 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
public void hideTopBar() {
mTopBar.setVisibility(View.GONE);
mTopBarTitle.setText("");
}
public void showTopBar() {
mTopBar.setVisibility(View.VISIBLE);
}
public void showTopBarWithTitle(String title) {
showTopBar();
mTopBarTitle.setText(title);
}
@SuppressWarnings("incomplete-switch")
@ -880,9 +892,10 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
case SETTINGS:
case ACCOUNT_SETTINGS:
hideTabBar(hideBottomBar);
mTopBar.setVisibility(View.VISIBLE);
showTopBarWithTitle(getString(R.string.settings));
break;
case ABOUT:
showTopBarWithTitle(getString(R.string.about));
hideTabBar(hideBottomBar);
break;
case CHAT_LIST:
@ -1557,8 +1570,14 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
}
break;
case GROUP_CHAT:
hideTopBar(); // just in case
LinphoneActivity.instance().goToChatList();
return true;
case SETTINGS:
case ABOUT:
hideTopBar(); // just in case
LinphoneActivity.instance().goToDialerFragment();
return true;
default:
break;
}

View file

@ -129,7 +129,10 @@ public class ChatMessagesAdapter extends SelectableAdapter<ChatMessageViewHolder
}
Address address = event.getParticipantAddress();
String displayName = null;
if (address == null && event.getType() == EventLog.Type.ConferenceSecurityEvent) {
address = event.getSecurityEventFaultyDeviceAddress();
}
String displayName = "";
if (address != null) {
LinphoneContact contact = ContactsManager.getInstance().findContactFromAddress(address);
if (contact != null) {

View file

@ -60,6 +60,7 @@ import org.linphone.core.ChatMessageListenerStub;
import org.linphone.settings.LinphonePreferences;
import org.linphone.LinphoneService;
import org.linphone.utils.FileUtils;
import org.linphone.utils.ImageUtils;
import org.linphone.utils.LinphoneUtils;
import org.linphone.R;
import org.linphone.LinphoneActivity;
@ -164,12 +165,16 @@ public class ChatMessagesFragment extends Fragment implements ChatRoomListener,
});
mBackButton = view.findViewById(R.id.back);
if (getResources().getBoolean(R.bool.isTablet)) {
mBackButton.setVisibility(View.INVISIBLE);
} else {
mBackButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
LinphoneActivity.instance().goToChatList();
}
});
}
mCallButton = view.findViewById(R.id.start_call);
mCallButton.setOnClickListener(new View.OnClickListener() {
@ -835,6 +840,11 @@ public class ChatMessagesFragment extends Fragment implements ChatRoomListener,
mSendMessageButton.setEnabled(true);
}
private Bitmap scaleToFitHeight(Bitmap b, int height) {
float factor = height / (float) b.getHeight();
return Bitmap.createScaledBitmap(b, (int) (b.getWidth() * factor), height, true);
}
private void addImageToPendingList(String path) {
if (path == null) {
Log.e("Can't add image to pending list because it's path is null...");
@ -847,7 +857,7 @@ public class ChatMessagesFragment extends Fragment implements ChatRoomListener,
ImageView image = pendingImage.findViewById(R.id.pendingImageForUpload);
Bitmap bm = BitmapFactory.decodeFile(path);
if (bm == null) return;
image.setImageBitmap(bm);
image.setImageBitmap(scaleToFitHeight(bm, (int) ImageUtils.dpToPixels(mContext, 100)));
ImageView remove = pendingImage.findViewById(R.id.remove);
remove.setTag(pendingImage);

View file

@ -162,10 +162,14 @@ public class ChatRoomViewHolder extends RecyclerView.ViewHolder implements View.
ContactAvatar.displayAvatar(contact, avatarLayout);
}
} else {
Address remoteAddr;
Address remoteAddr = null;
if (mRoom.hasCapability(ChatRoomCapabilities.Encrypted.toInt())) {
Participant[] participants = mRoom.getParticipants();
if (participants.length > 0) {
remoteAddr = participants[0].getAddress();
} else {
//TODO: error
}
} else {
remoteAddr = mRoom.getPeerAddress();
}

View file

@ -145,6 +145,9 @@ public class SearchContactsListAdapter extends RecyclerView.Adapter<SearchContac
}
if (c != null) {
if (c.getFullName() == null && c.getFirstName() == null && c.getLastName() == null) {
c.setFullName(holder.name.getText().toString());
}
ContactAvatar.displayAvatar(c, holder.avatarLayout);
//TODO get if contact has security capabilities
} else {

View file

@ -48,7 +48,6 @@ import org.linphone.mediastream.Log;
public class AboutFragment extends Fragment implements OnClickListener {
View sendLogButton = null;
View resetLogButton = null;
ImageView cancel;
CoreListenerStub mListener;
private ProgressDialog progress;
private boolean uploadInProgress;
@ -62,9 +61,6 @@ public class AboutFragment extends Fragment implements OnClickListener {
aboutLiblinphoneVersion.setText(String.format(getString(R.string.about_liblinphone_version), LinphoneManager.getLc().getVersion()));
aboutVersion.setText(String.format(getString(R.string.about_version), BuildConfig.VERSION_NAME));
cancel = view.findViewById(R.id.cancel);
cancel.setOnClickListener(this);
sendLogButton = view.findViewById(R.id.send_log);
sendLogButton.setOnClickListener(this);
sendLogButton.setVisibility(LinphonePreferences.instance().isDebugEnabled() ? View.VISIBLE : View.GONE);
@ -162,8 +158,6 @@ public class AboutFragment extends Fragment implements OnClickListener {
if (lc != null) {
lc.resetLogCollection();
}
} else if (v == cancel) {
LinphoneActivity.instance().goToDialerFragment();
}
}
}

View file

@ -20,6 +20,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
@ -29,6 +30,7 @@ import android.graphics.PorterDuffXfermode;
import android.graphics.Rect;
import android.net.Uri;
import android.provider.MediaStore;
import android.util.TypedValue;
import android.widget.ImageView;
import org.linphone.R;
@ -131,4 +133,10 @@ public class ImageUtils {
return output;
}
public static float dpToPixels(Context context, float dp) {
Resources r = context.getResources();
float px = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, r.getDisplayMetrics());
return px;
}
}

View file

@ -2,6 +2,6 @@
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="line">
<stroke android:width="50dp" android:color="@color/colorI"/>
<size android:height="1dp" />
<stroke android:width="1dp" android:color="@color/colorI"/>
<size android:height="1dp" android:width="50dp" />
</shape>

View file

@ -1,42 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:id="@+id/top_bar"
android:orientation="horizontal"
android:background="@color/colorF"
android:layout_width="match_parent"
android:layout_height="60dp">
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.2"/>
<TextView
android:id="@+id/menu_name"
android:text="@string/about"
style="@style/font1"
android:maxLines="1"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.4"
android:gravity="center"
android:padding="15dp"/>
<ImageView
android:id="@+id/cancel"
android:src="@drawable/dialer_back"
android:background="@drawable/toolbar_button"
android:contentDescription="@string/content_description_dialer_back"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.2"
android:padding="15dp"/>
</LinearLayout>
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:baselineAligned="false"

View file

@ -22,34 +22,40 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
<LinearLayout
android:id="@+id/top_bar"
android:visibility="gone"
android:orientation="horizontal"
android:background="@color/colorF"
android:layout_width="match_parent"
android:layout_height="60dp"
android:visibility="gone"
android:layout_alignParentTop="true">
android:layout_height="60dp">
<ImageView
android:id="@+id/cancel"
android:src="@drawable/back"
android:background="@drawable/toolbar_button"
android:contentDescription="@string/content_description_dialer_back"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.2"
android:padding="15dp"/>
<TextView
android:id="@+id/menu_name"
android:text="@string/settings"
android:id="@+id/top_bar_title"
style="@style/font1"
android:layout_width="wrap_content"
android:maxLines="1"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:gravity="center_vertical"/>
android:layout_weight="0.4"
android:gravity="center"
android:padding="15dp"/>
<ImageView
android:id="@+id/cancel"
android:src="@drawable/dialer_back"
android:contentDescription="@string/content_description_dialer_back"
android:layout_width="wrap_content"
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:padding="15dp"
android:layout_centerInParent="true"
android:layout_alignParentRight="true"/>
android:layout_weight="0.2"/>
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
@ -202,6 +208,7 @@
android:layout_alignParentEnd="true"/>
</RelativeLayout>
</LinearLayout>
<LinearLayout
@ -212,6 +219,7 @@
android:orientation="vertical">
</LinearLayout>
</RelativeLayout>
<!-- Side Menu -->
@ -285,6 +293,7 @@
android:background="@color/colorE"/>
</LinearLayout>
</RelativeLayout>
</androidx.drawerlayout.widget.DrawerLayout>

View file

@ -22,34 +22,40 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
<LinearLayout
android:id="@+id/top_bar"
android:visibility="gone"
android:orientation="horizontal"
android:background="@color/colorF"
android:layout_width="match_parent"
android:layout_height="60dp"
android:visibility="gone"
android:layout_alignParentTop="true">
android:layout_height="60dp">
<ImageView
android:id="@+id/cancel"
android:src="@drawable/back"
android:background="@drawable/toolbar_button"
android:contentDescription="@string/content_description_dialer_back"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.2"
android:padding="15dp"/>
<TextView
android:id="@+id/menu_name"
android:text="@string/settings"
android:id="@+id/top_bar_title"
style="@style/font1"
android:layout_width="wrap_content"
android:maxLines="1"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:gravity="center_vertical"/>
android:layout_weight="0.4"
android:gravity="center"
android:padding="15dp"/>
<ImageView
android:id="@+id/cancel"
android:src="@drawable/dialer_back"
android:contentDescription="@string/content_description_dialer_back"
android:layout_width="wrap_content"
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:padding="15dp"
android:layout_centerInParent="true"
android:layout_alignParentRight="true"/>
android:layout_weight="0.2"/>
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
@ -89,6 +95,7 @@
</LinearLayout>
</LinearLayout>
</FrameLayout>
</LinearLayout>
@ -223,7 +230,9 @@
android:layout_alignParentEnd="true"/>
</RelativeLayout>
</LinearLayout>
</RelativeLayout>
<!-- Side Menu -->

View file

@ -22,34 +22,40 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
<LinearLayout
android:id="@+id/top_bar"
android:visibility="gone"
android:orientation="horizontal"
android:background="@color/colorF"
android:layout_width="match_parent"
android:layout_height="60dp"
android:visibility="gone"
android:layout_alignParentTop="true">
android:layout_height="60dp">
<ImageView
android:id="@+id/cancel"
android:src="@drawable/back"
android:background="@drawable/toolbar_button"
android:contentDescription="@string/content_description_dialer_back"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.2"
android:padding="15dp"/>
<TextView
android:id="@+id/menu_name"
android:text="@string/settings"
android:id="@+id/top_bar_title"
style="@style/font1"
android:layout_width="wrap_content"
android:maxLines="1"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:gravity="center_vertical"/>
android:layout_weight="0.4"
android:gravity="center"
android:padding="15dp"/>
<ImageView
android:id="@+id/cancel"
android:src="@drawable/dialer_back"
android:contentDescription="@string/content_description_dialer_back"
android:layout_width="wrap_content"
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:padding="15dp"
android:layout_centerInParent="true"
android:layout_alignParentRight="true"/>
android:layout_weight="0.2"/>
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
@ -88,7 +94,9 @@
android:layout_height="match_parent"/>
</LinearLayout>
</LinearLayout>
</FrameLayout>
</LinearLayout>
@ -222,7 +230,9 @@
android:visibility="gone"/>
</RelativeLayout>
</LinearLayout>
</RelativeLayout>
<!-- Side Menu -->

View file

@ -5,40 +5,6 @@
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:id="@+id/top_bar"
android:orientation="horizontal"
android:background="@color/colorF"
android:layout_width="match_parent"
android:layout_height="60dp">
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.2"/>
<TextView
android:id="@+id/menu_name"
android:text="@string/about"
style="@style/font1"
android:maxLines="1"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.4"
android:gravity="center"
android:padding="15dp"/>
<ImageView
android:id="@+id/cancel"
android:src="@drawable/dialer_back"
android:background="@drawable/toolbar_button"
android:contentDescription="@string/content_description_dialer_back"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.2"
android:padding="15dp"/>
</LinearLayout>
<LinearLayout
android:background="@color/colorC"
android:orientation="vertical"

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="100dp"
android:layout_width="wrap_content"
android:layout_height="100dp"
android:layout_margin="5dp"
android:orientation="vertical">

View file

@ -22,34 +22,40 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
<LinearLayout
android:id="@+id/top_bar"
android:visibility="gone"
android:orientation="horizontal"
android:background="@color/colorF"
android:layout_width="match_parent"
android:layout_height="60dp"
android:visibility="gone"
android:layout_alignParentTop="true">
android:layout_height="60dp">
<ImageView
android:id="@+id/cancel"
android:src="@drawable/back"
android:background="@drawable/toolbar_button"
android:contentDescription="@string/content_description_dialer_back"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.2"
android:padding="15dp"/>
<TextView
android:id="@+id/menu_name"
android:text="@string/settings"
android:id="@+id/top_bar_title"
style="@style/font1"
android:layout_width="wrap_content"
android:maxLines="1"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:gravity="center_vertical"/>
android:layout_weight="0.4"
android:gravity="center"
android:padding="15dp"/>
<ImageView
android:id="@+id/cancel"
android:src="@drawable/dialer_back"
android:contentDescription="@string/content_description_dialer_back"
android:layout_width="wrap_content"
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:padding="15dp"
android:layout_centerInParent="true"
android:layout_alignParentRight="true"/>
android:layout_weight="0.2"/>
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
@ -196,6 +202,7 @@
android:visibility="gone"/>
</RelativeLayout>
</LinearLayout>
<LinearLayout
@ -206,6 +213,7 @@
android:orientation="vertical">
</LinearLayout>
</RelativeLayout>
<!-- Side Menu -->
@ -279,6 +287,7 @@
android:background="@color/colorE"/>
</LinearLayout>
</RelativeLayout>
</androidx.drawerlayout.widget.DrawerLayout>

View file

@ -8,7 +8,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.google.gms:google-services:3.1.0'
classpath 'com.google.gms:google-services:3.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files