Added custom boolean to replace wizard by simple interface
This commit is contained in:
parent
43173f0564
commit
46fa49533f
5 changed files with 34 additions and 3 deletions
|
@ -84,6 +84,7 @@
|
|||
<string name="click_to_show_first_login_view">Commencer</string>
|
||||
<string name="dialer_null_on_new_intent">Application pas prête</string>
|
||||
|
||||
<string name="pref_add_account">Ajouter un compte</string>
|
||||
<string name="no_phone_numbers">Aucun numéro trouvé pour %s</string>
|
||||
<string name="filter_contacts">Filtrer contacts</string>
|
||||
<string name="title_numbers_dialog">Numéros de %s</string>
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
<bool name="display_about_in_settings">true</bool>
|
||||
|
||||
<bool name="hide_camera_settings">false</bool>
|
||||
<bool name="replace_wizard_with_old_interface">false</bool>
|
||||
<bool name="hide_wizard">false</bool>
|
||||
<bool name="hide_linphone_accounts_wizard">false</bool>
|
||||
<bool name="hide_generic_accounts_wizard">false</bool>
|
||||
|
|
|
@ -103,7 +103,7 @@
|
|||
<string name="click_to_show_first_login_view">Start</string>
|
||||
<string name="dialer_null_on_new_intent">Application not ready</string>
|
||||
|
||||
|
||||
<string name="pref_add_account">Add account</string>
|
||||
<string name="no_phone_numbers">No phone numbers found for %s</string>
|
||||
<string name="filter_contacts">Filter contacts</string>
|
||||
<string name="title_numbers_dialog">%s\'s phone numbers</string>
|
||||
|
|
|
@ -168,6 +168,17 @@ public class AccountPreferencesFragment extends PreferencesListFragment {
|
|||
public void onPause() {
|
||||
super.onPause();
|
||||
|
||||
SharedPreferences prefs = getPreferenceManager().getSharedPreferences();
|
||||
int n = prefs.getInt(getString(R.string.pref_extra_accounts), 1);
|
||||
String keyUsername = getString(R.string.pref_username_key) + (n-1 == 0 ? "" : Integer.toString(n-1));
|
||||
|
||||
if (prefs.getString(keyUsername, "").equals("")) {
|
||||
//If not, we suppress it to not display a blank field
|
||||
SharedPreferences.Editor editor = prefs.edit();
|
||||
editor.putInt(getString(R.string.pref_extra_accounts), n-1);
|
||||
editor.commit();
|
||||
}
|
||||
|
||||
if (LinphoneActivity.isInstanciated()) {
|
||||
LinphoneActivity.instance().applyConfigChangesIfNeeded();
|
||||
}
|
||||
|
|
|
@ -58,6 +58,7 @@ import android.preference.Preference;
|
|||
import android.preference.Preference.OnPreferenceChangeListener;
|
||||
import android.preference.Preference.OnPreferenceClickListener;
|
||||
import android.preference.PreferenceCategory;
|
||||
import android.preference.PreferenceFragment;
|
||||
import android.preference.PreferenceScreen;
|
||||
|
||||
public class PreferencesFragment extends PreferencesListFragment implements EcCalibrationListener {
|
||||
|
@ -92,9 +93,13 @@ public class PreferencesFragment extends PreferencesListFragment implements EcCa
|
|||
accounts.setLayoutResource(R.layout.hidden);
|
||||
}
|
||||
|
||||
if (getResources().getBoolean(R.bool.hide_wizard)) {
|
||||
if (getResources().getBoolean(R.bool.hide_wizard) || getResources().getBoolean(R.bool.replace_wizard_with_old_interface)) {
|
||||
Preference wizard = (Preference) getPreferenceScreen().getPreference(WIZARD_SETTINGS_ID);
|
||||
wizard.setLayoutResource(R.layout.hidden);
|
||||
if (getResources().getBoolean(R.bool.replace_wizard_with_old_interface)) {
|
||||
createAddAccountButton();
|
||||
} else {
|
||||
wizard.setLayoutResource(R.layout.hidden);
|
||||
}
|
||||
} else {
|
||||
addWizardPreferenceButton();
|
||||
}
|
||||
|
@ -199,6 +204,19 @@ public class PreferencesFragment extends PreferencesListFragment implements EcCa
|
|||
}
|
||||
}
|
||||
|
||||
private void createAddAccountButton() {
|
||||
Preference addAccount = (Preference) getPreferenceScreen().getPreference(WIZARD_SETTINGS_ID);
|
||||
addAccount.setTitle(getString(R.string.pref_add_account));
|
||||
addAccount.setOnPreferenceClickListener(new OnPreferenceClickListener() {
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
addExtraAccountPreferencesButton(accounts, nbAccounts, true);
|
||||
LinphoneActivity.instance().displayAccountSettings(nbAccounts);
|
||||
nbAccounts++;
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void hidePreferenceCategory(int key) {
|
||||
PreferenceCategory p = (PreferenceCategory) findPreference(key);
|
||||
p.removeAll();
|
||||
|
|
Loading…
Reference in a new issue