Create qrcode view

This commit is contained in:
Erwan Croze 2018-06-19 14:17:30 +02:00
parent 73abcd78ac
commit 52c0c5f532
20 changed files with 294 additions and 192 deletions

View file

@ -20,9 +20,9 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0'
if (googleFile.exists()) {
classpath 'com.google.gms:google-services:3.1.0'
}
if (googleFile.exists()) {
classpath 'com.google.gms:google-services:3.1.0'
}
}
}

View file

@ -1,125 +1,68 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:background="@color/colorG"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:background="@color/colorH"
android:gravity="center">
<LinearLayout
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="20dp"
android:orientation="vertical">
android:layout_gravity="center"
android:layout_weight="0.1"
android:gravity="center">
<LinearLayout
<RelativeLayout
android:id="@+id/header_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
android:layout_height="120dp"
android:layout_marginBottom="20dp"
android:layout_marginLeft="35dp"
android:layout_marginRight="35dp">
<ImageView
android:src="@drawable/linphone_logo"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_gravity="bottom"/>
<LinearLayout
<TextView
android:id="@+id/textView2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="20dp"
android:layout_gravity="bottom"
android:orientation="vertical">
android:layout_centerVertical="true"
android:layout_toEndOf="@+id/imageView3"
android:text="Bienvenue sur
Mobile Security Intense"
android:textColor="#595959"
android:textSize="20sp"/>
<TextView
android:text="@string/welcome"
style="@style/font13"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<ImageView
android:id="@+id/imageView3"
android:layout_width="65dp"
android:layout_height="65dp"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:layout_marginRight="10dp"
android:src="@drawable/logo_secure_phone_big"/>
</RelativeLayout>
<TextView
android:text="@string/assistant_remote_provisioning_login"
style="@style/font11"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
</LinearLayout>
<TextView
android:text="@string/username"
style="@style/font9"
android:layout_marginTop="30dp"
<RelativeLayout
android:id="@+id/bottom_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
android:layout_height="match_parent"
android:layout_below="@+id/header_text"
android:layout_gravity="center"
android:layout_margin="50dp"
android:foreground="@drawable/avatar_mask_border"
android:gravity="center"
>
<EditText
android:id="@+id/assistant_username"
android:background="@drawable/resizable_textfield"
android:textColor="@color/colorC"
android:textCursorDrawable="@null"
android:inputType="textNoSuggestions"
android:layout_width="match_parent"
android:layout_height="40dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:maxLines="1"/>
<SurfaceView
android:id="@+id/qrcodeCaptureSurface"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_weight="10"
android:visibility="visible"/>
</RelativeLayout>
</RelativeLayout>
<TextView
style="@style/font9"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="20dp"
android:text="@string/domain"/>
<EditText
android:id="@+id/assistant_domain"
android:background="@drawable/resizable_textfield"
android:textColor="@color/colorC"
android:textCursorDrawable="@null"
android:inputType="textEmailAddress"
android:layout_width="match_parent"
android:layout_height="40dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:maxLines="1"/>
<TextView
android:text="@string/password"
style="@style/font9"
android:paddingTop="20dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<EditText
android:id="@+id/assistant_password"
android:background="@drawable/resizable_textfield"
android:textColor="@color/colorC"
android:textCursorDrawable="@null"
android:inputType="textPassword"
android:layout_width="match_parent"
android:layout_height="40dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:maxLines="1"/>
<Button
android:id="@+id/assistant_connect"
android:text="@string/connect"
android:background="@drawable/assistant_button"
style="@style/font5"
android:textAllCaps="false"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:layout_marginTop="20dp"/>
</LinearLayout>
<ImageView
android:src="@drawable/logo_orange"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_margin="30dp"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"/>
</RelativeLayout>
</LinearLayout>

View file

@ -4,9 +4,10 @@
style="@style/font6"
android:layout_width="match_parent"
android:layout_height="45dp"
android:textSize="20sp"
android:textColor="#000000"
android:lineSpacingExtra="13.3sp"
android:divider="@color/colorE"
android:gravity="center_vertical"
android:lineSpacingExtra="13.3sp"
android:paddingLeft="16dp"
android:paddingRight="16dp"/>
android:paddingRight="16dp"
android:textColor="#000000"
android:textSize="20sp"/>

View file

