Clean settings and add orientation preference

This commit is contained in:
Margaux Clerc 2015-11-19 15:08:15 +01:00
parent 1a32603085
commit 41d998beb9
8 changed files with 28 additions and 66 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View file

@ -1,13 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- New settings -->
<bool name="assistant_use_linphone_login_as_first_fragment">false</bool>
<bool name="hide_in_call_stats">false</bool>
<string name="default_domain">sip.linphone.org</string>
<string name="default_stun">stun.linphone.org</string>
<bool name="assistant_use_linphone_login_as_first_fragment">false</bool>
<bool name="hide_in_call_stats">false</bool>
<bool name="use_linphone_friend">false</bool>
<bool name="orientation_portrait_only">false</bool>
<bool name="show_statusbar_only_on_dialer">false</bool>
<bool name="replace_assistant_with_old_interface">false</bool>
<string name="wizard_url">https://www.linphone.org/wizard.php</string>
@ -70,7 +73,6 @@
<bool name="hide_phone_numbers_in_editor">false</bool>
<bool name="hide_sip_addresses_in_editor">false</bool>
<bool name="setup_cancel_move_to_back">false</bool>
<bool name="replace_wizard_with_old_interface">false</bool>
<bool name="enable_call_notification">true</bool>

View file

@ -36,7 +36,6 @@
<string name="pref_add_account_key">pref_add_account_key</string>
<string name="pref_video_key">pref_video_key</string>
<string name="pref_video_codecs_key">pref_video_codecs_key</string>
<string name="pref_linphone_friend_key">pref_linphone_friend_key</string>
<string name="pref_transport_key">pref_transport_key</string>
<string name="pref_transport_udp_key">pref_transport_udp_key</string>

View file

@ -85,6 +85,13 @@
<string name="call_paused_by_remote">Your correspondent paused the call</string>
<string name="zrtp_dialog">ZRTP token is %s\nYou should only accept if you have the same token as your correspondent</string>
<!-- Settings -->
<string-array name="video_preset_entries">
<item>default</item>
<item>high-fps</item>
<item>custom</item>
</string-array>
<!-- Content description -->
<string name="content_description_toggle_micro">Toggle micro</string>

View file

@ -104,7 +104,9 @@
<ListPreference
android:title="Video preset"
android:key="@string/pref_video_preset_key"/>
android:key="@string/pref_video_preset_key"
android:entries="@array/video_preset_entries"
android:entryValues="@array/video_preset_entries" />
<ListPreference
android:title="@string/pref_preferred_video_size"
@ -267,15 +269,4 @@
</PreferenceCategory>
<PreferenceCategory
android:title="@string/pref_linphone_friend_title"
android:key="@string/pref_linphone_friend_key">
<CheckBoxPreference
android:title="@string/pref_auto_accept_friends_title"
android:key="@string/pref_auto_accept_friends_key"
android:summary="@string/pref_auto_accept_friends_desc"/>
</PreferenceCategory>
</PreferenceScreen>

View file

@ -135,7 +135,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
if (isTablet() && getRequestedOrientation() != ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
} else if (!isTablet() && getResources().getBoolean(R.bool.orientation_portrait_only)) {
} else if (getResources().getBoolean(R.bool.orientation_portrait_only)) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}

View file

@ -52,9 +52,9 @@ public class LinphoneLauncherActivity extends Activity {
// Hack to avoid to draw twice LinphoneActivity on tablets
if (getResources().getBoolean(R.bool.isTablet)) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
} else {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
} else if (getResources().getBoolean(R.bool.orientation_portrait_only)) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
setContentView(R.layout.launch_screen);
mHandler = new Handler();

View file

