Performances improvements
This commit is contained in:
parent
f81910644a
commit
45254d3261
19 changed files with 66 additions and 162 deletions
|
@ -441,11 +441,13 @@ public class LinphoneManager implements SensorEventListener {
|
|||
mPrefs.getLinphoneFactoryConfig(),
|
||||
mContext);
|
||||
mCore.addListener(mCoreListener);
|
||||
|
||||
if (isPush) {
|
||||
Log.w(
|
||||
"[Manager] We are here because of a received push notification, enter background mode before starting the Core");
|
||||
mCore.enterBackground();
|
||||
}
|
||||
|
||||
mCore.start();
|
||||
TimerTask lTask =
|
||||
new TimerTask() {
|
||||
|
|
|
@ -21,7 +21,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
|
||||
import android.Manifest;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Configuration;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
|
@ -30,6 +29,8 @@ import android.view.View;
|
|||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import org.linphone.LinphoneManager;
|
||||
import org.linphone.R;
|
||||
import org.linphone.call.CallActivity;
|
||||
|
@ -40,15 +41,14 @@ import org.linphone.core.Core;
|
|||
import org.linphone.core.CoreListenerStub;
|
||||
import org.linphone.core.tools.Log;
|
||||
import org.linphone.settings.LinphonePreferences;
|
||||
import org.linphone.views.AddressAware;
|
||||
import org.linphone.views.AddressText;
|
||||
import org.linphone.views.CallButton;
|
||||
import org.linphone.views.Digit;
|
||||
import org.linphone.views.EraseButton;
|
||||
|
||||
public class DialerActivity extends MainActivity implements AddressText.AddressChangedListener {
|
||||
private static final String ACTION_CALL_LINPHONE = "org.linphone.intent.action.CallLaunched";
|
||||
|
||||
private AddressAware mNumpad;
|
||||
private AddressText mAddress;
|
||||
private CallButton mStartCall, mAddCall, mTransferCall;
|
||||
private ImageView mAddContact, mBackToCall;
|
||||
|
@ -91,11 +91,6 @@ public class DialerActivity extends MainActivity implements AddressText.AddressC
|
|||
mTransferCall.setAddressWidget(mAddress);
|
||||
mTransferCall.setIsTransfer(true);
|
||||
|
||||
mNumpad = findViewById(R.id.numpad);
|
||||
if (mNumpad != null) {
|
||||
mNumpad.setAddressWidget(mAddress);
|
||||
}
|
||||
|
||||
mAddContact = findViewById(R.id.add_contact);
|
||||
mAddContact.setEnabled(false);
|
||||
mAddContact.setOnClickListener(
|
||||
|
@ -144,6 +139,7 @@ public class DialerActivity extends MainActivity implements AddressText.AddressC
|
|||
Manifest.permission.READ_CONTACTS
|
||||
};
|
||||
|
||||
setUpNumpad(dialerView);
|
||||
handleIntentParams(getIntent());
|
||||
}
|
||||
|
||||
|
@ -164,15 +160,6 @@ public class DialerActivity extends MainActivity implements AddressText.AddressC
|
|||
core.addListener(mListener);
|
||||
}
|
||||
|
||||
boolean isOrientationLandscape =
|
||||
getResources().getConfiguration().orientation
|
||||
== Configuration.ORIENTATION_LANDSCAPE;
|
||||
if (isOrientationLandscape && !isTablet()) {
|
||||
((LinearLayout) mNumpad).setVisibility(View.GONE);
|
||||
} else {
|
||||
((LinearLayout) mNumpad).setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
updateLayout();
|
||||
enableVideoPreviewIfTablet(true);
|
||||
}
|
||||
|
@ -296,4 +283,24 @@ public class DialerActivity extends MainActivity implements AddressText.AddressC
|
|||
mAddress.setText(addressToCall);
|
||||
}
|
||||
}
|
||||
|
||||
private void setUpNumpad(View view) {
|
||||
if (view == null) return;
|
||||
for (Digit v : retrieveChildren((ViewGroup) view, Digit.class)) {
|
||||
v.setAddressWidget(mAddress);
|
||||
}
|
||||
}
|
||||
|
||||
private <T> Collection<T> retrieveChildren(ViewGroup viewGroup, Class<T> clazz) {
|
||||
final Collection<T> views = new ArrayList<>();
|
||||
for (int i = 0; i < viewGroup.getChildCount(); i++) {
|
||||
View v = viewGroup.getChildAt(i);
|
||||
if (v instanceof ViewGroup) {
|
||||
views.addAll(retrieveChildren((ViewGroup) v, clazz));
|
||||
} else {
|
||||
if (clazz.isInstance(v)) views.add(clazz.cast(v));
|
||||
}
|
||||
}
|
||||
return views;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,7 +70,6 @@ import org.linphone.settings.LinphonePreferences;
|
|||
import org.linphone.utils.AndroidAudioManager;
|
||||
import org.linphone.utils.LinphoneUtils;
|
||||
import org.linphone.views.ContactAvatar;
|
||||
import org.linphone.views.Numpad;
|
||||
|
||||
public class CallActivity extends LinphoneGenericActivity
|
||||
implements CallStatusBarFragment.StatsClikedListener,
|
||||
|
@ -109,7 +108,6 @@ public class CallActivity extends LinphoneGenericActivity
|
|||
private ImageView mPause, mSwitchCamera, mRecordingInProgress;
|
||||
private ImageView mExtrasButtons, mAddCall, mTransferCall, mRecordCall, mConference;
|
||||
private ImageView mAudioRoute, mRouteEarpiece, mRouteSpeaker, mRouteBluetooth;
|
||||
private Numpad mNumpad;
|
||||
private TextView mContactName, mMissedMessages;
|
||||
private ProgressBar mVideoInviteInProgress;
|
||||
private Chronometer mCallTimer;
|
||||
|
@ -300,15 +298,16 @@ public class CallActivity extends LinphoneGenericActivity
|
|||
}
|
||||
});
|
||||
|
||||
mNumpad = findViewById(R.id.numpad);
|
||||
|
||||
ImageView numpadButton = findViewById(R.id.dialer);
|
||||
numpadButton.setOnClickListener(
|
||||
new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
mNumpad.setVisibility(
|
||||
mNumpad.getVisibility() == View.VISIBLE ? View.GONE : View.VISIBLE);
|
||||
findViewById(R.id.numpad)
|
||||
.setVisibility(
|
||||
findViewById(R.id.numpad).getVisibility() == View.VISIBLE
|
||||
? View.GONE
|
||||
: View.VISIBLE);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -443,8 +443,8 @@ public class ContactsManager extends ContentObserver implements FriendListListen
|
|||
|
||||
private synchronized boolean refreshSipContact(Friend lf) {
|
||||
LinphoneContact contact = (LinphoneContact) lf.getUserData();
|
||||
if (contact != null) {
|
||||
|
||||
if (contact != null) {
|
||||
if (LinphoneService.instance().getResources().getBoolean(R.bool.use_linphone_tag)) {
|
||||
// Inserting Linphone information in Android contact if the parameter is enabled
|
||||
if (LinphonePreferences.instance()
|
||||
|
@ -457,10 +457,10 @@ public class ContactsManager extends ContentObserver implements FriendListListen
|
|||
|
||||
if (!mSipContacts.contains(contact)) {
|
||||
mSipContacts.add(contact);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,6 @@ import android.provider.ContactsContract;
|
|||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import org.linphone.LinphoneManager;
|
||||
import org.linphone.LinphoneService;
|
||||
import org.linphone.R;
|
||||
|
@ -78,12 +77,8 @@ public class LinphoneContact extends AndroidContact
|
|||
|
||||
@Override
|
||||
public int compareTo(LinphoneContact contact) {
|
||||
String fullName =
|
||||
getFullName() != null ? getFullName().toUpperCase(Locale.getDefault()) : "";
|
||||
String contactFullName =
|
||||
contact.getFullName() != null
|
||||
? contact.getFullName().toUpperCase(Locale.getDefault())
|
||||
: "";
|
||||
String fullName = getFullName() != null ? getFullName() : "";
|
||||
String contactFullName = contact.getFullName() != null ? contact.getFullName() : "";
|
||||
|
||||
if (fullName.equals(contactFullName)) {
|
||||
if (getAndroidId() != null) {
|
||||
|
|
|
@ -23,6 +23,7 @@ import android.annotation.SuppressLint;
|
|||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.res.TypedArray;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
|
@ -37,18 +38,17 @@ import org.linphone.settings.LinphonePreferences;
|
|||
|
||||
@SuppressLint("AppCompatCustomView")
|
||||
public class Digit extends Button implements AddressAware {
|
||||
|
||||
private AddressText mAddress;
|
||||
private boolean mPlayDtmf;
|
||||
private AddressText mAddress;
|
||||
|
||||
public Digit(Context context, AttributeSet attrs, int style) {
|
||||
super(context, attrs, style);
|
||||
setLongClickable(true);
|
||||
init(context, attrs);
|
||||
}
|
||||
|
||||
public Digit(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
setLongClickable(true);
|
||||
init(context, attrs);
|
||||
}
|
||||
|
||||
public Digit(Context context) {
|
||||
|
@ -56,12 +56,12 @@ public class Digit extends Button implements AddressAware {
|
|||
setLongClickable(true);
|
||||
}
|
||||
|
||||
public void setAddressWidget(AddressText address) {
|
||||
mAddress = address;
|
||||
}
|
||||
private void init(Context context, AttributeSet attrs) {
|
||||
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.Numpad);
|
||||
mPlayDtmf = 1 == a.getInt(R.styleable.Numpad_play_dtmf, 1);
|
||||
a.recycle();
|
||||
|
||||
public void setPlayDtmf(boolean play) {
|
||||
mPlayDtmf = play;
|
||||
setLongClickable(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -85,6 +85,11 @@ public class Digit extends Button implements AddressAware {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAddressWidget(AddressText address) {
|
||||
mAddress = address;
|
||||
}
|
||||
|
||||
private class DialKeyListener implements OnClickListener, OnTouchListener, OnLongClickListener {
|
||||
final char mKeyCode;
|
||||
boolean mIsDtmfStarted;
|
||||
|
|
|
@ -1,74 +0,0 @@
|
|||
package org.linphone.views;
|
||||
|
||||
/*
|
||||
NumpadView.java
|
||||
Copyright (C) 2017 Belledonne Communications, Grenoble, France
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.LinearLayout;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import org.linphone.R;
|
||||
|
||||
public class Numpad extends LinearLayout implements AddressAware {
|
||||
private final boolean mPlayDtmf;
|
||||
|
||||
public Numpad(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
|
||||
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.Numpad);
|
||||
mPlayDtmf = 1 == a.getInt(R.styleable.Numpad_play_dtmf, 1);
|
||||
a.recycle();
|
||||
LayoutInflater.from(context).inflate(R.layout.numpad, this);
|
||||
setLongClickable(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final void onFinishInflate() {
|
||||
for (Digit v : retrieveChildren(this, Digit.class)) {
|
||||
v.setPlayDtmf(mPlayDtmf);
|
||||
}
|
||||
super.onFinishInflate();
|
||||
}
|
||||
|
||||
public void setAddressWidget(AddressText address) {
|
||||
for (AddressAware v : retrieveChildren(this, AddressAware.class)) {
|
||||
v.setAddressWidget(address);
|
||||
}
|
||||
}
|
||||
|
||||
private <T> Collection<T> retrieveChildren(ViewGroup viewGroup, Class<T> clazz) {
|
||||
final Collection<T> views = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < viewGroup.getChildCount(); i++) {
|
||||
View v = viewGroup.getChildAt(i);
|
||||
if (v instanceof ViewGroup) {
|
||||
views.addAll(retrieveChildren((ViewGroup) v, clazz));
|
||||
} else {
|
||||
if (clazz.isInstance(v)) views.add(clazz.cast(v));
|
||||
}
|
||||
}
|
||||
|
||||
return views;
|
||||
}
|
||||
}
|
|
@ -130,7 +130,7 @@
|
|||
|
||||
</RelativeLayout>
|
||||
|
||||
<org.linphone.views.Numpad
|
||||
<include layout="@layout/numpad"
|
||||
android:id="@+id/numpad"
|
||||
android:visibility="gone"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -138,8 +138,7 @@
|
|||
android:layout_centerInParent="true"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:background="@color/toolbar_color"
|
||||
android:contentDescription="@string/content_description_numpad" />
|
||||
android:background="@color/toolbar_color" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
|
|
@ -3,16 +3,6 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/dialer"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="460dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginBottom="50dp"
|
||||
android:background="?attr/backgroundColor"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/address_bar"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -49,16 +39,6 @@
|
|||
|
||||
</RelativeLayout>
|
||||
|
||||
<org.linphone.views.Numpad
|
||||
android:id="@+id/numpad"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_above="@id/controls"
|
||||
android:layout_below="@id/address_bar"
|
||||
android:layout_centerInParent="true"
|
||||
android:padding="10dp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
|
@ -70,10 +70,10 @@
|
|||
|
||||
</RelativeLayout>
|
||||
|
||||
<org.linphone.views.Numpad
|
||||
<include layout="@layout/numpad"
|
||||
android:id="@+id/numpad"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_above="@id/controls"
|
||||
android:layout_below="@id/address_bar"
|
||||
android:layout_centerInParent="true"
|
||||
|
|
|
@ -70,10 +70,10 @@
|
|||
|
||||
</RelativeLayout>
|
||||
|
||||
<org.linphone.views.Numpad
|
||||
<include layout="@layout/numpad"
|
||||
android:id="@+id/numpad"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_above="@id/controls"
|
||||
android:layout_below="@id/address_bar"
|
||||
android:layout_centerInParent="true"
|
||||
|
|
|
@ -122,7 +122,7 @@
|
|||
|
||||
</RelativeLayout>
|
||||
|
||||
<org.linphone.views.Numpad
|
||||
<include layout="@layout/numpad"
|
||||
android:id="@+id/numpad"
|
||||
android:visibility="gone"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -130,8 +130,7 @@
|
|||
android:layout_centerInParent="true"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:background="@color/toolbar_color"
|
||||
android:contentDescription="@string/content_description_numpad" />
|
||||
android:background="@color/toolbar_color" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
|
|
@ -33,8 +33,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_above="@+id/menu"
|
||||
android:layout_below="@id/top_bar"
|
||||
android:background="?attr/backgroundColor">
|
||||
android:layout_below="@id/top_bar">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/contact_name"
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/backgroundColor"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="80dp"
|
||||
android:background="?attr/backgroundColor"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingTop="5dp"
|
||||
|
|
|
@ -3,15 +3,6 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/dialer"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="460dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginBottom="50dp"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/address_bar"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -49,7 +40,7 @@
|
|||
|
||||
</RelativeLayout>
|
||||
|
||||
<org.linphone.views.Numpad
|
||||
<include layout="@layout/numpad"
|
||||
android:id="@+id/numpad"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/backgroundColor">
|
||||
|
||||
<TableRow
|
||||
android:layout_weight="1"
|
||||
|
@ -27,6 +28,7 @@
|
|||
android:background="@drawable/numpad_three"
|
||||
android:soundEffectsEnabled="true"
|
||||
android:text="3" />
|
||||
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
|
@ -53,6 +55,7 @@
|
|||
android:background="@drawable/numpad_six"
|
||||
android:soundEffectsEnabled="true"
|
||||
android:text="6" />
|
||||
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
|
@ -79,6 +82,7 @@
|
|||
android:background="@drawable/numpad_nine"
|
||||
android:soundEffectsEnabled="true"
|
||||
android:text="9" />
|
||||
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
|
@ -105,6 +109,7 @@
|
|||
android:background="@drawable/numpad_sharp"
|
||||
android:soundEffectsEnabled="true"
|
||||
android:text="#" />
|
||||
|
||||
</TableRow>
|
||||
|
||||
</TableLayout>
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<style name="DialerDigit" parent="@android:style/TextAppearance.Medium">
|
||||
<item name="android:layout_width">50dp</item>
|
||||
<item name="android:layout_height">50dp</item>
|
||||
|
|
|
@ -94,7 +94,7 @@
|
|||
<bool name="use_big_pictures_to_preview_images_file_transfers">true</bool>
|
||||
<bool name="show_sip_uri_in_chat">false</bool>
|
||||
<bool name="hide_empty_one_to_one_chat_rooms">true</bool>
|
||||
<bool name="create_most_recent_chat_rooms_shortcuts">true</bool>
|
||||
<bool name="create_most_recent_chat_rooms_shortcuts">false</bool>
|
||||
<bool name="force_end_to_end_encryption_in_chat">false</bool>
|
||||
|
||||
<!-- Contacts -->
|
||||
|
|
Loading…
Reference in a new issue