@ -1,34 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<config xmlns="http://www.linphone.org/xsds/lpconfig.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.linphone.org/xsds/lpconfig.xsd lpconfig.xsd">
<section name="proxy_default_values">
<entry name="avpf" overwrite="true">1</entry>
<entry name="dial_escape_plus" overwrite="true">0</entry>
<entry name="publish" overwrite="true">1</entry>
<entry name="quality_reporting_collector" overwrite="true">sip:voip-metrics@sip.linphone.org;transport=tls</entry>
<entry name="quality_reporting_enabled" overwrite="true">1</entry>
<entry name="quality_reporting_interval" overwrite="true">180</entry>
<entry name="reg_expires" overwrite="true">31536000</entry>
<entry name="reg_identity" overwrite="true">sip:?@sip.linphone.org</entry>
<entry name="reg_proxy" overwrite="true">&lt;sip:sip.linphone.org;transport=tls&gt;</entry>
<entry name="reg_sendregister" overwrite="true">1</entry>
<entry name="nat_policy_ref" overwrite="true">nat_policy_default_values</entry>
<entry name="realm" overwrite="true">sip.linphone.org</entry>
<entry name="conference_factory_uri" overwrite="true">sip:conference-factory@sip.linphone.org</entry>
</section>
<section name="nat_policy_default_values">
<entry name="stun_server" overwrite="true">stun.linphone.org</entry>
<entry name="protocols" overwrite="true">stun,ice</entry>
</section>
<section name="sip">
<entry name="rls_uri" overwrite="true">sips:rls@sip.linphone.org</entry>
</section>
<section name="assistant">
<entry name="domain" overwrite="true">sip.linphone.org</entry>
<entry name="password_max_length" overwrite="true">-1</entry>
<entry name="password_min_length" overwrite="true">1</entry>
<entry name="username_length" overwrite="true">-1</entry>
<entry name="username_max_length" overwrite="true">64</entry>
<entry name="username_min_length" overwrite="true">1</entry>
<entry name="username_regex" overwrite="true">^[a-z0-9+_.\-]*$</entry>
</section>
</config>

View file

@ -17,7 +17,7 @@ auto_answer_replacing_calls=1
ping_with_options=0
rls_uri=
use_cpim=1
linphone_specs=groupchat
linphone_specs=groupchat
[rtp]
audio_rtp_port=7076
@ -42,10 +42,15 @@ history_max_size=100
enable_basic_to_client_group_chat_room_migration=0
enable_simple_group_chat_message_state=0
aggregate_imdn=1
store_friends=1
debug=1
[app]
activation_code_length=4
prefer_basic_chat_room=1
show_login_view=1
debug_popup_magic=#1234
server_url=http://85.233.205.218:443/xmlrpc
[in-app-purchase]
server_url=https://subscribe.linphone.org:444/inapp.php

35
res/raw/rootca.pem Normal file
View file