@ -28,7 +28,6 @@ import org.linphone.core.LinphoneCore.AdaptiveRateAlgorithm;
import org.linphone.core.LinphoneCore.EcCalibratorStatus;
import org.linphone.core.LinphoneCore.MediaEncryption;
import org.linphone.core.LinphoneCoreException;
import org.linphone.core.LinphoneCoreFactory;
import org.linphone.core.LinphoneCoreListenerBase;
import org.linphone.core.LinphoneProxyConfig;
import org.linphone.core.PayloadType;
@ -98,8 +97,6 @@ public class SettingsFragment extends PreferencesListFragment {
// Inits the values or the listener on some settings
private void initSettings() {
//Init accounts on Resume instead of on Create to update the account list when coming back from wizard
initTunnelSettings();
initAudioSettings();
initVideoSettings();
@ -133,7 +130,7 @@ public class SettingsFragment extends PreferencesListFragment {
emptyAndHidePreference(R.string.pref_sipaccounts_key);
}
if(!getResources().getBoolean(R.bool.replace_wizard_with_old_interface)){
if(!getResources().getBoolean(R.bool.replace_assistant_with_old_interface)){
hidePreference(R.string.pref_add_account_key);
}
@ -141,10 +138,6 @@ public class SettingsFragment extends PreferencesListFragment {
uncheckAndHidePreference(R.string.pref_animation_enable_key);
}
if (!getResources().getBoolean(R.bool.enable_linphone_friends)) {
emptyAndHidePreference(R.string.pref_linphone_friend_key);
}
if (getResources().getBoolean(R.bool.disable_chat)) {
findPreference(getString(R.string.pref_image_sharing_server_key)).setLayoutResource(R.layout.hidden);
}
@ -320,13 +313,7 @@ public class SettingsFragment extends PreferencesListFragment {
if (LinphoneManager.getLcIfManagerNotDestroyedOrNull() != null) {
for (LinphoneProxyConfig lpc : LinphoneManager.getLc().getProxyConfigList()) {
LinphoneAddress addr = null;
try {
addr = LinphoneCoreFactory.instance().createLinphoneAddress(lpc.getIdentity());
} catch (LinphoneCoreException e) {
me.setLed(R.drawable.led_disconnected);
return;
}
LinphoneAddress addr = lpc.getAddress();
if (addr.getUserName().equals(username) && addr.getDomain().equals(domain)) {
if (lpc.getState() == LinphoneCore.RegistrationState.RegistrationOk) {
me.setLed(R.drawable.led_connected);
@ -397,21 +384,6 @@ public class SettingsFragment extends PreferencesListFragment {
pref.setValue(key);
}
private void initializeVideoPresetPreferences(ListPreference pref) {
List<CharSequence> entries = new ArrayList<CharSequence>();
List<CharSequence> values = new ArrayList<CharSequence>();
entries.add("default");
values.add("default");
entries.add("high-fps");
values.add("high-fps");
entries.add("custom");
values.add("custom");
setListPreferenceValues(pref, entries, values);
String value = mPrefs.getVideoPreset();
pref.setSummary(value);
pref.setValue(value);
}
private void initializePreferredVideoSizePreferences(ListPreference pref) {
List<CharSequence> entries = new ArrayList<CharSequence>();
List<CharSequence> values = new ArrayList<CharSequence>();
@ -581,7 +553,6 @@ public class SettingsFragment extends PreferencesListFragment {
}
private void initVideoSettings() {
initializeVideoPresetPreferences((ListPreference) findPreference(getString(R.string.pref_video_preset_key)));
initializePreferredVideoSizePreferences((ListPreference) findPreference(getString(R.string.pref_preferred_video_size_key)));
initializePreferredVideoFpsPreferences((ListPreference) findPreference(getString(R.string.pref_preferred_video_fps_key)));
EditTextPreference bandwidth = (EditTextPreference) findPreference(getString(R.string.pref_bandwidth_limit_key));
@ -589,6 +560,10 @@ public class SettingsFragment extends PreferencesListFragment {
bandwidth.setSummary(bandwidth.getText());
updateVideoPreferencesAccordingToPreset();
ListPreference videoPresetPref = (ListPreference) findPreference(getString(R.string.pref_video_preset_key));
videoPresetPref.setSummary(mPrefs.getVideoPreset());
videoPresetPref.setValue(mPrefs.getVideoPreset());
PreferenceCategory codecs = (PreferenceCategory) findPreference(getString(R.string.pref_video_codecs_key));
codecs.removeAll();
@ -630,7 +605,6 @@ public class SettingsFragment extends PreferencesListFragment {
((CheckBoxPreference) findPreference(getString(R.string.pref_video_enable_key))).setChecked(mPrefs.isVideoEnabled());
((CheckBoxPreference) findPreference(getString(R.string.pref_video_use_front_camera_key))).setChecked(mPrefs.useFrontCam());
((CheckBoxPreference) findPreference(getString(R.string.pref_video_initiate_call_with_video_key))).setChecked(mPrefs.shouldInitiateVideoCall());
//((CheckBoxPreference) findPreference(getString(R.string.pref_video_automatically_share_my_video_key))).setChecked(mPrefs.shouldAutomaticallyShareMyVideo());
((CheckBoxPreference) findPreference(getString(R.string.pref_video_automatically_accept_video_key))).setChecked(mPrefs.shouldAutomaticallyAcceptVideoRequests());
}
@ -642,14 +616,14 @@ public class SettingsFragment extends PreferencesListFragment {
findPreference(getString(R.string.pref_preferred_video_fps_key)).setEnabled(false);
findPreference(getString(R.string.pref_bandwidth_limit_key)).setEnabled(false);
}
((ListPreference) findPreference(getString(R.string.pref_video_preset_key))).setSummary(mPrefs.getVideoPreset());
findPreference(getString(R.string.pref_video_preset_key)).setSummary(mPrefs.getVideoPreset());
int fps = mPrefs.getPreferredVideoFps();
String fpsStr = Integer.toString(fps);
if (fpsStr.equals("0")) {
fpsStr = "none";
}
((ListPreference) findPreference(getString(R.string.pref_preferred_video_fps_key))).setSummary(fpsStr);
((EditTextPreference) findPreference(getString(R.string.pref_bandwidth_limit_key))).setSummary(Integer.toString(mPrefs.getBandwidthLimit()));
findPreference(getString(R.string.pref_preferred_video_fps_key)).setSummary(fpsStr);
findPreference(getString(R.string.pref_bandwidth_limit_key)).setSummary(Integer.toString(mPrefs.getBandwidthLimit()));
}
private void setVideoPreferencesListener() {
@ -680,17 +654,6 @@ public class SettingsFragment extends PreferencesListFragment {
}
});
/*
findPreference(getString(R.string.pref_video_automatically_share_my_video_key)).setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
boolean enable = (Boolean) newValue;
mPrefs.setAutomaticallyShareMyVideo(enable);
return true;
}
});
*/
findPreference(getString(R.string.pref_video_automatically_accept_video_key)).setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {