Reworked assistant code

This commit is contained in:
Sylvain Berfini 2019-05-03 13:28:41 +02:00
parent 3b66218d63
commit df27d9bed5
83 changed files with 4658 additions and 6560 deletions

View file

@ -59,7 +59,7 @@ project.tasks['preBuild'].dependsOn 'getGitVersion'
repositories { repositories {
maven { maven {
// Replace snapshots by releases for releases ! // Replace snapshots by releases for releases !
url "https://linphone.org/releases/maven_repository" url "https://linphone.org/snapshots/maven_repository"
} }
} }

View file

@ -75,6 +75,7 @@
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity <activity
android:name=".LinphoneActivity" android:name=".LinphoneActivity"
android:launchMode="singleTask" android:launchMode="singleTask"
@ -130,6 +131,7 @@
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity <activity
android:name=".call.CallIncomingActivity" android:name=".call.CallIncomingActivity"
android:launchMode="singleTop" android:launchMode="singleTop"
@ -159,23 +161,93 @@
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
</intent-filter> </intent-filter>
<!--
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<data android:mimeType="audio/*" />
<data android:mimeType="video/*" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
-->
</activity> </activity>
<activity <activity
android:name=".assistant.AssistantActivity" android:name=".assistant.MenuAssistantActivity"
android:screenOrientation="behind"
android:theme="@style/LinphoneStyleLight"> android:theme="@style/LinphoneStyleLight">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity
android:name=".assistant.AccountConnectionAssistantActivity"
android:theme="@style/LinphoneStyleLight">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
<activity
android:name=".assistant.EmailAccountCreationAssistantActivity"
android:theme="@style/LinphoneStyleLight">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
<activity
android:name=".assistant.EmailAccountValidationAssistantActivity"
android:theme="@style/LinphoneStyleLight">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
<activity
android:name=".assistant.PhoneAccountCreationAssistantActivity"
android:theme="@style/LinphoneStyleLight">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
<activity
android:name=".assistant.PhoneAccountValidationAssistantActivity"
android:theme="@style/LinphoneStyleLight">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
<activity
android:name=".assistant.PhoneAccountLinkingAssistantActivity"
android:theme="@style/LinphoneStyleLight">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
<activity
android:name=".assistant.GenericConnectionAssistantActivity"
android:theme="@style/LinphoneStyleLight">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
<activity
android:name=".assistant.QrCodeConfigurationAssistantActivity"
android:theme="@style/LinphoneStyleLight">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
<activity
android:name=".assistant.RemoteConfigurationAssistantActivity"
android:theme="@style/LinphoneStyleLight">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
<activity
android:name=".assistant.EchoCancellerCalibrationAssistantActivity"
android:theme="@style/LinphoneStyleLight">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
<activity
android:name=".assistant.OpenH264DownloadAssistantActivity"
android:theme="@style/LinphoneStyleLight">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
<activity <activity
android:name=".purchase.InAppPurchaseActivity" android:name=".purchase.InAppPurchaseActivity"
android:screenOrientation="nosensor" android:screenOrientation="nosensor"
@ -184,29 +256,6 @@
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity
android:name=".assistant.RemoteProvisioningLoginActivity"
android:screenOrientation="nosensor"
android:theme="@style/LinphoneStyleLight">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
<activity
android:name=".assistant.RemoteProvisioningActivity"
android:screenOrientation="nosensor"
android:theme="@style/LinphoneStyleLight">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
<intent-filter>
<data android:scheme="linphone-config" /> <!-- Change if needed -->
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<service <service
android:name=".LinphoneService" android:name=".LinphoneService"
@ -258,14 +307,6 @@
</intent-filter> </intent-filter>
</receiver> </receiver>
<!--<receiver
android:name=".receivers.OutgoingCallReceiver"
android:permission="android.permission.PROCESS_OUTGOING_CALLS">
<intent-filter>
<action android:name="android.intent.action.NEW_OUTGOING_CALL" />
</intent-filter>
</receiver>-->
<receiver <receiver
android:name=".receivers.AccountEnableReceiver" android:name=".receivers.AccountEnableReceiver"
android:permission="android.permission.USE_SIP"> android:permission="android.permission.USE_SIP">

View file