@ -0,0 +1,35 @@
-----BEGIN CERTIFICATE-----
MIIGCzCCA/OgAwIBAgIJAOjhE26c44vQMA0GCSqGSIb3DQEBCwUAMIGbMQswCQYD
VQQGEwJGUjEOMAwGA1UECAwFSXNlcmUxIjAgBgNVBAoMGUJlbGxlZG9ubmUgQ29t
bXVuaWNhdGlvbnMxJTAjBgNVBAMMHEJlbGxlZG9ubmUgQ29tbXVuaWNhdGlvbnMg
Q0ExMTAvBgkqhkiG9w0BCQEWImluZm9AYmVsbGVkb25uZS1jb21tdW5pY2F0aW9u
cy5jb20wHhcNMTYwMjA5MTMyNzIyWhcNMjEwMjA3MTMyNzIyWjCBmzELMAkGA1UE
BhMCRlIxDjAMBgNVBAgMBUlzZXJlMSIwIAYDVQQKDBlCZWxsZWRvbm5lIENvbW11
bmljYXRpb25zMSUwIwYDVQQDDBxCZWxsZWRvbm5lIENvbW11bmljYXRpb25zIENB
MTEwLwYJKoZIhvcNAQkBFiJpbmZvQGJlbGxlZG9ubmUtY29tbXVuaWNhdGlvbnMu
Y29tMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAwRV4AVvnhd0DC/Lq
XBdCKB2yO7t0+mGt8I5KysvC0YDLtPG8JAJaMYHsv4uEgs59mQTh2nquCjhgfwTE
OTuM9jFA7oLIDA64TGcDKrLR2HZn2IMWqwSO6UKhpxo2sJdMrahdXdrj8mkirAx2
46RQypZO3tdNKz1KF7qtYwBjuHfBh56Kbpb7OxXuq/7rr4SiN5mF3AGjMvItUSud
nCFOyQhpXrjxTihdHfK3utsmBeQIf/Je/qs4WuWsEbd/MswWJ/susOCTwDeTbbBs
ada8qOZJBLMowb3/WWZQQg6QyiC+OdOztTB0uRm288ofE9w8a6pbebgWE5ldK0CU
fgr2mmiXwhld0g/N4uVKWWfBSh6YkTX0pI3rWqZU/rQmxWIbsgHZwt2Nm0DEkqfL
+V/isR6IPSuHm+qC0nRKfpzK4F3uPW8HQHC74jYO6W4MqlChBEAp0fVSjzTaq+2p
Xq1jgKFwfDM/JRFoN9MrcUm0IJKaurIYCt/ehgeUC7CVk2gisZCOCCSalrQQrG/4
ahiiicQ16NF7vU1wh87QE7JaU+PpKB+m2r/zPf0t20sWccUReJXMBiY5U5R53468
uex0/pUomRh9+Wk1HX7+4jglj480yVpF4JUYAJKSv5pPOr41ALQhGmZYNNSi1jlx
+DsHyin9WtgTqsQsM55j7dp9ynECAwEAAaNQME4wHQYDVR0OBBYEFJVsMl0INe0b
oPqh80KyBoQD3EFCMB8GA1UdIwQYMBaAFJVsMl0INe0boPqh80KyBoQD3EFCMAwG
A1UdEwQFMAMBAf8wDQYJKoZIhvcNAQELBQADggIBAFFe1CEciCuVEJtgqc86SL79
QTdj04Fre1y3X6d8JSDXDUixSrcALtYKYRaQ8V9iN3OQsxcdFg0rZZpwe6fC7dUM
dZGu2LIVFG8foGHmN+H8lX5AS6XXhLuC6BAoF3aBSiXNArB/3UFKwpzbtWK0ddNS
vg4fqcUua+nzTCv/MKQgJmcgIrYyPKEgLBinhvyERfrzCKfKnifS2dWEAQQPauKq
nwLavdrF6BCXBDygnz5QbaWJyVSfAL6gdbrzGXTDfeM/sAC8cUrpVcQJPFrJWBJ0
29Yie86yZ2Ngr5P/zyuJxkTRTpM95LkjrXiAOfnIqfdpkD/xTxeHvj5AvKO1Ypzv
tihroRoAv4xlCLo795rjryMVCJPw877nUW4m4Vk6+droJOMz0cixs6Hak96/wRJL
3IRxDplk+ZQA9mp6AW/1B1PTv5SvjvhjNIi3s8xjF2eszJ4miucSds9RhsSHg1hN
nxAxhUXBHgNrWdaCf/lassYmIDCkk+yeUwZKBesmoHFBGJtLHT7AtyVVBWzZJ3yH
GaMnP7s9WuhmFEFVK1lrQ/VRDacfQUh8KfV3goRdLb69FA/lrNCn2+1aNVBOCeGQ
n1N2bAvaw595UOLcVhRyuVXnlSgX9gtYuxYz+3SUXIU4eORXb4xhIUEMK8PS2C2f
iYY5TczBWGgvDQuxUXZy
-----END CERTIFICATE-----

View file

@ -2,7 +2,7 @@
<resources>
<!-- Global -->
<string name="default_domain">sip.linphone.org</string><!-- Set the default domain used for account creation/addresses -->
<string name="default_domain">sip.orangecyberdefense.com</string><!-- Set the default domain used for account creation/addresses -->
<string name="default_conference_factory_uri">sip:conference-factory@sip.linphone.org</string>
<string name="sync_account_type">org.linphone</string> <!-- Change package ! -->
<string name="sync_mimetype">vnd.android.cursor.item/org.linphone.profile</string> <!-- Change package, leave .profile at the end. Also change res/xml/contacts.xml ! -->

View file

