Works on assistant for tablet
This commit is contained in:
parent
967ab77533
commit
f1d3a1bfac
10 changed files with 261 additions and 236 deletions
|
@ -23,7 +23,8 @@
|
|||
android:paddingTop="10dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/message_create_account"/>
|
||||
|
||||
|
||||
<TableLayout
|
||||
|
@ -133,42 +134,12 @@
|
|||
android:id="@+id/sip_uri"
|
||||
style="@style/font9"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:layout_weight="1"
|
||||
android:gravity="left"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp">
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/use_username"
|
||||
android:visibility="visible"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/use_username_instead_or_phone_number"
|
||||
android:checked="false" android:layout_column="1"/>
|
||||
</TableRow>
|
||||
android:visibility="visible"/>
|
||||
|
||||
<TableRow
|
||||
android:layout_weight="1"
|
||||
android:gravity="left"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp">
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/use_email"
|
||||
android:visibility="visible"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/use_email_for_validation" android:layout_column="1"
|
||||
android:checked="false"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</TableRow>
|
||||
|
||||
|
@ -178,14 +149,51 @@
|
|||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/username_layout"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_column="0">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/username_label"
|
||||
android:text="@string/username"
|
||||
style="@style/font13"
|
||||
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/colorB"
|
||||
android:inputType="text|textNoSuggestions"
|
||||
android:contentDescription="@string/content_description_username_field"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"
|
||||
android:singleLine="true"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/username_error"
|
||||
android:text="@string/error"
|
||||
style="@style/font20"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="invisible"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/password_layout"
|
||||
android:orientation="vertical"
|
||||
android:visibility="visible"
|
||||
android:visibility="gone"
|
||||
android:paddingLeft="30dp"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content" android:layout_column="0">
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_column="1">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/password_label"
|
||||
|
@ -216,40 +224,7 @@
|
|||
android:visibility="invisible"/>
|
||||
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:id="@+id/username_layout"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content" android:layout_column="1">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/username_label"
|
||||
android:text="@string/username"
|
||||
style="@style/font13"
|
||||
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/colorB"
|
||||
android:inputType="text|textNoSuggestions"
|
||||
android:contentDescription="@string/content_description_username_field"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"
|
||||
android:singleLine="true"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/username_error"
|
||||
android:text="@string/error"
|
||||
style="@style/font20"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="invisible"/>
|
||||
</LinearLayout>
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
|
@ -264,7 +239,6 @@
|
|||
android:orientation="vertical"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:paddingLeft="30dp"
|
||||
android:layout_height="wrap_content" android:layout_column="0">
|
||||
|
||||
<TextView
|
||||
|
@ -297,13 +271,15 @@
|
|||
android:visibility="invisible"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/password_confirm_layout"
|
||||
android:visibility="gone"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content" android:layout_column="1">
|
||||
android:layout_height="wrap_content" android:layout_column="1"
|
||||
android:paddingLeft="30dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/confirm_password_label"
|
||||
|
@ -336,6 +312,39 @@
|
|||
|
||||
</LinearLayout>
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:layout_weight="1"
|
||||
android:gravity="left"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp">
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/use_username"
|
||||
android:visibility="visible"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/use_username_instead_or_phone_number"
|
||||
android:checked="false"
|
||||
android:layout_column="1"/>
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:layout_weight="1"
|
||||
android:gravity="left"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp">
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/use_email"
|
||||
android:visibility="visible"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/use_email_for_validation"
|
||||
android:layout_column="1"
|
||||
android:checked="false"/>
|
||||
|
||||
</TableRow>
|
||||
</TableLayout>
|
||||
|
||||
<Button
|
||||
|
|
|
@ -19,7 +19,8 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="10dp"
|
||||
android:layout_gravity="center"/>
|
||||
android:layout_gravity="center"
|
||||
android:id="@+id/message_phone_number"/>
|
||||
|
||||
|
||||
|
||||
|
@ -110,23 +111,17 @@
|
|||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:layout_weight="1"
|
||||
android:gravity="left"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp">
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/use_username"
|
||||
android:visibility="visible"
|
||||
<TextView
|
||||
android:id="@+id/phone_number_error_2"
|
||||
android:text="@string/error"
|
||||
style="@style/font20"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/login_with_username"/>
|
||||
android:visibility="invisible"/>
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
|
@ -233,6 +228,20 @@
|
|||
android:layout_height="0dp"/>
|
||||
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:layout_weight="1"
|
||||
android:gravity="left"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp">
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/use_username"
|
||||
android:visibility="visible"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/login_with_username"/>
|
||||
</TableRow>
|
||||
</TableLayout>
|
||||
|
||||
<Button
|
||||
|
|
|
@ -24,7 +24,8 @@
|
|||
android:paddingTop="10dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/message_create_account"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
@ -121,21 +122,6 @@
|
|||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/use_username"
|
||||
android:visibility="gone"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/use_username_instead_or_phone_number"/>
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/use_email"
|
||||
android:visibility="gone"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/use_email_for_validation"/>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/username_layout"
|
||||
android:visibility="gone"
|
||||
|
@ -171,6 +157,49 @@
|
|||
|
||||
</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/font13"
|
||||
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/colorB"
|
||||
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:singleLine="true"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/email_error"
|
||||
android:text="@string/error"
|
||||
style="@style/font20"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="invisible"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/password_layout"
|
||||
android:visibility="gone"
|
||||
|
@ -253,50 +282,21 @@
|
|||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/email_layout"
|
||||
</LinearLayout>
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/use_username"
|
||||
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/font13"
|
||||
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/colorB"
|
||||
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:singleLine="true"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/email_error"
|
||||
android:text="@string/error"
|
||||
style="@style/font20"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="invisible"/>
|
||||
android:text="@string/use_username_instead_or_phone_number"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
<CheckBox
|
||||
android:id="@+id/use_email"
|
||||
android:visibility="gone"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/use_email_for_validation"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/assistant_create"
|
||||
|
|
|
@ -96,7 +96,7 @@
|
|||
android:textCursorDrawable="@null"
|
||||
android:inputType="textShortMessage|textMultiLine"
|
||||
android:contentDescription="@string/content_description_message"
|
||||
android:maxLines="2"
|
||||
android:maxLines="50"
|
||||
android:padding="5dp"
|
||||
android:layout_margin="5dp"
|
||||
android:layout_weight="1"
|
||||
|
|
|
@ -1,34 +0,0 @@
|
|||
#
|
||||
#This file shall not contain path referencing package name, in order to be portable when app is renamed.
|
||||
#Paths to resources must be set from LinphoneManager, after creating LinphoneCore.
|
||||
|
||||
[net]
|
||||
mtu=1300
|
||||
|
||||
[sip]
|
||||
guess_hostname=1
|
||||
inc_timeout=15
|
||||
register_only_when_network_is_up=1
|
||||
auto_net_state_mon=0
|
||||
auto_answer_replacing_calls=1
|
||||
ping_with_options=0
|
||||
|
||||
[rtp]
|
||||
audio_rtp_port=7076
|
||||
video_rtp_port=9078
|
||||
audio_jitt_comp=60
|
||||
video_jitt_comp=60
|
||||
nortp_timeout=30
|
||||
disable_upnp=1
|
||||
|
||||
[sound]
|
||||
playback_dev_id=
|
||||
ringer_dev_id=
|
||||
capture_dev_id=
|
||||
dtmf_player_amp=0.1
|
||||
|
||||
#remove this property for any application that is not Linphone public version itself
|
||||
ec_calibrator_cool_tones=1
|
||||
|
||||
[misc]
|
||||
max_calls=10
|
|
@ -81,6 +81,7 @@
|
|||
<string name="assistant_remote_provisioning">Fetch remote configuration</string>
|
||||
<string name="assistant_create_account_part_1">Please confirm your country code and enter your phone number</string>
|
||||
<string name="assistant_create_account_part_2">We have sent you a SMS with a validation code.\n\nTo complete your phone number verification, please enter the 4 digit code below:\n</string>
|
||||
<string name="assistant_create_account_part_email">Please enter an username, email and password for your Linphone account</string>
|
||||
<string name="assistant_display_name_optional">Display name (optional)</string>
|
||||
<string name="assistant_linphone_account">Use your Linphone account</string>
|
||||
<string name="assistant_generic_account">Use SIP account</string>
|
||||
|
|
|
@ -57,6 +57,7 @@ import org.linphone.mediastream.video.capture.hwconf.Hacks;
|
|||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.ContentValues;
|
||||
import android.content.Context;
|
||||
|
@ -619,17 +620,17 @@ public final class LinphoneUtils {
|
|||
return ctxt.getString(R.string.invalid_display_name);
|
||||
if (status.equals(LinphoneAccountCreator.Status.Failed))
|
||||
return ctxt.getString(R.string.request_failed);
|
||||
if (status.equals(LinphoneAccountCreator.Status.ErrorServeur))
|
||||
if (status.equals(LinphoneAccountCreator.Status.ErrorServer))
|
||||
return ctxt.getString(R.string.wizard_failed);
|
||||
if (status.equals(LinphoneAccountCreator.Status.TransportNotSupported))
|
||||
return ctxt.getString(R.string.transport_unsupported);
|
||||
if (status.equals(LinphoneAccountCreator.Status.AccountExist))
|
||||
if (status.equals(LinphoneAccountCreator.Status.AccountExist)
|
||||
|| status.equals(LinphoneAccountCreator.Status.AccountExistWithAlias))
|
||||
return ctxt.getString(R.string.account_already_exist);
|
||||
if (status.equals(LinphoneAccountCreator.Status.CountryCodeInvalid))
|
||||
return ctxt.getString(R.string.country_code_invalid);
|
||||
if (status.equals(LinphoneAccountCreator.Status.PhoneNumberUsedAccount)
|
||||
|| status.equals(LinphoneAccountCreator.Status.PhoneNumberUsedAlias)
|
||||
|| status.equals(LinphoneAccountCreator.Status.AccountExistWithAlias))
|
||||
|| status.equals(LinphoneAccountCreator.Status.PhoneNumberUsedAlias))
|
||||
return ctxt.getString(R.string.assistant_phone_number_unavailable);
|
||||
if (status.equals(LinphoneAccountCreator.Status.AccountNotExist))
|
||||
return ctxt.getString(R.string.assistant_error_bad_credentials);
|
||||
|
|
|
@ -22,6 +22,7 @@ import java.util.Locale;
|
|||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.linphone.LinphoneActivity;
|
||||
import org.linphone.LinphoneManager;
|
||||
import org.linphone.LinphonePreferences;
|
||||
import org.linphone.LinphoneUtils;
|
||||
|
@ -31,6 +32,7 @@ import org.linphone.core.LinphoneAccountCreator.LinphoneAccountCreatorListener;
|
|||
import org.linphone.core.LinphoneAccountCreator.Status;
|
||||
import org.linphone.core.LinphoneCoreFactory;
|
||||
import org.linphone.core.LinphoneProxyConfig;
|
||||
import org.w3c.dom.Text;
|
||||
|
||||
import android.accounts.Account;
|
||||
import android.accounts.AccountManager;
|
||||
|
@ -63,7 +65,7 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
|
|||
private EditText phoneNumberEdit, usernameEdit, passwordEdit, passwordConfirmEdit
|
||||
, emailEdit, dialCode;
|
||||
private TextView phoneNumberError, passwordError, passwordConfirmError
|
||||
, emailError, assisstantTitle, sipUri, skip;
|
||||
, emailError, assisstantTitle, sipUri, skip, instruction;
|
||||
private ImageView phoneNumberInfo;
|
||||
|
||||
private boolean passwordOk = false;
|
||||
|
@ -88,6 +90,8 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
|
|||
accountCreator.setDomain(getResources().getString(R.string.default_domain));
|
||||
accountCreator.setListener(this);
|
||||
|
||||
instruction = (TextView) view.findViewById(R.id.message_create_account);
|
||||
|
||||
createAccount = (Button) view.findViewById(R.id.assistant_create);
|
||||
|
||||
phoneNumberLayout = (LinearLayout) view.findViewById(R.id.phone_number_layout);
|
||||
|
@ -243,9 +247,6 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
|
|||
if (buttonView.getId() == R.id.use_username) {
|
||||
if (isChecked) {
|
||||
usernameLayout.setVisibility(View.VISIBLE);
|
||||
if (getResources().getBoolean(R.bool.isTablet)) {
|
||||
passwordLayout.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
onTextChanged2();
|
||||
} else {
|
||||
usernameLayout.setVisibility(View.GONE);
|
||||
|
@ -254,19 +255,33 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
|
|||
}
|
||||
} else if (buttonView.getId() == R.id.use_email) {
|
||||
if (isChecked) {
|
||||
dialCode.setBackgroundResource(R.drawable.resizable_textfield);
|
||||
phoneNumberEdit.setBackgroundResource(R.drawable.resizable_textfield);
|
||||
useUsername.setEnabled(false);
|
||||
dialCode.setEnabled(false);
|
||||
selectCountry.setEnabled(false);
|
||||
phoneNumberEdit.setEnabled(false);
|
||||
emailLayout.setVisibility(View.VISIBLE);
|
||||
passwordLayout.setVisibility(View.VISIBLE);
|
||||
passwordConfirmLayout.setVisibility(View.VISIBLE);
|
||||
usernameLayout.setVisibility(View.VISIBLE);
|
||||
|
||||
useUsername.setVisibility(CheckBox.GONE);
|
||||
phoneNumberLayout.setVisibility(LinearLayout.GONE);
|
||||
instruction.setText(getString(R.string.assistant_create_account_part_email));
|
||||
} else {
|
||||
if (!useUsername.isChecked()) {
|
||||
usernameLayout.setVisibility(View.GONE);
|
||||
}
|
||||
useUsername.setEnabled(true);
|
||||
dialCode.setEnabled(true);
|
||||
selectCountry.setEnabled(true);
|
||||
phoneNumberEdit.setEnabled(true);
|
||||
emailLayout.setVisibility(View.GONE);
|
||||
passwordLayout.setVisibility(View.GONE);
|
||||
passwordConfirmLayout.setVisibility(View.GONE);
|
||||
usernameLayout.setVisibility(View.GONE);
|
||||
useUsername.setVisibility(CheckBox.VISIBLE);
|
||||
phoneNumberLayout.setVisibility(LinearLayout.VISIBLE);
|
||||
instruction.setText(getString(R.string.assistant_create_account_part_1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -302,10 +317,17 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
|
|||
|
||||
case R.id.assistant_create: {
|
||||
createAccount.setEnabled(false);
|
||||
if (linkAccount)
|
||||
if (linkAccount) {
|
||||
addAlias();
|
||||
else
|
||||
} else {
|
||||
if (getUsername().length() > 0) {
|
||||
accountCreator.isAccountUsed();
|
||||
} else {
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForStatus(Status.UsernameTooShort)
|
||||
, AssistantActivity.instance());
|
||||
createAccount.setEnabled(true);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -331,14 +353,14 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
|
|||
accountCreator.linkPhoneNumberWithAccount();
|
||||
} else {
|
||||
createAccount.setEnabled(true);
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForStatus(status), getContext());
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForStatus(status), AssistantActivity.instance());
|
||||
LinphoneUtils.displayError(isOk, phoneNumberError, LinphoneUtils.errorForStatus(status));
|
||||
}
|
||||
}
|
||||
|
||||
private void createAccount() {
|
||||
if (getResources().getBoolean(R.bool.isTablet)
|
||||
|| !getResources().getBoolean(R.bool.use_phone_number_validation)) {
|
||||
if ((getResources().getBoolean(R.bool.isTablet) || !getResources().getBoolean(R.bool.use_phone_number_validation))
|
||||
&& useEmail.isChecked()) {
|
||||
Status emailStatus;
|
||||
Status passwordStatus;
|
||||
|
||||
|
@ -347,10 +369,12 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
|
|||
|
||||
if (!emailOk) {
|
||||
LinphoneUtils.displayError(false, emailError, LinphoneUtils.errorForStatus(emailStatus));
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForStatus(emailStatus), getContext());
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForStatus(emailStatus)
|
||||
, AssistantActivity.instance());
|
||||
} else if (!passwordOk) {
|
||||
LinphoneUtils.displayError(false, passwordError, LinphoneUtils.errorForStatus(passwordStatus));
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForStatus(passwordStatus), getContext());
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForStatus(passwordStatus)
|
||||
, AssistantActivity.instance());
|
||||
} else if (!confirmPasswordOk) {
|
||||
String msg;
|
||||
if (passwordConfirmEdit.getText().toString().equals(passwordEdit.getText().toString())) {
|
||||
|
@ -359,7 +383,7 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
|
|||
msg = getString(R.string.wizard_passwords_unmatched);
|
||||
}
|
||||
LinphoneUtils.displayError(false, passwordError, msg);
|
||||
LinphoneUtils.displayErrorAlert(msg, getContext());
|
||||
LinphoneUtils.displayErrorAlert(msg, AssistantActivity.instance());
|
||||
} else {
|
||||
accountCreator.createAccount();
|
||||
}
|
||||
|
@ -381,15 +405,16 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
|
|||
accountCreator.createAccount();
|
||||
} else {
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForStatus(phoneStatus)
|
||||
, getContext());
|
||||
, AssistantActivity.instance());
|
||||
LinphoneUtils.displayError(isOk, phoneNumberError
|
||||
, LinphoneUtils.errorForStatus(phoneStatus));
|
||||
}
|
||||
} else {
|
||||
LinphoneUtils.displayErrorAlert(getString(R.string.assistant_create_account_part_1)
|
||||
, getContext());
|
||||
, AssistantActivity.instance());
|
||||
}
|
||||
}
|
||||
createAccount.setEnabled(true);
|
||||
}
|
||||
|
||||
private LinphoneAccountCreator.Status getPhoneNumberStatus() {
|
||||
|
@ -400,17 +425,16 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
|
|||
}
|
||||
|
||||
public void onTextChanged2() {
|
||||
String msg;
|
||||
String msg = "";
|
||||
accountCreator.setUsername(getUsername());
|
||||
|
||||
if (!useEmail.isChecked() && getResources().getBoolean(R.bool.use_phone_number_validation)) {
|
||||
LinphoneAccountCreator.Status status = getPhoneNumberStatus();
|
||||
boolean isOk = status.equals(LinphoneAccountCreator.Status.Ok);
|
||||
LinphoneUtils.displayError(isOk, phoneNumberError, LinphoneUtils.errorForStatus(status));
|
||||
|
||||
accountCreator.setUsername(getUsername());
|
||||
|
||||
// Username or phone number
|
||||
if (getResources().getBoolean(R.bool.assistant_allow_username) && useUsername.isChecked()
|
||||
|| (getResources().getBoolean(R.bool.isTablet) || useEmail.isChecked()
|
||||
|| !getResources().getBoolean(R.bool.use_phone_number_validation))) {
|
||||
if (getResources().getBoolean(R.bool.assistant_allow_username) && useUsername.isChecked()) {
|
||||
addressSip = getUsername();
|
||||
}
|
||||
|
||||
|
@ -418,11 +442,9 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
|
|||
if (status.equals(LinphoneAccountCreator.Status.CountryCodeInvalid)) {
|
||||
dialCode.setBackgroundResource(R.drawable.resizable_textfield_error);
|
||||
phoneNumberEdit.setBackgroundResource(R.drawable.resizable_textfield);
|
||||
sipUri.setText("");
|
||||
} else {
|
||||
dialCode.setBackgroundResource(R.drawable.resizable_textfield);
|
||||
phoneNumberEdit.setBackgroundResource(R.drawable.resizable_textfield_error);
|
||||
sipUri.setText("");
|
||||
}
|
||||
} else {
|
||||
dialCode.setBackgroundResource(R.drawable.resizable_textfield);
|
||||
|
@ -430,11 +452,16 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
|
|||
if (!linkAccount && addressSip.length() > 0) {
|
||||
msg = getResources().getString(R.string.assistant_create_account_phone_number_address)
|
||||
+ " <" + addressSip + "@" + getResources().getString(R.string.default_domain) + ">";
|
||||
sipUri.setText(msg);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
sipUri.setText("");
|
||||
addressSip = getUsername();
|
||||
if (addressSip.length() > 0) {
|
||||
msg = getResources().getString(R.string.assistant_create_account_phone_number_address)
|
||||
+ " <" + addressSip + "@" + getResources().getString(R.string.default_domain) + ">";
|
||||
}
|
||||
}
|
||||
sipUri.setText(msg);
|
||||
}
|
||||
|
||||
private void addPhoneNumberHandler(final EditText field, final ImageView icon) {
|
||||
|
@ -557,7 +584,13 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
|
|||
@Override
|
||||
public void onAccountCreatorIsAccountUsed(LinphoneAccountCreator accountCreator, final Status status) {
|
||||
if (status.equals(Status.AccountExist) || status.equals(Status.AccountExistWithAlias)) {
|
||||
if (useEmail.isChecked()) {
|
||||
createAccount.setEnabled(true);
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForStatus(status)
|
||||
, AssistantActivity.instance());
|
||||
} else {
|
||||
accountCreator.isPhoneNumberUsed();
|
||||
}
|
||||
} else {
|
||||
createAccount();
|
||||
}
|
||||
|
@ -576,7 +609,8 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
|
|||
}
|
||||
} else {
|
||||
createAccount.setEnabled(true);
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForStatus(status), getContext());
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForStatus(status)
|
||||
, AssistantActivity.instance());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -613,7 +647,8 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
|
|||
}
|
||||
} else {
|
||||
createAccount.setEnabled(true);
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForStatus(status), getContext());
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForStatus(status)
|
||||
, AssistantActivity.instance());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -625,7 +660,8 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
|
|||
} else {
|
||||
createAccount.setEnabled(true);
|
||||
//SMS error
|
||||
LinphoneUtils.displayErrorAlert(getString(R.string.request_failed), getContext());
|
||||
LinphoneUtils.displayErrorAlert(getString(R.string.request_failed)
|
||||
, AssistantActivity.instance());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -640,7 +676,8 @@ public class CreateAccountFragment extends Fragment implements CompoundButton.On
|
|||
accountCreator.isAccountActivated();
|
||||
} else {
|
||||
createAccount.setEnabled(true);
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForStatus(status), getContext());
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForStatus(status)
|
||||
, AssistantActivity.instance());
|
||||
}
|
||||
} else {
|
||||
accountCreator.isAccountActivated();
|
||||
|
|
|
@ -162,7 +162,7 @@ public class LinphoneLoginFragment extends Fragment implements CompoundButton.On
|
|||
|
||||
public void linphoneLogIn() {
|
||||
if (login.getText() == null || login.length() == 0 || password.getText() == null || password.length() == 0) {
|
||||
LinphoneUtils.displayErrorAlert(getString(R.string.first_launch_no_login_password), getContext());
|
||||
LinphoneUtils.displayErrorAlert(getString(R.string.first_launch_no_login_password), AssistantActivity.instance());
|
||||
apply.setEnabled(true);
|
||||
return;
|
||||
}
|
||||
|
@ -244,12 +244,14 @@ public class LinphoneLoginFragment extends Fragment implements CompoundButton.On
|
|||
accountCreator.isPhoneNumberUsed();
|
||||
} else {
|
||||
apply.setEnabled(true);
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForStatus(status), getContext());
|
||||
LinphoneUtils.displayError(isOk, phoneNumberError, LinphoneUtils.errorForStatus(status));
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForStatus(status),
|
||||
AssistantActivity.instance());
|
||||
LinphoneUtils.displayError(isOk, phoneNumberError,
|
||||
LinphoneUtils.errorForStatus(status));
|
||||
}
|
||||
} else {
|
||||
apply.setEnabled(true);
|
||||
LinphoneUtils.displayErrorAlert(getString(R.string.assistant_create_account_part_1), getContext());
|
||||
LinphoneUtils.displayErrorAlert(getString(R.string.assistant_create_account_part_1), AssistantActivity.instance());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -347,7 +349,7 @@ public class LinphoneLoginFragment extends Fragment implements CompoundButton.On
|
|||
accountCreator.recoverPhoneAccount();
|
||||
} else {
|
||||
apply.setEnabled(true);
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForStatus(status), getContext());
|
||||
LinphoneUtils.displayErrorAlert(LinphoneUtils.errorForStatus(status), AssistantActivity.instance());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 565f83f13d731e5ed90fe1a466c5f21a55eb44ce
|
||||
Subproject commit 43b61677f39580147ae622ba7716f6b9731580be
|
Loading…
Reference in a new issue