@ -29,7 +29,6 @@ import android.app.FragmentTransaction;
import android.app.KeyguardManager; import android.app.KeyguardManager;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
@ -68,8 +67,7 @@ import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import org.linphone.LinphoneManager.AddressType; import org.linphone.LinphoneManager.AddressType;
import org.linphone.assistant.AssistantActivity; import org.linphone.assistant.MenuAssistantActivity;
import org.linphone.assistant.RemoteProvisioningLoginActivity;
import org.linphone.call.CallActivity; import org.linphone.call.CallActivity;
import org.linphone.call.CallIncomingActivity; import org.linphone.call.CallIncomingActivity;
import org.linphone.call.CallOutgoingActivity; import org.linphone.call.CallOutgoingActivity;
@ -180,31 +178,6 @@ public class LinphoneActivity extends LinphoneGenericActivity
LinphoneService.instance().removeForegroundServiceNotificationIfPossible(); LinphoneService.instance().removeForegroundServiceNotificationIfPossible();
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()) {
Intent wizard = new Intent();
wizard.setClass(this, RemoteProvisioningLoginActivity.class);
wizard.putExtra("Domain", LinphoneManager.getInstance().wizardLoginViewDomain);
startActivity(wizard);
finish();
return;
} else if (savedInstanceState == null
&& (useFirstLoginActivity
&& LinphoneManager.getLcIfManagerNotDestroyedOrNull() != null
&& LinphonePreferences.instance().isFirstLaunch())) {
if (LinphonePreferences.instance().getAccountCount() > 0) {
LinphonePreferences.instance().firstLaunchSuccessful();
} else {
startActivity(new Intent().setClass(this, AssistantActivity.class));
finish();
return;
}
}
if (getResources().getBoolean(R.bool.use_linphone_tag)) { if (getResources().getBoolean(R.bool.use_linphone_tag)) {
if (getPackageManager() if (getPackageManager()
.checkPermission( .checkPermission(
@ -1034,7 +1007,7 @@ public class LinphoneActivity extends LinphoneGenericActivity
} }
private void displayAssistant() { private void displayAssistant() {
startActivity(new Intent(LinphoneActivity.this, AssistantActivity.class)); startActivity(new Intent(LinphoneActivity.this, MenuAssistantActivity.class));
} }
private void displayInapp() { private void displayInapp() {
@ -1660,7 +1633,7 @@ public class LinphoneActivity extends LinphoneGenericActivity
new Intent() new Intent()
.setClass( .setClass(
LinphoneManager.getInstance().getContext(), LinphoneManager.getInstance().getContext(),
AssistantActivity.class)); MenuAssistantActivity.class));
finish(); finish();
} }
} else if (selectedItem.equals(getString(R.string.menu_settings))) { } else if (selectedItem.equals(getString(R.string.menu_settings))) {

View file

@ -26,7 +26,7 @@ import android.content.Intent;
import android.content.pm.ActivityInfo; import android.content.pm.ActivityInfo;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import org.linphone.assistant.RemoteProvisioningActivity; import org.linphone.assistant.MenuAssistantActivity;
import org.linphone.settings.LinphonePreferences; import org.linphone.settings.LinphonePreferences;
/** Launch Linphone main activity when Service is ready. */ /** Launch Linphone main activity when Service is ready. */
@ -62,12 +62,11 @@ public class LinphoneLauncherActivity extends Activity {
private void onServiceReady() { private void onServiceReady() {
final Class<? extends Activity> classToStart; final Class<? extends Activity> classToStart;
/*if (getResources().getBoolean(R.bool.show_tutorials_instead_of_app)) {
classToStart = TutorialLauncherActivity.class; boolean useFirstLoginActivity =
} else */ getResources().getBoolean(R.bool.display_account_assistant_at_first_start);
if (getResources().getBoolean(R.bool.display_sms_remote_provisioning_activity) if (useFirstLoginActivity && LinphonePreferences.instance().isFirstLaunch()) {
&& LinphonePreferences.instance().isFirstRemoteProvisioning()) { classToStart = MenuAssistantActivity.class;
classToStart = RemoteProvisioningActivity.class;
} else { } else {
classToStart = LinphoneActivity.class; classToStart = LinphoneActivity.class;
} }
@ -76,8 +75,12 @@ public class LinphoneLauncherActivity extends Activity {
new Runnable() { new Runnable() {
@Override @Override
public void run() { public void run() {
startActivity( Intent intent = new Intent();
getIntent().setClass(LinphoneLauncherActivity.this, classToStart)); intent.setClass(LinphoneLauncherActivity.this, classToStart);
if (getIntent() != null && getIntent().getExtras() != null) {
intent.putExtras(getIntent().getExtras());
}
startActivity(intent);
} }
}, },
500); 500);

View file

@ -68,7 +68,7 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Timer; import java.util.Timer;
import java.util.TimerTask; import java.util.TimerTask;
import org.linphone.assistant.AssistantActivity; import org.linphone.assistant.PhoneAccountLinkingAssistantActivity;
import org.linphone.call.CallActivity; import org.linphone.call.CallActivity;
import org.linphone.call.CallIncomingActivity; import org.linphone.call.CallIncomingActivity;
import org.linphone.call.CallManager; import org.linphone.call.CallManager;
@ -149,7 +149,6 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
private static boolean sExited; private static boolean sExited;
public final String configFile; public final String configFile;
public String wizardLoginViewDomain = null;
/** Called when the activity is first created. */ /** Called when the activity is first created. */
private final String mLPConfigXsd; private final String mLPConfigXsd;
@ -382,7 +381,7 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
} else { } else {
progress.dismiss(); progress.dismiss();
progress = null; progress = null;
if (Build.VERSION.SDK_INT /*if (Build.VERSION.SDK_INT
>= Build.VERSION_CODES.LOLLIPOP_MR1) { >= Build.VERSION_CODES.LOLLIPOP_MR1) {
LinphoneManager.getLc() LinphoneManager.getLc()
.reloadMsPlugins( .reloadMsPlugins(
@ -393,7 +392,7 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
} else { } else {
// We need to restart due to bad android linker // We need to restart due to bad android linker
AssistantActivity.instance().restartApplication(); AssistantActivity.instance().restartApplication();
} }*/
} }
} }
}); });
@ -1507,6 +1506,21 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
private void askLinkWithPhoneNumber() { private void askLinkWithPhoneNumber() {
if (!LinphonePreferences.instance().isLinkPopupEnabled()) return; if (!LinphonePreferences.instance().isLinkPopupEnabled()) return;
long now = new Timestamp(new Date().getTime()).getTime();
if (LinphonePreferences.instance().getLinkPopupTime() != null
&& Long.parseLong(LinphonePreferences.instance().getLinkPopupTime()) >= now) return;
long future =
new Timestamp(
LinphoneActivity.instance()
.getResources()
.getInteger(
R.integer.phone_number_linking_popup_time_interval))
.getTime();
long newDate = now + future;
LinphonePreferences.instance().setLinkPopupTime(String.valueOf(newDate));
final Dialog dialog = final Dialog dialog =
LinphoneActivity.instance() LinphoneActivity.instance()
.displayDialog( .displayDialog(
@ -1540,9 +1554,9 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
@Override @Override
public void onClick(View view) { public void onClick(View view) {
Intent assistant = new Intent(); Intent assistant = new Intent();
assistant.setClass(LinphoneActivity.instance(), AssistantActivity.class); assistant.setClass(
assistant.putExtra("LinkPhoneNumber", true); LinphoneActivity.instance(),
assistant.putExtra("LinkPhoneNumberAsk", true); PhoneAccountLinkingAssistantActivity.class);
mServiceContext.startActivity(assistant); mServiceContext.startActivity(assistant);
dialog.dismiss(); dialog.dismiss();
} }
@ -1643,11 +1657,6 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
LinphonePreferences prefs = LinphonePreferences.instance(); LinphonePreferences prefs = LinphonePreferences.instance();
if (state == ConfiguringState.Successful) { if (state == ConfiguringState.Successful) {
if (prefs.isProvisioningLoginViewEnabled()) {
ProxyConfig proxyConfig = lc.createProxyConfig();
Address addr = proxyConfig.getIdentityAddress();
wizardLoginViewDomain = addr.getDomain();
}
prefs.setPushNotificationEnabled(prefs.isPushNotificationEnabled()); prefs.setPushNotificationEnabled(prefs.isPushNotificationEnabled());
} }
} }

View file

@ -0,0 +1,271 @@
package org.linphone.assistant;
/*
AccountConnectionAssistantActivity.java
Copyright (C) 2019 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.Intent;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.Switch;
import android.widget.TextView;
import androidx.annotation.Nullable;
import org.linphone.R;
import org.linphone.core.AccountCreator;
import org.linphone.core.AccountCreatorListenerStub;
import org.linphone.core.DialPlan;
import org.linphone.core.tools.Log;
public class AccountConnectionAssistantActivity extends AssistantActivity {
private RelativeLayout mPhoneNumberConnection, mUsernameConnection;
private Switch mUsernameConnectionSwitch;
private EditText mPrefix, mPhoneNumber, mUsername, mPassword;
private TextView mCountryPicker, mError, mConnect;
private ImageView mPhoneNumberInfos;
private AccountCreatorListenerStub mListener;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.assistant_account_connection);
mPhoneNumberConnection = findViewById(R.id.phone_number_form);
mUsernameConnection = findViewById(R.id.username_form);
mUsernameConnectionSwitch = findViewById(R.id.username_login);
mUsernameConnectionSwitch.setOnCheckedChangeListener(
new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
mPhoneNumberConnection.setVisibility(isChecked ? View.GONE : View.VISIBLE);
mUsernameConnection.setVisibility(isChecked ? View.VISIBLE : View.GONE);
}
});
mConnect = findViewById(R.id.assistant_login);
mConnect.setOnClickListener(
new View.OnClickListener() {
@Override
public void onClick(View v) {
mAccountCreator.setDomain(getString(R.string.default_domain));
mConnect.setEnabled(false);
if (mUsernameConnectionSwitch.isChecked()) {
mAccountCreator.setUsername(mUsername.getText().toString());
mAccountCreator.setPassword(mPassword.getText().toString());
createProxyConfigAndLeaveAssistant();
} else {
mAccountCreator.setUsername(mPhoneNumber.getText().toString());
AccountCreator.Status status = mAccountCreator.recoverAccount();
if (status != AccountCreator.Status.RequestOk) {
Log.e("[Account Connection] recoverAccount returned " + status);
mConnect.setEnabled(true);
showGenericErrorDialog(status);
}
}
}
});
mConnect.setEnabled(false);
if (getResources().getBoolean(R.bool.use_phone_number_validation)) {
if (getResources().getBoolean(R.bool.isTablet)) {
mUsernameConnectionSwitch.setChecked(true);
} else {
mUsernameConnection.setVisibility(View.GONE);
}
} else {
mPhoneNumberConnection.setVisibility(View.GONE);
findViewById(R.id.username_switch_layout).setVisibility(View.GONE);
}
mCountryPicker = findViewById(R.id.select_country);
mCountryPicker.setOnClickListener(
new View.OnClickListener() {
@Override
public void onClick(View v) {
showCountryPickerDialog();
}
});
mError = findViewById(R.id.phone_number_error);
mPrefix = findViewById(R.id.dial_code);
mPrefix.setText("+");
mPrefix.addTextChangedListener(
new TextWatcher() {
@Override
public void beforeTextChanged(
CharSequence s, int start, int count, int after) {}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {}
@Override
public void afterTextChanged(Editable s) {
String prefix = s.toString();
if (prefix.startsWith("+")) {
prefix = prefix.substring(1);
}
DialPlan dp = getDialPlanFromPrefix(prefix);
if (dp != null) {
mCountryPicker.setText(dp.getCountry());
}
updateConnectButtonAndDisplayError();
}
});
mPhoneNumber = findViewById(R.id.phone_number);
mPhoneNumber.addTextChangedListener(
new TextWatcher() {
@Override
public void beforeTextChanged(
CharSequence s, int start, int count, int after) {}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {}
@Override
public void afterTextChanged(Editable s) {
updateConnectButtonAndDisplayError();
}
});
mPhoneNumberInfos = findViewById(R.id.info_phone_number);
mPhoneNumberInfos.setOnClickListener(
new View.OnClickListener() {
@Override
public void onClick(View v) {
showPhoneNumberDialog();
}
});
mUsername = findViewById(R.id.assistant_username);
mUsername.addTextChangedListener(
new TextWatcher() {
@Override
public void beforeTextChanged(
CharSequence s, int start, int count, int after) {}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {}
@Override
public void afterTextChanged(Editable s) {
mConnect.setEnabled(s.length() > 0 && mPassword.getText().length() > 0);
}
});
mPassword = findViewById(R.id.assistant_password);
mPassword.addTextChangedListener(
new TextWatcher() {
@Override
public void beforeTextChanged(
CharSequence s, int start, int count, int after) {}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {}
@Override
public void afterTextChanged(Editable s) {
mConnect.setEnabled(s.length() > 0 && mUsername.getText().length() > 0);
}
});
mListener =
new AccountCreatorListenerStub() {
@Override
public void onRecoverAccount(
AccountCreator creator, AccountCreator.Status status, String resp) {
Log.i("[Account Connection] onRecoverAccount status is " + status);
if (status.equals(AccountCreator.Status.RequestOk)) {
Intent intent =
new Intent(
AccountConnectionAssistantActivity.this,
PhoneAccountValidationAssistantActivity.class);
intent.putExtra("isLoginVerification", true);
startActivity(intent);
} else {
mConnect.setEnabled(true);
showGenericErrorDialog(status);
}
}
};
}
@Override
protected void onResume() {
super.onResume();
mAccountCreator.addListener(mListener);
DialPlan dp = getDialPlanForCurrentCountry();
displayDialPlan(dp);
String phoneNumber = getDevicePhoneNumber();
if (phoneNumber != null) {
mPhoneNumber.setText(phoneNumber);
}
}
@Override
protected void onPause() {
super.onPause();
mAccountCreator.removeListener(mListener);
}
@Override
public void onCountryClicked(DialPlan dialPlan) {
super.onCountryClicked(dialPlan);
displayDialPlan(dialPlan);
}
private void updateConnectButtonAndDisplayError() {
if (mPrefix.getText().toString().isEmpty() || mPhoneNumber.getText().toString().isEmpty())
return;
int status = arePhoneNumberAndPrefixOk(mPrefix, mPhoneNumber);
if (status == AccountCreator.PhoneNumberStatus.Ok.toInt()) {
mConnect.setEnabled(true);
mError.setText("");
mError.setVisibility(View.INVISIBLE);
} else {
mConnect.setEnabled(false);
mError.setText(getErrorFromPhoneNumberStatus(status));
mError.setVisibility(View.VISIBLE);
}
}
private void displayDialPlan(DialPlan dp) {
if (dp != null) {
mPrefix.setText("+" + dp.getCountryCallingCode());
mCountryPicker.setText(dp.getCountry());
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -1,33 +0,0 @@
package org.linphone.assistant;
/*
AssistantFragmentsEnum.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.
*/
public enum AssistantFragmentsEnum {
WELCOME,
CREATE_ACCOUNT,
CREATE_ACCOUNT_ACTIVATION,
CREATE_ACCOUNT_CODE_ACTIVATION,
LINPHONE_LOGIN,
COUNTRY_CHOOSER,
LOGIN,
REMOTE_PROVISIONING,
ECHO_CANCELLER_CALIBRATION,
DOWNLOAD_CODEC,
QRCODE_READER
}

View file

@ -1,220 +0,0 @@
package org.linphone.assistant;
/*
CodecDownloaderFragment.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.app.Fragment;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ProgressBar;
import android.widget.TextView;
import org.linphone.LinphoneManager;
import org.linphone.R;
import org.linphone.core.PayloadType;
import org.linphone.core.tools.OpenH264DownloadHelper;
import org.linphone.core.tools.OpenH264DownloadHelperListener;
public class CodecDownloaderFragment extends Fragment {
private final Handler mHandler = new Handler();
private TextView mQuestion;
private TextView mDownloading;
private TextView mDownloaded;
private Button mYes;
private Button mNo;
private Button mOk;
private ProgressBar mProgressBar;
private TextView mDownloadingInfo;
@Override
public View onCreateView(
LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
final View view = inflater.inflate(R.layout.assistant_codec_downloader, container, false);
mQuestion = view.findViewById(R.id.question);
mDownloading = view.findViewById(R.id.downloading);
mDownloaded = view.findViewById(R.id.downloaded);
mYes = view.findViewById(R.id.answerYes);
mNo = view.findViewById(R.id.answerNo);
mOk = view.findViewById(R.id.answerOk);
mProgressBar = view.findViewById(R.id.progressBar);
mDownloadingInfo = view.findViewById(R.id.downloadingInfo);
final OpenH264DownloadHelper codecDownloader =
LinphoneManager.getInstance().getOpenH264DownloadHelper();
final OpenH264DownloadHelperListener codecListener =
new OpenH264DownloadHelperListener() {
@Override
public void OnProgress(final int current, final int max) {
mHandler.post(
new Runnable() {
@Override
public void run() {
if (current <= max) {
hideAllItems();
mDownloadingInfo.setText(current + " / " + max);
mDownloadingInfo.setVisibility(View.VISIBLE);
mDownloading.setVisibility(View.VISIBLE);
mProgressBar.setMax(max);
mProgressBar.setProgress(current);
mProgressBar.setVisibility(View.VISIBLE);
} else {
hideAllItems();
mDownloaded.setVisibility(View.VISIBLE);
if (Build.VERSION.SDK_INT
>= Build.VERSION_CODES.LOLLIPOP_MR1) {
enabledH264(true);
LinphoneManager.getLc()
.reloadMsPlugins(
AssistantActivity.instance()
.getApplicationInfo()
.nativeLibraryDir);
AssistantActivity.instance().endDownloadCodec();
} else {
// We need to restart due to bad android linker
AssistantActivity.instance().restartApplication();
}
}
}
});
}
@Override
public void OnError(final String error) {
mHandler.post(
new Runnable() {
@Override
public void run() {
hideAllItems();
mDownloaded.setText("Sorry an error has occurred.");
mDownloaded.setVisibility(View.VISIBLE);
mOk.setVisibility(View.VISIBLE);
enabledH264(false);
AssistantActivity.instance().endDownloadCodec();
}
});
}
};
codecDownloader.setOpenH264HelperListener(codecListener);
mYes.setOnClickListener(
new View.OnClickListener() {
@Override
public void onClick(View v) {
hideAllItems();
mProgressBar.setVisibility(View.VISIBLE);
codecDownloader.downloadCodec();
}
});
mNo.setOnClickListener(
new View.OnClickListener() {
@Override
public void onClick(View v) {
enabledH264(false);
AssistantActivity.instance().endDownloadCodec();
}
});
hideAllItems();
if (savedInstanceState != null) {
if (savedInstanceState.containsKey("mQuestion"))
mQuestion.setVisibility((Integer) savedInstanceState.getSerializable("mQuestion"));
else mQuestion.setVisibility(View.VISIBLE);
if (savedInstanceState.containsKey("mYes"))
mYes.setVisibility((Integer) savedInstanceState.getSerializable("mYes"));
else mYes.setVisibility(View.VISIBLE);
if (savedInstanceState.containsKey("mNo"))
mNo.setVisibility((Integer) savedInstanceState.getSerializable("mNo"));
else mNo.setVisibility(View.VISIBLE);
if (savedInstanceState.containsKey("mDownloading"))
mDownloading.setVisibility(
(Integer) savedInstanceState.getSerializable("mDownloading"));
if (savedInstanceState.containsKey("mDownloaded"))
mDownloaded.setVisibility(
(Integer) savedInstanceState.getSerializable("mDownloaded"));
if (savedInstanceState.containsKey("context_bar"))
mProgressBar.setVisibility(
(Integer) savedInstanceState.getSerializable("context_bar"));
if (savedInstanceState.containsKey("mDownloadingInfo"))
mDownloadingInfo.setVisibility(
(Integer) savedInstanceState.getSerializable("mDownloadingInfo"));
if (savedInstanceState.containsKey("mOk"))
mOk.setVisibility((Integer) savedInstanceState.getSerializable("mOk"));
} else {
mYes.setVisibility(View.VISIBLE);
mQuestion.setVisibility(View.VISIBLE);
mNo.setVisibility(View.VISIBLE);
}
return view;
}
@Override
public void onSaveInstanceState(Bundle outState) {
if (mQuestion != null) outState.putSerializable("mQuestion", mQuestion.getVisibility());
if (mDownloading != null)
outState.putSerializable("mDownloading", mDownloading.getVisibility());
if (mDownloaded != null)
outState.putSerializable("mDownloaded", mDownloaded.getVisibility());
if (mYes != null) outState.putSerializable("mYes", mYes.getVisibility());
if (mNo != null) outState.putSerializable("mNo", mNo.getVisibility());
if (mOk != null) outState.putSerializable("mOk", mOk.getVisibility());
if (mProgressBar != null)
outState.putSerializable("context_bar", mProgressBar.getVisibility());
if (mDownloadingInfo != null)
outState.putSerializable("mDownloadingInfo", mDownloadingInfo.getVisibility());
super.onSaveInstanceState(outState);
}
private void hideAllItems() {
if (mQuestion != null) mQuestion.setVisibility(View.INVISIBLE);
if (mDownloading != null) mDownloading.setVisibility(View.INVISIBLE);
if (mDownloaded != null) mDownloaded.setVisibility(View.INVISIBLE);
if (mYes != null) mYes.setVisibility(View.INVISIBLE);
if (mNo != null) mNo.setVisibility(View.INVISIBLE);
if (mOk != null) mOk.setVisibility(View.INVISIBLE);
if (mProgressBar != null) mProgressBar.setVisibility(View.INVISIBLE);
if (mDownloadingInfo != null) mDownloadingInfo.setVisibility(View.INVISIBLE);
}
private void enabledH264(boolean enable) {
PayloadType h264 = null;
for (PayloadType pt : LinphoneManager.getLc().getVideoPayloadTypes()) {
if (pt.getMimeType().equals("H264")) h264 = pt;
}
if (h264 != null) {
h264.enable(enable);
}
}
}

View file

@ -0,0 +1,114 @@
package org.linphone.assistant;
/*
CountryAdapter.java
Copyright (C) 2019 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.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Filter;
import android.widget.Filterable;
import android.widget.TextView;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.linphone.R;
import org.linphone.core.DialPlan;
import org.linphone.core.Factory;
public class CountryAdapter extends BaseAdapter implements Filterable {
private Context mContext;
private LayoutInflater mInflater;
private final DialPlan[] mAllCountries;
private List<DialPlan> mFilteredCountries;
public CountryAdapter(Context context, LayoutInflater inflater) {
mContext = context;
mInflater = inflater;
mAllCountries = Factory.instance().getDialPlans();
mFilteredCountries = new ArrayList<>(Arrays.asList(mAllCountries));
}
@Override
public int getCount() {
return mFilteredCountries.size();
}
@Override
public DialPlan getItem(int position) {
return mFilteredCountries.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View view;
if (convertView != null) {
view = convertView;
} else {
view = mInflater.inflate(R.layout.country_cell, parent, false);
}
DialPlan c = mFilteredCountries.get(position);
TextView name = view.findViewById(R.id.country_name);
name.setText(c.getCountry());
TextView dial_code = view.findViewById(R.id.country_prefix);
dial_code.setText(
String.format(
mContext.getString(R.string.country_code), c.getCountryCallingCode()));
view.setTag(c);
return view;
}
@Override
public Filter getFilter() {
return new Filter() {
@Override
protected FilterResults performFiltering(CharSequence constraint) {
List<DialPlan> filteredCountries = new ArrayList<>();
for (DialPlan c : mAllCountries) {
if (c.getCountry().toLowerCase().contains(constraint)
|| c.getCountryCallingCode().contains(constraint)) {
filteredCountries.add(c);
}
}
FilterResults filterResults = new FilterResults();
filterResults.values = filteredCountries;
return filterResults;
}
@Override
@SuppressWarnings("unchecked")
protected void publishResults(CharSequence constraint, FilterResults results) {
mFilteredCountries = (List<DialPlan>) results.values;
notifyDataSetChanged();
}
};
}
}

View file

@ -1,90 +0,0 @@
package org.linphone.assistant;
/*
CountryListFragment.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.app.Fragment;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.ListView;
import org.linphone.R;
import org.linphone.core.DialPlan;
public class CountryListFragment extends Fragment
implements AdapterView.OnItemClickListener, View.OnClickListener {
private ListView mList;
private EditText mSearch;
private ImageView mClearSearchField;
private AssistantActivity.CountryListAdapter mAdapter;
@Override
public View onCreateView(
LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.assistant_country_list, container, false);
mAdapter = AssistantActivity.instance().getCountryListAdapter();
mAdapter.setInflater(inflater);
mSearch = view.findViewById(R.id.search_country);
mClearSearchField = view.findViewById(R.id.clearSearchField);
mClearSearchField.setOnClickListener(this);
mList = view.findViewById(R.id.countryList);
mList.setAdapter(mAdapter);
mList.setOnItemClickListener(this);
mSearch.addTextChangedListener(
new TextWatcher() {
@Override
public void beforeTextChanged(
CharSequence s, int start, int count, int after) {}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
mAdapter.getFilter().filter(s);
}
@Override
public void afterTextChanged(Editable s) {}
});
mSearch.setText("");
return view;
}
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
AssistantActivity.instance().country = (DialPlan) view.getTag();
AssistantActivity.instance().onBackPressed();
}
@Override
public void onClick(View v) {
if (v.getId() == R.id.clearSearchField) {
mSearch.setText("");
}
}
}

View file

@ -0,0 +1,108 @@
package org.linphone.assistant;
/*
CountryPicker.java
Copyright (C) 2019 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.text.Editable;
import android.text.TextWatcher;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.AdapterView;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.ListView;
import org.linphone.R;
import org.linphone.core.DialPlan;
public class CountryPicker {
private Context mContext;
private LayoutInflater mInflater;
private CountryAdapter mAdapter;
private ListView mList;
private EditText mSearch;
private ImageView mClear;
private CountryPickedListener mListener;
public CountryPicker(Context context, CountryPickedListener listener) {
mContext = context;
mListener = listener;
mInflater = LayoutInflater.from(mContext);
mAdapter = new CountryAdapter(mContext, mInflater);
}
private View createView() {
View view = mInflater.inflate(R.layout.assistant_country_list, null, false);
mList = view.findViewById(R.id.countryList);
mList.setAdapter(mAdapter);
mList.setOnItemClickListener(
new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(
AdapterView<?> parent, View view, int position, long id) {
DialPlan dp = null;
if (position > 0 && position < mAdapter.getCount()) {
dp = mAdapter.getItem(position);
}
if (mListener != null) {
mListener.onCountryClicked(dp);
}
}
});
mSearch = view.findViewById(R.id.search_country);
mSearch.addTextChangedListener(
new TextWatcher() {
@Override
public void beforeTextChanged(
CharSequence s, int start, int count, int after) {}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {}
@Override
public void afterTextChanged(Editable s) {
mAdapter.getFilter().filter(s);
}
});
mSearch.setText("");
mClear = view.findViewById(R.id.clear_field);
mClear.setOnClickListener(
new View.OnClickListener() {
@Override
public void onClick(View v) {
mSearch.setText("");
}
});
return view;
}
public View getView() {
View view = createView();
return view;
}
public interface CountryPickedListener {
void onCountryClicked(DialPlan dialPlan);
}
}

View file

@ -1,141 +0,0 @@
package org.linphone.assistant;
/*
CreateAccountActivationFragment.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.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import org.linphone.LinphoneManager;
import org.linphone.R;
import org.linphone.core.AccountCreator;
import org.linphone.core.AccountCreatorListener;
import org.linphone.core.tools.Log;
import org.linphone.settings.LinphonePreferences;
public class CreateAccountActivationFragment extends Fragment
implements OnClickListener, AccountCreatorListener {
private String mUsername, mPassword;
private Button mCheckAccount;
private TextView mEmail;
private AccountCreator mAccountCreator;
@Override
public View onCreateView(
LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view =
inflater.inflate(
R.layout.assistant_account_creation_email_activation, container, false);
mAccountCreator =
LinphoneManager.getLc()
.createAccountCreator(LinphonePreferences.instance().getXmlrpcUrl());
mAccountCreator.setListener(this);
mUsername = getArguments().getString("Username");
mPassword = getArguments().getString("Password");
mAccountCreator.setUsername(mUsername);
mAccountCreator.setPassword(mPassword);
mAccountCreator.setDomain(getString(R.string.default_domain));
mEmail = view.findViewById(R.id.send_email);
mEmail.setText(getArguments().getString("Email"));
mCheckAccount = view.findViewById(R.id.assistant_check);
mCheckAccount.setOnClickListener(this);
return view;
}
@Override
public void onClick(View v) {
int id = v.getId();
if (id == R.id.assistant_check) {
mCheckAccount.setEnabled(false);
AccountCreator.Status status = mAccountCreator.isAccountActivated();
}
}
@Override
public void onIsAccountExist(
AccountCreator accountCreator, AccountCreator.Status status, String resp) {}
@Override
public void onCreateAccount(
AccountCreator accountCreator, AccountCreator.Status status, String resp) {}
@Override
public void onActivateAccount(
AccountCreator accountCreator, AccountCreator.Status status, String resp) {}
@Override
public void onLinkAccount(
AccountCreator accountCreator, AccountCreator.Status status, String resp) {}
@Override
public void onActivateAlias(
AccountCreator accountCreator, AccountCreator.Status status, String resp) {}
@Override
public void onIsAccountActivated(
AccountCreator accountCreator, AccountCreator.Status status, String resp) {
if (AssistantActivity.instance() == null) {
return;
}
if (status.equals(AccountCreator.Status.AccountNotActivated)) {
Toast.makeText(
getActivity(),
getString(R.string.assistant_account_not_validated),
Toast.LENGTH_LONG)
.show();
} else if (status.equals(AccountCreator.Status.AccountActivated)) {
AssistantActivity.instance().linphoneLogIn(accountCreator);
AssistantActivity.instance().isAccountVerified();
} else {
Log.w("Unexpected error " + status.name());
Toast.makeText(
getActivity(),
getString(R.string.wizard_server_unavailable),
Toast.LENGTH_LONG)
.show();
}
mCheckAccount.setEnabled(true);
}
@Override
public void onRecoverAccount(
AccountCreator accountCreator, AccountCreator.Status status, String resp) {}
@Override
public void onIsAccountLinked(
AccountCreator accountCreator, AccountCreator.Status status, String resp) {}
@Override
public void onIsAliasUsed(
AccountCreator accountCreator, AccountCreator.Status status, String resp) {}
@Override
public void onUpdateAccount(
AccountCreator accountCreator, AccountCreator.Status status, String resp) {}
}

View file

@ -1,227 +0,0 @@
package org.linphone.assistant;
/*
CreateAccountCodeActivationFragment.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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
import android.app.Fragment;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import org.linphone.LinphoneManager;
import org.linphone.R;
import org.linphone.core.AccountCreator;
import org.linphone.core.AccountCreatorListener;
import org.linphone.settings.LinphonePreferences;
public class CreateAccountCodeActivationFragment extends Fragment
implements AccountCreatorListener {
private String mUsername, mPhone, mDialcode;
private TextView mTitle, mPhonenumber;
private EditText mCode;
private boolean mRecoverAccount = false, mLinkAccount = false;
private int mCodeLength, mAccountNumber;
private ImageView mBack;
private Button mCheckAccount;
private AccountCreator mAccountCreator;
@Override
public View onCreateView(
LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view =
inflater.inflate(
R.layout.assistant_account_creation_code_activation, container, false);
mUsername = getArguments().getString("Username");
mPhone = getArguments().getString("Phone");
mDialcode = getArguments().getString("Dialcode");
mRecoverAccount = getArguments().getBoolean("RecoverAccount");
mLinkAccount = getArguments().getBoolean("LinkAccount");
mAccountNumber = getArguments().getInt("AccountNumber");
mCodeLength = LinphonePreferences.instance().getCodeLength();
mAccountCreator =
LinphoneManager.getLc()
.createAccountCreator(LinphonePreferences.instance().getXmlrpcUrl());
mAccountCreator.setListener(this);
mAccountCreator.setUsername(mUsername);
mAccountCreator.setPhoneNumber(mPhone, mDialcode);
mBack = view.findViewById(R.id.back);
if (mBack != null) mBack.setVisibility(Button.INVISIBLE);
mTitle = view.findViewById(R.id.title_account_activation);
if (mLinkAccount) {
mTitle.setText(getString(R.string.assistant_link_account));
} else if (mRecoverAccount) {
mTitle.setText(getString(R.string.assistant_linphone_account));
}
mPhonenumber = view.findViewById(R.id.send_phone_number);
mPhonenumber.setText(mAccountCreator.getPhoneNumber());
mCode = view.findViewById(R.id.assistant_code);
mCode.addTextChangedListener(
new TextWatcher() {
@Override
public void beforeTextChanged(
CharSequence s, int start, int count, int after) {}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {}
@Override
public void afterTextChanged(Editable s) {
if (s.length() == mCodeLength) {
mCheckAccount.setEnabled(true);
} else {
mCheckAccount.setEnabled(false);
}
}
});
mCheckAccount = view.findViewById(R.id.assistant_check);
mCheckAccount.setEnabled(false);
mCheckAccount.setOnClickListener(
new OnClickListener() {
@Override
public void onClick(View v) {
mCheckAccount.setEnabled(false);
mAccountCreator.setActivationCode(mCode.getText().toString());
if (mLinkAccount) {
linkAccount();
} else {
activateAccount();
}
}
});
return view;
}
private void linkAccount() {
mAccountCreator.setUsername(
LinphonePreferences.instance().getAccountUsername(mAccountNumber));
mAccountCreator.setHa1(LinphonePreferences.instance().getAccountHa1(mAccountNumber));
mAccountCreator.activateAlias();
}
private void activateAccount() {
if (mAccountCreator.getUsername() == null) {
mAccountCreator.setUsername(mAccountCreator.getPhoneNumber());
}
mAccountCreator.activateAccount();
}
@Override
public void onIsAccountExist(
AccountCreator accountCreator, AccountCreator.Status status, String resp) {}
@Override
public void onCreateAccount(
AccountCreator accountCreator, AccountCreator.Status status, String resp) {}
@Override
public void onActivateAccount(
AccountCreator accountCreator, AccountCreator.Status status, String resp) {
if (AssistantActivity.instance() == null) {
return;
}
if (status.equals(AccountCreator.Status.AccountActivated)) {
mCheckAccount.setEnabled(true);
if (accountCreator.getUsername() != null) {
AssistantActivity.instance().linphoneLogIn(accountCreator);
if (!mRecoverAccount) {
AssistantActivity.instance().isAccountVerified();
} else {
AssistantActivity.instance().success();
}
} else {
AssistantActivity.instance().linphoneLogIn(accountCreator);
if (!mRecoverAccount) {
AssistantActivity.instance().isAccountVerified();
} else {
AssistantActivity.instance().success();
}
}
} else if (status.equals(AccountCreator.Status.RequestFailed)) {
Toast.makeText(
getActivity(),
getString(R.string.wizard_server_unavailable),
Toast.LENGTH_LONG)
.show();
} else {
Toast.makeText(
getActivity(),
getString(R.string.assistant_error_confirmation_code),
Toast.LENGTH_LONG)
.show();
AssistantActivity.instance().displayAssistantLinphoneLogin(mPhone, mDialcode);
}
}
@Override
public void onLinkAccount(
AccountCreator accountCreator, AccountCreator.Status status, String resp) {}
@Override
public void onActivateAlias(
AccountCreator accountCreator, AccountCreator.Status status, String resp) {
if (AssistantActivity.instance() == null) {
return;
}
if (status.equals(AccountCreator.Status.AccountActivated)) {
LinphonePreferences.instance()
.setPrefix(
mAccountNumber,
org.linphone.core.Utils.getPrefixFromE164(
accountCreator.getPhoneNumber()));
LinphonePreferences.instance().setLinkPopupTime("");
AssistantActivity.instance().hideKeyboard();
AssistantActivity.instance().success();
}
}
@Override
public void onIsAccountActivated(
AccountCreator accountCreator, AccountCreator.Status status, String resp) {}
@Override
public void onRecoverAccount(
AccountCreator accountCreator, AccountCreator.Status status, String resp) {}
@Override
public void onIsAccountLinked(
AccountCreator accountCreator, AccountCreator.Status status, String resp) {}
@Override
public void onIsAliasUsed(
AccountCreator accountCreator, AccountCreator.Status status, String resp) {}
@Override
public void onUpdateAccount(
AccountCreator accountCreator, AccountCreator.Status status, String resp) {}
}

View file

@ -1,803 +0,0 @@
package org.linphone.assistant;
/*
CreateAccountFragment.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.accounts.Account;
import android.accounts.AccountManager;
import android.app.AlertDialog;
import android.app.Fragment;
import android.content.Context;
import android.os.Build;
import android.os.Bundle;
import android.telephony.TelephonyManager;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Patterns;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import java.util.Locale;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.linphone.LinphoneManager;
import org.linphone.R;
import org.linphone.core.AccountCreator;
import org.linphone.core.AccountCreator.Status;
import org.linphone.core.AccountCreatorListener;
import org.linphone.core.DialPlan;
import org.linphone.settings.LinphonePreferences;
import org.linphone.utils.LinphoneUtils;
public class CreateAccountFragment extends Fragment
implements CompoundButton.OnCheckedChangeListener, OnClickListener, AccountCreatorListener {
private final Pattern UPPER_CASE_REGEX = Pattern.compile("[A-Z]");
private EditText mPhoneNumberEdit,
mUsernameEdit,
mPasswordEdit,
mPasswordConfirmEdit,
mEmailEdit,
mDialCode;
private TextView mPhoneNumberError,
mPasswordError,
mPasswordConfirmError,
mEmailError,
mAssisstantTitle,
mSipUri,
mSkip,
mInstruction;
private ImageView mPhoneNumberInfo;
private boolean mPasswordOk = false;
private boolean mEmailOk = false;
private boolean mConfirmPasswordOk = false;
private boolean mLinkAccount = false;
private Button mCreateAccount, mSelectCountry;
private CheckBox mUseUsername, mUseEmail;
private String mAddressSip = "";
private int mCountryCode;
private LinearLayout mPhoneNumberLayout,
mUsernameLayout,
mEmailLayout,
mPasswordLayout,
mPasswordConfirmLayout;
private AccountCreator mAccountCreator;
@Override
public View onCreateView(
LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.assistant_account_creation, container, false);
// Initialize mAccountCreator
mAccountCreator =
LinphoneManager.getLc()
.createAccountCreator(LinphonePreferences.instance().getXmlrpcUrl());
mAccountCreator.setListener(this);
mAccountCreator.setDomain(getString(R.string.default_domain));
mInstruction = view.findViewById(R.id.message_create_account);
mCreateAccount = view.findViewById(R.id.assistant_create);
mPhoneNumberLayout = view.findViewById(R.id.phone_number_layout);
mUsernameLayout = view.findViewById(R.id.username_layout);
mEmailLayout = view.findViewById(R.id.email_layout);
mPasswordLayout = view.findViewById(R.id.password_layout);
mPasswordConfirmLayout = view.findViewById(R.id.password_confirm_layout);
mUseUsername = view.findViewById(R.id.use_username);
mUseEmail = view.findViewById(R.id.use_email);
mUsernameEdit = view.findViewById(R.id.username);
mPhoneNumberError = view.findViewById(R.id.phone_number_error);
mPhoneNumberEdit = view.findViewById(R.id.phone_number);
mSipUri = view.findViewById(R.id.sip_uri);
mPhoneNumberInfo = view.findViewById(R.id.info_phone_number);
mSelectCountry = view.findViewById(R.id.select_country);
mDialCode = view.findViewById(R.id.dial_code);
mAssisstantTitle = view.findViewById(R.id.assistant_title);
mPasswordError = view.findViewById(R.id.password_error);
mPasswordEdit = view.findViewById(R.id.password);
mPasswordConfirmError = view.findViewById(R.id.confirm_password_error);
mPasswordConfirmEdit = view.findViewById(R.id.confirm_password);
mEmailError = view.findViewById(R.id.email_error);
mEmailEdit = view.findViewById(R.id.email);
mSkip = view.findViewById(R.id.assistant_skip);
// Phone number
if (!getResources().getBoolean(R.bool.isTablet)
&& getResources().getBoolean(R.bool.use_phone_number_validation)) {
getActivity().getApplicationContext();
// Automatically get the country code from the phone
TelephonyManager tm =
(TelephonyManager)
getActivity()
.getApplicationContext()
.getSystemService(Context.TELEPHONY_SERVICE);
String countryIso = tm.getNetworkCountryIso();
mCountryCode = org.linphone.core.Utils.getCccFromIso(countryIso.toUpperCase());
mPhoneNumberLayout.setVisibility(View.VISIBLE);
mPhoneNumberInfo.setOnClickListener(this);
mSelectCountry.setOnClickListener(this);
DialPlan c = AssistantActivity.instance().country;
if (c != null) {
mSelectCountry.setText(c.getCountry());
mDialCode.setText(
c.getCountryCallingCode().contains("+")
? c.getCountryCallingCode()
: "+" + c.getCountryCallingCode());
} else {
c =
AssistantActivity.instance()
.getCountryListAdapter()
.getCountryFromCountryCode(String.valueOf(mCountryCode));
if (c != null) {
mSelectCountry.setText(c.getCountry());
mDialCode.setText(
c.getCountryCallingCode().contains("+")
? c.getCountryCallingCode()
: "+" + c.getCountryCallingCode());
}
}
// Allow user to enter a username instead use the phone number as username
if (getResources().getBoolean(R.bool.assistant_allow_username)) {
mUseUsername.setVisibility(View.VISIBLE);
mUseUsername.setOnCheckedChangeListener(this);
}
addPhoneNumberHandler(mPhoneNumberEdit);
addPhoneNumberHandler(mDialCode);
} else {
if (!getResources().getBoolean(R.bool.isTablet)) {
mUseEmail.setVisibility(View.VISIBLE);
}
mUseEmail.setOnCheckedChangeListener(this);
if (getResources().getBoolean(R.bool.pre_fill_email_in_assistant)) {
Account[] accounts =
AccountManager.get(getActivity()).getAccountsByType("com.google");
for (Account account : accounts) {
if (isEmailCorrect(account.name)) {
String possibleEmail = account.name;
mEmailEdit.setText(possibleEmail);
mAccountCreator.setEmail(possibleEmail);
mEmailOk = true;
break;
}
}
}
addPasswordHandler(mPasswordEdit);
addConfirmPasswordHandler(mPasswordEdit, mPasswordConfirmEdit);
addEmailHandler(mEmailEdit);
}
// Hide phone number and display username/email/password
if (!getResources().getBoolean(R.bool.use_phone_number_validation)) {
mUseEmail.setVisibility(View.GONE);
mUseUsername.setVisibility(View.GONE);
mUsernameLayout.setVisibility(View.VISIBLE);
mPasswordLayout.setVisibility(View.VISIBLE);
mPasswordConfirmLayout.setVisibility(View.VISIBLE);
mEmailLayout.setVisibility(View.VISIBLE);
}
// Link account with phone number
if (getArguments().getBoolean("LinkPhoneNumber")) {
mLinkAccount = true;
mUseEmail.setVisibility(View.GONE);
mUseUsername.setVisibility(View.GONE);
mUsernameLayout.setVisibility(View.GONE);
mPasswordLayout.setVisibility(View.GONE);
mPasswordConfirmLayout.setVisibility(View.GONE);
mEmailLayout.setVisibility(View.GONE);
mSkip.setVisibility(View.VISIBLE);
mSkip.setOnClickListener(this);
mCreateAccount.setText(getResources().getString(R.string.link_account));
mAssisstantTitle.setText(getResources().getString(R.string.link_account));
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
mAccountCreator.setLanguage(Locale.getDefault().toLanguageTag());
}
addUsernameHandler(mUsernameEdit);
mCreateAccount.setEnabled(true);
mCreateAccount.setOnClickListener(this);
return view;
}
@Override
public void onPause() {
super.onPause();
mAccountCreator.setListener(null);
}
private String getUsername() {
if (mUsernameEdit != null) {
String username = mUsernameEdit.getText().toString();
return username.toLowerCase(Locale.getDefault());
}
return null;
}
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (buttonView.getId() == R.id.use_username) {
if (isChecked) {
mUsernameLayout.setVisibility(View.VISIBLE);
onTextChanged2();
} else {
mUsernameLayout.setVisibility(View.GONE);
mAccountCreator.setUsername(null);
onTextChanged2();
}
} else if (buttonView.getId() == R.id.use_email) {
if (isChecked) {
mDialCode.setBackgroundResource(R.drawable.resizable_textfield);
mPhoneNumberEdit.setBackgroundResource(R.drawable.resizable_textfield);
mUseUsername.setEnabled(false);
mDialCode.setEnabled(false);
mSelectCountry.setEnabled(false);
mPhoneNumberEdit.setEnabled(false);
mEmailLayout.setVisibility(View.VISIBLE);
mPasswordLayout.setVisibility(View.VISIBLE);
mPasswordConfirmLayout.setVisibility(View.VISIBLE);
mUsernameLayout.setVisibility(View.VISIBLE);
mUseUsername.setVisibility(CheckBox.GONE);
mPhoneNumberLayout.setVisibility(LinearLayout.GONE);
mInstruction.setText(getString(R.string.assistant_create_account_part_email));
} else {
if (!mUseUsername.isChecked()) {
mUsernameLayout.setVisibility(View.GONE);
}
mUseUsername.setEnabled(true);
mDialCode.setEnabled(true);
mSelectCountry.setEnabled(true);
mPhoneNumberEdit.setEnabled(true);
mEmailLayout.setVisibility(View.GONE);
mPasswordLayout.setVisibility(View.GONE);
mPasswordConfirmLayout.setVisibility(View.GONE);
mUseUsername.setVisibility(CheckBox.VISIBLE);
mPhoneNumberLayout.setVisibility(LinearLayout.VISIBLE);
mInstruction.setText(getString(R.string.assistant_create_account_part_1));
}
}
}
@Override
public void onClick(View v) {
int id = v.getId();
if (id == R.id.select_country) {
AssistantActivity.instance().displayCountryChooser();
} else if (id == R.id.assistant_skip) {
if (getArguments().getBoolean("LinkFromPref")) {
AssistantActivity.instance().finish();
} else {
AssistantActivity.instance().success();
}
} else if (id == R.id.info_phone_number) {
if (mLinkAccount) {
new AlertDialog.Builder(getActivity())
.setTitle(getString(R.string.phone_number_info_title))
.setMessage(
getString(R.string.phone_number_link_info_content)
+ "\n"
+ getString(
R.string
.phone_number_link_info_content_already_account))
.show();
} else {
new AlertDialog.Builder(getActivity())
.setTitle(getString(R.string.phone_number_info_title))
.setMessage(getString(R.string.phone_number_info_content))
.show();
}
} else if (id == R.id.assistant_create) {
mCreateAccount.setEnabled(false);
if (mLinkAccount) {
addAlias();
} else {
if (mUseEmail.isChecked()) mAccountCreator.setPhoneNumber(null, null);
if (getUsername().length() > 0) {
mAccountCreator.isAccountExist();
} else {
LinphoneUtils.displayErrorAlert(
LinphoneUtils.errorForUsernameStatus(
AccountCreator.UsernameStatus.TooShort),
AssistantActivity.instance());
mCreateAccount.setEnabled(true);
}
}
}
}
private boolean isEmailCorrect(String email) {
Pattern emailPattern = Patterns.EMAIL_ADDRESS;
return emailPattern.matcher(email).matches();
}
private boolean isPasswordCorrect(String password) {
return password.length() >= 1;
}
private void addAlias() {
mAccountCreator.setUsername(
LinphonePreferences.instance()
.getAccountUsername(
LinphonePreferences.instance().getDefaultAccountIndex()));
int status =
mAccountCreator.setPhoneNumber(
mPhoneNumberEdit.getText().toString(),
LinphoneUtils.getCountryCode(mDialCode));
boolean isOk = status == AccountCreator.PhoneNumberStatus.Ok.toInt();
if (isOk) {
mAccountCreator.linkAccount();
} else {
mCreateAccount.setEnabled(true);
LinphoneUtils.displayErrorAlert(
LinphoneUtils.errorForPhoneNumberStatus(status), AssistantActivity.instance());
LinphoneUtils.displayError(
isOk, mPhoneNumberError, LinphoneUtils.errorForPhoneNumberStatus(status));
}
}
private void createAccount() {
if ((getResources().getBoolean(R.bool.isTablet)
|| !getResources().getBoolean(R.bool.use_phone_number_validation))
&& mUseEmail.isChecked()) {
AccountCreator.EmailStatus emailStatus;
AccountCreator.PasswordStatus passwordStatus;
passwordStatus = mAccountCreator.setPassword(mPasswordEdit.getText().toString());
emailStatus = mAccountCreator.setEmail(mEmailEdit.getText().toString());
if (!mEmailOk) {
LinphoneUtils.displayError(
false, mEmailError, LinphoneUtils.errorForEmailStatus(emailStatus));
LinphoneUtils.displayErrorAlert(
LinphoneUtils.errorForEmailStatus(emailStatus),
AssistantActivity.instance());
} else if (!mPasswordOk) {
LinphoneUtils.displayError(
false,
mPasswordError,
LinphoneUtils.errorForPasswordStatus(passwordStatus));
LinphoneUtils.displayErrorAlert(
LinphoneUtils.errorForPasswordStatus(passwordStatus),
AssistantActivity.instance());
} else if (!mConfirmPasswordOk) {
String msg;
if (mPasswordConfirmEdit
.getText()
.toString()
.equals(mPasswordEdit.getText().toString())) {
msg = getString(R.string.wizard_password_incorrect);
} else {
msg = getString(R.string.wizard_passwords_unmatched);
}
LinphoneUtils.displayError(false, mPasswordError, msg);
LinphoneUtils.displayErrorAlert(msg, AssistantActivity.instance());
} else {
mAccountCreator.createAccount();
}
} else {
if (mPhoneNumberEdit.length() > 0 || mDialCode.length() > 1) {
int phoneStatus;
boolean isOk;
phoneStatus =
mAccountCreator.setPhoneNumber(
mPhoneNumberEdit.getText().toString(),
LinphoneUtils.getCountryCode(mDialCode));
isOk = phoneStatus == AccountCreator.PhoneNumberStatus.Ok.toInt();
if (!mUseUsername.isChecked() && mAccountCreator.getUsername() == null) {
mAccountCreator.setUsername(mAccountCreator.getPhoneNumber());
} else {
mAccountCreator.setUsername(mUsernameEdit.getText().toString());
mAccountCreator.setPhoneNumber(
mPhoneNumberEdit.getText().toString(), mDialCode.getText().toString());
}
if (isOk) {
mAccountCreator.createAccount();
} else {
LinphoneUtils.displayErrorAlert(
LinphoneUtils.errorForPhoneNumberStatus(phoneStatus),
AssistantActivity.instance());
LinphoneUtils.displayError(
isOk,
mPhoneNumberError,
LinphoneUtils.errorForPhoneNumberStatus(phoneStatus));
}
} else {
LinphoneUtils.displayErrorAlert(
getString(R.string.assistant_create_account_part_1),
AssistantActivity.instance());
}
}
mCreateAccount.setEnabled(true);
}
private int getPhoneNumberStatus() {
int status =
mAccountCreator.setPhoneNumber(
mPhoneNumberEdit.getText().toString(),
LinphoneUtils.getCountryCode(mDialCode));
mAddressSip = mAccountCreator.getPhoneNumber();
return status;
}
private void onTextChanged2() {
String msg = "";
mAccountCreator.setUsername(getUsername());
if (!mUseEmail.isChecked()
&& getResources().getBoolean(R.bool.use_phone_number_validation)) {
int status = getPhoneNumberStatus();
boolean isOk = (status == AccountCreator.PhoneNumberStatus.Ok.toInt());
LinphoneUtils.displayError(
isOk, mPhoneNumberError, LinphoneUtils.errorForPhoneNumberStatus(status));
// Username or phone number
if (getResources().getBoolean(R.bool.assistant_allow_username)
&& mUseUsername.isChecked()) {
mAddressSip = getUsername();
}
if (!isOk) {
if (status == AccountCreator.PhoneNumberStatus.InvalidCountryCode.toInt()) {
mDialCode.setBackgroundResource(R.drawable.resizable_textfield_error);
mPhoneNumberEdit.setBackgroundResource(R.drawable.resizable_textfield);
} else {
mDialCode.setBackgroundResource(R.drawable.resizable_textfield);
mPhoneNumberEdit.setBackgroundResource(R.drawable.resizable_textfield_error);
}
} else {
mDialCode.setBackgroundResource(R.drawable.resizable_textfield);
mPhoneNumberEdit.setBackgroundResource(R.drawable.resizable_textfield);
if (!mLinkAccount && mAddressSip.length() > 0) {
msg =
getResources()
.getString(
R.string
.assistant_create_account_phone_number_address)
+ " <"
+ mAddressSip
+ "@"
+ getResources().getString(R.string.default_domain)
+ ">";
}
}
} else {
mAddressSip = getUsername();
if (mAddressSip.length() > 0) {
msg =
getResources()
.getString(
R.string
.assistant_create_account_phone_number_address)
+ " <sip:"
+ mAddressSip
+ "@"
+ getResources().getString(R.string.default_domain)
+ ">";
}
}
mSipUri.setText(msg);
}
private void addPhoneNumberHandler(final EditText field) {
field.addTextChangedListener(
new TextWatcher() {
public void afterTextChanged(Editable s) {
if (field.equals(mDialCode)) {
DialPlan c =
AssistantActivity.instance()
.getCountryListAdapter()
.getCountryFromCountryCode(
mDialCode.getText().toString());
if (c != null) {
AssistantActivity.instance().country = c;
mSelectCountry.setText(c.getCountry());
} else {
mSelectCountry.setText(R.string.select_your_country);
}
}
}
public void beforeTextChanged(
CharSequence s, int start, int count, int after) {}
public void onTextChanged(CharSequence s, int start, int count, int after) {
onTextChanged2();
}
});
}
private void addUsernameHandler(final EditText field) {
field.addTextChangedListener(
new TextWatcher() {
public void afterTextChanged(Editable s) {
Matcher matcher = UPPER_CASE_REGEX.matcher(s);
while (matcher.find()) {
CharSequence upperCaseRegion =
s.subSequence(matcher.start(), matcher.end());
s.replace(
matcher.start(),
matcher.end(),
upperCaseRegion.toString().toLowerCase());
}
}
public void beforeTextChanged(
CharSequence s, int start, int count, int after) {}
public void onTextChanged(CharSequence s, int start, int count, int after) {
onTextChanged2();
}
});
}
private void addEmailHandler(final EditText field) {
field.addTextChangedListener(
new TextWatcher() {
public void afterTextChanged(Editable s) {
mEmailOk = false;
AccountCreator.EmailStatus status =
mAccountCreator.setEmail(field.getText().toString());
if (status.equals(AccountCreator.EmailStatus.Ok)) {
mEmailOk = true;
LinphoneUtils.displayError(mEmailOk, mEmailError, "");
} else {
LinphoneUtils.displayError(
mEmailOk,
mEmailError,
LinphoneUtils.errorForEmailStatus(status));
}
}
public void beforeTextChanged(
CharSequence s, int start, int count, int after) {}
public void onTextChanged(CharSequence s, int start, int count, int after) {}
});
}
private void addPasswordHandler(final EditText field1) {
TextWatcher passwordListener =
new TextWatcher() {
public void afterTextChanged(Editable s) {
mPasswordOk = false;
AccountCreator.PasswordStatus status =
mAccountCreator.setPassword(field1.getText().toString());
if (isPasswordCorrect(field1.getText().toString())) {
mPasswordOk = true;
LinphoneUtils.displayError(mPasswordOk, mPasswordError, "");
} else {
LinphoneUtils.displayError(
mPasswordOk,
mPasswordError,
LinphoneUtils.errorForPasswordStatus(status));
}
}
public void beforeTextChanged(
CharSequence s, int start, int count, int after) {}
public void onTextChanged(CharSequence s, int start, int count, int after) {}
};
field1.addTextChangedListener(passwordListener);
}
private void addConfirmPasswordHandler(final EditText field1, final EditText field2) {
TextWatcher passwordListener =
new TextWatcher() {
public void afterTextChanged(Editable s) {
mConfirmPasswordOk = false;
if (field1.getText().toString().equals(field2.getText().toString())) {
mConfirmPasswordOk = true;
if (!isPasswordCorrect(field1.getText().toString())) {
LinphoneUtils.displayError(
mPasswordOk,
mPasswordError,
getString(R.string.wizard_password_incorrect));
} else {
LinphoneUtils.displayError(
mConfirmPasswordOk, mPasswordConfirmError, "");
}
} else {
LinphoneUtils.displayError(
mConfirmPasswordOk,
mPasswordConfirmError,
getString(R.string.wizard_passwords_unmatched));
}
}
public void beforeTextChanged(
CharSequence s, int start, int count, int after) {}
public void onTextChanged(CharSequence s, int start, int count, int after) {}
};
field1.addTextChangedListener(passwordListener);
field2.addTextChangedListener(passwordListener);
}
@Override
public void onIsAccountExist(AccountCreator accountCreator, final Status status, String resp) {
if (status.equals(Status.AccountExist) || status.equals(Status.AccountExistWithAlias)) {
if (mUseEmail.isChecked()) {
mCreateAccount.setEnabled(true);
LinphoneUtils.displayErrorAlert(
LinphoneUtils.errorForStatus(status), AssistantActivity.instance());
} else {
accountCreator.isAliasUsed();
}
} else {
createAccount();
}
}
@Override
public void onCreateAccount(AccountCreator accountCreator, Status status, String resp) {
if (status.equals(Status.AccountCreated)) {
if (mUseEmail.isChecked()
|| !getResources().getBoolean(R.bool.use_phone_number_validation)) {
AssistantActivity.instance()
.displayAssistantConfirm(
getUsername(),
mPasswordEdit.getText().toString(),
mEmailEdit.getText().toString());
} else {
AssistantActivity.instance()
.displayAssistantCodeConfirm(
getUsername(),
mPhoneNumberEdit.getText().toString(),
LinphoneUtils.getCountryCode(mDialCode),
false);
}
} else {
mCreateAccount.setEnabled(true);
LinphoneUtils.displayErrorAlert(
LinphoneUtils.errorForStatus(status), AssistantActivity.instance());
}
}
@Override
public void onActivateAccount(AccountCreator accountCreator, Status status, String resp) {}
@Override
public void onLinkAccount(AccountCreator accountCreator, Status status, String resp) {
if (AssistantActivity.instance() == null) {
return;
}
if (status.equals(Status.RequestOk)) {
AssistantActivity.instance()
.displayAssistantCodeConfirm(
getUsername(),
mPhoneNumberEdit.getText().toString(),
LinphoneUtils.getCountryCode(mDialCode),
false);
}
}
@Override
public void onActivateAlias(AccountCreator accountCreator, Status status, String resp) {
if (AssistantActivity.instance() == null) {
return;
}
if (status.equals(Status.RequestOk)) {
AssistantActivity.instance()
.displayAssistantCodeConfirm(
getUsername(),
mPhoneNumberEdit.getText().toString(),
LinphoneUtils.getCountryCode(mDialCode),
false);
}
}
@Override
public void onIsAccountActivated(AccountCreator accountCreator, Status status, String resp) {
if (AssistantActivity.instance() == null) {
return;
}
if (status.equals(Status.AccountNotActivated)) {
if (getResources().getBoolean(R.bool.isTablet)
|| !getResources().getBoolean(R.bool.use_phone_number_validation)) {
// mAccountCreator.activateAccount(); // Resend email TODO
} else {
accountCreator.recoverAccount(); // Resend SMS
}
} else {
mCreateAccount.setEnabled(true);
LinphoneUtils.displayErrorAlert(
LinphoneUtils.errorForStatus(status), AssistantActivity.instance());
}
}
@Override
public void onRecoverAccount(AccountCreator accountCreator, Status status, String resp) {
if (AssistantActivity.instance() == null) {
return;
}
if (status.equals(Status.RequestOk)) {
AssistantActivity.instance()
.displayAssistantCodeConfirm(
getUsername(),
mPhoneNumberEdit.getText().toString(),
mDialCode.getText().toString(),
false);
} else {
mCreateAccount.setEnabled(true);
// SMS error
LinphoneUtils.displayErrorAlert(
getString(R.string.request_failed), AssistantActivity.instance());
}
}
@Override
public void onIsAccountLinked(AccountCreator accountCreator, Status status, String resp) {}
@Override
public void onIsAliasUsed(AccountCreator ac, Status status, String resp) {
if (AssistantActivity.instance() == null) {
return;
}
if (status.equals(Status.AliasIsAccount) || status.equals(Status.AliasExist)) {
if (mAccountCreator.getPhoneNumber() != null
&& mAccountCreator.getUsername() != null
&& mAccountCreator.getPhoneNumber().compareTo(mAccountCreator.getUsername())
== 0) {
mAccountCreator.isAccountActivated();
} else {
mCreateAccount.setEnabled(true);
LinphoneUtils.displayErrorAlert(
LinphoneUtils.errorForStatus(status), AssistantActivity.instance());
}
} else {
mAccountCreator.isAccountActivated();
}
}
@Override
public void onUpdateAccount(AccountCreator accountCreator, Status status, String resp) {}
}

View file

@ -0,0 +1,131 @@
package org.linphone.assistant;
/*
EchoCancellerCalibrationAssistantActivity.java
Copyright (C) 2019 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.Manifest;
import android.content.Context;
import android.content.pm.PackageManager;
import android.media.AudioManager;
import android.os.Bundle;
import androidx.annotation.Nullable;
import androidx.core.app.ActivityCompat;
import org.linphone.LinphoneManager;
import org.linphone.R;
import org.linphone.core.Core;
import org.linphone.core.CoreListenerStub;
import org.linphone.core.EcCalibratorStatus;
import org.linphone.core.tools.Log;
import org.linphone.settings.LinphonePreferences;
public class EchoCancellerCalibrationAssistantActivity extends AssistantActivity {
private static final int RECORD_AUDIO_PERMISSION_RESULT = 1;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.assistant_echo_canceller_calibration);
}
@Override
protected void onStart() {
super.onStart();
checkRecordAudioPermissionForEchoCancellerCalibration();
}
@Override
protected void onResume() {
super.onResume();
LinphonePreferences.instance().setEchoCancellationCalibrationDone(true);
if (isRecordAudioPermissionGranted()) {
startEchoCancellerCalibration();
} else {
goToLinphoneActivity();
}
}
@Override
public void onRequestPermissionsResult(
int requestCode, String[] permissions, final int[] grantResults) {
for (int i = 0; i < permissions.length; i++) {
Log.i(
"[Permission] "
+ permissions[i]
+ " has been "
+ (grantResults[i] == PackageManager.PERMISSION_GRANTED
? "granted"
: "denied"));
}
switch (requestCode) {
case RECORD_AUDIO_PERMISSION_RESULT:
if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
startEchoCancellerCalibration();
} else {
// TODO: permission denied, display something to the user
}
break;
}
}
private boolean isRecordAudioPermissionGranted() {
int permissionGranted =
getPackageManager()
.checkPermission(Manifest.permission.RECORD_AUDIO, getPackageName());
Log.i(
"[Permission] Manifest.permission.RECORD_AUDIO is "
+ (permissionGranted == PackageManager.PERMISSION_GRANTED
? "granted"
: "denied"));
return permissionGranted == PackageManager.PERMISSION_GRANTED;
}
private void checkRecordAudioPermissionForEchoCancellerCalibration() {
if (!isRecordAudioPermissionGranted()) {
Log.i("[Permission] Asking for " + Manifest.permission.RECORD_AUDIO);
ActivityCompat.requestPermissions(
this,
new String[] {Manifest.permission.RECORD_AUDIO},
RECORD_AUDIO_PERMISSION_RESULT);
}
}
private void startEchoCancellerCalibration() {
LinphoneManager.getLc()
.addListener(
new CoreListenerStub() {
@Override
public void onEcCalibrationResult(
Core core, EcCalibratorStatus status, int delayMs) {
if (status == EcCalibratorStatus.InProgress) return;
core.removeListener(this);
LinphoneManager.getInstance().routeAudioToReceiver();
goToLinphoneActivity();
((AudioManager) getSystemService(Context.AUDIO_SERVICE))
.setMode(AudioManager.MODE_NORMAL);
}
});
LinphoneManager.getInstance().startEcCalibration();
}
}

View file

@ -1,117 +0,0 @@
package org.linphone.assistant;
/*
EchoCancellerCalibrationFragment.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.app.Fragment;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import org.linphone.LinphoneManager;
import org.linphone.R;
import org.linphone.core.Core;
import org.linphone.core.CoreListenerStub;
import org.linphone.core.EcCalibratorStatus;
import org.linphone.core.XmlRpcArgType;
import org.linphone.core.XmlRpcRequest;
import org.linphone.core.XmlRpcRequestListener;
import org.linphone.core.XmlRpcSession;
import org.linphone.core.tools.Log;
import org.linphone.settings.LinphonePreferences;
public class EchoCancellerCalibrationFragment extends Fragment implements XmlRpcRequestListener {
private final Handler mHandler = new Handler();
private boolean mSendEcCalibrationResult = false;
private CoreListenerStub mListener;
private XmlRpcSession mXmlRpcSession;
private XmlRpcRequest mXmlRpcRequest;
private Runnable mRunFinished;
@Override
public View onCreateView(
LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.assistant_ec_calibration, container, false);
mListener =
new CoreListenerStub() {
@Override
public void onEcCalibrationResult(
Core lc, EcCalibratorStatus status, int delay_ms) {
lc.removeListener(mListener);
LinphoneManager.getInstance().routeAudioToReceiver();
if (mSendEcCalibrationResult) {
sendEcCalibrationResult(status, delay_ms);
} else {
AssistantActivity.instance().isEchoCalibrationFinished();
}
}
};
mRunFinished =
new Runnable() {
public void run() {
AssistantActivity.instance().isEchoCalibrationFinished();
}
};
mXmlRpcSession =
LinphoneManager.getLcIfManagerNotDestroyedOrNull()
.createXmlRpcSession(LinphonePreferences.instance().getXmlrpcUrl());
mXmlRpcRequest =
mXmlRpcSession.createRequest(XmlRpcArgType.None, "add_ec_calibration_result");
mXmlRpcRequest.setListener(this);
LinphoneManager.getLc().addListener(mListener);
LinphoneManager.getInstance().startEcCalibration();
return view;
}
public void enableEcCalibrationResultSending(boolean enabled) {
mSendEcCalibrationResult = enabled;
}
@Override
public void onResponse(XmlRpcRequest request) {
mHandler.post(mRunFinished);
}
private void sendEcCalibrationResult(EcCalibratorStatus status, int delayMs) {
Boolean hasBuiltInEchoCanceler = LinphoneManager.getLc().hasBuiltinEchoCanceller();
Log.i(
"Add echo canceller calibration result: manufacturer="
+ Build.MANUFACTURER
+ " model="
+ Build.MODEL
+ " status="
+ status
+ " delay="
+ delayMs
+ "ms"
+ " hasBuiltInEchoCanceler "
+ hasBuiltInEchoCanceler);
mXmlRpcRequest.addStringArg(Build.MANUFACTURER);
mXmlRpcRequest.addStringArg(Build.MODEL);
mXmlRpcRequest.addStringArg(status.toString());
mXmlRpcRequest.addIntArg(delayMs);
mXmlRpcRequest.addIntArg(hasBuiltInEchoCanceler ? 1 : 0);
mXmlRpcSession.sendRequest(mXmlRpcRequest);
}
}

View file

@ -0,0 +1,270 @@
package org.linphone.assistant;
/*
EmailAccountCreationAssistantActivity.java
Copyright (C) 2019 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.accounts.Account;
import android.accounts.AccountManager;
import android.content.Intent;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Patterns;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import androidx.annotation.Nullable;
import org.linphone.R;
import org.linphone.core.AccountCreator;
import org.linphone.core.AccountCreatorListenerStub;
import org.linphone.core.tools.Log;
public class EmailAccountCreationAssistantActivity extends AssistantActivity {
private EditText mUsername, mPassword, mPasswordConfirm, mEmail;
private TextView mCreate, mUsernameError, mPasswordError, mPasswordConfirmError, mEmailError;
private AccountCreatorListenerStub mListener;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.assistant_email_account_creation);
mUsernameError = findViewById(R.id.username_error);
mPasswordError = findViewById(R.id.password_error);
mPasswordConfirmError = findViewById(R.id.confirm_password_error);
mEmailError = findViewById(R.id.email_error);
mUsername = findViewById(R.id.assistant_username);
mUsername.addTextChangedListener(
new TextWatcher() {
@Override
public void beforeTextChanged(
CharSequence s, int start, int count, int after) {}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {}
@Override
public void afterTextChanged(Editable s) {
AccountCreator.UsernameStatus status =
mAccountCreator.setUsername(s.toString());
mUsernameError.setVisibility(
status == AccountCreator.UsernameStatus.Ok
? View.INVISIBLE
: View.VISIBLE);
switch (status) {
case Invalid:
mUsernameError.setText(getString(R.string.username_invalid_size));
break;
case InvalidCharacters:
mUsernameError.setText(getString(R.string.invalid_characters));
break;
case TooLong:
mUsernameError.setText(getString(R.string.username_too_long));
break;
case TooShort:
mUsernameError.setText(getString(R.string.username_too_short));
break;
}
updateCreateButton();
}
});
mPassword = findViewById(R.id.assistant_password);
mPassword.addTextChangedListener(
new TextWatcher() {
@Override
public void beforeTextChanged(
CharSequence s, int start, int count, int after) {}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {}
@Override
public void afterTextChanged(Editable s) {
AccountCreator.PasswordStatus status =
mAccountCreator.setPassword(s.toString());
mPasswordError.setVisibility(
status == AccountCreator.PasswordStatus.Ok
? View.INVISIBLE
: View.VISIBLE);
mPasswordConfirmError.setVisibility(
s.toString().equals(mPasswordConfirm.getText().toString())
? View.INVISIBLE
: View.VISIBLE);
switch (status) {
case InvalidCharacters:
mPasswordError.setText(getString(R.string.invalid_characters));
break;
case TooLong:
mPasswordError.setText(getString(R.string.password_too_long));
break;
case TooShort:
mPasswordError.setText(getString(R.string.password_too_short));
break;
}
updateCreateButton();
}
});
mPasswordConfirm = findViewById(R.id.assistant_password_confirmation);
mPasswordConfirm.addTextChangedListener(
new TextWatcher() {
@Override
public void beforeTextChanged(
CharSequence s, int start, int count, int after) {}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {}
@Override
public void afterTextChanged(Editable s) {
mPasswordConfirmError.setVisibility(
s.toString().equals(mPassword.getText().toString())
? View.INVISIBLE
: View.VISIBLE);
updateCreateButton();
}
});
mEmail = findViewById(R.id.assistant_email);
mEmail.addTextChangedListener(
new TextWatcher() {
@Override
public void beforeTextChanged(
CharSequence s, int start, int count, int after) {}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {}
@Override
public void afterTextChanged(Editable s) {
AccountCreator.EmailStatus status = mAccountCreator.setEmail(s.toString());
mEmailError.setVisibility(
status == AccountCreator.EmailStatus.Ok
? View.INVISIBLE
: View.VISIBLE);
updateCreateButton();
}
});
mCreate = findViewById(R.id.assistant_create);
mCreate.setOnClickListener(
new View.OnClickListener() {
@Override
public void onClick(View v) {
enableButtonsAndFields(false);
mAccountCreator.setDomain(getString(R.string.default_domain));
AccountCreator.Status status = mAccountCreator.isAccountExist();
if (status != AccountCreator.Status.RequestOk) {
enableButtonsAndFields(true);
Log.e("[Email Account Creation] isAccountExists returned " + status);
showGenericErrorDialog(status);
}
}
});
mCreate.setEnabled(false);
mListener =
new AccountCreatorListenerStub() {
public void onIsAccountExist(
AccountCreator creator, AccountCreator.Status status, String resp) {
Log.i("[Email Account Creation] onIsAccountExist status is " + status);
if (status.equals(AccountCreator.Status.AccountExist)
|| status.equals(AccountCreator.Status.AccountExistWithAlias)) {
showAccountAlreadyExistsDialog();
enableButtonsAndFields(true);
} else if (status.equals(AccountCreator.Status.AccountNotExist)) {
status = mAccountCreator.createAccount();
if (status != AccountCreator.Status.RequestOk) {
Log.e("[Email Account Creation] createAccount returned " + status);
enableButtonsAndFields(true);
showGenericErrorDialog(status);
}
} else {
enableButtonsAndFields(true);
showGenericErrorDialog(status);
}
}
@Override
public void onCreateAccount(
AccountCreator creator, AccountCreator.Status status, String resp) {
Log.i("[Email Account Creation] onCreateAccount status is " + status);
if (status.equals(AccountCreator.Status.AccountCreated)) {
startActivity(
new Intent(
EmailAccountCreationAssistantActivity.this,
EmailAccountValidationAssistantActivity.class));
} else {
enableButtonsAndFields(true);
showGenericErrorDialog(status);
}
}
};
}
private void enableButtonsAndFields(boolean enable) {
mUsername.setEnabled(enable);
mPassword.setEnabled(enable);
mPasswordConfirm.setEnabled(enable);
mEmail.setEnabled(enable);
mCreate.setEnabled(enable);
}
private void updateCreateButton() {
mCreate.setEnabled(
mUsername.getText().length() > 0
&& mPassword.getText().toString().length() > 0
&& mEmail.getText().toString().length() > 0
&& mEmailError.getVisibility() == View.INVISIBLE
&& mUsernameError.getVisibility() == View.INVISIBLE
&& mPasswordError.getVisibility() == View.INVISIBLE
&& mPasswordConfirmError.getVisibility() == View.INVISIBLE);
}
@Override
protected void onResume() {
super.onResume();
mAccountCreator.addListener(mListener);
if (getResources().getBoolean(R.bool.pre_fill_email_in_assistant)) {
Account[] accounts = AccountManager.get(this).getAccountsByType("com.google");
for (Account account : accounts) {
if (Patterns.EMAIL_ADDRESS.matcher(account.name).matches()) {
String possibleEmail = account.name;
mEmail.setText(possibleEmail);
break;
}
}
}
}
@Override
protected void onPause() {
super.onPause();
mAccountCreator.removeListener(mListener);
}
}

View file

@ -0,0 +1,101 @@
package org.linphone.assistant;
/*
PhoneAccountValidationAssistantActivity.java
Copyright (C) 2019 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.os.Bundle;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.Nullable;
import org.linphone.R;
import org.linphone.core.AccountCreator;
import org.linphone.core.AccountCreatorListenerStub;
import org.linphone.core.tools.Log;
public class EmailAccountValidationAssistantActivity extends AssistantActivity {
private TextView mEmail, mFinishCreation;
private AccountCreatorListenerStub mListener;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.assistant_email_account_validation);
mEmail = findViewById(R.id.send_email);
mEmail.setText(mAccountCreator.getEmail());
mFinishCreation = findViewById(R.id.assistant_check);
mFinishCreation.setOnClickListener(
new View.OnClickListener() {
@Override
public void onClick(View v) {
mFinishCreation.setEnabled(false);
AccountCreator.Status status = mAccountCreator.isAccountActivated();
if (status != AccountCreator.Status.RequestOk) {
Log.e("[Email Account Validation] activateAccount returned " + status);
mFinishCreation.setEnabled(true);
showGenericErrorDialog(status);
}
}
});
mListener =
new AccountCreatorListenerStub() {
@Override
public void onIsAccountActivated(
AccountCreator creator, AccountCreator.Status status, String resp) {
Log.i(
"[Email Account Validation] onIsAccountActivated status is "
+ status);
if (status.equals(AccountCreator.Status.AccountActivated)) {
createProxyConfigAndLeaveAssistant();
} else if (status.equals(AccountCreator.Status.AccountNotActivated)) {
Toast.makeText(
EmailAccountValidationAssistantActivity.this,
getString(R.string.assistant_account_not_validated),
Toast.LENGTH_LONG)
.show();
mFinishCreation.setEnabled(true);
} else {
showGenericErrorDialog(status);
mFinishCreation.setEnabled(true);
}
}
};
}
@Override
protected void onResume() {
super.onResume();
mAccountCreator.addListener(mListener);
// Prevent user to go back, it won't be able to come back here after...
mBack.setEnabled(false);
}
@Override
protected void onPause() {
super.onPause();
mAccountCreator.removeListener(mListener);
}
}

View file

@ -0,0 +1,108 @@
package org.linphone.assistant;
/*
GenericConnectionAssistantActivity.java
Copyright (C) 2019 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.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
import android.widget.EditText;
import android.widget.RadioGroup;
import android.widget.TextView;
import androidx.annotation.Nullable;
import org.linphone.LinphoneManager;
import org.linphone.R;
import org.linphone.core.AccountCreator;
import org.linphone.core.TransportType;
import org.linphone.settings.LinphonePreferences;
public class GenericConnectionAssistantActivity extends AssistantActivity implements TextWatcher {
private TextView mLogin;
private EditText mUsername, mPassword, mDomain, mDisplayName;
private RadioGroup mTransport;
private AccountCreator mAccountCreator;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.assistant_generic_connection);
mLogin = findViewById(R.id.assistant_login);
mLogin.setEnabled(false);
mLogin.setOnClickListener(
new View.OnClickListener() {
@Override
public void onClick(View v) {
configureAccount();
}
});
mUsername = findViewById(R.id.assistant_username);
mUsername.addTextChangedListener(this);
mDisplayName = findViewById(R.id.assistant_display_name);
mDisplayName.addTextChangedListener(this);
mPassword = findViewById(R.id.assistant_password);
mPassword.addTextChangedListener(this);
mDomain = findViewById(R.id.assistant_domain);
mDomain.addTextChangedListener(this);
mTransport = findViewById(R.id.assistant_transports);
mAccountCreator =
LinphoneManager.getLcIfManagerNotDestroyedOrNull()
.createAccountCreator(LinphonePreferences.instance().getXmlrpcUrl());
}
private void configureAccount() {
mAccountCreator.setUsername(mUsername.getText().toString());
mAccountCreator.setDomain(mDomain.getText().toString());
mAccountCreator.setPassword(mPassword.getText().toString());
mAccountCreator.setDisplayName(mDisplayName.getText().toString());
// TODO: mUserId
switch (mTransport.getCheckedRadioButtonId()) {
case R.id.transport_udp:
mAccountCreator.setTransport(TransportType.Udp);
break;
case R.id.transport_tcp:
mAccountCreator.setTransport(TransportType.Tcp);
break;
case R.id.transport_tls:
mAccountCreator.setTransport(TransportType.Tls);
break;
}
createProxyConfigAndLeaveAssistant();
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
mLogin.setEnabled(
!mUsername.getText().toString().isEmpty()
&& !mDomain.getText().toString().isEmpty());
}
@Override
public void afterTextChanged(Editable s) {}
}

View file

@ -1,426 +0,0 @@
package org.linphone.assistant;
/*
LinphoneLoginFragment.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.app.AlertDialog;
import android.app.Fragment;
import android.content.Context;
import android.os.Build;
import android.os.Bundle;
import android.telephony.TelephonyManager;
import android.text.Editable;
import android.text.Html;
import android.text.TextWatcher;
import android.text.method.LinkMovementMethod;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import java.util.Locale;
import org.linphone.LinphoneManager;
import org.linphone.R;
import org.linphone.core.AccountCreator;
import org.linphone.core.AccountCreatorListener;
import org.linphone.core.DialPlan;
import org.linphone.settings.LinphonePreferences;
import org.linphone.utils.LinphoneUtils;
public class LinphoneLoginFragment extends Fragment
implements CompoundButton.OnCheckedChangeListener,
OnClickListener,
TextWatcher,
AccountCreatorListener {
private EditText mLogin, mPassword, mPhoneNumberEdit, mDialCode;
private Button mApply, mSelectCountry;
private CheckBox mUseUsername;
private LinearLayout mPhoneNumberLayout, mUsernameLayout, mPasswordLayout;
private TextView mForgotPassword, mMessagePhoneNumber, mPhoneNumberError;
private AccountCreator mAccountCreator;
private int mCountryCode;
private String mPhone, mUsername, mPwd;
private ImageView mPhoneNumberInfo;
@Override
public View onCreateView(
LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.assistant_linphone_login, container, false);
mAccountCreator =
LinphoneManager.getLc()
.createAccountCreator(LinphonePreferences.instance().getXmlrpcUrl());
mAccountCreator.setListener(this);
mLogin = view.findViewById(R.id.assistant_username);
mLogin.addTextChangedListener(this);
mDialCode = view.findViewById(R.id.dial_code);
mPhoneNumberEdit = view.findViewById(R.id.phone_number);
mPhoneNumberLayout = view.findViewById(R.id.phone_number_layout);
mPhoneNumberError = view.findViewById(R.id.phone_number_error_2);
mPhoneNumberInfo = view.findViewById(R.id.info_phone_number);
mUseUsername = view.findViewById(R.id.use_username);
mUsernameLayout = view.findViewById(R.id.username_layout);
mPasswordLayout = view.findViewById(R.id.password_layout);
mPassword = view.findViewById(R.id.assistant_password);
mMessagePhoneNumber = view.findViewById(R.id.message_phone_number);
mForgotPassword = view.findViewById(R.id.forgot_password);
mSelectCountry = view.findViewById(R.id.select_country);
mApply = view.findViewById(R.id.assistant_apply);
mApply.setEnabled(true);
mApply.setOnClickListener(this);
// Phone number
if (getResources().getBoolean(R.bool.use_phone_number_validation)) {
mMessagePhoneNumber.setText(getString(R.string.assistant_create_account_part_1));
mPhone = getArguments().getString("Phone");
String prefix = getArguments().getString("Dialcode");
getActivity().getApplicationContext();
// Automatically get the country code from the mPhone
TelephonyManager tm =
(TelephonyManager)
getActivity()
.getApplicationContext()
.getSystemService(Context.TELEPHONY_SERVICE);
String countryIso = tm.getNetworkCountryIso();
mCountryCode = org.linphone.core.Utils.getCccFromIso(countryIso.toUpperCase());
DialPlan c = AssistantActivity.instance().country;
if (c != null) {
mSelectCountry.setText(c.getCountry());
mDialCode.setText(
c.getCountryCallingCode().contains("+")
? c.getCountryCallingCode()
: "+" + c.getCountryCallingCode());
} else {
c =
AssistantActivity.instance()
.getCountryListAdapter()
.getCountryFromCountryCode(String.valueOf(mCountryCode));
if (c != null) {
mSelectCountry.setText(c.getCountry());
mDialCode.setText(
c.getCountryCallingCode().contains("+")
? c.getCountryCallingCode()
: "+" + c.getCountryCallingCode());
}
}
mPhoneNumberLayout.setVisibility(View.VISIBLE);
mSelectCountry.setOnClickListener(this);
mPhoneNumberInfo.setOnClickListener(this);
// Allow user to enter a mUsername instead use the mPhone number as mUsername
if (getResources().getBoolean(R.bool.assistant_allow_username)) {
mUseUsername.setVisibility(View.VISIBLE);
mUseUsername.setOnCheckedChangeListener(this);
}
if (mPhone != null) mPhoneNumberEdit.setText(mPhone);
if (prefix != null) mDialCode.setText("+" + prefix);
}
if (getResources().getBoolean(R.bool.assistant_allow_username)) {
mUseUsername.setVisibility(View.VISIBLE);
mUseUsername.setOnCheckedChangeListener(this);
mPassword.addTextChangedListener(this);
mForgotPassword.setText(
Html.fromHtml(
"<a href=\""
+ getString(R.string.recover_password_link)
+ "\"'>"
+ getString(R.string.forgot_password)
+ "</a>"));
mForgotPassword.setMovementMethod(LinkMovementMethod.getInstance());
}
// Hide mPhone number and display mUsername/email/mPassword
if (!getResources().getBoolean(R.bool.use_phone_number_validation)) {
mPhoneNumberLayout.setVisibility(View.GONE);
mUseUsername.setVisibility(View.GONE);
mUsernameLayout.setVisibility(View.VISIBLE);
mPasswordLayout.setVisibility(View.VISIBLE);
}
// When we come from generic mLogin fragment
mUsername = getArguments().getString("Username");
mPwd = getArguments().getString("Password");
if (mUsername != null && mPwd != null) {
mUseUsername.setChecked(true);
onCheckedChanged(mUseUsername, true);
mLogin.setText(mUsername);
mPassword.setText(mPwd);
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
mAccountCreator.setLanguage(Locale.getDefault().toLanguageTag());
}
addPhoneNumberHandler(mDialCode);
addPhoneNumberHandler(mPhoneNumberEdit);
return view;
}
private void linphoneLogIn() {
if (mLogin.getText() == null
|| mLogin.length() == 0
|| mPassword.getText() == null
|| mPassword.length() == 0) {
LinphoneUtils.displayErrorAlert(
getString(R.string.first_launch_no_login_password),
AssistantActivity.instance());
mApply.setEnabled(true);
return;
}
mAccountCreator.setUsername(mLogin.getText().toString());
mAccountCreator.setPassword(mPassword.getText().toString());
mAccountCreator.setDomain(getString(R.string.default_domain));
mAccountCreator.isAccountExist();
}
private int getPhoneNumberStatus() {
mAccountCreator.setDomain(getString(R.string.default_domain));
return mAccountCreator.setPhoneNumber(
mPhoneNumberEdit.getText().toString(), LinphoneUtils.getCountryCode(mDialCode));
}
private void addPhoneNumberHandler(final EditText field) {
field.addTextChangedListener(
new TextWatcher() {
public void afterTextChanged(Editable s) {
if (field.equals(mDialCode)) {
DialPlan c =
AssistantActivity.instance()
.getCountryListAdapter()
.getCountryFromCountryCode(
mDialCode.getText().toString());
if (c != null) {
AssistantActivity.instance().country = c;
mSelectCountry.setText(c.getCountry());
} else {
mSelectCountry.setText(R.string.select_your_country);
}
}
}
public void beforeTextChanged(
CharSequence s, int start, int count, int after) {}
public void onTextChanged(CharSequence s, int start, int count, int after) {
onTextChanged2();
}
});
}
@Override
public void onResume() {
super.onResume();
}
@Override
public void onClick(View v) {
int id = v.getId();
if (id == R.id.assistant_apply) {
mApply.setEnabled(false);
if (mUseUsername == null || !mUseUsername.isChecked()) {
recoverAccount();
} else {
linphoneLogIn();
}
} else if (id == R.id.info_phone_number) {
new AlertDialog.Builder(getActivity())
.setTitle(getString(R.string.phone_number_info_title))
.setMessage(getString(R.string.phone_number_link_info_content))
.show();
} else if (id == R.id.select_country) {
AssistantActivity.instance().displayCountryChooser();
}
}
private void recoverAccount() {
if (mPhoneNumberEdit.getText().length() > 0 || mDialCode.getText().length() > 1) {
int status = getPhoneNumberStatus();
boolean isOk = status == AccountCreator.PhoneNumberStatus.Ok.toInt();
if (isOk) {
mAccountCreator.isAliasUsed();
} else {
mApply.setEnabled(true);
LinphoneUtils.displayErrorAlert(
LinphoneUtils.errorForPhoneNumberStatus(status),
AssistantActivity.instance());
LinphoneUtils.displayError(
isOk, mPhoneNumberError, LinphoneUtils.errorForPhoneNumberStatus(status));
}
} else {
mApply.setEnabled(true);
LinphoneUtils.displayErrorAlert(
getString(R.string.assistant_create_account_part_1),
AssistantActivity.instance());
}
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
private void onTextChanged2() {
int status = getPhoneNumberStatus();
boolean isOk = status == AccountCreator.PhoneNumberStatus.Ok.toInt();
LinphoneUtils.displayError(
isOk, mPhoneNumberError, LinphoneUtils.errorForPhoneNumberStatus(status));
if (!isOk) {
if ((1 == (status & AccountCreator.PhoneNumberStatus.InvalidCountryCode.toInt()))) {
mDialCode.setBackgroundResource(R.drawable.resizable_textfield_error);
mPhoneNumberEdit.setBackgroundResource(R.drawable.resizable_textfield);
} else {
mDialCode.setBackgroundResource(R.drawable.resizable_textfield);
mPhoneNumberEdit.setBackgroundResource(R.drawable.resizable_textfield_error);
}
} else {
mAccountCreator.setPhoneNumber(
mPhoneNumberEdit.getText().toString(), mDialCode.getText().toString());
mDialCode.setBackgroundResource(R.drawable.resizable_textfield);
mPhoneNumberEdit.setBackgroundResource(R.drawable.resizable_textfield);
}
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
onTextChanged2();
}
@Override
public void afterTextChanged(Editable s) {}
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (buttonView.getId() == R.id.use_username) {
if (isChecked) {
mUsernameLayout.setVisibility(View.VISIBLE);
mPasswordLayout.setVisibility(View.VISIBLE);
mPhoneNumberEdit.setVisibility(EditText.GONE);
mPhoneNumberLayout.setVisibility(LinearLayout.GONE);
mMessagePhoneNumber.setText(getString(R.string.assistant_linphone_login_desc));
} else {
mUsernameLayout.setVisibility(View.GONE);
mPasswordLayout.setVisibility(View.GONE);
mPhoneNumberEdit.setVisibility(EditText.VISIBLE);
mPhoneNumberLayout.setVisibility(LinearLayout.VISIBLE);
mMessagePhoneNumber.setText(getString(R.string.assistant_create_account_part_1));
}
}
}
@Override
public void onIsAccountExist(
AccountCreator accountCreator, AccountCreator.Status status, String resp) {
if (AssistantActivity.instance() == null) {
mApply.setEnabled(true);
return;
}
if (status.equals(AccountCreator.Status.AccountExist)
|| status.equals(AccountCreator.Status.AccountExistWithAlias)) {
AssistantActivity.instance().linphoneLogIn(accountCreator);
} else {
LinphoneUtils.displayErrorAlert(
LinphoneUtils.errorForStatus(status), AssistantActivity.instance());
}
mApply.setEnabled(true);
}
@Override
public void onCreateAccount(
AccountCreator accountCreator, AccountCreator.Status status, String resp) {}
@Override
public void onActivateAccount(
AccountCreator accountCreator, AccountCreator.Status status, String resp) {}
@Override
public void onLinkAccount(
AccountCreator accountCreator, AccountCreator.Status status, String resp) {}
@Override
public void onActivateAlias(
AccountCreator accountCreator, AccountCreator.Status status, String resp) {}
@Override
public void onIsAccountActivated(
AccountCreator accountCreator, AccountCreator.Status status, String resp) {}
@Override
public void onRecoverAccount(
AccountCreator accountCreator, AccountCreator.Status status, String resp) {
if (AssistantActivity.instance() == null) {
mApply.setEnabled(true);
return;
}
if (status.equals(AccountCreator.Status.ServerError)) {
LinphoneUtils.displayErrorAlert(
LinphoneUtils.errorForStatus(AccountCreator.Status.RequestFailed),
AssistantActivity.instance());
mApply.setEnabled(true);
} else {
AssistantActivity.instance()
.displayAssistantCodeConfirm(
accountCreator.getUsername(),
mPhoneNumberEdit.getText().toString(),
LinphoneUtils.getCountryCode(mDialCode),
true);
}
}
@Override
public void onIsAccountLinked(
AccountCreator accountCreator, AccountCreator.Status status, String resp) {}
@Override
public void onIsAliasUsed(
AccountCreator accountCreator, AccountCreator.Status status, String resp) {
if (AssistantActivity.instance() == null) {
mApply.setEnabled(true);
return;
}
if (status.equals(AccountCreator.Status.AliasIsAccount)
|| status.equals(AccountCreator.Status.AliasExist)) {
accountCreator.recoverAccount();
} else {
mApply.setEnabled(true);
LinphoneUtils.displayErrorAlert(
LinphoneUtils.errorForStatus(status), AssistantActivity.instance());
}
}
@Override
public void onUpdateAccount(
AccountCreator accountCreator, AccountCreator.Status status, String resp) {}
}

View file

@ -1,125 +0,0 @@
package org.linphone.assistant;
/*
LoginFragment.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.app.Fragment;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RadioGroup;
import android.widget.Toast;
import org.linphone.R;
import org.linphone.core.TransportType;
public class LoginFragment extends Fragment implements OnClickListener, TextWatcher {
private EditText mLogin, mUserid, mPassword, mDomain, mDisplayName;
private RadioGroup mTransports;
private Button mApply;
@Override
public View onCreateView(
LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.assistant_login, container, false);
mLogin = view.findViewById(R.id.assistant_username);
mLogin.addTextChangedListener(this);
mDisplayName = view.findViewById(R.id.assistant_display_name);
mDisplayName.addTextChangedListener(this);
mUserid = view.findViewById(R.id.assistant_userid);
mUserid.addTextChangedListener(this);
mPassword = view.findViewById(R.id.assistant_password);
mPassword.addTextChangedListener(this);
mDomain = view.findViewById(R.id.assistant_domain);
mDomain.addTextChangedListener(this);
mTransports = view.findViewById(R.id.assistant_transports);
mApply = view.findViewById(R.id.assistant_apply);
mApply.setEnabled(false);
mApply.setOnClickListener(this);
return view;
}
@Override
public void onClick(View v) {
int id = v.getId();
if (id == R.id.assistant_apply) {
if (mLogin.getText() == null
|| mLogin.length() == 0
|| mPassword.getText() == null
|| mPassword.length() == 0
|| mDomain.getText() == null
|| mDomain.length() == 0) {
Toast.makeText(
getActivity(),
getString(R.string.first_launch_no_login_password),
Toast.LENGTH_LONG)
.show();
return;
}
TransportType transport;
if (mTransports.getCheckedRadioButtonId() == R.id.transport_udp) {
transport = TransportType.Udp;
} else {
if (mTransports.getCheckedRadioButtonId() == R.id.transport_tcp) {
transport = TransportType.Tcp;
} else {
transport = TransportType.Tls;
}
}
if (mDomain.getText().toString().compareTo(getString(R.string.default_domain)) == 0) {
AssistantActivity.instance()
.displayLoginLinphone(
mLogin.getText().toString(), mPassword.getText().toString());
} else {
AssistantActivity.instance()
.genericLogIn(
mLogin.getText().toString(),
mUserid.getText().toString(),
mPassword.getText().toString(),
mDisplayName.getText().toString(),
null,
mDomain.getText().toString(),
transport);
}
}
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
mApply.setEnabled(
!mLogin.getText().toString().isEmpty()
&& !mPassword.getText().toString().isEmpty()
&& !mDomain.getText().toString().isEmpty());
}
@Override
public void afterTextChanged(Editable s) {}
}

View file

@ -0,0 +1,164 @@
package org.linphone.assistant;
/*
MenuAssistantActivity.java
Copyright (C) 2019 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.Intent;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.widget.TextView;
import androidx.annotation.Nullable;
import org.linphone.R;
import org.linphone.core.tools.Log;
import org.linphone.settings.LinphonePreferences;
public class MenuAssistantActivity extends AssistantActivity {
private TextView mAccountCreation, mAccountConnection, mGenericConnection, mRemoteConfiguration;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.assistant_menu);
Log.e("###");
mAccountCreation = findViewById(R.id.account_creation);
mAccountCreation.setOnClickListener(
new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent;
if (getResources().getBoolean(R.bool.isTablet)
|| !getResources().getBoolean(R.bool.use_phone_number_validation)) {
intent =
new Intent(
MenuAssistantActivity.this,
EmailAccountCreationAssistantActivity.class);
} else {
intent =
new Intent(
MenuAssistantActivity.this,
PhoneAccountCreationAssistantActivity.class);
}
startActivity(intent);
}
});
mAccountConnection = findViewById(R.id.account_connection);
mAccountConnection.setOnClickListener(
new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(
new Intent(
MenuAssistantActivity.this,
AccountConnectionAssistantActivity.class));
}
});
if (getResources().getBoolean(R.bool.hide_linphone_accounts_in_assistant)) {
mAccountConnection.setVisibility(View.GONE);
}
mGenericConnection = findViewById(R.id.generic_connection);
mGenericConnection.setOnClickListener(
new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(
new Intent(
MenuAssistantActivity.this,
GenericConnectionAssistantActivity.class));
}
});
if (getResources().getBoolean(R.bool.hide_generic_accounts_in_assistant)) {
mGenericConnection.setVisibility(View.GONE);
}
mRemoteConfiguration = findViewById(R.id.remote_configuration);
mRemoteConfiguration.setOnClickListener(
new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(
new Intent(
MenuAssistantActivity.this,
RemoteConfigurationAssistantActivity.class));
}
});
if (getResources().getBoolean(R.bool.hide_remote_provisioning_in_assistant)) {
mRemoteConfiguration.setVisibility(View.GONE);
}
if (getResources().getBoolean(R.bool.assistant_use_linphone_login_as_first_fragment)) {
startActivity(
new Intent(
MenuAssistantActivity.this, AccountConnectionAssistantActivity.class));
finish();
} else if (getResources()
.getBoolean(R.bool.assistant_use_generic_login_as_first_fragment)) {
startActivity(
new Intent(
MenuAssistantActivity.this, GenericConnectionAssistantActivity.class));
finish();
} else if (getResources()
.getBoolean(R.bool.assistant_use_create_linphone_account_as_first_fragment)) {
startActivity(
new Intent(
MenuAssistantActivity.this,
PhoneAccountCreationAssistantActivity.class));
finish();
}
}
@Override
protected void onResume() {
super.onResume();
if (!getResources()
.getBoolean(R.bool.forbid_to_leave_assistant_before_account_configuration)) {
mBack.setOnClickListener(
new View.OnClickListener() {
@Override
public void onClick(View v) {
LinphonePreferences.instance().firstLaunchSuccessful();
goToLinphoneActivity();
}
});
} else {
mBack.setEnabled(false);
}
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
if (getResources()
.getBoolean(R.bool.forbid_to_leave_assistant_before_account_configuration)) {
// Do nothing
return true;
} else {
LinphonePreferences.instance().firstLaunchSuccessful();
goToLinphoneActivity();
return true;
}
}
return super.onKeyDown(keyCode, event);
}
}

View file

@ -0,0 +1,125 @@
package org.linphone.assistant;
/*
OpenH264DownloadAssistantActivity.java
Copyright (C) 2019 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.os.Bundle;
import android.view.View;
import android.widget.ProgressBar;
import android.widget.TextView;
import androidx.annotation.Nullable;
import org.linphone.LinphoneManager;
import org.linphone.R;
import org.linphone.core.Core;
import org.linphone.core.PayloadType;
import org.linphone.core.tools.Log;
import org.linphone.core.tools.OpenH264DownloadHelper;
import org.linphone.core.tools.OpenH264DownloadHelperListener;
import org.linphone.settings.LinphonePreferences;
public class OpenH264DownloadAssistantActivity extends AssistantActivity {
private TextView mYes, mNo;
private ProgressBar mProgress;
private OpenH264DownloadHelper mHelper;
private OpenH264DownloadHelperListener mListener;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.assistant_openh264_codec_download);
mHelper = LinphoneManager.getInstance().getOpenH264DownloadHelper();
LinphonePreferences.instance().setOpenH264CodecDownloadEnabled(false);
mProgress = findViewById(R.id.progress_bar);
mYes = findViewById(R.id.answer_yes);
mYes.setOnClickListener(
new View.OnClickListener() {
@Override
public void onClick(View v) {
mYes.setEnabled(false);
mNo.setEnabled(false);
Log.e("[OpenH264 Downloader] Start download");
mProgress.setVisibility(View.VISIBLE);
mHelper.downloadCodec();
}
});
mNo = findViewById(R.id.answer_no);
mNo.setOnClickListener(
new View.OnClickListener() {
@Override
public void onClick(View v) {
mYes.setEnabled(false);
mNo.setEnabled(false);
Log.e("[OpenH264 Downloader] Download refused");
goToLinphoneActivity();
}
});
mListener =
new OpenH264DownloadHelperListener() {
@Override
public void OnProgress(int current, int max) {
if (current < max) {
mProgress.setMax(max);
mProgress.setProgress(current);
} else {
Core core = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (core != null) {
core.reloadMsPlugins(getApplicationInfo().nativeLibraryDir);
enableH264();
}
goToLinphoneActivity();
}
}
@Override
public void OnError(String s) {
Log.e("[OpenH264 Downloader] " + s);
mYes.setEnabled(true);
mNo.setEnabled(true);
}
};
}
@Override
protected void onResume() {
super.onResume();
mHelper.setOpenH264HelperListener(mListener);
}
@Override
protected void onPause() {
mHelper.setOpenH264HelperListener(null);
super.onPause();
}
private void enableH264() {
for (PayloadType pt : LinphoneManager.getLc().getVideoPayloadTypes()) {
if (pt.getMimeType().equals("H264")) {
pt.enable(true);
break;
}
}
}
}

View file

@ -0,0 +1,240 @@
package org.linphone.assistant;
/*
PhoneAccountCreationAssistantActivity.java
Copyright (C) 2019 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.Intent;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.Nullable;
import org.linphone.R;
import org.linphone.core.AccountCreator;
import org.linphone.core.AccountCreatorListenerStub;
import org.linphone.core.DialPlan;
import org.linphone.core.tools.Log;
public class PhoneAccountCreationAssistantActivity extends AssistantActivity {
private TextView mCountryPicker, mError, mSipUri, mCreate;
private EditText mPrefix, mPhoneNumber;
private ImageView mPhoneNumberInfos;
private AccountCreatorListenerStub mListener;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.assistant_phone_account_creation);
mCountryPicker = findViewById(R.id.select_country);
mCountryPicker.setOnClickListener(
new View.OnClickListener() {
@Override
public void onClick(View v) {
showCountryPickerDialog();
}
});
mError = findViewById(R.id.phone_number_error);
mSipUri = findViewById(R.id.sip_uri);
mCreate = findViewById(R.id.assistant_create);
mCreate.setOnClickListener(
new View.OnClickListener() {
@Override
public void onClick(View v) {
enableButtonsAndFields(false);
mAccountCreator.setUsername(mAccountCreator.getPhoneNumber());
mAccountCreator.setDomain(getString(R.string.default_domain));
AccountCreator.Status status = mAccountCreator.isAccountExist();
if (status != AccountCreator.Status.RequestOk) {
Log.e("[Phone Account Creation] isAccountExists returned " + status);
enableButtonsAndFields(true);
showGenericErrorDialog(status);
}
}
});
mCreate.setEnabled(false);
mPrefix = findViewById(R.id.dial_code);
mPrefix.setText("+");
mPrefix.addTextChangedListener(
new TextWatcher() {
@Override
public void beforeTextChanged(
CharSequence s, int start, int count, int after) {}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {}
@Override
public void afterTextChanged(Editable s) {
String prefix = s.toString();
if (prefix.startsWith("+")) {
prefix = prefix.substring(1);
}
DialPlan dp = getDialPlanFromPrefix(prefix);
if (dp != null) {
mCountryPicker.setText(dp.getCountry());
}
updateCreateButtonAndDisplayError();
}
});
mPhoneNumber = findViewById(R.id.phone_number);
mPhoneNumber.addTextChangedListener(
new TextWatcher() {
@Override
public void beforeTextChanged(
CharSequence s, int start, int count, int after) {}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {}
@Override
public void afterTextChanged(Editable s) {
updateCreateButtonAndDisplayError();
}
});
mPhoneNumberInfos = findViewById(R.id.info_phone_number);
mPhoneNumberInfos.setOnClickListener(
new View.OnClickListener() {
@Override
public void onClick(View v) {
showPhoneNumberDialog();
}
});
mListener =
new AccountCreatorListenerStub() {
public void onIsAccountExist(
AccountCreator creator, AccountCreator.Status status, String resp) {
Log.i("[Phone Account Creation] onIsAccountExist status is " + status);
if (status.equals(AccountCreator.Status.AccountExist)
|| status.equals(AccountCreator.Status.AccountExistWithAlias)) {
showAccountAlreadyExistsDialog();
enableButtonsAndFields(true);
} else if (status.equals(AccountCreator.Status.AccountNotExist)) {
status = mAccountCreator.createAccount();
if (status != AccountCreator.Status.RequestOk) {
Log.e("[Phone Account Creation] createAccount returned " + status);
enableButtonsAndFields(true);
showGenericErrorDialog(status);
}
} else {
enableButtonsAndFields(true);
showGenericErrorDialog(status);
}
}
@Override
public void onCreateAccount(
AccountCreator creator, AccountCreator.Status status, String resp) {
Log.i("[Phone Account Creation] onCreateAccount status is " + status);
if (status.equals(AccountCreator.Status.AccountCreated)) {
startActivity(
new Intent(
PhoneAccountCreationAssistantActivity.this,
PhoneAccountValidationAssistantActivity.class));
} else {
enableButtonsAndFields(true);
showGenericErrorDialog(status);
}
}
};
}
@Override
protected void onResume() {
super.onResume();
mAccountCreator.addListener(mListener);
DialPlan dp = getDialPlanForCurrentCountry();
displayDialPlan(dp);
String phoneNumber = getDevicePhoneNumber();
if (phoneNumber != null) {
mPhoneNumber.setText(phoneNumber);
}
}
@Override
protected void onPause() {
super.onPause();
mAccountCreator.removeListener(mListener);
}
@Override
public void onCountryClicked(DialPlan dialPlan) {
super.onCountryClicked(dialPlan);
displayDialPlan(dialPlan);
}
private void enableButtonsAndFields(boolean enable) {
mPrefix.setEnabled(enable);
mPhoneNumber.setEnabled(enable);
mCreate.setEnabled(enable);
}
private void updateCreateButtonAndDisplayError() {
if (mPrefix.getText().toString().isEmpty() || mPhoneNumber.getText().toString().isEmpty())
return;
int status = arePhoneNumberAndPrefixOk(mPrefix, mPhoneNumber);
if (status == AccountCreator.PhoneNumberStatus.Ok.toInt()) {
mCreate.setEnabled(true);
mError.setText("");
mError.setVisibility(View.INVISIBLE);
} else {
mCreate.setEnabled(false);
mError.setText(getErrorFromPhoneNumberStatus(status));
mError.setVisibility(View.VISIBLE);
}
String username = mAccountCreator.getPhoneNumber();
if (username != null) {
String sip =
getString(R.string.assistant_create_account_phone_number_address)
+ " <sip:"
+ username
+ "@"
+ getResources().getString(R.string.default_domain)
+ ">";
mSipUri.setText(sip);
}
}
private void displayDialPlan(DialPlan dp) {
if (dp != null) {
mPrefix.setText("+" + dp.getCountryCallingCode());
mCountryPicker.setText(dp.getCountry());
}
}
}

View file

@ -0,0 +1,275 @@
package org.linphone.assistant;
/*
PhoneAccountLinkingAssistantActivity.java
Copyright (C) 2019 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.Intent;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.Nullable;
import org.linphone.LinphoneManager;
import org.linphone.R;
import org.linphone.core.AccountCreator;
import org.linphone.core.AccountCreatorListenerStub;
import org.linphone.core.Address;
import org.linphone.core.AuthInfo;
import org.linphone.core.Core;
import org.linphone.core.DialPlan;
import org.linphone.core.ProxyConfig;
import org.linphone.core.tools.Log;
public class PhoneAccountLinkingAssistantActivity extends AssistantActivity {
private TextView mCountryPicker, mError, mLink;
private EditText mPrefix, mPhoneNumber;
private ImageView mPhoneNumberInfos;
private AccountCreatorListenerStub mListener;
private ProxyConfig mProxyConfig;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.assistant_phone_account_linking);
if (getIntent() != null && getIntent().hasExtra("AccountNumber")) {
int proxyConfigIndex = getIntent().getExtras().getInt("AccountNumber");
Core core = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (core == null) {
Log.e("[Account Linking] Core not available");
unexpectedError();
}
ProxyConfig[] proxyConfigs = core.getProxyConfigList();
if (proxyConfigIndex >= 0 && proxyConfigIndex < proxyConfigs.length) {
mProxyConfig = proxyConfigs[proxyConfigIndex];
Address identity = mProxyConfig.getIdentityAddress();
if (identity == null) {
Log.e("[Account Linking] Proxy doesn't have an identity address");
unexpectedError();
}
mAccountCreator.setUsername(identity.getUsername());
AuthInfo authInfo = mProxyConfig.findAuthInfo();
if (authInfo == null) {
Log.e("[Account Linking] Auth info not found");
unexpectedError();
}
mAccountCreator.setHa1(authInfo.getHa1());
mAccountCreator.setDomain(getString(R.string.default_domain));
} else {
Log.e("[Account Linking] Proxy config index out of bounds: " + proxyConfigIndex);
unexpectedError();
}
} else {
Log.e("[Account Linking] Proxy config index not found");
unexpectedError();
}
mCountryPicker = findViewById(R.id.select_country);
mCountryPicker.setOnClickListener(
new View.OnClickListener() {
@Override
public void onClick(View v) {
showCountryPickerDialog();
}
});
mError = findViewById(R.id.phone_number_error);
mLink = findViewById(R.id.assistant_link);
mLink.setOnClickListener(
new View.OnClickListener() {
@Override
public void onClick(View v) {
enableButtonsAndFields(false);
AccountCreator.Status status = mAccountCreator.isAliasUsed();
if (status != AccountCreator.Status.RequestOk) {
Log.e("[Phone Account Linking] isAliasUsed returned " + status);
enableButtonsAndFields(true);
showGenericErrorDialog(status);
}
}
});
mLink.setEnabled(false);
mPrefix = findViewById(R.id.dial_code);
mPrefix.setText("+");
mPrefix.addTextChangedListener(
new TextWatcher() {
@Override
public void beforeTextChanged(
CharSequence s, int start, int count, int after) {}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {}
@Override
public void afterTextChanged(Editable s) {
String prefix = s.toString();
if (prefix.startsWith("+")) {
prefix = prefix.substring(1);
}
DialPlan dp = getDialPlanFromPrefix(prefix);
if (dp != null) {
mCountryPicker.setText(dp.getCountry());
}
updateCreateButtonAndDisplayError();
}
});
mPhoneNumber = findViewById(R.id.phone_number);
mPhoneNumber.addTextChangedListener(
new TextWatcher() {
@Override
public void beforeTextChanged(
CharSequence s, int start, int count, int after) {}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {}
@Override
public void afterTextChanged(Editable s) {
updateCreateButtonAndDisplayError();
}
});
mPhoneNumberInfos = findViewById(R.id.info_phone_number);
mPhoneNumberInfos.setOnClickListener(
new View.OnClickListener() {
@Override
public void onClick(View v) {
showPhoneNumberDialog();
}
});
mListener =
new AccountCreatorListenerStub() {
@Override
public void onIsAliasUsed(
AccountCreator creator, AccountCreator.Status status, String resp) {
Log.i("[Phone Account Linking] onIsAliasUsed status is " + status);
if (status.equals(AccountCreator.Status.AliasNotExist)) {
status = mAccountCreator.linkAccount();
if (status != AccountCreator.Status.RequestOk) {
Log.e("[Phone Account Linking] linkAccount returned " + status);
enableButtonsAndFields(true);
showGenericErrorDialog(status);
}
} else {
if (status.equals(AccountCreator.Status.AliasIsAccount)
|| status.equals(AccountCreator.Status.AliasExist)) {
showAccountAlreadyExistsDialog();
} else {
showGenericErrorDialog(status);
}
enableButtonsAndFields(true);
}
}
@Override
public void onLinkAccount(
AccountCreator creator, AccountCreator.Status status, String resp) {
Log.i("[Phone Account Linking] onLinkAccount status is " + status);
if (status.equals(AccountCreator.Status.RequestOk)) {
Intent intent =
new Intent(
PhoneAccountLinkingAssistantActivity.this,
PhoneAccountValidationAssistantActivity.class);
intent.putExtra("isLinkingVerification", true);
startActivity(intent);
} else {
enableButtonsAndFields(true);
showGenericErrorDialog(status);
}
}
};
}
@Override
protected void onResume() {
super.onResume();
mAccountCreator.addListener(mListener);
DialPlan dp = getDialPlanForCurrentCountry();
displayDialPlan(dp);
String phoneNumber = getDevicePhoneNumber();
if (phoneNumber != null) {
mPhoneNumber.setText(phoneNumber);
}
}
@Override
protected void onPause() {
super.onPause();
mAccountCreator.removeListener(mListener);
}
@Override
public void onCountryClicked(DialPlan dialPlan) {
super.onCountryClicked(dialPlan);
displayDialPlan(dialPlan);
}
private void enableButtonsAndFields(boolean enable) {
mPrefix.setEnabled(enable);
mPhoneNumber.setEnabled(enable);
mLink.setEnabled(enable);
}
private void updateCreateButtonAndDisplayError() {
if (mPrefix.getText().toString().isEmpty() || mPhoneNumber.getText().toString().isEmpty())
return;
int status = arePhoneNumberAndPrefixOk(mPrefix, mPhoneNumber);
if (status == AccountCreator.PhoneNumberStatus.Ok.toInt()) {
mLink.setEnabled(true);
mError.setText("");
mError.setVisibility(View.INVISIBLE);
} else {
mLink.setEnabled(false);
mError.setText(getErrorFromPhoneNumberStatus(status));
mError.setVisibility(View.VISIBLE);
}
}
private void displayDialPlan(DialPlan dp) {
if (dp != null) {
mPrefix.setText("+" + dp.getCountryCallingCode());
mCountryPicker.setText(dp.getCountry());
}
}
private void unexpectedError() {
Toast.makeText(this, R.string.error_unknown, Toast.LENGTH_SHORT).show();
finish();
}
}

View file

@ -0,0 +1,180 @@
package org.linphone.assistant;
/*
PhoneAccountValidationAssistantActivity.java
Copyright (C) 2019 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.ClipData;
import android.content.ClipboardManager;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import androidx.annotation.Nullable;
import org.linphone.R;
import org.linphone.core.AccountCreator;
import org.linphone.core.AccountCreatorListenerStub;
import org.linphone.core.tools.Log;
import org.linphone.settings.LinphonePreferences;
public class PhoneAccountValidationAssistantActivity extends AssistantActivity {
private TextView mPhoneNumber, mFinishCreation;
private EditText mSmsCode;
private ClipboardManager mClipboard;
private int mActivationCodeLength;
private boolean mIsLogin, mIsLinking;
private AccountCreatorListenerStub mListener;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.assistant_phone_account_validation);
mIsLogin = mIsLinking = false;
if (getIntent() != null && getIntent().getBooleanExtra("isLoginVerification", false)) {
findViewById(R.id.title_account_creation).setVisibility(View.VISIBLE);
mIsLogin = true;
} else if (getIntent() != null
&& getIntent().getBooleanExtra("isLinkingVerification", false)) {
mIsLinking = true;
findViewById(R.id.title_account_linking).setVisibility(View.VISIBLE);
} else {
findViewById(R.id.title_account_activation).setVisibility(View.VISIBLE);
}
mActivationCodeLength =
getResources().getInteger(R.integer.phone_number_validation_code_length);
mPhoneNumber = findViewById(R.id.phone_number);
mPhoneNumber.setText(mAccountCreator.getPhoneNumber());
mSmsCode = findViewById(R.id.sms_code);
mSmsCode.addTextChangedListener(
new TextWatcher() {
@Override
public void beforeTextChanged(
CharSequence s, int start, int count, int after) {}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {}
@Override
public void afterTextChanged(Editable s) {
mFinishCreation.setEnabled(s.length() == mActivationCodeLength);
}
});
mFinishCreation = findViewById(R.id.finish_account_creation);
mFinishCreation.setEnabled(false);
mFinishCreation.setOnClickListener(
new View.OnClickListener() {
@Override
public void onClick(View v) {
mFinishCreation.setEnabled(false);
mAccountCreator.setActivationCode(mSmsCode.getText().toString());
AccountCreator.Status status;
if (mIsLinking) {
status = mAccountCreator.activateAlias();
} else {
status = mAccountCreator.activateAccount();
}
if (status != AccountCreator.Status.RequestOk) {
Log.e(
"[Phone Account Validation] "
+ (mIsLinking
? "linkAccount"
: "activateAccount" + " returned ")
+ status);
mFinishCreation.setEnabled(true);
showGenericErrorDialog(status);
}
}
});
mListener =
new AccountCreatorListenerStub() {
@Override
public void onActivateAccount(
AccountCreator creator, AccountCreator.Status status, String resp) {
Log.i("[Phone Account Validation] onActivateAccount status is " + status);
if (status.equals(AccountCreator.Status.AccountActivated)) {
createProxyConfigAndLeaveAssistant();
} else {
mFinishCreation.setEnabled(true);
showGenericErrorDialog(status);
if (status.equals(AccountCreator.Status.WrongActivationCode)) {
// TODO
}
}
}
@Override
public void onActivateAlias(
AccountCreator creator, AccountCreator.Status status, String resp) {
Log.i("[Phone Account Validation] onActivateAlias status is " + status);
if (status.equals(AccountCreator.Status.AccountActivated)) {
LinphonePreferences.instance().setLinkPopupTime("");
goToLinphoneActivity();
} else {
mFinishCreation.setEnabled(true);
showGenericErrorDialog(status);
if (status.equals(AccountCreator.Status.WrongActivationCode)) {
// TODO
}
}
}
};
mClipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
mClipboard.addPrimaryClipChangedListener(
new ClipboardManager.OnPrimaryClipChangedListener() {
@Override
public void onPrimaryClipChanged() {
ClipData data = mClipboard.getPrimaryClip();
if (data != null && data.getItemCount() > 0) {
String clip = data.getItemAt(0).getText().toString();
if (clip.length() == mActivationCodeLength) {
mSmsCode.setText(clip);
}
}
}
});
}
@Override
protected void onResume() {
super.onResume();
mAccountCreator.addListener(mListener);
// Prevent user to go back, it won't be able to come back here after...
mBack.setEnabled(false);
}
@Override
protected void onPause() {
super.onPause();
mAccountCreator.removeListener(mListener);
}
}

View file

@ -1,8 +1,8 @@
package org.linphone.assistant; package org.linphone.assistant;
/* /*
QrCodeFragment.java QrCodeConfigurationAssistantActivity.java
Copyright (C) 2018 Belledonne Communications, Grenoble, France Copyright (C) 2019 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -19,46 +19,46 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
import android.app.Fragment; import android.app.Activity;
import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.TextureView; import android.view.TextureView;
import android.view.View; import androidx.annotation.Nullable;
import android.view.ViewGroup;
import org.linphone.LinphoneManager; import org.linphone.LinphoneManager;
import org.linphone.R; import org.linphone.R;
import org.linphone.core.Core; import org.linphone.core.Core;
import org.linphone.core.CoreListenerStub; import org.linphone.core.CoreListenerStub;
import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration; import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration;
public class QrCodeFragment extends Fragment { public class QrCodeConfigurationAssistantActivity extends AssistantActivity {
private TextureView mQrcodeView; private TextureView mQrcodeView;
private CoreListenerStub mListener; private CoreListenerStub mListener;
@Override @Override
public View onCreateView( protected void onCreate(@Nullable Bundle savedInstanceState) {
LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { super.onCreate(savedInstanceState);
View view = inflater.inflate(R.layout.qrcode, container, false);
mQrcodeView = view.findViewById(R.id.qrcodeCaptureSurface); setContentView(R.layout.assistant_qr_code_remote_configuration);
LinphoneManager.getLc().setNativePreviewWindowId(mQrcodeView); mQrcodeView = findViewById(R.id.qr_code_capture_texture);
mListener = mListener =
new CoreListenerStub() { new CoreListenerStub() {
@Override @Override
public void onQrcodeFound(Core lc, String result) { public void onQrcodeFound(Core lc, String result) {
enableQrcodeReader(false); Intent resultIntent = new Intent();
AssistantActivity.instance().displayRemoteProvisioning(result); resultIntent.putExtra("URL", result);
setResult(Activity.RESULT_OK, resultIntent);
finish();
} }
}; };
return view;
} }
private void enableQrcodeReader(boolean enable) { private void enableQrcodeReader(boolean enable) {
LinphoneManager.getLc().enableQrcodeVideoPreview(enable); LinphoneManager.getLc().enableQrcodeVideoPreview(enable);
LinphoneManager.getLc().enableVideoPreview(enable); LinphoneManager.getLc().enableVideoPreview(enable);
if (enable) { if (enable) {
LinphoneManager.getLc().addListener(mListener); LinphoneManager.getLc().addListener(mListener);
} else { } else {
@ -79,6 +79,7 @@ public class QrCodeFragment extends Fragment {
} }
private void launchQrcodeReader() { private void launchQrcodeReader() {
LinphoneManager.getLc().setNativePreviewWindowId(mQrcodeView);
setBackCamera(); setBackCamera();
enableQrcodeReader(true); enableQrcodeReader(true);
@ -86,14 +87,13 @@ public class QrCodeFragment extends Fragment {
@Override @Override
public void onResume() { public void onResume() {
launchQrcodeReader();
super.onResume(); super.onResume();
launchQrcodeReader();
} }
@Override @Override
public void onPause() { public void onPause() {
enableQrcodeReader(false); enableQrcodeReader(false);
// setBackCamera(false);
super.onPause(); super.onPause();
} }
} }

View file

@ -0,0 +1,203 @@
package org.linphone.assistant;
/*
RemoteConfigurationAssistantActivity.java
Copyright (C) 2019 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.Manifest;
import android.app.Activity;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Patterns;
import android.view.View;
import android.widget.EditText;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.Nullable;
import androidx.core.app.ActivityCompat;
import org.linphone.LinphoneManager;
import org.linphone.R;
import org.linphone.core.ConfiguringState;
import org.linphone.core.Core;
import org.linphone.core.CoreListenerStub;
import org.linphone.core.tools.Log;
import org.linphone.settings.LinphonePreferences;
public class RemoteConfigurationAssistantActivity extends AssistantActivity {
private static final int QR_CODE_ACTIVITY_RESULT = 1;
private static final int CAMERA_PERMISSION_RESULT = 2;
private TextView mFetchAndApply, mQrCode;
private EditText mRemoteConfigurationUrl;
private RelativeLayout mWaitLayout;
private CoreListenerStub mListener;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.assistant_remote_configuration);
mWaitLayout = findViewById(R.id.waitScreen);
mWaitLayout.setVisibility(View.GONE);
mFetchAndApply = findViewById(R.id.fetch_and_apply_remote_configuration);
mFetchAndApply.setEnabled(false);
mFetchAndApply.setOnClickListener(
new View.OnClickListener() {
@Override
public void onClick(View v) {
String url = mRemoteConfigurationUrl.getText().toString();
if (Patterns.WEB_URL.matcher(url).matches()) {
mWaitLayout.setVisibility(View.VISIBLE);
mFetchAndApply.setEnabled(false);
LinphonePreferences.instance().setRemoteProvisioningUrl(url);
LinphoneManager.getLc().getConfig().sync();
Core core = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (core != null) {
core.addListener(mListener);
}
LinphoneManager.getInstance().restartCore();
} else {
// TODO improve error text
Toast.makeText(
RemoteConfigurationAssistantActivity.this,
getString(R.string.remote_provisioning_failure),
Toast.LENGTH_LONG)
.show();
}
}
});
mRemoteConfigurationUrl = findViewById(R.id.remote_configuration_url);
mRemoteConfigurationUrl.addTextChangedListener(
new TextWatcher() {
@Override
public void beforeTextChanged(
CharSequence s, int start, int count, int after) {}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
mFetchAndApply.setEnabled(!s.toString().isEmpty());
}
@Override
public void afterTextChanged(Editable s) {}
});
mRemoteConfigurationUrl.setText(LinphonePreferences.instance().getRemoteProvisioningUrl());
mQrCode = findViewById(R.id.qr_code);
mQrCode.setOnClickListener(
new View.OnClickListener() {
@Override
public void onClick(View v) {
if (checkCameraPermissionForQrCode()) {
startActivityForResult(
new Intent(
RemoteConfigurationAssistantActivity.this,
QrCodeConfigurationAssistantActivity.class),
QR_CODE_ACTIVITY_RESULT);
}
}
});
mListener =
new CoreListenerStub() {
@Override
public void onConfiguringStatus(
Core core, ConfiguringState status, String message) {
core.removeListener(mListener);
mWaitLayout.setVisibility(View.GONE);
mFetchAndApply.setEnabled(true);
if (status == ConfiguringState.Successful) {
LinphonePreferences.instance().firstLaunchSuccessful();
goToLinphoneActivity();
} else if (status == ConfiguringState.Failed) {
Toast.makeText(
RemoteConfigurationAssistantActivity.this,
getString(R.string.remote_provisioning_failure),
Toast.LENGTH_LONG)
.show();
}
}
};
}
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
if (requestCode == QR_CODE_ACTIVITY_RESULT
&& resultCode == Activity.RESULT_OK
&& data != null) {
String url = data.getStringExtra("URL");
mRemoteConfigurationUrl.setText(url);
}
super.onActivityResult(requestCode, resultCode, data);
}
private boolean checkCameraPermissionForQrCode() {
int permissionGranted =
getPackageManager().checkPermission(Manifest.permission.CAMERA, getPackageName());
Log.i(
"[Permission] Manifest.permission.CAMERA is "
+ (permissionGranted == PackageManager.PERMISSION_GRANTED
? "granted"
: "denied"));
if (permissionGranted != PackageManager.PERMISSION_GRANTED) {
Log.i("[Permission] Asking for " + Manifest.permission.CAMERA);
ActivityCompat.requestPermissions(
this, new String[] {Manifest.permission.CAMERA}, CAMERA_PERMISSION_RESULT);
return false;
}
return true;
}
@Override
public void onRequestPermissionsResult(
int requestCode, String[] permissions, final int[] grantResults) {
for (int i = 0; i < permissions.length; i++) {
Log.i(
"[Permission] "
+ permissions[i]
+ " has been "
+ (grantResults[i] == PackageManager.PERMISSION_GRANTED
? "granted"
: "denied"));
}
switch (requestCode) {
case CAMERA_PERMISSION_RESULT:
if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
startActivityForResult(
new Intent(
RemoteConfigurationAssistantActivity.this,
QrCodeConfigurationAssistantActivity.class),
QR_CODE_ACTIVITY_RESULT);
} else {
// TODO: permission denied, display something to the user
}
break;
}
}
}

View file

@ -1,217 +0,0 @@
package org.linphone.assistant;
/*
RemoteProvisioningActivity.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.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.widget.ProgressBar;
import android.widget.Toast;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import org.linphone.LinphoneLauncherActivity;
import org.linphone.LinphoneManager;
import org.linphone.LinphoneService;
import org.linphone.R;
import org.linphone.core.ConfiguringState;
import org.linphone.core.Core;
import org.linphone.core.CoreListenerStub;
import org.linphone.core.tools.Log;
import org.linphone.settings.LinphonePreferences;
import org.linphone.utils.ThemableActivity;
public class RemoteProvisioningActivity extends ThemableActivity {
private final Handler mHandler = new Handler();
private String mConfigUriParam = null;
private ProgressBar mSpinner;
private CoreListenerStub mListener;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.remote_provisioning);
mSpinner = findViewById(R.id.spinner);
mListener =
new CoreListenerStub() {
@Override
public void onConfiguringStatus(
Core lc, final ConfiguringState state, String message) {
if (mSpinner != null) mSpinner.setVisibility(View.GONE);
if (state == ConfiguringState.Successful) {
goToLinphoneActivity();
} else if (state == ConfiguringState.Failed) {
Toast.makeText(
RemoteProvisioningActivity.this,
R.string.remote_provisioning_failure,
Toast.LENGTH_LONG)
.show();
}
}
};
}
@Override
protected void onResume() {
super.onResume();
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (lc != null) {
lc.addListener(mListener);
}
LinphonePreferences.instance().setContext(this);
checkIntentForConfigUri(getIntent());
}
@Override
protected void onPause() {
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (lc != null) {
lc.removeListener(mListener);
}
super.onPause();
}
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
checkIntentForConfigUri(intent);
}
private void checkIntentForConfigUri(final Intent intent) {
new Thread(
new Runnable() {
@Override
public void run() {
Uri openUri = intent.getData();
if (openUri != null) {
// We expect something like
// linphone-config://http://linphone.org/config.xml
mConfigUriParam =
openUri.getEncodedSchemeSpecificPart()
.substring(2); // Removes the linphone-config://
try {
mConfigUriParam =
URLDecoder.decode(mConfigUriParam, "UTF-8");
} catch (UnsupportedEncodingException e) {
Log.e(e);
}
Log.d("Using config uri: " + mConfigUriParam);
}
if (mConfigUriParam == null) {
if (!LinphonePreferences.instance()
.isFirstRemoteProvisioning()) {
mHandler.post(
new Runnable() {
@Override
public void run() {
goToLinphoneActivity();
}
});
} else if (!getResources()
.getBoolean(
R.bool.forbid_app_usage_until_remote_provisioning_completed)) {
// Show this view for a few seconds then go to the dialer
mHandler.postDelayed(
new Runnable() {
@Override
public void run() {
goToLinphoneActivity();
}
},
1500);
} // else we do nothing if there is no config uri parameter and
// if user not allowed to leave this screen
} else {
if (getResources()
.getBoolean(
R.bool.display_confirmation_popup_after_first_configuration)
&& !LinphonePreferences.instance()
.isFirstRemoteProvisioning()) {
mHandler.post(
new Runnable() {
@Override
public void run() {
displayDialogConfirmation();
}
});
} else {
mHandler.post(
new Runnable() {
@Override
public void run() {
setRemoteProvisioningAddressAndRestart(
mConfigUriParam);
}
});
}
}
}
})
.start();
}
private void displayDialogConfirmation() {
new AlertDialog.Builder(RemoteProvisioningActivity.this)
.setTitle(getString(R.string.remote_provisioning_again_title))
.setMessage(getString(R.string.remote_provisioning_again_message))
.setPositiveButton(
R.string.accept,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
setRemoteProvisioningAddressAndRestart(mConfigUriParam);
}
})
.setNegativeButton(
R.string.cancel,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
goToLinphoneActivity();
}
})
.show();
}
private void setRemoteProvisioningAddressAndRestart(final String configUri) {
if (mSpinner != null) mSpinner.setVisibility(View.VISIBLE);
LinphonePreferences.instance().setContext(this); // Needed, else the next call will crash
LinphonePreferences.instance().setRemoteProvisioningUrl(configUri);
LinphoneManager.getLc().getConfig().sync();
LinphoneManager.getInstance().restartCore();
}
private void goToLinphoneActivity() {
if (LinphoneService.isReady()) {
LinphoneService.instance()
.setActivityToLaunchOnIncomingReceived("org.linphone.LinphoneLauncherActivity");
// finish(); // To prevent the user to come back to this page using back button
startActivity(new Intent().setClass(this, LinphoneLauncherActivity.class));
} else {
finish();
}
}
}

View file

@ -1,85 +0,0 @@
package org.linphone.assistant;
/*
RemoteProvisioningFragment.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.app.Fragment;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import org.linphone.LinphoneManager;
import org.linphone.R;
import org.linphone.settings.LinphonePreferences;
public class RemoteProvisioningFragment extends Fragment implements OnClickListener, TextWatcher {
private EditText mRemoteProvisioningUrl;
private Button mApply, mQrcode;
@Override
public View onCreateView(
LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.assistant_remote_provisioning, container, false);
mRemoteProvisioningUrl = view.findViewById(R.id.assistant_remote_provisioning_url);
mRemoteProvisioningUrl.addTextChangedListener(this);
mQrcode = view.findViewById(R.id.assistant_qrcode);
mQrcode.setOnClickListener(this);
mApply = view.findViewById(R.id.assistant_apply);
mApply.setEnabled(false);
mApply.setOnClickListener(this);
if (getArguments() != null && !getArguments().getString("RemoteUrl").isEmpty()) {
mRemoteProvisioningUrl.setText(getArguments().getString("RemoteUrl"));
}
return view;
}
@Override
public void onClick(View v) {
int id = v.getId();
if (id == R.id.assistant_apply) {
String url = mRemoteProvisioningUrl.getText().toString();
AssistantActivity.instance().displayRemoteProvisioningInProgressDialog();
LinphonePreferences.instance().setRemoteProvisioningUrl(url);
LinphoneManager.getLc().getConfig().sync();
LinphoneManager.getInstance().restartCore();
AssistantActivity.instance().setCoreListener();
} else if (id == R.id.assistant_qrcode) {
AssistantActivity.instance().displayQRCodeReader();
}
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
mApply.setEnabled(!mRemoteProvisioningUrl.getText().toString().isEmpty());
}
@Override
public void afterTextChanged(Editable s) {}
}

View file

@ -1,143 +0,0 @@
package org.linphone.assistant;
/*
RemoteProvisioningLoginActivity.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.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import org.linphone.LinphoneManager;
import org.linphone.R;
import org.linphone.core.ConfiguringState;
import org.linphone.core.Core;
import org.linphone.core.CoreListenerStub;
import org.linphone.settings.LinphonePreferences;
import org.linphone.utils.ThemableActivity;
import org.linphone.xmlrpc.XmlRpcHelper;
import org.linphone.xmlrpc.XmlRpcListenerBase;
public class RemoteProvisioningLoginActivity extends ThemableActivity implements OnClickListener {
private EditText mLogin, mPassword, mDomain;
private Button mConnect;
private CoreListenerStub mListener;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.assistant_remote_provisioning_login);
mLogin = findViewById(R.id.assistant_username);
mPassword = findViewById(R.id.assistant_password);
mDomain = findViewById(R.id.assistant_domain);
mConnect = findViewById(R.id.assistant_connect);
mConnect.setOnClickListener(this);
String defaultDomain = getIntent().getStringExtra("Domain");
if (defaultDomain != null) {
mDomain.setText(defaultDomain);
mDomain.setEnabled(false);
}
mListener =
new CoreListenerStub() {
@Override
public void onConfiguringStatus(
Core lc, final ConfiguringState state, String message) {
if (state == ConfiguringState.Successful) {
// TODO
} else if (state == ConfiguringState.Failed) {
Toast.makeText(
RemoteProvisioningLoginActivity.this,
R.string.remote_provisioning_failure,
Toast.LENGTH_LONG)
.show();
}
}
};
}
private void cancelWizard() {
if (getResources().getBoolean(R.bool.allow_cancel_remote_provisioning_login_activity)) {
LinphonePreferences.instance().disableProvisioningLoginView();
setResult(Activity.RESULT_CANCELED);
finish();
}
}
private void storeAccount(String username, String password, String domain) {
XmlRpcHelper xmlRpcHelper = new XmlRpcHelper();
xmlRpcHelper.getRemoteProvisioningFilenameAsync(
new XmlRpcListenerBase() {
@Override
public void onRemoteProvisioningFilenameSent(String result) {
LinphonePreferences.instance().setRemoteProvisioningUrl(result);
LinphoneManager.getInstance().restartCore();
}
},
username,
password,
domain);
LinphonePreferences.instance().firstLaunchSuccessful();
setResult(Activity.RESULT_OK);
finish();
}
@Override
protected void onResume() {
super.onResume();
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (lc != null) {
lc.addListener(mListener);
}
}
@Override
protected void onPause() {
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (lc != null) {
lc.removeListener(mListener);
}
super.onPause();
}
@Override
public void onClick(View v) {
int id = v.getId();
if (id == R.id.cancel) {
cancelWizard();
}
if (id == R.id.assistant_connect) {
storeAccount(
mLogin.getText().toString(),
mPassword.getText().toString(),
mDomain.getText().toString());
}
}
@Override
public void onBackPressed() {
cancelWizard();
}
}

View file

@ -1,78 +0,0 @@
package org.linphone.assistant;
/*
WelcomeFragment.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.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.TextView;
import org.linphone.R;
public class WelcomeFragment extends Fragment implements OnClickListener {
private TextView mCreateAccount, mLogLinphoneAccount, mLogGenericAccount, mRemoteProvisioning;
@Override
public View onCreateView(
LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.assistant_welcome, container, false);
mCreateAccount = view.findViewById(R.id.create_account);
mCreateAccount.setOnClickListener(this);
mLogLinphoneAccount = view.findViewById(R.id.login_linphone);
if (getResources().getBoolean(R.bool.hide_linphone_accounts_in_assistant)) {
mLogLinphoneAccount.setVisibility(View.GONE);
} else {
mLogLinphoneAccount.setOnClickListener(this);
}
mLogGenericAccount = view.findViewById(R.id.login_generic);
if (getResources().getBoolean(R.bool.hide_generic_accounts_in_assistant)) {
mLogGenericAccount.setVisibility(View.GONE);
} else {
mLogGenericAccount.setOnClickListener(this);
}
mRemoteProvisioning = view.findViewById(R.id.remote_provisioning);
if (getResources().getBoolean(R.bool.hide_remote_provisioning_in_assistant)) {
mRemoteProvisioning.setVisibility(View.GONE);
} else {
mRemoteProvisioning.setOnClickListener(this);
}
return view;
}
@Override
public void onClick(View v) {
int id = v.getId();
if (id == R.id.login_generic) {
AssistantActivity.instance().displayLoginGeneric();
} else if (id == R.id.login_linphone) {
AssistantActivity.instance().displayLoginLinphone(null, null);
} else if (id == R.id.create_account) {
AssistantActivity.instance().displayCreateAccount();
} else if (id == R.id.remote_provisioning) {
AssistantActivity.instance().displayRemoteProvisioning("");
}
}
}

View file

@ -27,7 +27,6 @@ import android.content.BroadcastReceiver;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.IntentFilter; import android.content.IntentFilter;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
@ -171,10 +170,6 @@ public class CallActivity extends LinphoneGenericActivity
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
sInstance = this; sInstance = this;
if (getResources().getBoolean(R.bool.orientation_portrait_only)) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
Compatibility.setShowWhenLocked(this, true); Compatibility.setShowWhenLocked(this, true);

View file

@ -23,7 +23,6 @@ import android.Manifest;
import android.app.KeyguardManager; import android.app.KeyguardManager;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.os.Bundle; import android.os.Bundle;
import android.view.KeyEvent; import android.view.KeyEvent;
@ -79,10 +78,6 @@ public class CallIncomingActivity extends LinphoneGenericActivity {
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
if (getResources().getBoolean(R.bool.orientation_portrait_only)) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
Compatibility.setShowWhenLocked(this, true); Compatibility.setShowWhenLocked(this, true);
Compatibility.setTurnScreenOn(this, true); Compatibility.setTurnScreenOn(this, true);

View file

@ -20,7 +20,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
import android.Manifest; import android.Manifest;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.os.Bundle; import android.os.Bundle;
import android.view.Gravity; import android.view.Gravity;
@ -63,10 +62,6 @@ public class CallOutgoingActivity extends LinphoneGenericActivity implements OnC
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
if (getResources().getBoolean(R.bool.orientation_portrait_only)) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
setContentView(R.layout.call_outgoing); setContentView(R.layout.call_outgoing);

View file

@ -516,9 +516,6 @@ public class ChatRoomCreationFragment extends Fragment
mShareInfos, mShareInfos,
mSecurityToggle.isChecked()); mSecurityToggle.isChecked());
} }
} else if (id == R.id.clearSearchField) {
mSearchField.setQuery("", false);
mSearchAdapter.searchContacts("");
} else if (id == R.id.contactChatDelete) { } else if (id == R.id.contactChatDelete) {
ContactAddress ca = (ContactAddress) view.getTag(); ContactAddress ca = (ContactAddress) view.getTag();
addOrRemoveContactFromSelection(ca); addOrRemoveContactFromSelection(ca);

View file

@ -40,7 +40,6 @@ import org.linphone.LinphoneActivity;
import org.linphone.LinphoneManager; import org.linphone.LinphoneManager;
import org.linphone.LinphoneService; import org.linphone.LinphoneService;
import org.linphone.R; import org.linphone.R;
import org.linphone.assistant.AssistantActivity;
import org.linphone.call.CallActivity; import org.linphone.call.CallActivity;
import org.linphone.call.CallIncomingActivity; import org.linphone.call.CallIncomingActivity;
import org.linphone.call.CallOutgoingActivity; import org.linphone.call.CallOutgoingActivity;
@ -165,8 +164,6 @@ public class StatusFragment extends Fragment {
((LinphoneActivity) activity).updateStatusFragment(this); ((LinphoneActivity) activity).updateStatusFragment(this);
} else if (activity instanceof CallActivity) { } else if (activity instanceof CallActivity) {
((CallActivity) activity).updateStatusFragment(this); ((CallActivity) activity).updateStatusFragment(this);
} else if (activity instanceof AssistantActivity) {
((AssistantActivity) activity).updateStatusFragment(this);
} }
mIsInCall = mIsInCall =
activity instanceof CallActivity activity instanceof CallActivity
@ -176,18 +173,6 @@ public class StatusFragment extends Fragment {
return view; return view;
} }
public void setCoreListener() {
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (lc != null) {
lc.addListener(mListener);
ProxyConfig lpc = lc.getDefaultProxyConfig();
if (lpc != null) {
mListener.onRegistrationStateChanged(lc, lpc, lpc.getState(), null);
}
}
}
@Override @Override
public void onDetach() { public void onDetach() {
super.onDetach(); super.onDetach();

View file

@ -32,7 +32,7 @@ import java.util.List;
import org.linphone.LinphoneActivity; import org.linphone.LinphoneActivity;
import org.linphone.LinphoneManager; import org.linphone.LinphoneManager;
import org.linphone.R; import org.linphone.R;
import org.linphone.assistant.AssistantActivity; import org.linphone.assistant.PhoneAccountLinkingAssistantActivity;
import org.linphone.core.AVPFMode; import org.linphone.core.AVPFMode;
import org.linphone.core.Address; import org.linphone.core.Address;
import org.linphone.core.AuthInfo; import org.linphone.core.AuthInfo;
@ -558,9 +558,9 @@ public class AccountSettingsFragment extends Fragment {
@Override @Override
public void onClicked() { public void onClicked() {
Intent assistant = new Intent(); Intent assistant = new Intent();
assistant.setClass(LinphoneActivity.instance(), AssistantActivity.class); assistant.setClass(
assistant.putExtra("LinkPhoneNumber", true); LinphoneActivity.instance(),
assistant.putExtra("FromPref", true); PhoneAccountLinkingAssistantActivity.class);
assistant.putExtra("AccountNumber", mAccountIndex); assistant.putExtra("AccountNumber", mAccountIndex);
startActivity(assistant); startActivity(assistant);
} }

View file

@ -164,13 +164,6 @@ public class LinphonePreferences {
return (proxyConf != null) ? proxyConf.getDomain() : ""; return (proxyConf != null) ? proxyConf.getDomain() : "";
} }
public void setPrefix(int n, String prefix) {
ProxyConfig prxCfg = getProxyConfig(n);
prxCfg.edit();
prxCfg.setDialPrefix(prefix);
prxCfg.done();
}
public boolean isFriendlistsubscriptionEnabled() { public boolean isFriendlistsubscriptionEnabled() {
if (getConfig().getBool("app", "friendlist_subscription_enabled", false)) { if (getConfig().getBool("app", "friendlist_subscription_enabled", false)) {
// Old setting, do migration // Old setting, do migration
@ -235,21 +228,6 @@ public class LinphonePreferences {
public boolean isAccountEnabled(int n) { public boolean isAccountEnabled(int n) {
return getProxyConfig(n).registerEnabled(); return getProxyConfig(n).registerEnabled();
} }
public void resetDefaultProxyConfig() {
if (getLc() == null) return;
int count = getLc().getProxyConfigList().length;
for (int i = 0; i < count; i++) {
if (isAccountEnabled(i)) {
getLc().setDefaultProxyConfig(getProxyConfig(i));
break;
}
}
if (getLc().getDefaultProxyConfig() == null) {
getLc().setDefaultProxyConfig(getProxyConfig(0));
}
}
// End of accounts settings // End of accounts settings
// Audio settings // Audio settings
@ -820,20 +798,8 @@ public class LinphonePreferences {
LinphoneManager.getInstance().initTunnelFromConf(); LinphoneManager.getInstance().initTunnelFromConf();
} }
public boolean isProvisioningLoginViewEnabled() {
return (getConfig() != null) && getConfig().getBool("app", "show_login_view", false);
}
// End of tunnel settings // End of tunnel settings
public void disableProvisioningLoginView() {
if (isProvisioningLoginViewEnabled()) { // Only do it if it was previously enabled
getConfig().setBool("app", "show_login_view", false);
} else {
Log.w("Remote provisioning login view wasn't enabled, ignoring");
}
}
public boolean isFirstRemoteProvisioning() { public boolean isFirstRemoteProvisioning() {
return getConfig().getBool("app", "first_remote_provisioning", true); return getConfig().getBool("app", "first_remote_provisioning", true);
} }
@ -1021,10 +987,6 @@ public class LinphonePreferences {
getConfig().setInt("app", "auto_answer_delay", time); getConfig().setInt("app", "auto_answer_delay", time);
} }
public int getCodeLength() {
return getConfig().getInt("app", "activation_code_length", 0);
}
public void disableFriendsStorage() { public void disableFriendsStorage() {
getConfig().setBool("misc", "store_friends", false); getConfig().setBool("misc", "store_friends", false);
} }
@ -1076,4 +1038,20 @@ public class LinphonePreferences {
public void setDeviceName(String name) { public void setDeviceName(String name) {
getConfig().setString("app", "device_name", name); getConfig().setString("app", "device_name", name);
} }
public boolean isEchoCancellationCalibrationDone() {
return getConfig().getBool("app", "echo_cancellation_calibration_done", false);
}
public void setEchoCancellationCalibrationDone(boolean done) {
getConfig().setBool("app", "echo_cancellation_calibration_done", done);
}
public boolean isOpenH264CodecDownloadEnabled() {
return getConfig().getBool("app", "open_h264_download_enabled", true);
}
public void setOpenH264CodecDownloadEnabled(boolean enable) {
getConfig().setBool("app", "open_h264_download_enabled", enable);
}
} }

View file

@ -153,6 +153,11 @@ public class SettingsFragment extends Fragment {
mTunnel.setVisibility(core.tunnelAvailable() ? View.VISIBLE : View.GONE); mTunnel.setVisibility(core.tunnelAvailable() ? View.VISIBLE : View.GONE);
initAccounts(core); initAccounts(core);
} }
if (getResources().getBoolean(R.bool.hide_accounts)) {
mAccounts.setVisibility(View.GONE);
mAccountsHeader.setVisibility(View.GONE);
}
} }
private void initAccounts(Core core) { private void initAccounts(Core core) {

View file

@ -38,11 +38,6 @@ import android.view.View;
import android.view.Window; import android.view.Window;
import android.view.WindowManager; import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager; import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.core.content.ContextCompat;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
@ -53,7 +48,6 @@ import java.util.regex.Pattern;
import org.linphone.LinphoneManager; import org.linphone.LinphoneManager;
import org.linphone.LinphoneService; import org.linphone.LinphoneService;
import org.linphone.R; import org.linphone.R;
import org.linphone.core.AccountCreator;
import org.linphone.core.Address; import org.linphone.core.Address;
import org.linphone.core.Call; import org.linphone.core.Call;
import org.linphone.core.Call.State; import org.linphone.core.Call.State;
@ -325,112 +319,6 @@ public final class LinphoneUtils {
return sipAddress; return sipAddress;
} }
public static void displayError(boolean isOk, TextView error, String errorText) {
if (isOk) {
error.setVisibility(View.INVISIBLE);
error.setText("");
} else {
error.setVisibility(View.VISIBLE);
error.setText(errorText);
}
}
public static String errorForPhoneNumberStatus(int status) {
Context ctxt = getContext();
if (ctxt != null) {
if (AccountCreator.PhoneNumberStatus.InvalidCountryCode.toInt()
== (status & AccountCreator.PhoneNumberStatus.InvalidCountryCode.toInt()))
return ctxt.getString(R.string.country_code_invalid);
if (AccountCreator.PhoneNumberStatus.TooShort.toInt()
== (status & AccountCreator.PhoneNumberStatus.TooShort.toInt()))
return ctxt.getString(R.string.phone_number_too_short);
if (AccountCreator.PhoneNumberStatus.TooLong.toInt()
== (status & AccountCreator.PhoneNumberStatus.TooLong.toInt()))
return ctxt.getString(R.string.phone_number_too_long);
if (AccountCreator.PhoneNumberStatus.Invalid.toInt()
== (status & AccountCreator.PhoneNumberStatus.Invalid.toInt()))
return ctxt.getString(R.string.phone_number_invalid);
}
return null;
}
public static String errorForEmailStatus(AccountCreator.EmailStatus status) {
Context ctxt = getContext();
if (ctxt != null) {
if (status.equals(AccountCreator.EmailStatus.InvalidCharacters)
|| status.equals(AccountCreator.EmailStatus.Malformed))
return ctxt.getString(R.string.invalid_email);
}
return null;
}
public static String errorForUsernameStatus(AccountCreator.UsernameStatus status) {
Context ctxt = getContext();
if (ctxt != null) {
if (status.equals(AccountCreator.UsernameStatus.InvalidCharacters))
return ctxt.getString(R.string.invalid_username);
if (status.equals(AccountCreator.UsernameStatus.TooShort))
return ctxt.getString(R.string.username_too_short);
if (status.equals(AccountCreator.UsernameStatus.TooLong))
return ctxt.getString(R.string.username_too_long);
if (status.equals(AccountCreator.UsernameStatus.Invalid))
return ctxt.getString(R.string.username_invalid_size);
if (status.equals(AccountCreator.UsernameStatus.InvalidCharacters))
return ctxt.getString(R.string.invalid_display_name);
}
return null;
}
public static String errorForPasswordStatus(AccountCreator.PasswordStatus status) {
Context ctxt = getContext();
if (ctxt != null) {
if (status.equals(AccountCreator.PasswordStatus.TooShort))
return ctxt.getString(R.string.password_too_short);
if (status.equals(AccountCreator.PasswordStatus.TooLong))
return ctxt.getString(R.string.password_too_long);
}
return null;
}
public static String errorForStatus(AccountCreator.Status status) {
Context ctxt = getContext();
Log.e("Status error " + status.name());
if (ctxt != null) {
if (status.equals(AccountCreator.Status.RequestFailed))
return ctxt.getString(R.string.request_failed);
if (status.equals(AccountCreator.Status.ServerError))
return ctxt.getString(R.string.wizard_failed);
if (status.equals(AccountCreator.Status.AccountExist)
|| status.equals(AccountCreator.Status.AccountExistWithAlias))
return ctxt.getString(R.string.account_already_exist);
if (status.equals(AccountCreator.Status.AliasIsAccount)
|| status.equals(AccountCreator.Status.AliasExist))
return ctxt.getString(R.string.assistant_phone_number_unavailable);
if (status.equals(AccountCreator.Status.AccountNotExist))
return ctxt.getString(R.string.assistant_error_bad_credentials);
if (status.equals(AccountCreator.Status.AliasNotExist))
return ctxt.getString(R.string.phone_number_not_exist);
if (status.equals(AccountCreator.Status.AliasNotExist)
|| status.equals(AccountCreator.Status.AccountNotActivated)
|| status.equals(AccountCreator.Status.AccountAlreadyActivated)
|| status.equals(AccountCreator.Status.AccountActivated)
|| status.equals(AccountCreator.Status.AccountNotCreated)
|| status.equals(AccountCreator.Status.RequestOk)) return "";
}
return null;
}
public static String getCountryCode(EditText dialCode) {
if (dialCode != null) {
String code = dialCode.getText().toString();
if (code != null && code.startsWith("+")) {
code = code.substring(1);
}
return code;
}
return null;
}
public static void displayErrorAlert(String msg, Context ctxt) { public static void displayErrorAlert(String msg, Context ctxt) {
if (ctxt != null && msg != null) { if (ctxt != null && msg != null) {
AlertDialog.Builder builder = new AlertDialog.Builder(ctxt); AlertDialog.Builder builder = new AlertDialog.Builder(ctxt);
@ -493,12 +381,6 @@ public final class LinphoneUtils {
imm.hideSoftInputFromWindow(view.getWindowToken(), 0); imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
} }
private static Context getContext() {
if (sContext == null && LinphoneManager.isInstanciated())
sContext = LinphoneManager.getInstance().getContext();
return sContext;
}
public static ArrayList<ChatRoom> removeEmptyOneToOneChatRooms(ChatRoom[] rooms) { public static ArrayList<ChatRoom> removeEmptyOneToOneChatRooms(ChatRoom[] rooms) {
ArrayList<ChatRoom> newRooms = new ArrayList<>(); ArrayList<ChatRoom> newRooms = new ArrayList<>();
for (ChatRoom room : rooms) { for (ChatRoom room : rooms) {

View file

@ -19,6 +19,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
import android.content.pm.ActivityInfo;
import android.os.Bundle; import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import org.linphone.R; import org.linphone.R;
@ -32,6 +33,10 @@ public class ThemableActivity extends AppCompatActivity {
setTheme(R.style.LinphoneStyleDark); setTheme(R.style.LinphoneStyleDark);
} }
if (getResources().getBoolean(R.bool.orientation_portrait_only)) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
} }
} }

View file

@ -1,103 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="30dp"
android:background="?attr/backgroundColor">
<TextView
android:id="@+id/question"
style="@style/assistant_codec_downloader_font"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:gravity="center"
android:text="@string/assistant_codec_down_question"
android:textAllCaps="true" />
<ProgressBar
android:id="@+id/progressBar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/answerNo"
android:layout_alignEnd="@+id/downloadingInfo"
android:layout_alignRight="@+id/downloadingInfo"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true" />
<TextView
android:id="@+id/downloading"
style="@style/assistant_codec_downloader_font"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:gravity="center"
android:text="@string/assistant_codec_downloading"
android:textAllCaps="true" />
<Button
android:id="@+id/answerNo"
style="@style/assistant_codec_downloader_font"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginEnd="26dp"
android:layout_marginRight="26dp"
android:layout_marginBottom="35dp"
android:gravity="center"
android:text="@string/no"
android:textAllCaps="true" />
<Button
android:id="@+id/answerYes"
style="@style/assistant_codec_downloader_font"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/progressBar"
android:layout_alignEnd="@+id/progressBar"
android:layout_alignRight="@+id/progressBar"
android:gravity="center"
android:text="@string/yes"
android:textAllCaps="true" />
<Button
android:id="@+id/answerOk"
style="@style/assistant_codec_downloader_font"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/answerYes"
android:layout_centerHorizontal="true"
android:gravity="center"
android:text="@string/ok"
android:textAllCaps="true" />
<TextView
android:id="@+id/downloaded"
style="@style/assistant_codec_downloader_font"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:gravity="center"
android:text="@string/assistant_codec_downloaded"
android:textAllCaps="true" />
<TextView
android:id="@+id/downloadingInfo"
style="@style/assistant_codec_downloader_font"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/progressBar"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:gravity="center"
android:textAllCaps="true" />
</RelativeLayout>

View file

@ -0,0 +1,211 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/backgroundColor"
android:orientation="vertical">
<fragment
android:id="@+id/status"
android:name="org.linphone.fragments.StatusFragment"
android:layout_width="match_parent"
android:layout_height="40dp"
tools:layout="@layout/status" />
<include
android:id="@+id/top_bar"
layout="@layout/assistant_topbar" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
style="@style/standard_text_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/assistant_create_account"
android:paddingTop="10dp"
android:textAllCaps="true" />
<TextView
style="@style/standard_small_text_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_gravity="top"
android:paddingTop="10dp"
android:text="@string/assistant_create_account_part_email" />
<GridLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:columnCount="2">
<LinearLayout
android:layout_width="wrap_content"
android:layout_gravity="fill"
android:layout_columnWeight="1"
android:layout_height="wrap_content"
android:padding="10dp"
android:orientation="vertical">
<TextView
style="@style/assistant_input_field_header_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/username"
android:textAllCaps="true" />
<EditText
android:id="@+id/assistant_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/resizable_textfield"
android:contentDescription="@string/content_description_username_field"
android:inputType="text|textNoSuggestions"
android:maxLines="1"
android:hint="@string/username"
android:textColor="@color/black_color" />
<TextView
android:id="@+id/username_error"
android:text="@string/error"
style="@style/assistant_input_field_error_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="invisible"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_gravity="fill"
android:layout_columnWeight="1"
android:layout_height="wrap_content"
android:padding="10dp"
android:orientation="vertical">
<TextView
style="@style/assistant_input_field_header_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/email"
android:textAllCaps="true" />
<EditText
android:id="@+id/assistant_email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/resizable_textfield"
android:inputType="text|textEmailAddress"
android:maxLines="1"
android:hint="@string/email"
android:textColor="@color/black_color" />
<TextView
android:id="@+id/email_error"
android:text="@string/invalid_email"
style="@style/assistant_input_field_error_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="invisible"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_gravity="fill"
android:layout_columnWeight="1"
android:layout_height="wrap_content"
android:padding="10dp"
android:orientation="vertical">
<TextView
style="@style/assistant_input_field_header_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/password"
android:textAllCaps="true" />
<EditText
android:id="@+id/assistant_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/resizable_textfield"
android:inputType="textPassword"
android:maxLines="1"
android:hint="@string/password"
android:textColor="@color/black_color" />
<TextView
android:id="@+id/password_error"
android:text="@string/error"
style="@style/assistant_input_field_error_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="invisible"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_gravity="fill"
android:layout_columnWeight="1"
android:layout_height="wrap_content"
android:padding="10dp"
android:orientation="vertical">
<TextView
style="@style/assistant_input_field_header_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/confirm_password"
android:textAllCaps="true" />
<EditText
android:id="@+id/assistant_password_confirmation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/resizable_textfield"
android:inputType="textPassword"
android:maxLines="1"
android:hint="@string/confirm_password"
android:textColor="@color/black_color" />
<TextView
android:id="@+id/confirm_password_error"
android:text="@string/wizard_passwords_unmatched"
style="@style/assistant_input_field_error_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="invisible"/>
</LinearLayout>
</GridLayout>
<TextView
android:id="@+id/assistant_create"
android:text="@string/assistant_create_account"
android:background="@drawable/assistant_button"
android:textColor="@drawable/assistant_button_text_color"
android:layout_gravity="center"
style="@style/button_font"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:padding="10dp"/>
</LinearLayout>
</ScrollView>
</LinearLayout>

View file

@ -1,45 +1,61 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="fill_parent"> android:layout_height="match_parent"
android:background="?attr/backgroundColor"
android:orientation="vertical">
<LinearLayout <fragment
android:id="@+id/status"
android:name="org.linphone.fragments.StatusFragment"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="40dp"
android:orientation="vertical" tools:layout="@layout/status" />
android:padding="30dp">
<TextView <include
style="@style/standard_text_font" android:id="@+id/top_bar"
android:layout_width="wrap_content" layout="@layout/assistant_topbar" />
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="@string/assistant_generic_account"
android:textAllCaps="true" />
<TextView <ScrollView
style="@style/standard_small_text_font" android:layout_width="match_parent"
android:layout_width="wrap_content" android:layout_height="match_parent">
android:layout_height="wrap_content"
android:layout_gravity="center"
android:paddingTop="10dp"
android:text="@string/assistant_login_desc" />
<TableLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:layout_marginTop="30dp" android:orientation="vertical">
android:orientation="horizontal">
<TableRow <TextView
android:layout_margin="10dp" style="@style/standard_text_font"
android:layout_weight="1" android:layout_width="match_parent"
android:gravity="center"> android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:text="@string/assistant_generic_account"
android:paddingTop="10dp"
android:textAllCaps="true" />
<TextView
style="@style/standard_small_text_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_gravity="top"
android:paddingTop="10dp"
android:text="@string/assistant_login_desc" />
<GridLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:columnCount="2">
<LinearLayout <LinearLayout
android:layout_width="0dp" android:layout_width="wrap_content"
android:layout_gravity="fill"
android:layout_columnWeight="1"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:padding="10dp"
android:orientation="vertical"> android:orientation="vertical">
<TextView <TextView
@ -52,21 +68,23 @@
<EditText <EditText
android:id="@+id/assistant_username" android:id="@+id/assistant_username"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="40dp" android:layout_height="wrap_content"
android:background="@drawable/resizable_textfield" android:background="@drawable/resizable_textfield"
android:contentDescription="@string/content_description_username_field" android:contentDescription="@string/content_description_username_field"
android:inputType="text|textNoSuggestions" android:inputType="text|textNoSuggestions"
android:maxLines="1" android:maxLines="1"
android:hint="@string/username" android:hint="@string/username"
android:textColor="@color/black_color" /> android:textColor="@color/black_color" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:layout_width="0dp" android:layout_width="wrap_content"
android:layout_gravity="fill"
android:layout_columnWeight="1"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:padding="10dp"
android:orientation="vertical" android:orientation="vertical">
android:paddingLeft="30dp">
<TextView <TextView
style="@style/assistant_input_field_header_font" style="@style/assistant_input_field_header_font"
@ -78,25 +96,49 @@
<EditText <EditText
android:id="@+id/assistant_password" android:id="@+id/assistant_password"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="40dp" android:layout_height="wrap_content"
android:background="@drawable/resizable_textfield" android:background="@drawable/resizable_textfield"
android:inputType="textPassword" android:inputType="textPassword"
android:maxLines="1" android:maxLines="1"
android:hint="@string/password" android:hint="@string/password"
android:textColor="@color/black_color" /> android:textColor="@color/black_color" />
</LinearLayout> </LinearLayout>
</TableRow> <LinearLayout
android:layout_width="wrap_content"
android:layout_gravity="fill"
android:layout_columnWeight="1"
android:layout_height="wrap_content"
android:padding="10dp"
android:orientation="vertical">
<TableRow <TextView
android:layout_margin="10dp" style="@style/assistant_input_field_header_font"
android:layout_weight="1" android:layout_width="match_parent"
android:gravity="center"> android:layout_height="wrap_content"
android:text="@string/domain"
android:textAllCaps="true" />
<EditText
android:id="@+id/assistant_domain"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/resizable_textfield"
android:contentDescription="@string/content_description_domain_field"
android:inputType="textUri"
android:maxLines="1"
android:hint="@string/domain"
android:textColor="@color/black_color" />
</LinearLayout>
<LinearLayout <LinearLayout
android:layout_width="0dp" android:layout_width="wrap_content"
android:layout_gravity="fill"
android:layout_columnWeight="1"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:padding="10dp"
android:orientation="vertical"> android:orientation="vertical">
<TextView <TextView
@ -109,86 +151,28 @@
<EditText <EditText
android:id="@+id/assistant_display_name" android:id="@+id/assistant_display_name"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="40dp" android:layout_height="wrap_content"
android:background="@drawable/resizable_textfield" android:background="@drawable/resizable_textfield"
android:contentDescription="@string/content_description_display_field" android:contentDescription="@string/content_description_display_field"
android:inputType="textPersonName" android:inputType="textPersonName"
android:maxLines="1" android:maxLines="1"
android:hint="@string/assistant_display_name_optional" android:hint="@string/assistant_display_name_optional"
android:textColor="@color/black_color" /> android:textColor="@color/black_color" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
android:paddingLeft="30dp">
<TextView
style="@style/assistant_input_field_header_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/domain"
android:textAllCaps="true" />
<EditText
android:id="@+id/assistant_domain"
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="@drawable/resizable_textfield"
android:contentDescription="@string/content_description_domain_field"
android:inputType="textUri"
android:maxLines="1"
android:hint="@string/domain"
android:textColor="@color/black_color" />
</LinearLayout> </LinearLayout>
</TableRow>
<TableRow
android:layout_margin="10dp"
android:layout_weight="1"
android:gravity="center">
<LinearLayout <LinearLayout
android:layout_width="0dp" android:layout_width="wrap_content"
android:layout_gravity="fill"
android:layout_columnWeight="1"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:padding="10dp"
android:orientation="vertical"> android:orientation="vertical">
<TextView <TextView
style="@style/assistant_input_field_header_font" style="@style/assistant_input_field_header_font"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/userid"
android:textAllCaps="true" />
<EditText
android:id="@+id/assistant_userid"
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="@drawable/resizable_textfield"
android:contentDescription="@string/content_description_username_field"
android:inputType="text|textNoSuggestions"
android:maxLines="1"
android:hint="@string/userid"
android:textColor="@color/black_color" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<TextView
style="@style/assistant_input_field_header_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/transport" android:text="@string/transport"
android:textAllCaps="true" /> android:textAllCaps="true" />
@ -223,27 +207,27 @@
android:textColor="?attr/primaryTextColor" android:textColor="?attr/primaryTextColor"
android:checked="true" android:checked="true"
android:text="@string/pref_transport_tls" /> android:text="@string/pref_transport_tls" />
</RadioGroup> </RadioGroup>
</LinearLayout> </LinearLayout>
</TableRow> <TextView
android:id="@+id/assistant_login"
android:text="@string/assistant_login"
android:background="@drawable/assistant_button"
android:textColor="@drawable/assistant_button_text_color"
style="@style/button_font"
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:padding="10dp"/>
</TableLayout> </GridLayout>
<Button </LinearLayout>
android:id="@+id/assistant_apply"
style="@style/button_font"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_gravity="center"
android:layout_marginTop="20dp"
android:background="@drawable/assistant_button"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:text="@string/assistant_login"
android:textColor="@drawable/assistant_button_text_color" />
</LinearLayout> </ScrollView>
</ScrollView> </LinearLayout>

View file

@ -0,0 +1,118 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/backgroundColor"
android:orientation="vertical">
<fragment
android:id="@+id/status"
android:name="org.linphone.fragments.StatusFragment"
android:layout_width="match_parent"
android:layout_height="40dp"
tools:layout="@layout/status" />
<include
android:id="@+id/top_bar"
layout="@layout/assistant_topbar" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
style="@style/standard_text_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/welcome"
android:paddingTop="10dp"
android:textAllCaps="true" />
<TextView
style="@style/standard_small_text_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_gravity="top"
android:paddingTop="10dp"
android:text="@string/assistant_welcome_desc" />
<GridLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:columnCount="2">
<TextView
android:id="@+id/account_creation"
style="@style/button_font"
android:gravity="center"
android:padding="10dp"
android:layout_margin="20dp"
android:layout_width="wrap_content"
android:layout_gravity="fill"
android:layout_columnWeight="1"
android:layout_height="wrap_content"
android:background="@drawable/assistant_button"
android:textColor="@drawable/assistant_button_text_color"
android:contentDescription="@string/assistant_create_account"
android:text="@string/assistant_create_account" />
<TextView
android:id="@+id/account_connection"
style="@style/button_font"
android:gravity="center"
android:padding="10dp"
android:layout_margin="20dp"
android:layout_width="wrap_content"
android:layout_gravity="fill"
android:layout_columnWeight="1"
android:layout_height="wrap_content"
android:background="@drawable/assistant_button"
android:textColor="@drawable/assistant_button_text_color"
android:contentDescription="@string/assistant_login_linphone"
android:text="@string/assistant_login_linphone" />
<TextView
android:id="@+id/generic_connection"
style="@style/button_font"
android:gravity="center"
android:padding="10dp"
android:layout_margin="20dp"
android:layout_width="wrap_content"
android:layout_gravity="fill"
android:layout_columnWeight="1"
android:layout_height="wrap_content"
android:background="@drawable/assistant_button"
android:textColor="@drawable/assistant_button_text_color"
android:contentDescription="@string/assistant_login_generic"
android:text="@string/assistant_login_generic" />
<TextView
android:id="@+id/remote_configuration"
style="@style/button_font"
android:gravity="center"
android:padding="10dp"
android:layout_margin="20dp"
android:layout_width="wrap_content"
android:layout_gravity="fill"
android:layout_columnWeight="1"
android:layout_height="wrap_content"
android:background="@drawable/assistant_button"
android:textColor="@drawable/assistant_button_text_color"
android:contentDescription="@string/assistant_remote_provisioning"
android:text="@string/assistant_remote_provisioning" />
</GridLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>

View file

@ -1,399 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/backgroundColor">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="30dp">
<TextView
android:id="@+id/assistant_title"
style="@style/standard_text_font"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/assistant_create_account"
android:textAllCaps="true" />
<TextView
android:id="@+id/message_create_account"
style="@style/standard_small_text_font"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:paddingTop="10dp"
android:text="@string/assistant_create_account_part_1" />
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:orientation="vertical">
<TableRow
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_weight="1"
android:gravity="center">
<LinearLayout
android:id="@+id/phone_number_layout"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
android:visibility="gone">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/phone_number_label"
style="@style/assistant_input_field_header_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/phone_number"
android:textAllCaps="true" />
<ImageView
android:id="@+id/info_phone_number"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_alignParentRight="true"
android:src="@drawable/info" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="5dp"
android:layout_weight="1"
android:orientation="horizontal"
android:visibility="visible">
<Button
android:id="@+id/select_country"
style="@style/button_font"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_weight="1"
android:background="@drawable/resizable_assistant_button"
android:textColor="@drawable/assistant_button_text_color"
android:text="@string/select_your_country" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp"
android:layout_weight="1"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<EditText
android:id="@+id/dial_code"
android:layout_width="65dp"
android:layout_height="40dp"
android:layout_marginRight="10dp"
android:background="@drawable/resizable_textfield"
android:gravity="center"
android:inputType="phone"
android:maxLines="1"
android:text="+"
android:hint="@string/international_prefix"
android:textColor="@color/black_color" />
<EditText
android:id="@+id/phone_number"
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="@drawable/resizable_textfield"
android:contentDescription="@string/content_description_phone_number_field"
android:inputType="phone"
android:maxLines="1"
android:hint="@string/phone_number"
android:textColor="@color/black_color" />
</LinearLayout>
<TextView
android:id="@+id/phone_number_error"
style="@style/assistant_input_field_error_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/error"
android:visibility="invisible" />
<TextView
android:id="@+id/sip_uri"
style="@style/contact_organization_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="visible" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</TableRow>
<TableRow
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_weight="1"
android:gravity="center">
<LinearLayout
android:id="@+id/username_layout"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_column="0"
android:layout_weight="1"
android:orientation="vertical"
android:visibility="visible">
<TextView
android:id="@+id/username_label"
style="@style/assistant_input_field_header_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/username"
android:textAllCaps="true" />
<EditText
android:id="@+id/username"
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="@drawable/resizable_textfield"
android:contentDescription="@string/content_description_username_field"
android:inputType="text|textNoSuggestions"
android:maxLines="1"
android:hint="@string/username"
android:textColor="@color/black_color" />
<TextView
android:id="@+id/username_error"
style="@style/assistant_input_field_error_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/error"
android:visibility="invisible" />
</LinearLayout>
<LinearLayout
android:id="@+id/password_layout"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_column="1"
android:layout_weight="1"
android:orientation="vertical"
android:paddingLeft="30dp"
android:visibility="visible">
<TextView
android:id="@+id/password_label"
style="@style/assistant_input_field_header_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/password"
android:textAllCaps="true" />
<EditText
android:id="@+id/password"
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="@drawable/resizable_textfield"
android:inputType="textPassword"
android:maxLines="1"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:textColor="@color/black_color"
android:hint="@string/password"
android:textCursorDrawable="@null" />
<TextView
android:id="@+id/password_error"
style="@style/assistant_input_field_error_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/error"
android:visibility="invisible" />
</LinearLayout>
</TableRow>
<TableRow
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_weight="1"
android:gravity="center">
<LinearLayout
android:id="@+id/email_layout"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_column="0"
android:layout_weight="1"
android:orientation="vertical"
android:visibility="visible">
<TextView
android:id="@+id/email_label"
style="@style/assistant_input_field_header_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/email"
android:textAllCaps="true" />
<EditText
android:id="@+id/email"
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="@drawable/resizable_textfield"
android:contentDescription="@string/content_description_email_field"
android:inputType="text|textEmailAddress"
android:maxLines="1"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:textColor="@color/black_color"
android:hint="@string/email"
android:textCursorDrawable="@null" />
<TextView
android:id="@+id/email_error"
style="@style/assistant_input_field_error_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/error"
android:visibility="invisible" />
</LinearLayout>
<LinearLayout
android:id="@+id/password_confirm_layout"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_column="1"
android:layout_weight="1"
android:orientation="vertical"
android:paddingLeft="30dp"
android:visibility="visible">
<TextView
android:id="@+id/confirm_password_label"
style="@style/assistant_input_field_header_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/confirm_password"
android:textAllCaps="true" />
<EditText
android:id="@+id/confirm_password"
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="@drawable/resizable_textfield"
android:contentDescription="@string/content_description_confirm_password_field"
android:inputType="textPassword"
android:maxLines="1"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:textColor="@color/black_color"
android:hint="@string/confirm_password"
android:textCursorDrawable="@null" />
<TextView
android:id="@+id/confirm_password_error"
style="@style/assistant_input_field_error_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/error"
android:visibility="invisible" />
</LinearLayout>
</TableRow>
<TableRow
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_weight="1"
android:gravity="left">
<CheckBox
android:id="@+id/use_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_column="1"
android:checked="true"
android:paddingLeft="5dp"
android:button="@drawable/checkbox"
android:textColor="?attr/primaryTextColor"
android:text="@string/use_username_instead_or_phone_number"
android:visibility="gone" />
</TableRow>
<TableRow
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_weight="1"
android:gravity="left">
<CheckBox
android:id="@+id/use_email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_column="1"
android:checked="true"
android:paddingLeft="5dp"
android:button="@drawable/checkbox"
android:textColor="?attr/primaryTextColor"
android:text="@string/use_email_for_validation"
android:visibility="gone" />
</TableRow>
</TableLayout>
<Button
android:id="@+id/assistant_create"
style="@style/button_font"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_gravity="center"
android:layout_marginTop="20dp"
android:background="@drawable/assistant_button"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:text="@string/assistant_create_account"
android:textColor="@drawable/assistant_button_text_color" />
<TextView
android:id="@+id/assistant_skip"
android:textSize="18sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="20dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:text="@string/maybe_later"
android:textColor="?attr/primaryTextColor"
android:visibility="gone" />
</LinearLayout>
</ScrollView>

View file

@ -1,110 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="30dp"
android:background="?attr/backgroundColor">
<TextView
android:id="@+id/question"
style="@style/assistant_codec_downloader_font"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/downloading"
android:layout_centerHorizontal="true"
android:gravity="center"
android:text="@string/assistant_codec_down_question"
android:textAllCaps="true" />
<ImageView
android:id="@+id/imageView"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_below="@+id/question"
android:layout_centerHorizontal="true"
android:layout_marginTop="38dp"
android:src="@drawable/linphone_logo_orange" />
<ProgressBar
android:id="@+id/progressBar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/answerNo"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true" />
<TextView
android:id="@+id/downloading"
style="@style/assistant_codec_downloader_font"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignStart="@+id/question"
android:layout_alignLeft="@+id/question"
android:layout_alignTop="@+id/downloaded"
android:gravity="center"
android:text="@string/assistant_codec_downloading"
android:textAllCaps="true" />
<Button
android:id="@+id/answerNo"
style="@style/assistant_codec_downloader_font"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginBottom="40dp"
android:layout_toStartOf="@+id/imageView"
android:layout_toLeftOf="@+id/imageView"
android:gravity="center"
android:text="No"
android:textAllCaps="true" />
<Button
android:id="@+id/answerYes"
style="@style/assistant_codec_downloader_font"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/answerOk"
android:layout_toEndOf="@+id/imageView"
android:layout_toRightOf="@+id/imageView"
android:gravity="center"
android:text="Yes"
android:textAllCaps="true" />
<Button
android:id="@+id/answerOk"
style="@style/assistant_codec_downloader_font"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/answerNo"
android:layout_centerHorizontal="true"
android:gravity="center"
android:text="Ok"
android:textAllCaps="true" />
<TextView
android:id="@+id/downloaded"
style="@style/assistant_codec_downloader_font"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="36dp"
android:gravity="center"
android:text="@string/assistant_codec_downloaded"
android:textAllCaps="true" />
<TextView
android:id="@+id/downloadingInfo"
style="@style/assistant_codec_downloader_font"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/answerOk"
android:layout_centerHorizontal="true"
android:gravity="center"
android:textAllCaps="true" />
</RelativeLayout>

View file

@ -1,248 +0,0 @@
<?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"
android:background="?attr/backgroundColor"
android:padding="30dp">
<TextView
style="@style/standard_text_font"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/assistant_linphone_account"
android:textAllCaps="true" />
<TextView
android:id="@+id/message_phone_number"
style="@style/standard_small_text_font"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:paddingTop="10dp"
android:text="@string/assistant_linphone_login_desc" />
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:orientation="horizontal">
<TableRow
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_weight="1"
android:gravity="left">
<LinearLayout
android:id="@+id/phone_number_layout"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal"
android:visibility="visible">
<Button
android:id="@+id/select_country"
style="@style/button_font"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginTop="15dp"
android:layout_weight="1"
android:background="@drawable/resizable_assistant_button"
android:textColor="@drawable/assistant_button_text_color"
android:text="@string/select_your_country" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp"
android:layout_weight="1"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/phone_number_label"
style="@style/assistant_input_field_header_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/phone_number"
android:textAllCaps="true" />
<ImageView
android:id="@+id/info_phone_number"
android:layout_width="15dp"
android:layout_height="15dp"
android:layout_alignParentRight="true"
android:src="@drawable/info" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<EditText
android:id="@+id/dial_code"
android:layout_width="65dp"
android:layout_height="40dp"
android:layout_marginRight="10dp"
android:background="@drawable/resizable_textfield"
android:gravity="center"
android:inputType="phone"
android:maxLines="1"
android:hint="@string/international_prefix"
android:text="+"
android:textColor="@color/black_color" />
<EditText
android:id="@+id/phone_number"
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="@drawable/resizable_textfield"
android:contentDescription="@string/content_description_phone_number_field"
android:inputType="phone"
android:maxLines="1"
android:hint="@string/phone_number"
android:textColor="@color/black_color" />
</LinearLayout>
<TextView
android:id="@+id/phone_number_error_2"
style="@style/assistant_input_field_error_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/error"
android:visibility="invisible" />
</LinearLayout>
</LinearLayout>
</TableRow>
<TableRow
android:layout_margin="10dp"
android:layout_weight="1"
android:gravity="center">
<LinearLayout
android:id="@+id/username_layout"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:layout_weight="1"
android:orientation="vertical"
android:visibility="gone">
<TextView
style="@style/assistant_input_field_header_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/username"
android:textAllCaps="true" />
<EditText
android:id="@+id/assistant_username"
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="@drawable/resizable_textfield"
android:contentDescription="@string/content_description_username_field"
android:inputType="text|textNoSuggestions"
android:maxLines="1"
android:hint="@string/username"
android:textColor="@color/black_color" />
</LinearLayout>
<LinearLayout
android:id="@+id/password_layout"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="top"
android:layout_weight="1"
android:orientation="vertical"
android:paddingLeft="30dp"
android:visibility="gone">
<TextView
style="@style/assistant_input_field_header_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/password"
android:textAllCaps="true" />
<EditText
android:id="@+id/assistant_password"
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="@drawable/resizable_textfield"
android:inputType="textPassword"
android:maxLines="1"
android:hint="@string/password"
android:textColor="@color/black_color" />
<TextView
android:id="@+id/forgot_password"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:maxLines="1" />
</LinearLayout>
</TableRow>
<TableRow
android:layout_margin="10dp"
android:layout_weight="1"
android:gravity="center">
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1" />
</TableRow>
<TableRow
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_weight="1"
android:gravity="left">
<CheckBox
android:id="@+id/use_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:button="@drawable/checkbox"
android:paddingLeft="5dp"
android:textColor="?attr/primaryTextColor"
android:text="@string/login_with_username"
android:visibility="visible" />
</TableRow>
</TableLayout>
<Button
android:id="@+id/assistant_apply"
style="@style/button_font"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_gravity="center"
android:layout_marginTop="20dp"
android:background="@drawable/assistant_button"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:text="@string/assistant_login"
android:textColor="@drawable/assistant_button_text_color" />
</LinearLayout>

View file

@ -1,106 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/backgroundColor">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="30dp">
<TextView
style="@style/standard_text_font"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/welcome"
android:textAllCaps="true" />
<TextView
style="@style/standard_small_text_font"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:paddingTop="20dp"
android:text="@string/assistant_welcome_desc" />
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:orientation="horizontal">
<TableRow
android:layout_margin="10dp"
android:layout_weight="1"
android:gravity="center">
<TextView
android:id="@+id/create_account"
style="@style/button_font"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/assistant_button"
android:textColor="@drawable/assistant_button_text_color"
android:gravity="center"
android:padding="10dp"
android:contentDescription="@string/assistant_create_account"
android:text="@string/assistant_create_account" />
<TextView
android:id="@+id/login_linphone"
style="@style/button_font"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp"
android:layout_weight="1"
android:background="@drawable/assistant_button"
android:textColor="@drawable/assistant_button_text_color"
android:gravity="center"
android:padding="10dp"
android:contentDescription="@string/assistant_login_linphone"
android:text="@string/assistant_login_linphone" />
</TableRow>
<TableRow
android:layout_margin="10dp"
android:layout_weight="1"
android:gravity="center">
<TextView
android:id="@+id/login_generic"
style="@style/button_font"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/assistant_button"
android:textColor="@drawable/assistant_button_text_color"
android:gravity="center"
android:padding="10dp"
android:contentDescription="@string/assistant_login_generic"
android:text="@string/assistant_login_generic" />
<TextView
android:id="@+id/remote_provisioning"
style="@style/button_font"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp"
android:layout_weight="1"
android:background="@drawable/assistant_button"
android:textColor="@drawable/assistant_button_text_color"
android:gravity="center"
android:padding="10dp"
android:contentDescription="@string/assistant_remote_provisioning"
android:text="@string/assistant_remote_provisioning" />
</TableRow>
</TableLayout>
</LinearLayout>
</ScrollView>

View file

@ -1,113 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="30dp"
android:background="?attr/backgroundColor">
<TextView
android:id="@+id/question"
style="@style/assistant_codec_downloader_font"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginTop="145dp"
android:gravity="center"
android:text="@string/assistant_codec_down_question"
android:textAllCaps="true" />
<ImageView
android:id="@+id/imageView"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:src="@drawable/linphone_logo_orange" />
<ProgressBar
android:id="@+id/progressBar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/imageView"
android:layout_alignEnd="@+id/question"
android:layout_alignRight="@+id/question"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_marginTop="107dp" />
<TextView
android:id="@+id/downloading"
style="@style/assistant_codec_downloader_font"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/downloaded"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:gravity="center"
android:text="@string/assistant_codec_downloading"
android:textAllCaps="true" />
<Button
android:id="@+id/answerNo"
style="@style/assistant_codec_downloader_font"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginBottom="40dp"
android:layout_toStartOf="@+id/imageView"
android:layout_toLeftOf="@+id/imageView"
android:gravity="center"
android:text="No"
android:textAllCaps="true" />
<Button
android:id="@+id/answerYes"
style="@style/assistant_codec_downloader_font"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/answerOk"
android:layout_toEndOf="@+id/imageView"
android:layout_toRightOf="@+id/imageView"
android:gravity="center"
android:text="Yes"
android:textAllCaps="true" />
<Button
android:id="@+id/answerOk"
style="@style/assistant_codec_downloader_font"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/answerNo"
android:layout_centerHorizontal="true"
android:gravity="center"
android:text="Ok"
android:textAllCaps="true" />
<TextView
android:id="@+id/downloaded"
style="@style/assistant_codec_downloader_font"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/question"
android:layout_alignBottom="@+id/question"
android:layout_centerHorizontal="true"
android:gravity="center"
android:text="@string/assistant_codec_downloaded"
android:textAllCaps="true" />
<TextView
android:id="@+id/downloadingInfo"
style="@style/assistant_codec_downloader_font"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/progressBar"
android:layout_centerHorizontal="true"
android:layout_marginBottom="29dp"
android:gravity="center"
android:textAllCaps="true" />
</RelativeLayout>

View file

@ -1,112 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="30dp"
android:background="?attr/backgroundColor">
<TextView
android:id="@+id/question"
style="@style/assistant_codec_downloader_font"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/downloading"
android:layout_centerHorizontal="true"
android:gravity="center"
android:text="@string/assistant_codec_down_question"
android:textAllCaps="true" />
<ImageView
android:id="@+id/imageView"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_below="@+id/question"
android:layout_centerHorizontal="true"
android:layout_marginTop="96dp"
android:src="@drawable/linphone_logo_orange" />
<ProgressBar
android:id="@+id/progressBar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/imageView"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginTop="120dp" />
<TextView
android:id="@+id/downloading"
style="@style/assistant_codec_downloader_font"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignStart="@+id/question"
android:layout_alignLeft="@+id/question"
android:layout_alignTop="@+id/downloaded"
android:gravity="center"
android:text="@string/assistant_codec_downloading"
android:textAllCaps="true" />
<Button
android:id="@+id/answerNo"
style="@style/assistant_codec_downloader_font"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginBottom="40dp"
android:layout_toStartOf="@+id/imageView"
android:layout_toLeftOf="@+id/imageView"
android:gravity="center"
android:text="No"
android:textAllCaps="true" />
<Button
android:id="@+id/answerYes"
style="@style/assistant_codec_downloader_font"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/answerOk"
android:layout_toEndOf="@+id/imageView"
android:layout_toRightOf="@+id/imageView"
android:gravity="center"
android:text="Yes"
android:textAllCaps="true" />
<Button
android:id="@+id/answerOk"
style="@style/assistant_codec_downloader_font"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/answerNo"
android:layout_centerHorizontal="true"
android:gravity="center"
android:text="Ok"
android:textAllCaps="true" />
<TextView
android:id="@+id/downloaded"
style="@style/assistant_codec_downloader_font"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="37dp"
android:gravity="center"
android:text="@string/assistant_codec_downloaded"
android:textAllCaps="true" />
<TextView
android:id="@+id/downloadingInfo"
style="@style/assistant_codec_downloader_font"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/progressBar"
android:layout_centerHorizontal="true"
android:layout_marginBottom="54dp"
android:gravity="center"
android:textAllCaps="true" />
</RelativeLayout>

View file

@ -0,0 +1,251 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/backgroundColor"
android:orientation="vertical">
<fragment
android:id="@+id/status"
android:name="org.linphone.fragments.StatusFragment"
android:layout_width="match_parent"
android:layout_height="40dp"
tools:layout="@layout/status" />
<include
android:id="@+id/top_bar"
layout="@layout/assistant_topbar" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingRight="30dp"
android:paddingLeft="30dp"
android:orientation="vertical">
<TextView
style="@style/standard_text_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/assistant_linphone_account"
android:paddingTop="10dp"
android:textAllCaps="true" />
<RelativeLayout
android:id="@+id/phone_number_form"
android:layout_marginBottom="5dp"
android:paddingTop="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/phone_number_desc"
style="@style/standard_small_text_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_alignParentTop="true"
android:paddingTop="10dp"
android:text="@string/assistant_create_account_part_1" />
<TextView
android:id="@+id/phone_number_label"
android:text="@string/phone_number"
style="@style/assistant_input_field_header_font"
android:textAllCaps="true"
android:layout_marginTop="10dp"
android:layout_below="@id/phone_number_desc"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<ImageView
android:id="@+id/info_phone_number"
android:src="@drawable/info"
android:layout_marginTop="10dp"
android:layout_below="@id/phone_number_desc"
android:layout_alignParentRight="true"
android:layout_width="20dp"
android:layout_height="20dp"/>
<TextView
android:id="@+id/select_country"
style="@style/button_font"
android:text="@string/select_your_country"
android:background="@drawable/resizable_assistant_button"
android:textColor="@drawable/assistant_button_text_color"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:layout_marginTop="5dp"
android:gravity="center"
android:layout_below="@id/phone_number_label"/>
<LinearLayout
android:orientation="vertical"
android:layout_marginTop="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/select_country">
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/dial_code"
android:background="@drawable/resizable_textfield"
android:textColor="@color/black_color"
android:inputType="phone"
android:text="+"
android:layout_marginRight="10dp"
android:gravity="center"
android:layout_width="65dp"
android:layout_height="wrap_content"
android:hint="@string/international_prefix"
android:maxLines="1"/>
<EditText
android:id="@+id/phone_number"
android:background="@drawable/resizable_textfield"
android:textColor="@color/black_color"
android:contentDescription="@string/content_description_phone_number_field"
android:inputType="phone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/phone_number"
android:maxLines="1"/>
</LinearLayout>
<TextView
android:id="@+id/phone_number_error"
android:text="@string/error"
style="@style/assistant_input_field_error_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="invisible"/>
</LinearLayout>
</RelativeLayout>
<RelativeLayout
android:id="@+id/username_form"
android:layout_marginBottom="5dp"
android:paddingTop="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/username_desc"
style="@style/standard_small_text_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_alignParentTop="true"
android:paddingTop="10dp"
android:text="@string/assistant_linphone_login_desc" />
<LinearLayout
android:id="@+id/username_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:layout_below="@id/username_desc"
android:orientation="vertical">
<TextView
style="@style/assistant_input_field_header_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/username"
android:textAllCaps="true" />
<EditText
android:id="@+id/assistant_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/resizable_textfield"
android:contentDescription="@string/content_description_username_field"
android:inputType="text|textNoSuggestions"
android:maxLines="1"
android:hint="@string/username"
android:textColor="@color/black_color" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:layout_below="@id/username_layout"
android:orientation="vertical">
<TextView
style="@style/assistant_input_field_header_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/password"
android:textAllCaps="true" />
<EditText
android:id="@+id/assistant_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/resizable_textfield"
android:inputType="textPassword"
android:maxLines="1"
android:hint="@string/password"
android:textColor="@color/black_color" />
</LinearLayout>
</RelativeLayout>
<LinearLayout
android:id="@+id/username_switch_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center"
android:paddingTop="10dp">
<Switch
android:id="@+id/username_login"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
style="@style/standard_small_text_font"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:text="@string/login_with_username" />
</LinearLayout>
<TextView
android:id="@+id/assistant_login"
android:text="@string/assistant_login"
android:background="@drawable/assistant_button"
android:textColor="@drawable/assistant_button_text_color"
style="@style/button_font"
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:padding="10dp"/>
</LinearLayout>
</ScrollView>
</LinearLayout>

View file

@ -1,344 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/backgroundColor">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="30dp"
android:orientation="vertical">
<TextView
android:id="@+id/assistant_title"
android:text="@string/assistant_create_account"
style="@style/standard_text_font"
android:textAllCaps="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"/>
<TextView
android:text="@string/assistant_create_account_part_1"
style="@style/standard_small_text_font"
android:paddingTop="10dp"
android:gravity="center_horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/message_create_account"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:layout_marginTop="30dp"
android:orientation="vertical">
<LinearLayout
android:id="@+id/phone_number_layout"
android:visibility="gone"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_marginBottom="5dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/phone_number_label"
android:text="@string/phone_number"
style="@style/assistant_input_field_header_font"
android:textAllCaps="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<ImageView
android:id="@+id/info_phone_number"
android:src="@drawable/info"
android:layout_alignParentRight="true"
android:layout_width="20dp"
android:layout_height="20dp"/>
</RelativeLayout>
<Button
android:id="@+id/select_country"
style="@style/button_font"
android:text="@string/select_your_country"
android:background="@drawable/resizable_assistant_button"
android:textColor="@drawable/assistant_button_text_color"
android:layout_width="match_parent"
android:layout_height="40dp"/>
<LinearLayout
android:orientation="vertical"
android:layout_marginTop="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/dial_code"
android:background="@drawable/resizable_textfield"
android:textColor="@color/black_color"
android:inputType="phone"
android:text="+"
android:layout_marginRight="10dp"
android:gravity="center"
android:layout_width="65dp"
android:layout_height="42dp"
android:hint="@string/international_prefix"
android:maxLines="1"/>
<EditText
android:id="@+id/phone_number"
android:background="@drawable/resizable_textfield"
android:textColor="@color/black_color"
android:contentDescription="@string/content_description_phone_number_field"
android:inputType="phone"
android:layout_width="match_parent"
android:layout_height="40dp"
android:hint="@string/phone_number"
android:maxLines="1"/>
</LinearLayout>
<TextView
android:id="@+id/phone_number_error"
android:text="@string/error"
style="@style/assistant_input_field_error_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="invisible"/>
<TextView
android:id="@+id/sip_uri"
style="@style/contact_organization_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/username_layout"
android:visibility="gone"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/username_label"
android:text="@string/username"
style="@style/assistant_input_field_header_font"
android:textAllCaps="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<EditText
android:id="@+id/username"
android:background="@drawable/resizable_textfield"
android:textColor="@color/black_color"
android:contentDescription="@string/content_description_username_field"
android:inputType="text|textNoSuggestions"
android:layout_width="match_parent"
android:layout_height="40dp"
android:hint="@string/username"
android:maxLines="1"/>
<TextView
android:id="@+id/username_error"
android:text="@string/error"
style="@style/assistant_input_field_error_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="invisible"/>
</LinearLayout>
<LinearLayout
android:id="@+id/email_layout"
android:visibility="gone"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/email_label"
android:text="@string/email"
style="@style/assistant_input_field_header_font"
android:textAllCaps="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<EditText
android:id="@+id/email"
android:background="@drawable/resizable_textfield"
android:textColor="@color/black_color"
android:inputType="textEmailAddress"
android:contentDescription="@string/content_description_email_field"
android:textCursorDrawable="@null"
android:layout_width="match_parent"
android:layout_height="40dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:hint="@string/email"
android:maxLines="1"/>
<TextView
android:id="@+id/email_error"
android:text="@string/error"
style="@style/assistant_input_field_error_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="invisible"/>
</LinearLayout>
<LinearLayout
android:id="@+id/password_layout"
android:visibility="gone"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/password_label"
style="@style/assistant_input_field_header_font"
android:text="@string/password"
android:textAllCaps="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<EditText
android:id="@+id/password"
android:background="@drawable/resizable_textfield"
android:textColor="@color/black_color"
android:inputType="textPassword"
android:textCursorDrawable="@null"
android:layout_width="match_parent"
android:layout_height="40dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:hint="@string/password"
android:maxLines="1"/>
<TextView
android:id="@+id/password_error"
android:text="@string/error"
style="@style/assistant_input_field_error_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="invisible"/>
</LinearLayout>
<LinearLayout
android:id="@+id/password_confirm_layout"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/confirm_password_label"
android:text="@string/confirm_password"
style="@style/assistant_input_field_header_font"
android:textAllCaps="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<EditText
android:id="@+id/confirm_password"
android:background="@drawable/resizable_textfield"
android:textColor="@color/black_color"
android:inputType="textPassword"
android:contentDescription="@string/content_description_confirm_password_field"
android:textCursorDrawable="@null"
android:layout_width="match_parent"
android:layout_height="40dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:hint="@string/confirm_password"
android:maxLines="1"/>
<TextView
android:id="@+id/confirm_password_error"
android:text="@string/error"
style="@style/assistant_input_field_error_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="invisible"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<CheckBox
android:id="@+id/use_username"
android:visibility="gone"
android:paddingLeft="5dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:button="@drawable/checkbox"
android:text="@string/use_username_instead_or_phone_number"
android:textColor="?attr/primaryTextColor"/>
<CheckBox
android:id="@+id/use_email"
android:visibility="gone"
android:paddingLeft="5dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:button="@drawable/checkbox"
android:textColor="?attr/primaryTextColor"
android:text="@string/use_email_for_validation"/>
<Button
android:id="@+id/assistant_create"
android:text="@string/assistant_create_account"
android:background="@drawable/assistant_button"
android:textColor="@drawable/assistant_button_text_color"
style="@style/button_font"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:layout_marginTop="20dp"/>
<TextView
android:id="@+id/assistant_skip"
android:visibility="gone"
android:text="@string/maybe_later"
android:textColor="?attr/primaryTextColor"
android:textSize="18sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:layout_marginTop="20dp"/>
</LinearLayout>
</LinearLayout>
</ScrollView>

View file

@ -1,73 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/backgroundColor">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="30dp"
android:gravity="center_horizontal"
android:orientation="vertical" >
<TextView
android:text="@string/assistant_create_account"
style="@style/standard_text_font"
android:textAllCaps="true"
android:gravity="center_horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/title_account_activation" />
<TextView
android:text="@string/assistant_create_account_part_2"
style="@style/standard_small_text_font"
android:paddingTop="10dp"
android:gravity="center_horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:id="@+id/send_phone_number"
style="@style/standard_text_font"
android:paddingTop="10dp"
android:gravity="center_horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:text="@string/assistant_create_account_part_3"
style="@style/standard_small_text_font"
android:paddingTop="10dp"
android:gravity="center_horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<EditText
android:id="@+id/assistant_code"
android:background="@drawable/resizable_textfield"
android:textColor="@color/black_color"
android:contentDescription="@string/content_description_activation_code_field"
android:inputType="number"
android:gravity="center_vertical|center_horizontal"
android:layout_width="match_parent"
android:layout_height="40dp"
android:hint="@string/confirmation_code"
android:maxLines="1"/>
<Button
android:id="@+id/assistant_check"
android:text="@string/assistant_activate"
android:background="@drawable/assistant_button"
android:textColor="@drawable/assistant_button_text_color"
style="@style/button_font"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:layout_marginTop="20dp"/>
</LinearLayout>
</ScrollView>

View file

@ -1,63 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/backgroundColor">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="30dp"
android:gravity="center_horizontal"
android:orientation="vertical" >
<TextView
android:text="@string/assistant_create_account"
style="@style/standard_text_font"
android:textAllCaps="true"
android:gravity="center_horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:text="@string/assistant_validate_account_1"
style="@style/standard_small_text_font"
android:paddingTop="10dp"
android:gravity="center_horizontal"
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:id="@+id/send_email"
style="@style/standard_text_font"
android:paddingTop="10dp"
android:gravity="center_horizontal"
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:text="@string/assistant_validate_account_2"
style="@style/standard_small_text_font"
android:paddingTop="10dp"
android:gravity="center"
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<Button
android:id="@+id/assistant_check"
android:text="@string/assistant_finish"
android:background="@drawable/assistant_button"
android:textColor="@drawable/assistant_button_text_color"
style="@style/button_font"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_margin="10dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"/>
</LinearLayout>
</ScrollView>

View file

@ -1,114 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="30dp"
android:orientation="vertical"
android:background="?attr/backgroundColor">
<TextView
android:text="@string/assistant_codec_down_question"
style="@style/assistant_codec_downloader_font"
android:textAllCaps="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:id="@+id/question"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"/>
<ImageView
android:src="@drawable/linphone_logo_orange"
android:layout_width="150dp"
android:layout_height="150dp"
android:id="@+id/imageView"
android:layout_below="@+id/question"
android:layout_centerHorizontal="true"
android:layout_marginTop="36dp"/>
<ProgressBar
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/progressBar"
android:layout_marginBottom="50dp"
android:layout_above="@+id/answerNo"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"/>
<TextView
style="@style/assistant_codec_downloader_font"
android:text="@string/assistant_codec_downloading"
android:textAllCaps="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:id="@+id/downloading"
android:layout_above="@+id/imageView"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"/>
<Button
style="@style/assistant_codec_downloader_font"
android:text="No"
android:textAllCaps="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:id="@+id/answerNo"
android:layout_alignParentBottom="true"
android:layout_toLeftOf="@+id/imageView"
android:layout_toStartOf="@+id/imageView" />
<Button
style="@style/assistant_codec_downloader_font"
android:text="Yes"
android:textAllCaps="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:id="@+id/answerYes"
android:layout_below="@+id/progressBar"
android:layout_toRightOf="@+id/imageView"
android:layout_toEndOf="@+id/imageView"/>
<Button
style="@style/assistant_codec_downloader_font"
android:text="Ok"
android:textAllCaps="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:id="@+id/answerOk"
android:layout_centerHorizontal="true"
android:layout_alignTop="@+id/answerYes" />
<TextView
style="@style/assistant_codec_downloader_font"
android:text="@string/assistant_codec_downloaded"
android:textAllCaps="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:id="@+id/downloaded"
android:layout_above="@+id/imageView"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"/>
<TextView
style="@style/assistant_codec_downloader_font"
android:textAllCaps="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:id="@+id/downloadingInfo"
android:layout_above="@+id/progressBar"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"/>
</RelativeLayout>

View file

@ -28,7 +28,7 @@
<EditText <EditText
android:id="@+id/search_country" android:id="@+id/search_country"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="40dp" android:layout_height="wrap_content"
android:background="@drawable/resizable_textfield" android:background="@drawable/resizable_textfield"
android:gravity="center" android:gravity="center"
android:inputType="textPersonName" android:inputType="textPersonName"
@ -37,7 +37,7 @@
android:textCursorDrawable="@null" /> android:textCursorDrawable="@null" />
<ImageView <ImageView
android:id="@+id/clearSearchField" android:id="@+id/clear_field"
android:layout_width="30dp" android:layout_width="30dp"
android:layout_height="30dp" android:layout_height="30dp"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"

View file

@ -1,30 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="30dp"
android:orientation="vertical"
android:background="?attr/backgroundColor">
<TextView
android:text="@string/assistant_ec_calibration"
style="@style/standard_text_font"
android:textAllCaps="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_centerHorizontal="true"/>
<ImageView
android:src="@drawable/linphone_logo_orange"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_centerInParent="true"/>
<ProgressBar
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true" />
</RelativeLayout>

View file

@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/backgroundColor"
android:orientation="vertical">
<fragment
android:id="@+id/status"
android:name="org.linphone.fragments.StatusFragment"
android:layout_width="match_parent"
android:layout_height="40dp"
tools:layout="@layout/status" />
<include
android:id="@+id/top_bar"
layout="@layout/assistant_topbar" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="30dp"
android:orientation="vertical"
android:background="?attr/backgroundColor">
<TextView
android:text="@string/assistant_ec_calibration"
style="@style/standard_text_font"
android:textAllCaps="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_centerHorizontal="true"/>
<ImageView
android:src="@drawable/linphone_logo_orange"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_centerInParent="true"/>
<ProgressBar
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true" />
</RelativeLayout>
</LinearLayout>

View file

@ -0,0 +1,211 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/backgroundColor"
android:orientation="vertical">
<fragment
android:id="@+id/status"
android:name="org.linphone.fragments.StatusFragment"
android:layout_width="match_parent"
android:layout_height="40dp"
tools:layout="@layout/status" />
<include
android:id="@+id/top_bar"
layout="@layout/assistant_topbar" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
style="@style/standard_text_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/assistant_create_account"
android:paddingTop="10dp"
android:textAllCaps="true" />
<TextView
style="@style/standard_small_text_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_gravity="top"
android:paddingTop="10dp"
android:text="@string/assistant_create_account_part_email" />
<GridLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:columnCount="1">
<LinearLayout
android:layout_width="wrap_content"
android:layout_gravity="fill"
android:layout_columnWeight="1"
android:layout_height="wrap_content"
android:padding="10dp"
android:orientation="vertical">
<TextView
style="@style/assistant_input_field_header_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/username"
android:textAllCaps="true" />
<EditText
android:id="@+id/assistant_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/resizable_textfield"
android:contentDescription="@string/content_description_username_field"
android:inputType="text|textNoSuggestions"
android:maxLines="1"
android:hint="@string/username"
android:textColor="@color/black_color" />
<TextView
android:id="@+id/username_error"
android:text="@string/error"
style="@style/assistant_input_field_error_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="invisible"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_gravity="fill"
android:layout_columnWeight="1"
android:layout_height="wrap_content"
android:padding="10dp"
android:orientation="vertical">
<TextView
style="@style/assistant_input_field_header_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/email"
android:textAllCaps="true" />
<EditText
android:id="@+id/assistant_email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/resizable_textfield"
android:inputType="text|textEmailAddress"
android:maxLines="1"
android:hint="@string/email"
android:textColor="@color/black_color" />
<TextView
android:id="@+id/email_error"
android:text="@string/invalid_email"
style="@style/assistant_input_field_error_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="invisible"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_gravity="fill"
android:layout_columnWeight="1"
android:layout_height="wrap_content"
android:padding="10dp"
android:orientation="vertical">
<TextView
style="@style/assistant_input_field_header_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/password"
android:textAllCaps="true" />
<EditText
android:id="@+id/assistant_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/resizable_textfield"
android:inputType="textPassword"
android:maxLines="1"
android:hint="@string/password"
android:textColor="@color/black_color" />
<TextView
android:id="@+id/password_error"
android:text="@string/error"
style="@style/assistant_input_field_error_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="invisible"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_gravity="fill"
android:layout_columnWeight="1"
android:layout_height="wrap_content"
android:padding="10dp"
android:orientation="vertical">
<TextView
style="@style/assistant_input_field_header_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/confirm_password"
android:textAllCaps="true" />
<EditText
android:id="@+id/assistant_password_confirmation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/resizable_textfield"
android:inputType="textPassword"
android:maxLines="1"
android:hint="@string/confirm_password"
android:textColor="@color/black_color" />
<TextView
android:id="@+id/confirm_password_error"
android:text="@string/wizard_passwords_unmatched"
style="@style/assistant_input_field_error_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="invisible"/>
</LinearLayout>
</GridLayout>
<TextView
android:id="@+id/assistant_create"
android:text="@string/assistant_create_account"
android:background="@drawable/assistant_button"
android:textColor="@drawable/assistant_button_text_color"
android:layout_gravity="center"
style="@style/button_font"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:padding="10dp"/>
</LinearLayout>
</ScrollView>
</LinearLayout>

View file

@ -0,0 +1,77 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/backgroundColor"
android:orientation="vertical">
<fragment
android:id="@+id/status"
android:name="org.linphone.fragments.StatusFragment"
android:layout_width="match_parent"
android:layout_height="40dp"
tools:layout="@layout/status" />
<include
android:id="@+id/top_bar"
layout="@layout/assistant_topbar" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="30dp"
android:paddingRight="30dp"
android:gravity="center_horizontal"
android:orientation="vertical" >
<TextView
android:text="@string/assistant_create_account"
style="@style/standard_text_font"
android:paddingTop="10dp"
android:textAllCaps="true"
android:gravity="center_horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:text="@string/assistant_validate_account_1"
style="@style/standard_small_text_font"
android:paddingTop="10dp"
android:gravity="center_horizontal"
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:id="@+id/send_email"
style="@style/standard_text_font"
android:paddingTop="10dp"
android:gravity="center_horizontal"
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:text="@string/assistant_validate_account_2"
style="@style/standard_small_text_font"
android:paddingTop="10dp"
android:gravity="center"
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:id="@+id/assistant_check"
android:text="@string/assistant_finish"
android:background="@drawable/assistant_button"
android:textColor="@drawable/assistant_button_text_color"
style="@style/button_font"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:padding="10dp"/>
</LinearLayout>
</LinearLayout>

View file

@ -0,0 +1,233 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/backgroundColor"
android:orientation="vertical">
<fragment
android:id="@+id/status"
android:name="org.linphone.fragments.StatusFragment"
android:layout_width="match_parent"
android:layout_height="40dp"
tools:layout="@layout/status" />
<include
android:id="@+id/top_bar"
layout="@layout/assistant_topbar" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
style="@style/standard_text_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:text="@string/assistant_generic_account"
android:paddingTop="10dp"
android:textAllCaps="true" />
<TextView
style="@style/standard_small_text_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_gravity="top"
android:paddingTop="10dp"
android:text="@string/assistant_login_desc" />
<GridLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:columnCount="1">
<LinearLayout
android:layout_width="wrap_content"
android:layout_gravity="fill"
android:layout_columnWeight="1"
android:layout_height="wrap_content"
android:padding="10dp"
android:orientation="vertical">
<TextView
style="@style/assistant_input_field_header_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/username"
android:textAllCaps="true" />
<EditText
android:id="@+id/assistant_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/resizable_textfield"
android:contentDescription="@string/content_description_username_field"
android:inputType="text|textNoSuggestions"
android:maxLines="1"
android:hint="@string/username"
android:textColor="@color/black_color" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_gravity="fill"
android:layout_columnWeight="1"
android:layout_height="wrap_content"
android:padding="10dp"
android:orientation="vertical">
<TextView
style="@style/assistant_input_field_header_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/password"
android:textAllCaps="true" />
<EditText
android:id="@+id/assistant_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/resizable_textfield"
android:inputType="textPassword"
android:maxLines="1"
android:hint="@string/password"
android:textColor="@color/black_color" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_gravity="fill"
android:layout_columnWeight="1"
android:layout_height="wrap_content"
android:padding="10dp"
android:orientation="vertical">
<TextView
style="@style/assistant_input_field_header_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/domain"
android:textAllCaps="true" />
<EditText
android:id="@+id/assistant_domain"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/resizable_textfield"
android:contentDescription="@string/content_description_domain_field"
android:inputType="textUri"
android:maxLines="1"
android:hint="@string/domain"
android:textColor="@color/black_color" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_gravity="fill"
android:layout_columnWeight="1"
android:layout_height="wrap_content"
android:padding="10dp"
android:orientation="vertical">
<TextView
style="@style/assistant_input_field_header_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/assistant_display_name_optional"
android:textAllCaps="true" />
<EditText
android:id="@+id/assistant_display_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/resizable_textfield"
android:contentDescription="@string/content_description_display_field"
android:inputType="textPersonName"
android:maxLines="1"
android:hint="@string/assistant_display_name_optional"
android:textColor="@color/black_color" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_gravity="fill"
android:layout_columnWeight="1"
android:layout_height="wrap_content"
android:padding="10dp"
android:orientation="vertical">
<TextView
style="@style/assistant_input_field_header_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/transport"
android:textAllCaps="true" />
<RadioGroup
android:id="@+id/assistant_transports"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal">
<RadioButton
android:id="@+id/transport_udp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:textColor="?attr/primaryTextColor"
android:text="@string/pref_transport_udp" />
<RadioButton
android:id="@+id/transport_tcp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:textColor="?attr/primaryTextColor"
android:text="@string/pref_transport_tcp" />
<RadioButton
android:id="@+id/transport_tls"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:textColor="?attr/primaryTextColor"
android:checked="true"
android:text="@string/pref_transport_tls" />
</RadioGroup>
</LinearLayout>
</GridLayout>
<TextView
android:id="@+id/assistant_login"
android:text="@string/assistant_login"
android:background="@drawable/assistant_button"
android:textColor="@drawable/assistant_button_text_color"
style="@style/button_font"
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:padding="10dp"/>
</LinearLayout>
</ScrollView>
</LinearLayout>

View file

@ -1,222 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/backgroundColor">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="30dp"
android:orientation="vertical">
<TextView
android:text="@string/assistant_linphone_account"
style="@style/standard_text_font"
android:textAllCaps="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical|center_horizontal|center"
android:layout_gravity="center"/>
<TextView
android:text="@string/assistant_create_account_part_1"
style="@style/standard_small_text_font"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="10dp"
android:gravity="center"
android:layout_gravity="center"
android:id="@+id/message_phone_number" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:layout_marginTop="30dp"
android:orientation="vertical">
<LinearLayout
android:id="@+id/phone_number_layout"
android:visibility="gone"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_marginBottom="5dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/phone_number_label"
android:text="@string/phone_number"
style="@style/assistant_input_field_header_font"
android:textAllCaps="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<ImageView
android:id="@+id/info_phone_number"
android:src="@drawable/info"
android:layout_alignParentRight="true"
android:layout_width="20dp"
android:layout_height="20dp"/>
</RelativeLayout>
<LinearLayout
android:orientation="vertical"
android:layout_marginTop="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:id="@+id/select_country"
style="@style/button_font"
android:text="@string/select_your_country"
android:background="@drawable/resizable_assistant_button"
android:textColor="@drawable/assistant_button_text_color"
android:layout_width="match_parent"
android:layout_height="40dp"/>
<LinearLayout
android:orientation="vertical"
android:layout_marginTop="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/dial_code"
android:background="@drawable/resizable_textfield"
android:textColor="@color/black_color"
android:inputType="phone"
android:text="+"
android:layout_marginRight="10dp"
android:gravity="center"
android:layout_width="65dp"
android:layout_height="42dp"
android:hint="@string/international_prefix"
android:maxLines="1"/>
<EditText
android:id="@+id/phone_number"
android:background="@drawable/resizable_textfield"
android:textColor="@color/black_color"
android:contentDescription="@string/content_description_phone_number_field"
android:inputType="phone"
android:layout_width="match_parent"
android:layout_height="40dp"
android:hint="@string/phone_number"
android:maxLines="1"/>
</LinearLayout>
</LinearLayout>
<TextView
android:id="@+id/phone_number_error_2"
android:text="@string/error"
style="@style/assistant_input_field_error_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="invisible"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/username_layout"
android:visibility="gone"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:text="@string/username"
style="@style/assistant_input_field_header_font"
android:textAllCaps="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<EditText
android:id="@+id/assistant_username"
android:background="@drawable/resizable_textfield"
android:textColor="@color/black_color"
android:inputType="text|textNoSuggestions"
android:contentDescription="@string/content_description_username_field"
android:layout_width="match_parent"
android:layout_height="40dp"
android:hint="@string/username"
android:maxLines="1"/>
</LinearLayout>
<LinearLayout
android:id="@+id/password_layout"
android:visibility="gone"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:text="@string/password"
style="@style/assistant_input_field_header_font"
android:textAllCaps="true"
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/black_color"
android:inputType="textPassword"
android:layout_width="match_parent"
android:layout_height="40dp"
android:hint="@string/password"
android:maxLines="1"/>
<TextView
android:id="@+id/forgot_password"
android:layout_gravity="right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="1"/>
</LinearLayout>
<CheckBox
android:id="@+id/use_username"
android:visibility="visible"
android:layout_marginTop="20dp"
android:paddingLeft="5dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:button="@drawable/checkbox"
android:textColor="?attr/primaryTextColor"
android:text="@string/login_with_username"/>
<Button
android:id="@+id/assistant_apply"
android:text="@string/assistant_login"
android:background="@drawable/assistant_button"
android:textColor="@drawable/assistant_button_text_color"
style="@style/button_font"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:layout_marginTop="20dp"/>
</LinearLayout>
</LinearLayout>
</ScrollView>

View file

@ -1,188 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="fill_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="30dp">
<TextView
style="@style/standard_text_font"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:text="@string/assistant_generic_account"
android:textAllCaps="true" />
<TextView
style="@style/standard_small_text_font"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:paddingTop="10dp"
android:text="@string/assistant_login_desc" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="30dp"
android:gravity="center"
android:orientation="vertical">
<TextView
style="@style/assistant_input_field_header_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/username"
android:textAllCaps="true" />
<EditText
android:id="@+id/assistant_username"
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="@drawable/resizable_textfield"
android:contentDescription="@string/content_description_username_field"
android:inputType="text|textNoSuggestions"
android:maxLines="1"
android:hint="@string/username"
android:textColor="@color/black_color" />
<TextView
style="@style/assistant_input_field_header_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="20dp"
android:text="@string/userid"
android:textAllCaps="true" />
<EditText
android:id="@+id/assistant_userid"
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="@drawable/resizable_textfield"
android:contentDescription="@string/content_description_username_field"
android:inputType="text|textNoSuggestions"
android:maxLines="1"
android:hint="@string/userid"
android:textColor="@color/black_color" />
<TextView
style="@style/assistant_input_field_header_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="20dp"
android:text="@string/password"
android:textAllCaps="true" />
<EditText
android:id="@+id/assistant_password"
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="@drawable/resizable_textfield"
android:inputType="textPassword"
android:maxLines="1"
android:hint="@string/password"
android:textColor="@color/black_color" />
<TextView
style="@style/assistant_input_field_header_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="20dp"
android:text="@string/domain"
android:textAllCaps="true" />
<EditText
android:id="@+id/assistant_domain"
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="@drawable/resizable_textfield"
android:contentDescription="@string/content_description_domain_field"
android:inputType="textUri"
android:maxLines="1"
android:hint="@string/domain"
android:textColor="@color/black_color" />
<TextView
style="@style/assistant_input_field_header_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="20dp"
android:text="@string/assistant_display_name_optional"
android:textAllCaps="true" />
<EditText
android:id="@+id/assistant_display_name"
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="@drawable/resizable_textfield"
android:contentDescription="@string/content_description_display_field"
android:inputType="textPersonName"
android:maxLines="1"
android:hint="@string/assistant_display_name_optional"
android:textColor="@color/black_color" />
<TextView
style="@style/assistant_input_field_header_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="20dp"
android:text="@string/transport"
android:textAllCaps="true" />
<RadioGroup
android:id="@+id/assistant_transports"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal">
<RadioButton
android:id="@+id/transport_udp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:textColor="?attr/primaryTextColor"
android:text="@string/pref_transport_udp" />
<RadioButton
android:id="@+id/transport_tcp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:textColor="?attr/primaryTextColor"
android:text="@string/pref_transport_tcp" />
<RadioButton
android:id="@+id/transport_tls"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:textColor="?attr/primaryTextColor"
android:checked="true"
android:text="@string/pref_transport_tls" />
</RadioGroup>
<Button
android:id="@+id/assistant_apply"
style="@style/button_font"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_marginTop="20dp"
android:background="@drawable/assistant_button"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:text="@string/assistant_login"
android:textColor="@drawable/assistant_button_text_color" />
</LinearLayout>
</LinearLayout>
</ScrollView>

View file

@ -0,0 +1,118 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/backgroundColor"
android:orientation="vertical">
<fragment
android:id="@+id/status"
android:name="org.linphone.fragments.StatusFragment"
android:layout_width="match_parent"
android:layout_height="40dp"
tools:layout="@layout/status" />
<include
android:id="@+id/top_bar"
layout="@layout/assistant_topbar" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
style="@style/standard_text_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/welcome"
android:paddingTop="10dp"
android:textAllCaps="true" />
<TextView
style="@style/standard_small_text_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_gravity="top"
android:paddingTop="10dp"
android:text="@string/assistant_welcome_desc" />
<GridLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:columnCount="1">
<TextView
android:id="@+id/account_creation"
style="@style/button_font"
android:gravity="center"
android:padding="10dp"
android:layout_margin="20dp"
android:layout_width="wrap_content"
android:layout_gravity="fill"
android:layout_columnWeight="1"
android:layout_height="wrap_content"
android:background="@drawable/assistant_button"
android:textColor="@drawable/assistant_button_text_color"
android:contentDescription="@string/assistant_create_account"
android:text="@string/assistant_create_account" />
<TextView
android:id="@+id/account_connection"
style="@style/button_font"
android:gravity="center"
android:padding="10dp"
android:layout_margin="20dp"
android:layout_width="wrap_content"
android:layout_gravity="fill"
android:layout_columnWeight="1"
android:layout_height="wrap_content"
android:background="@drawable/assistant_button"
android:textColor="@drawable/assistant_button_text_color"
android:contentDescription="@string/assistant_login_linphone"
android:text="@string/assistant_login_linphone" />
<TextView
android:id="@+id/generic_connection"
style="@style/button_font"
android:gravity="center"
android:padding="10dp"
android:layout_margin="20dp"
android:layout_width="wrap_content"
android:layout_gravity="fill"
android:layout_columnWeight="1"
android:layout_height="wrap_content"
android:background="@drawable/assistant_button"
android:textColor="@drawable/assistant_button_text_color"
android:contentDescription="@string/assistant_login_generic"
android:text="@string/assistant_login_generic" />
<TextView
android:id="@+id/remote_configuration"
style="@style/button_font"
android:gravity="center"
android:padding="10dp"
android:layout_margin="20dp"
android:layout_width="wrap_content"
android:layout_gravity="fill"
android:layout_columnWeight="1"
android:layout_height="wrap_content"
android:background="@drawable/assistant_button"
android:textColor="@drawable/assistant_button_text_color"
android:contentDescription="@string/assistant_remote_provisioning"
android:text="@string/assistant_remote_provisioning" />
</GridLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>

View file

@ -0,0 +1,92 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/backgroundColor"
android:orientation="vertical">
<fragment
android:id="@+id/status"
android:name="org.linphone.fragments.StatusFragment"
android:layout_width="match_parent"
android:layout_height="40dp"
tools:layout="@layout/status" />
<include
android:id="@+id/top_bar"
layout="@layout/assistant_topbar" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="30dp"
android:orientation="vertical"
android:background="?attr/backgroundColor">
<TextView
android:id="@+id/question"
android:text="@string/assistant_codec_down_question"
style="@style/assistant_codec_downloader_font"
android:textAllCaps="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"/>
<ImageView
android:id="@+id/linphone_logo"
android:src="@drawable/linphone_logo_orange"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_below="@id/question"
android:layout_centerHorizontal="true"
android:layout_marginTop="36dp"/>
<ProgressBar
android:id="@+id/progress_bar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="40dp"
android:visibility="invisible"
android:layout_above="@id/answer_no"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"/>
<TextView
android:id="@+id/answer_no"
android:text="No"
android:textAllCaps="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:background="@drawable/assistant_button"
android:textColor="@drawable/assistant_button_text_color"
android:layout_gravity="center"
style="@style/button_font"
android:layout_margin="10dp"
android:padding="10dp"
android:layout_alignParentBottom="true"
android:layout_toLeftOf="@id/linphone_logo" />
<TextView
android:id="@+id/answer_yes"
android:text="Yes"
android:textAllCaps="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:background="@drawable/assistant_button"
android:textColor="@drawable/assistant_button_text_color"
android:layout_gravity="center"
style="@style/button_font"
android:layout_margin="10dp"
android:padding="10dp"
android:layout_below="@id/progress_bar"
android:layout_toRightOf="@id/linphone_logo"/>
</RelativeLayout>
</LinearLayout>

View file

@ -0,0 +1,155 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/backgroundColor"
android:orientation="vertical">
<fragment
android:id="@+id/status"
android:name="org.linphone.fragments.StatusFragment"
android:layout_width="match_parent"
android:layout_height="40dp"
tools:layout="@layout/status" />
<include
android:id="@+id/top_bar"
layout="@layout/assistant_topbar" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
style="@style/standard_text_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/assistant_create_account"
android:paddingTop="10dp"
android:textAllCaps="true" />
<TextView
style="@style/standard_small_text_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_gravity="top"
android:paddingTop="10dp"
android:text="@string/assistant_create_account_part_1" />
<RelativeLayout
android:layout_marginBottom="5dp"
android:paddingRight="30dp"
android:paddingLeft="30dp"
android:paddingTop="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/phone_number_label"
android:text="@string/phone_number"
style="@style/assistant_input_field_header_font"
android:textAllCaps="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<ImageView
android:id="@+id/info_phone_number"
android:src="@drawable/info"
android:layout_alignParentRight="true"
android:layout_width="20dp"
android:layout_height="20dp"/>
<TextView
android:id="@+id/select_country"
style="@style/button_font"
android:text="@string/select_your_country"
android:background="@drawable/resizable_assistant_button"
android:textColor="@drawable/assistant_button_text_color"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:layout_marginTop="5dp"
android:gravity="center"
android:layout_below="@id/phone_number_label"/>
<LinearLayout
android:orientation="vertical"
android:layout_marginTop="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/select_country">
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/dial_code"
android:background="@drawable/resizable_textfield"
android:textColor="@color/black_color"
android:inputType="phone"
android:text="+"
android:layout_marginRight="10dp"
android:gravity="center"
android:layout_width="65dp"
android:layout_height="wrap_content"
android:hint="@string/international_prefix"
android:maxLines="1"/>
<EditText
android:id="@+id/phone_number"
android:background="@drawable/resizable_textfield"
android:textColor="@color/black_color"
android:contentDescription="@string/content_description_phone_number_field"
android:inputType="phone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/phone_number"
android:maxLines="1"/>
</LinearLayout>
<TextView
android:id="@+id/phone_number_error"
android:text="@string/error"
style="@style/assistant_input_field_error_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="invisible"/>
<TextView
android:id="@+id/sip_uri"
style="@style/contact_organization_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
</RelativeLayout>
<TextView
android:id="@+id/assistant_create"
android:text="@string/assistant_create_account"
android:background="@drawable/assistant_button"
android:textColor="@drawable/assistant_button_text_color"
android:layout_gravity="center"
style="@style/button_font"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:padding="10dp"/>
</LinearLayout>
</ScrollView>
</LinearLayout>

View file

@ -0,0 +1,155 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/backgroundColor"
android:orientation="vertical">
<fragment
android:id="@+id/status"
android:name="org.linphone.fragments.StatusFragment"
android:layout_width="match_parent"
android:layout_height="40dp"
tools:layout="@layout/status" />
<include
android:id="@+id/top_bar"
layout="@layout/assistant_topbar" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
style="@style/standard_text_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/assistant_link_account"
android:paddingTop="10dp"
android:textAllCaps="true" />
<TextView
style="@style/standard_small_text_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_gravity="top"
android:paddingTop="10dp"
android:text="@string/assistant_create_account_part_1" />
<RelativeLayout
android:layout_marginBottom="5dp"
android:paddingRight="30dp"
android:paddingLeft="30dp"
android:paddingTop="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/phone_number_label"
android:text="@string/phone_number"
style="@style/assistant_input_field_header_font"
android:textAllCaps="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<ImageView
android:id="@+id/info_phone_number"
android:src="@drawable/info"
android:layout_alignParentRight="true"
android:layout_width="20dp"
android:layout_height="20dp"/>
<TextView
android:id="@+id/select_country"
style="@style/button_font"
android:text="@string/select_your_country"
android:background="@drawable/resizable_assistant_button"
android:textColor="@drawable/assistant_button_text_color"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:layout_marginTop="5dp"
android:gravity="center"
android:layout_below="@id/phone_number_label"/>
<LinearLayout
android:orientation="vertical"
android:layout_marginTop="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/select_country">
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/dial_code"
android:background="@drawable/resizable_textfield"
android:textColor="@color/black_color"
android:inputType="phone"
android:text="+"
android:layout_marginRight="10dp"
android:gravity="center"
android:layout_width="65dp"
android:layout_height="wrap_content"
android:hint="@string/international_prefix"
android:maxLines="1"/>
<EditText
android:id="@+id/phone_number"
android:background="@drawable/resizable_textfield"
android:textColor="@color/black_color"
android:contentDescription="@string/content_description_phone_number_field"
android:inputType="phone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/phone_number"
android:maxLines="1"/>
</LinearLayout>
<TextView
android:id="@+id/phone_number_error"
android:text="@string/error"
style="@style/assistant_input_field_error_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"/>
<TextView
android:id="@+id/sip_uri"
style="@style/contact_organization_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
</RelativeLayout>
<TextView
android:id="@+id/assistant_link"
android:text="@string/assistant_link_account"
android:background="@drawable/assistant_button"
android:textColor="@drawable/assistant_button_text_color"
android:layout_gravity="center"
style="@style/button_font"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:padding="10dp"/>
</LinearLayout>
</ScrollView>
</LinearLayout>

View file

@ -0,0 +1,110 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/backgroundColor"
android:orientation="vertical">
<fragment
android:id="@+id/status"
android:name="org.linphone.fragments.StatusFragment"
android:layout_width="match_parent"
android:layout_height="40dp"
tools:layout="@layout/status" />
<include
android:id="@+id/top_bar"
layout="@layout/assistant_topbar" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="30dp"
android:paddingRight="30dp"
android:gravity="center_horizontal"
android:orientation="vertical" >
<TextView
android:id="@+id/title_account_creation"
android:visibility="gone"
android:text="@string/assistant_create_account"
style="@style/standard_text_font"
android:textAllCaps="true"
android:gravity="center_horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="10dp"/>
<TextView
android:id="@+id/title_account_activation"
android:visibility="gone"
android:text="@string/assistant_login_linphone"
style="@style/standard_text_font"
android:textAllCaps="true"
android:gravity="center_horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="10dp"/>
<TextView
android:id="@+id/title_account_linking"
android:visibility="gone"
android:text="@string/assistant_link_account"
style="@style/standard_text_font"
android:textAllCaps="true"
android:gravity="center_horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="10dp"/>
<TextView
android:text="@string/assistant_create_account_part_2"
style="@style/standard_small_text_font"
android:paddingTop="10dp"
android:gravity="center_horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<TextView
android:id="@+id/phone_number"
style="@style/standard_text_font"
android:paddingTop="10dp"
android:gravity="center_horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:text="@string/assistant_create_account_part_3"
style="@style/standard_small_text_font"
android:paddingTop="10dp"
android:gravity="center_horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<EditText
android:id="@+id/sms_code"
android:background="@drawable/resizable_textfield"
android:textColor="@color/black_color"
android:contentDescription="@string/content_description_activation_code_field"
android:inputType="number"
android:gravity="center_vertical|center_horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/confirmation_code"
android:maxLines="1"/>
<TextView
android:id="@+id/finish_account_creation"
android:text="@string/assistant_finish"
android:background="@drawable/assistant_button"
android:textColor="@drawable/assistant_button_text_color"
style="@style/button_font"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:padding="10dp"/>
</LinearLayout>
</LinearLayout>

View file

@ -14,14 +14,12 @@
tools:layout="@layout/status" /> tools:layout="@layout/status" />
<include <include
android:id="@+id/topbar" android:id="@+id/top_bar"
layout="@layout/assistant_topbar" /> layout="@layout/assistant_topbar" />
<LinearLayout <TextureView
android:id="@+id/fragment_container" android:id="@+id/qr_code_capture_texture"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent" />
android:background="?attr/backgroundColor"
android:orientation="horizontal" />
</LinearLayout> </LinearLayout>

View file

@ -0,0 +1,99 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/backgroundColor"
android:orientation="vertical">
<fragment
android:id="@+id/status"
android:name="org.linphone.fragments.StatusFragment"
android:layout_width="match_parent"
android:layout_height="40dp"
tools:layout="@layout/status" />
<include
android:id="@+id/top_bar"
layout="@layout/assistant_topbar" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingLeft="30dp"
android:paddingRight="30dp"
android:orientation="vertical">
<TextView
style="@style/standard_text_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/assistant_remote_provisioning_title"
android:paddingTop="10dp"
android:textAllCaps="true" />
<TextView
style="@style/standard_small_text_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_gravity="top"
android:paddingTop="10dp"
android:text="@string/assistant_remote_provisioning_desc" />
<TextView
android:text="@string/remote_provisioning_url"
style="@style/assistant_input_field_header_font"
android:textAllCaps="true"
android:paddingTop="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<EditText
android:id="@+id/remote_configuration_url"
android:background="@drawable/resizable_textfield"
android:textColor="@color/black_color"
android:inputType="textUri"
android:contentDescription="@string/content_description_url_field"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/remote_provisioning_url"
android:maxLines="1"/>
<TextView
android:id="@+id/fetch_and_apply_remote_configuration"
android:text="@string/assistant_fetch_apply"
android:background="@drawable/assistant_button"
android:textColor="@drawable/assistant_button_text_color"
style="@style/button_font"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dp"
android:layout_marginTop="20dp"/>
<TextView
android:id="@+id/qr_code"
android:text="@string/assistant_launch_qrcode"
android:background="@drawable/assistant_button"
android:textColor="@drawable/assistant_button_text_color"
style="@style/button_font"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dp"
android:layout_marginTop="20dp"/>
</LinearLayout>
<include
android:id="@+id/waitScreen"
layout="@layout/wait_layout" />
</RelativeLayout>
</LinearLayout>

View file

@ -1,78 +0,0 @@
<?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:padding="30dp"
android:orientation="vertical"
android:background="?attr/backgroundColor">
<TextView
android:text="@string/assistant_remote_provisioning_title"
style="@style/standard_text_font"
android:textAllCaps="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_gravity="center"/>
<TextView
android:text="@string/assistant_remote_provisioning_desc"
style="@style/standard_small_text_font"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="10dp"
android:gravity="center"
android:layout_gravity="center"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_marginTop="30dp"
android:orientation="vertical">
<TextView
android:text="@string/remote_provisioning_url"
style="@style/assistant_input_field_header_font"
android:textAllCaps="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<EditText
android:id="@+id/assistant_remote_provisioning_url"
android:background="@drawable/resizable_textfield"
android:textColor="@color/black_color"
android:inputType="textUri"
android:contentDescription="@string/content_description_url_field"
android:layout_width="match_parent"
android:layout_height="40dp"
android:hint="@string/remote_provisioning_url"
android:maxLines="1"/>
<Button
android:id="@+id/assistant_apply"
android:text="@string/assistant_fetch_apply"
android:background="@drawable/assistant_button"
android:textColor="@drawable/assistant_button_text_color"
style="@style/button_font"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:layout_marginTop="20dp"/>
<Button
android:id="@+id/assistant_qrcode"
android:text="@string/assistant_launch_qrcode"
android:background="@drawable/assistant_button"
android:textColor="@drawable/assistant_button_text_color"
style="@style/button_font"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:layout_marginTop="20dp"/>
</LinearLayout>
</LinearLayout>

View file

@ -1,112 +0,0 @@
<?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"
android:background="?attr/backgroundColor">
<TextView
android:text="@string/assistant_remote_provisioning_title"
style="@style/standard_text_font"
android:textAllCaps="true"
android:paddingTop="20dp"
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal"/>
<TextView
android:text="@string/assistant_remote_provisioning_login"
style="@style/standard_small_text_font"
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:gravity="center"
android:orientation="vertical">
<TextView
android:text="@string/username"
style="@style/assistant_input_field_header_font"
android:textAllCaps="true"
android:paddingTop="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<EditText
android:id="@+id/assistant_username"
android:background="@drawable/resizable_textfield"
android:textColor="@color/black_color"
android:textCursorDrawable="@null"
android:inputType="textNoSuggestions"
android:layout_width="match_parent"
android:layout_height="40dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:hint="@string/username"
android:maxLines="1"/>
<TextView
android:text="@string/password"
style="@style/assistant_input_field_header_font"
android:textAllCaps="true"
android:paddingTop="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<EditText
android:id="@+id/assistant_password"
android:background="@drawable/resizable_textfield"
android:textColor="@color/black_color"
android:textCursorDrawable="@null"
android:inputType="textPassword"
android:layout_width="match_parent"
android:layout_height="40dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:hint="@string/password"
android:maxLines="1"/>
<TextView
android:text="@string/domain"
style="@style/assistant_input_field_header_font"
android:textAllCaps="true"
android:paddingTop="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<EditText
android:id="@+id/assistant_domain"
android:background="@drawable/resizable_textfield"
android:textColor="@color/black_color"
android:textCursorDrawable="@null"
android:inputType="textUri"
android:layout_width="match_parent"
android:layout_height="40dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:hint="@string/domain"
android:maxLines="1"/>
<Button
android:id="@+id/assistant_connect"
android:text="@string/connect"
android:background="@drawable/assistant_button"
style="@style/button_font"
android:contentDescription="@string/content_description_valid"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:layout_marginTop="20dp"/>
</LinearLayout>
</LinearLayout>

View file

@ -27,19 +27,13 @@
android:padding="15dp" android:padding="15dp"
android:text="@string/assistant"/> android:text="@string/assistant"/>
<View <ImageView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.2" />
<!--<ImageView
android:id="@+id/assistant_cancel"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="0.2" android:layout_weight="0.2"
android:background="@drawable/toolbar_button" android:background="?attr/button_background_drawable"
android:contentDescription="@string/content_description_dialer_back"
android:padding="15dp" android:padding="15dp"
android:src="@drawable/dialer_back" />--> android:visibility="invisible"
android:src="@drawable/valid" />
</LinearLayout> </LinearLayout>

View file

@ -1,94 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/backgroundColor">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="30dp">
<TextView
style="@style/standard_text_font"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/welcome"
android:textAllCaps="true" />
<TextView
style="@style/standard_small_text_font"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:paddingTop="10dp"
android:text="@string/assistant_welcome_desc" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="10dp"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="@+id/create_account"
style="@style/button_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:background="@drawable/assistant_button"
android:textColor="@drawable/assistant_button_text_color"
android:gravity="center"
android:padding="10dp"
android:contentDescription="@string/assistant_create_account"
android:text="@string/assistant_create_account" />
<TextView
android:id="@+id/login_linphone"
style="@style/button_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:background="@drawable/assistant_button"
android:textColor="@drawable/assistant_button_text_color"
android:gravity="center"
android:padding="10dp"
android:contentDescription="@string/assistant_login_linphone"
android:text="@string/assistant_login_linphone" />
<TextView
android:id="@+id/login_generic"
style="@style/button_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:background="@drawable/assistant_button"
android:textColor="@drawable/assistant_button_text_color"
android:gravity="center"
android:padding="10dp"
android:contentDescription="@string/assistant_login_generic"
android:text="@string/assistant_login_generic" />
<TextView
android:id="@+id/remote_provisioning"
style="@style/button_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:background="@drawable/assistant_button"
android:textColor="@drawable/assistant_button_text_color"
android:gravity="center"
android:padding="10dp"
android:contentDescription="@string/assistant_remote_provisioning"
android:text="@string/assistant_remote_provisioning" />
</LinearLayout>
</LinearLayout>
</ScrollView>

View file

@ -1,15 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/qrcode_frame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:screenOrientation="portrait" >
<TextureView
android:id="@+id/qrcodeCaptureSurface"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true" />
</RelativeLayout>

View file

@ -16,7 +16,22 @@
<entry name="realm" overwrite="true"></entry> <entry name="realm" overwrite="true"></entry>
<entry name="conference_factory_uri" overwrite="true"></entry> <entry name="conference_factory_uri" overwrite="true"></entry>
</section> </section>
<section name="nat_policy_default_values">
<entry name="stun_server" overwrite="true"></entry>
<entry name="protocols" overwrite="true"></entry>
</section>
<section name="sip">
<entry name="rls_uri" overwrite="true"></entry>
</section>
<section name="lime">
<entry name="x3dh_server_url" overwrite="true"></entry>
</section>
<section name="assistant"> <section name="assistant">
<entry name="domain" overwrite="true"></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> </section>
</config> </config>

View file

@ -16,21 +16,13 @@
<entry name="realm" overwrite="true">sip.linphone.org</entry> <entry name="realm" overwrite="true">sip.linphone.org</entry>
<entry name="conference_factory_uri" overwrite="true">sip:conference-factory@sip.linphone.org</entry> <entry name="conference_factory_uri" overwrite="true">sip:conference-factory@sip.linphone.org</entry>
</section> </section>
<section name="nat_policy_default_values"> <section name="nat_policy_default_values">
<entry name="stun_server" overwrite="true">stun.linphone.org</entry> <entry name="stun_server" overwrite="true">stun.linphone.org</entry>
<entry name="protocols" overwrite="true">stun,ice</entry> <entry name="protocols" overwrite="true">stun,ice</entry>
</section> </section>
<section name="sip"> <section name="sip">
<entry name="rls_uri" overwrite="true">sips:rls@sip.linphone.org</entry> <entry name="rls_uri" overwrite="true">sips:rls@sip.linphone.org</entry>
</section> </section>
<section name="assistant">
<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>
<section name="lime"> <section name="lime">
<entry name="x3dh_server_url" overwrite="true">https://lime.linphone.org/lime-server/lime-server.php</entry> <entry name="x3dh_server_url" overwrite="true">https://lime.linphone.org/lime-server/lime-server.php</entry>
</section> </section>

View file

@ -46,36 +46,28 @@
<!-- Phone numbers --> <!-- Phone numbers -->
<bool name="use_phone_number_validation">true</bool><!-- Use phone number for validation --> <bool name="use_phone_number_validation">true</bool><!-- Use phone number for validation -->
<!-- Time between two inapp notifications in milliseconds --> <!-- Time between two link your account with phone number dialog in milliseconds -->
<integer name="popup_time_interval">86400000</integer> <integer name="phone_number_linking_popup_time_interval">86400000</integer>
<integer name="phone_number_validation_code_length">4</integer>
<!-- Assistant --> <!-- Assistant -->
<!-- Allow to use an username instead of the phone number for account creation -->
<bool name="assistant_allow_username">true</bool>
<!-- Only on should be set to true at a time! If not the first one will be used --> <!-- Only on should be set to true at a time! If not the first one will be used -->
<!-- Start assistant in loginFragment view instead of menu --> <!-- Start assistant in linphone login view instead of menu -->
<bool name="assistant_use_linphone_login_as_first_fragment">false</bool> <bool name="assistant_use_linphone_login_as_first_fragment">false</bool>
<!-- Start assistant in generic login view instead of menu -->
<bool name="assistant_use_generic_login_as_first_fragment">false</bool>
<!-- Start Linphone creation account in loginFragment view instead of menu --> <!-- Start Linphone creation account in loginFragment view instead of menu -->
<bool name="assistant_use_create_linphone_account_as_first_fragment">false</bool> <bool name="assistant_use_create_linphone_account_as_first_fragment">false</bool>
<bool name="assistant_hide_status_bar">true</bool>
<bool name="assistant_hide_top_bar">false</bool> <bool name="assistant_hide_top_bar">false</bool>
<bool name="replace_assistant_with_old_interface">false</bool>
<bool name="hide_assistant">false</bool>
<bool name="assistant_cancel_move_to_back">false</bool>
<!-- Set the email field of the wizard with one of the gmail account registered on the device -->
<bool name="pre_fill_email_in_assistant">true</bool>
<bool name="assistant_account_validation_mandatory">false</bool>
<bool name="allow_only_phone_numbers_in_assistant">false</bool>
<bool name="hide_linphone_accounts_in_assistant">false</bool> <bool name="hide_linphone_accounts_in_assistant">false</bool>
<bool name="hide_generic_accounts_in_assistant">false</bool> <bool name="hide_generic_accounts_in_assistant">false</bool>
<bool name="hide_remote_provisioning_in_assistant">false</bool> <bool name="hide_remote_provisioning_in_assistant">false</bool>
<!-- Set the email field of the wizard with one of the gmail account registered on the device -->
<bool name="pre_fill_email_in_assistant">true</bool>
<bool name="assistant_account_validation_mandatory">false</bool>
<bool name="display_account_assistant_at_first_start">true</bool> <bool name="display_account_assistant_at_first_start">true</bool>
<bool name="forbid_to_leave_assistant_before_account_configuration">false</bool>
<!-- Remote provisioning -->
<bool name="display_sms_remote_provisioning_activity">false</bool>
<bool name="forbid_app_usage_until_remote_provisioning_completed">false</bool>
<bool name="display_confirmation_popup_after_first_configuration">false</bool>
<bool name="allow_cancel_remote_provisioning_login_activity">true</bool>
<!-- Call --> <!-- Call -->
<bool name="forbid_self_call">false</bool> <bool name="forbid_self_call">false</bool>
@ -91,7 +83,6 @@
<!-- Settings --> <!-- Settings -->
<bool name="disable_every_log">false</bool> <bool name="disable_every_log">false</bool>
<bool name="disable_all_security_features_for_markets">false </bool> <bool name="disable_all_security_features_for_markets">false </bool>
<bool name="disable_all_patented_codecs_for_markets">false</bool> <!-- Disable MPEG4/H264 -->
<bool name="hide_accounts">false</bool> <bool name="hide_accounts">false</bool>
<!-- Chat --> <!-- Chat -->

View file

@ -133,6 +133,7 @@
<string name="phone_number_info_content">\nThanks to your phone number, your friends will find you more easily.\n\n You will see in your address book who is using Linphone and your friends will know that they can reach you on Linphone as well.\n</string> <string name="phone_number_info_content">\nThanks to your phone number, your friends will find you more easily.\n\n You will see in your address book who is using Linphone and your friends will know that they can reach you on Linphone as well.\n</string>
<string name="phone_number_link_info_content">\nYour friends will find you more easily if you link your account to your phone number\n\nYou will see in your address book who is using Linphone and your friends will know that they can reach you on Linphone as well.\n</string> <string name="phone_number_link_info_content">\nYour friends will find you more easily if you link your account to your phone number\n\nYou will see in your address book who is using Linphone and your friends will know that they can reach you on Linphone as well.\n</string>
<string name="phone_number_link_info_content_already_account">You can only use your phone number with one Linphone account.\n\nIf you had already linked your number to an other account but you prefer to use this one, simply link it now and your number will automatically be moved to this account.</string> <string name="phone_number_link_info_content_already_account">You can only use your phone number with one Linphone account.\n\nIf you had already linked your number to an other account but you prefer to use this one, simply link it now and your number will automatically be moved to this account.</string>
<string name="phone_number_overuse">Too much SMS have been sent to this number in a short period of time, try again in 24 hours.</string>
<!-- Status --> <!-- Status -->
<string name="invalid_email">Invalid email</string> <string name="invalid_email">Invalid email</string>
@ -148,11 +149,13 @@
<string name="phone_number_too_long">Phone number too long</string> <string name="phone_number_too_long">Phone number too long</string>
<string name="phone_number_too_short">Phone number too short</string> <string name="phone_number_too_short">Phone number too short</string>
<string name="phone_number_invalid">Invalid phone number</string> <string name="phone_number_invalid">Invalid phone number</string>
<string name="activation_code_invalid">Invalid activation code</string>
<string name="password_too_short">Password too short</string> <string name="password_too_short">Password too short</string>
<string name="password_too_long">Password too long</string> <string name="password_too_long">Password too long</string>
<string name="request_failed">Failed to query the server. Please try again later</string> <string name="request_failed">Failed to query the server. Please try again later</string>
<string name="transport_unsupported">Unsupported transport</string> <string name="transport_unsupported">Unsupported transport</string>
<string name="country_code_invalid">Country code invalid</string> <string name="country_code_invalid">Country code invalid</string>
<string name="invalid_characters">Invalid character(s) found</string>
<!-- In-app --> <!-- In-app -->
<string name="inapp">In-app</string> <string name="inapp">In-app</string>

View file

@ -2,6 +2,9 @@
<resources> <resources>
<style name="LinphoneStyleLight" parent="Theme.AppCompat.Light.NoActionBar"> <style name="LinphoneStyleLight" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Disable animations between activities -->
<item name="android:windowAnimationStyle">@null</item>
<!-- Android theme override --> <!-- Android theme override -->
<item name="colorAccent">@color/primary_color</item> <item name="colorAccent">@color/primary_color</item>
<item name="android:colorPrimary">@color/primary_color</item> <item name="android:colorPrimary">@color/primary_color</item>
@ -41,6 +44,9 @@
</style> </style>
<style name="LinphoneStyleDark" parent="Theme.AppCompat.NoActionBar"> <style name="LinphoneStyleDark" parent="Theme.AppCompat.NoActionBar">
<!-- Disable animations between activities -->
<item name="android:windowAnimationStyle">@null</item>
<!-- Android theme override --> <!-- Android theme override -->
<item name="colorAccent">@color/primary_color</item> <item name="colorAccent">@color/primary_color</item>
<item name="android:colorPrimary">@color/primary_color</item> <item name="android:colorPrimary">@color/primary_color</item>