@ -988,7 +988,7 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
}
public static void ContactsManagerDestroy() {
if (LinphoneManager.instance != null && LinphoneManager.instance.mServiceContext != null)
if (LinphoneManager.isInstanciated() && LinphoneManager.instance.mServiceContext != null)
LinphoneManager.instance.mServiceContext.getContentResolver().unregisterContentObserver(ContactsManager.getInstance());
ContactsManager.getInstance().destroy();
}
@ -1268,6 +1268,10 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
}
@Override
public void onQrcodeFound(Core lc, String result) {
}
public void onCallEncryptionChanged(Core lc, Call call,
boolean encrypted, String authenticationToken) {
}

View file

@ -859,8 +859,8 @@ public final class LinphoneService extends Service {
lc.removeListener(mListener);
}
instance = null;
LinphoneManager.destroy();
instance = null;
// Make sure our notification is gone.
stopForegroundCompat(NOTIF_ID);

View file

@ -184,11 +184,22 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
//This must be done before calling super.onCreate().
super.onCreate(savedInstanceState);
//Obiane specifics
//HTTP to HTTPS migration
try {
if (LinphonePreferences.instance().getRemoteProvisioningUrl() != null
&& LinphonePreferences.instance().getRemoteProvisioningUrl().startsWith("http://")) {
LinphonePreferences.instance().setRemoteProvisioningUrl(LinphonePreferences.instance().getRemoteProvisioningUrl().replace("http://", "https://"));
}
}catch(NullPointerException nPE){
Log.e(nPE);
}
if (getResources().getBoolean(R.bool.orientation_portrait_only)) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
boolean useFirstLoginActivity = getResources().getBoolean(R.bool.display_account_assistant_at_first_start);
if (LinphonePreferences.instance().isProvisioningLoginViewEnabled()) {
if (LinphonePreferences.instance().isProvisioningLoginViewEnabled() && LinphonePreferences.instance().isFirstLaunch()) {
Intent wizard = new Intent();
wizard.setClass(this, RemoteProvisioningLoginActivity.class);
wizard.putExtra("Domain", LinphoneManager.getInstance().wizardLoginViewDomain);
@ -228,7 +239,7 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
currentFragment = FragmentsAvailable.EMPTY;
if (savedInstanceState == null) {
displayDialer();
displayContacts(false);
} else {
currentFragment = (FragmentsAvailable) savedInstanceState.getSerializable("currentFragment");
}
@ -1250,7 +1261,7 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
}
public void checkAndRequestWriteContactsPermission() {
checkAndRequestPermission(Manifest.permission.WRITE_CONTACTS, 0);
//checkAndRequestPermission(Manifest.permission.WRITE_CONTACTS, 0);
}
public void checkAndRequestRecordAudioPermissionForEchoCanceller() {
@ -1340,10 +1351,10 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
LinphonePreferences.instance().enableDeviceRingtone(enableRingtone);
LinphoneManager.getInstance().enableDeviceRingtone(enableRingtone);
break;
case PERMISSIONS_RECORD_AUDIO_ECHO_TESTER:
/*case PERMISSIONS_RECORD_AUDIO_ECHO_TESTER:
if (grantResults[0] == PackageManager.PERMISSION_GRANTED)
((SettingsFragment) fragment).startEchoTester();
break;
break;*/
}
if (readContactsI >= 0 && grantResults[readContactsI] == PackageManager.PERMISSION_GRANTED) {
ContactsManager.getInstance().enableContactsAccess();
@ -1359,8 +1370,8 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
super.onStart();
ArrayList<String> permissionsList = new ArrayList<String>();
int contacts = getPackageManager().checkPermission(Manifest.permission.READ_CONTACTS, getPackageName());
Log.i("[Permission] Contacts permission is " + (contacts == PackageManager.PERMISSION_GRANTED ? "granted" : "denied"));
/*int contacts = getPackageManager().checkPermission(Manifest.permission.READ_CONTACTS, getPackageName());
Log.i("[Permission] Contacts permission is " + (contacts == PackageManager.PERMISSION_GRANTED ? "granted" : "denied"));*/
int readPhone = getPackageManager().checkPermission(Manifest.permission.READ_PHONE_STATE, getPackageName());
Log.i("[Permission] Read phone state permission is " + (readPhone == PackageManager.PERMISSION_GRANTED ? "granted" : "denied"));
@ -1380,17 +1391,17 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
permissionsList.add(Manifest.permission.READ_PHONE_STATE);
}
}
if (contacts != PackageManager.PERMISSION_GRANTED) {
/*if (contacts != PackageManager.PERMISSION_GRANTED) {
if (LinphonePreferences.instance().firstTimeAskingForPermission(Manifest.permission.READ_CONTACTS) || ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.READ_CONTACTS)) {
Log.i("[Permission] Asking for contacts");
permissionsList.add(Manifest.permission.READ_CONTACTS);
}
} else {
} else {*/
if (!ContactsManager.getInstance().contactsFetchedOnce()) {
ContactsManager.getInstance().enableContactsAccess();
ContactsManager.getInstance().fetchContactsAsync();
}
}
//}
if (permissionsList.size() > 0) {
String[] permissions = new String[permissionsList.size()];
@ -1442,14 +1453,14 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
refreshAccounts();
if(getResources().getBoolean(R.bool.enable_in_app_purchase)){
/*if(getResources().getBoolean(R.bool.enable_in_app_purchase)){
isTrialAccount();
}
}*/
displayMissedChats(LinphoneManager.getInstance().getUnreadMessageCount());
displayMissedCalls(LinphoneManager.getLc().getMissedCallsCount());
LinphoneManager.getInstance().changeStatusToOnline();
//LinphoneManager.getInstance().changeStatusToOnline();
if (getIntent().getIntExtra("PreviousActivity", 0) != CALL_ACTIVITY && !doNotGoToCallActivity) {
if (LinphoneManager.getLc().getCalls().length > 0) {
@ -1622,12 +1633,13 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
public void initSideMenu() {
sideMenu = (DrawerLayout) findViewById(R.id.side_menu);
sideMenuItems = new ArrayList<String>();
sideMenuItems.add(getResources().getString(R.string.menu_assistant));
/*sideMenuItems.add(getResources().getString(R.string.menu_assistant));
sideMenuItems.add(getResources().getString(R.string.menu_settings));
if(getResources().getBoolean(R.bool.enable_in_app_purchase)){
sideMenuItems.add(getResources().getString(R.string.inapp));
}
}*/
sideMenuItems.add(getResources().getString(R.string.menu_about));
sideMenuItems.add("");
sideMenuContent = (RelativeLayout) findViewById(R.id.side_menu_content);
sideMenuItemList = (ListView)findViewById(R.id.item_list);
menu = (ImageView) findViewById(R.id.side_menu_button);
@ -1729,16 +1741,16 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
public void refreshAccounts(){
if (LinphoneManager.getLc().getProxyConfigList() != null &&
LinphoneManager.getLc().getProxyConfigList().length > 1) {
accountsList.setVisibility(View.VISIBLE);
accountsList.setVisibility(View.GONE);
accountsList.setAdapter(new AccountsListAdapter());
accountsList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
if(view != null && view.getTag() != null) {
/*if(view != null && view.getTag() != null) {
int position = Integer.parseInt(view.getTag().toString());
LinphoneActivity.instance().displayAccountSettings(position);
}
openOrCloseSideMenu(false);
openOrCloseSideMenu(false);*/
}
});
} else {

View file

@ -21,16 +21,28 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import org.linphone.LinphoneManager;
import org.linphone.LinphonePreferences;
import org.linphone.R;
import org.linphone.activities.LinphoneActivity;
import org.linphone.core.ConfiguringState;
import org.linphone.core.Core;
import org.linphone.core.CoreListenerStub;
import org.linphone.core.ProxyConfig;
import org.linphone.core.RegistrationState;
import org.linphone.mediastream.video.AndroidVideoWindowImpl;
import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration;
import org.linphone.xmlrpc.XmlRpcHelper;
import org.linphone.xmlrpc.XmlRpcListenerBase;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.support.v4.content.ContextCompat;
import android.view.SurfaceView;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
@ -38,16 +50,30 @@ import android.widget.Toast;
public class RemoteProvisioningLoginActivity extends Activity implements OnClickListener {
private EditText login, password, domain;
private Button connect;
private ProgressDialog progress;
private CoreListenerStub mListener;
private SurfaceView mQrcodeView;
private AndroidVideoWindowImpl androidVideoWindowImpl;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.assistant_remote_provisioning_login);
mQrcodeView = (SurfaceView) findViewById(R.id.qrcodeCaptureSurface);
login = (EditText) findViewById(R.id.assistant_username);
mListener = new CoreListenerStub() {
@Override
public void onQrcodeFound(Core lc, String result) {
enableQrcodeReader(false);
//AssistantActivity.instance().displayRemoteProvisioning(result);
}
};
/*login = (EditText) findViewById(R.id.assistant_username);
password = (EditText) findViewById(R.id.assistant_password);
domain = (EditText) findViewById(R.id.assistant_domain);
domain.setText(getString(R.string.default_domain));
connect = (Button) findViewById(R.id.assistant_connect);
connect.setOnClickListener(this);
@ -67,7 +93,17 @@ public class RemoteProvisioningLoginActivity extends Activity implements OnClick
Toast.makeText(RemoteProvisioningLoginActivity.this, R.string.remote_provisioning_failure, Toast.LENGTH_LONG).show();
}
}
};
@Override
public void onRegistrationStateChanged(Core lc, ProxyConfig proxy, RegistrationState state, String smessage) {
if (state.equals(RegistrationState.Ok)) {
LinphonePreferences.instance().firstLaunchSuccessful();
startActivity(new Intent().setClass(RemoteProvisioningLoginActivity.this, LinphoneActivity.class).setData(getIntent().getData()));
finish();
}
if (progress != null) progress.dismiss();
}
};*/
}
private void cancelWizard(boolean bypassCheck) {
@ -79,18 +115,29 @@ public class RemoteProvisioningLoginActivity extends Activity implements OnClick
}
private boolean storeAccount(String username, String password, String domain) {
XmlRpcHelper xmlRpcHelper = new XmlRpcHelper();
/*XmlRpcHelper xmlRpcHelper = new XmlRpcHelper();
xmlRpcHelper.getRemoteProvisioningFilenameAsync(new XmlRpcListenerBase() {
@Override
public void onRemoteProvisioningFilenameSent(String result) {
LinphonePreferences.instance().setRemoteProvisioningUrl(result);
LinphoneManager.getInstance().restartCore();
}
}, username.toString(), password.toString(), domain.toString());
}, username.toString(), password.toString(), domain.toString());*/
LinphonePreferences.instance().firstLaunchSuccessful();
setResult(Activity.RESULT_OK);
finish();
LinphonePreferences.instance().setRemoteProvisioningUrl("https://85.233.205.218/xmlrpc?username=" + username + "&password=" + password + "&domain=" + domain);
///////// TODO
LinphoneManager.getLc().iterate();
LinphoneManager.getLc().iterate();
LinphoneManager.getLc().iterate();
LinphoneManager.getLc().iterate();
LinphoneManager.getLc().iterate();
LinphoneManager.getLc().iterate();
///////// TODO
LinphoneManager.getInstance().restartCore();
LinphoneManager.getLc().addListener(mListener);
//LinphonePreferences.instance().firstLaunchSuccessful();
//setResult(Activity.RESULT_OK);
//finish();
/*String identity = "sip:" + username + "@" + domain;
ProxyConfig prxCfg = lc.createProxyConfig();
try {
@ -110,24 +157,97 @@ public class RemoteProvisioningLoginActivity extends Activity implements OnClick
return true;
}
private void enableQrcodeReader(boolean enable) {
LinphoneManager.getLc().enableQrcodeVideoPreview(enable);
LinphoneManager.getLc().enableVideoPreview(enable);
if (enable) {
LinphoneManager.getLc().addListener(mListener);
} else {
LinphoneManager.getLc().removeListener(mListener);
}
}
private void setBackCamera(boolean useBackCamera) {
int camId = 0;
AndroidCameraConfiguration.AndroidCamera[] cameras = AndroidCameraConfiguration.retrieveCameras();
for (AndroidCameraConfiguration.AndroidCamera androidCamera : cameras) {
if (androidCamera.frontFacing == !useBackCamera)
camId = androidCamera.id;
}
String[] devices = LinphoneManager.getLc().getVideoDevicesList();
String newDevice = devices[camId];
LinphoneManager.getLc().setVideoDevice(newDevice);
}
private void launchQrcodeReader() {
setBackCamera(true);
androidVideoWindowImpl = new AndroidVideoWindowImpl(null, mQrcodeView, new AndroidVideoWindowImpl.VideoWindowListener() {
public void onVideoRenderingSurfaceReady(AndroidVideoWindowImpl vw, SurfaceView surface) {
}
public void onVideoRenderingSurfaceDestroyed(AndroidVideoWindowImpl vw) {
}
public void onVideoPreviewSurfaceReady(AndroidVideoWindowImpl vw, SurfaceView surface) {
LinphoneManager.getLc().setNativePreviewWindowId(androidVideoWindowImpl);
}
public void onVideoPreviewSurfaceDestroyed(AndroidVideoWindowImpl vw) {
}
});
enableQrcodeReader(true);
}
@Override
protected void onResume() {
super.onResume();
public void onStart() {
super.onStart();
}
@Override
public void onResume() {
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (lc != null) {
lc.addListener(mListener);
}
launchQrcodeReader();
if (androidVideoWindowImpl != null) {
synchronized (androidVideoWindowImpl) {
LinphoneManager.getLc().setNativePreviewWindowId(androidVideoWindowImpl);
}
}
super.onResume();
}
@Override
protected void onPause() {
public void onPause() {
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (lc != null) {
lc.removeListener(mListener);
}
if (androidVideoWindowImpl != null) {
synchronized (androidVideoWindowImpl) {
LinphoneManager.getLc().setNativePreviewWindowId(null);
}
}
enableQrcodeReader(false);
setBackCamera(false);
super.onPause();
}
@Override
public void onDestroy() {
if (androidVideoWindowImpl != null) {
androidVideoWindowImpl.release();
androidVideoWindowImpl = null;
}
super.onDestroy();
}
@Override
public void onClick(View v) {
int id = v.getId();
@ -135,13 +255,25 @@ public class RemoteProvisioningLoginActivity extends Activity implements OnClick
if (id == R.id.cancel) {
cancelWizard(false);
}
if (id == R.id.assistant_connect){
/*if (id == R.id.assistant_connect){
displayRemoteProvisioningInProgressDialog();
connect.setEnabled(false);
storeAccount(login.getText().toString(), password.getText().toString(), domain.getText().toString());
}
}*/
}
@Override
public void onBackPressed() {
cancelWizard(false);
}
private void displayRemoteProvisioningInProgressDialog() {
progress = ProgressDialog.show(this, null, null);
Drawable d = new ColorDrawable(ContextCompat.getColor(this, R.color.colorE));
d.setAlpha(200);
progress.getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT);
progress.getWindow().setBackgroundDrawable(d);
progress.setContentView(R.layout.progress_dialog);
progress.show();
}
}

View file

@ -124,7 +124,7 @@ public class ChatCreationFragment extends Fragment implements View.OnClickListen
mClearSearchFieldButton.setOnClickListener(this);
mContactsFetchInProgress = view.findViewById(R.id.contactsFetchInProgress);
mContactsFetchInProgress.setVisibility(View.VISIBLE);
mContactsFetchInProgress.setVisibility(View.GONE);
mSearchAdapter = new SearchContactsListAdapter(null, mInflater, mContactsFetchInProgress);

View file

@ -167,7 +167,7 @@ public class AboutFragment extends Fragment implements OnClickListener {
lc.resetLogCollection();
}
} else */if (v == cancel) {
LinphoneActivity.instance().goToDialerFragment();
LinphoneActivity.instance().displayContacts(false);
}
}
}

