Add link button in account settings and fix some bugs

This commit is contained in:
Margaux Clerc 2016-09-12 17:14:16 +02:00
parent c39b57d1e0
commit bc08f8da6c
6 changed files with 57 additions and 39 deletions

View file

@ -29,7 +29,7 @@
android:background="@drawable/resizable_textfield"
android:textColor="@color/colorB"
android:contentDescription="@string/content_description_activation_code_field"
android:inputType="text|textNoSuggestions"
android:inputType="number"
android:gravity="center_vertical|center_horizontal"
android:layout_width="match_parent"
android:layout_height="40dp"

View file

@ -32,7 +32,7 @@
android:layout_height="wrap_content"
android:id="@+id/progressBar"
android:layout_marginBottom="50dp"
android:layout_above="@+id/answerNo"
android:layout_above="@+id/buttons"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentRight="true"
@ -50,43 +50,46 @@
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"/>
<Button
style="@style/font7"
android:text="No"
android:textAllCaps="true"
android:layout_width="wrap_content"
<RelativeLayout
android:id="@+id/buttons"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:id="@+id/answerNo"
android:layout_marginBottom="35dp"
android:layout_alignParentBottom="true"
android:layout_toLeftOf="@+id/imageView"
android:layout_toStartOf="@+id/imageView"
android:layout_marginRight="26dp"
android:layout_marginEnd="26dp"/>
android:layout_alignParentBottom="true">
<Button
style="@style/font7"
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
android:id="@+id/answerNo"
android:text="@string/no"
android:background="@drawable/assistant_button"
android:textColor="@drawable/assistant_button_text_color"
style="@style/font8"
android:layout_alignParentLeft="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"/>
<Button
style="@style/font7"
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_alignTop="@+id/answerYes"
android:layout_centerHorizontal="true"/>
<Button
android:id="@+id/answerOk"
android:text="@string/ok"
android:background="@drawable/assistant_button"
android:textColor="@drawable/assistant_button_text_color"
style="@style/font8"
android:layout_centerInParent="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"/>
<Button
android:id="@+id/answerYes"
android:text="@string/yes"
android:background="@drawable/assistant_button"
android:textColor="@drawable/assistant_button_text_color"
style="@style/font8"
android:layout_alignParentRight="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"/>
</RelativeLayout>
<TextView
style="@style/font7"

View file

@ -75,6 +75,7 @@
<string name="pref_service_notification_key">pref_service_notification_key</string>
<string name="pref_escape_plus_key">pref_escape_plus_key</string>
<string name="pref_friendlist_subscribe_key">pref_friendlist_subscribe_key</string>
<string name="pref_link_account_key">pref_link_account_key</string>
<string name="pref_echo_cancellation_key">pref_echo_cancellation_key</string>
<string name="pref_autostart_key">pref_autostart_key</string>
<string name="pref_enable_outbound_proxy_key">Outbound proxy</string>

View file

@ -52,6 +52,10 @@
<string name="link">Link</string>
<string name="link_account_popup">Do you want to link the account %s with your phone number ?</string>
<string name="maybe_later">Maybe later</string>
<string name="later">Later</string>
<string name="no">No</string>
<string name="ok">Ok</string>
<string name="yes">Yes</string>
<string name="link_account">Link account</string>
<!-- Launch screen -->
@ -251,6 +255,7 @@
<string name="pref_avpf_rr_interval"> AVPF regular RTCP interval in seconds (between 1 and 5)</string>
<string name="pref_escape_plus">Replace + by 00</string>
<string name="pref_friendlist_subscribe">Friendlist subscribe</string>
<string name="pref_link_account">Link account</string>
<string name="pref_auth_userid">Auth userid</string>
<string name="pref_help_auth_userid">Enter authentication userid (optional)</string>
<string name="pref_display_name">Display name</string>

View file

@ -240,6 +240,13 @@ public class AccountPreferencesFragment extends PreferencesListFragment {
return true;
}
};
OnPreferenceClickListener linkAccountListener = new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
LinphoneActivity.instance().displayLinkPhoneNumber();
return true;
}
};
OnPreferenceChangeListener disableChangedListener = new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
@ -371,6 +378,9 @@ public class AccountPreferencesFragment extends PreferencesListFragment {
if(!isNewAccount){
friendlistSubscribe.setChecked(mPrefs.isFriendlistsubscriptionEnabled());
}
Preference linkAccount = advanced.getPreference(9);
linkAccount.setOnPreferenceClickListener(linkAccountListener);
PreferenceCategory manage = (PreferenceCategory) getPreferenceScreen().findPreference(getString(R.string.pref_manage_key));
final CheckBoxPreference disable = (CheckBoxPreference) manage.getPreference(0);

View file

@ -370,7 +370,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
if(state.equals(RegistrationState.RegistrationOk) && LinphonePreferences.instance().getLinkPopupTime() != ""){
if(getResources().getBoolean(R.bool.use_phone_number_validation)) {
if (LinphonePreferences.instance().getLinkPopupTime() == null || (LinphonePreferences.instance().getLinkPopupTime() != null && !LinphonePreferences.instance().getLinkPopupTime().equals(""))){
if (LinphonePreferences.instance().getLinkPopupTime() == null || (LinphonePreferences.instance().getLinkPopupTime() != null)){
isAccountWithAlias();
}
}
@ -566,7 +566,6 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
}
private void changeFragment(Fragment newFragment, FragmentsAvailable newFragmentType, boolean withoutAnimation) {
FragmentManager fm = getFragmentManager();
FragmentTransaction transaction = fm.beginTransaction();
@ -1813,7 +1812,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
accountCreator.setUsername(LinphonePreferences.instance().getAccountUsername(LinphonePreferences.instance().getDefaultAccountIndex()));
accountCreator.isAccountUsed();
} else {
LinphonePreferences.instance().setInappPopupTime(null);
LinphonePreferences.instance().setLinkPopupTime(null);
}
}