@ -1 +1 @@
Subproject commit 48ac645caa629a65fb164882aeddab7eb13a56a9
Subproject commit 3eef7b37214cc8a3fc1453fe92ac483a6b388f08

@ -1 +1 @@
Subproject commit b1622d7ddf1cbe6a0f929537861dfa8b45b293c4
Subproject commit ab5416d66620f32ff6882b6e29dec63203dbca41

@ -1 +1 @@
Subproject commit 8e841b047641b1812a83880a90e89d702747ca5b
Subproject commit cfad8fcc28c7cdba69684c8e35846711aaa16775

@ -1 +1 @@
Subproject commit d389b30b6c417d8bc7a79f561075a5c58871e3bc
Subproject commit 68f19de842824573dd075a4ec41483930b8de325

@ -1 +1 @@
Subproject commit a5dce40387dfb8102aa2408122e3f0fb6fe25a50
Subproject commit f9384facd9e19c79cad20c14f7596e7c18d7b20c

@ -1 +1 @@
Subproject commit a9f96ff708f451d2568d1aa70ea40149d6f8d0ea
Subproject commit 7bae67807795b0dc18dacfa6c463313b97af4936

@ -1 +1 @@
Subproject commit 1fcd6fd1558f26255ae9dac687191ddf988bfd5b
Subproject commit 3afc47570a1c9f34bd2f1a759ae00fb7ecd26a0e