Small improvement in settings fragment

This commit is contained in:
Sylvain Berfini 2016-07-19 14:53:19 +02:00
parent e5baec4d20
commit 0ad206368c
2 changed files with 117 additions and 73 deletions

View file

@ -3,34 +3,41 @@
<PreferenceCategory
android:title="@string/pref_sipaccounts"
android:key="@string/pref_sipaccounts_key"/>
android:key="@string/pref_sipaccounts_key"
android:persistent="false"/>
<Preference
android:title="@string/pref_add_account"
android:key="@string/pref_add_account_key"/>
android:key="@string/pref_add_account_key"
android:persistent="false"/>
<Preference
android:title="@string/pref_in_app_store"
android:key="@string/pref_in_app_store_key"/>
android:key="@string/pref_in_app_store_key"
android:persistent="false"/>
<PreferenceCategory
android:title="@string/pref_tunnel"
android:key="@string/pref_tunnel_key">
android:key="@string/pref_tunnel_key"
android:persistent="false">
<EditTextPreference
android:title="@string/pref_tunnel_host"
android:key="@string/pref_tunnel_host_key"
android:persistent="false"/>
<EditTextPreference
android:title="@string/pref_tunnel_host"
android:key="@string/pref_tunnel_host_key"/>
<EditTextPreference
android:title="@string/pref_tunnel_port"
android:title="@string/pref_tunnel_port"
android:key="@string/pref_tunnel_port_key"
android:numeric="integer"/>
android:numeric="integer"
android:persistent="false"/>
<ListPreference
android:title="@string/pref_tunnel_mode"
<ListPreference
android:title="@string/pref_tunnel_mode"
android:key="@string/pref_tunnel_mode_key"
android:entries="@array/tunnel_mode_entries"
android:entryValues="@array/tunnel_mode_entry_values"/>
android:entryValues="@array/tunnel_mode_entry_values"
android:persistent="false"/>
</PreferenceCategory>
@ -39,7 +46,8 @@
<CheckBoxPreference
android:title="@string/pref_video_enable_title"
android:key="@string/pref_video_enable_key"/>
android:key="@string/pref_video_enable_key"
android:persistent="false"/>
<PreferenceScreen
android:title="@string/pref_audio_title">
@ -47,25 +55,30 @@
<CheckBoxPreference
android:title="@string/pref_echo_cancellation"
android:key="@string/pref_echo_cancellation_key"
android:summary="@string/pref_echo_cancellation_summary"/>
android:summary="@string/pref_echo_cancellation_summary"
android:persistent="false"/>
<Preference
android:title="@string/pref_echo_canceller_calibration"
android:key="@string/pref_echo_canceller_calibration_key"/>
android:key="@string/pref_echo_canceller_calibration_key"
android:persistent="false"/>
<CheckBoxPreference
android:title="@string/pref_adaptive_rate_control"
android:key="@string/pref_adaptive_rate_control_key" />
android:key="@string/pref_adaptive_rate_control_key"
android:persistent="false"/>
<ListPreference
android:title="@string/pref_codec_bitrate_limit"
android:key="@string/pref_codec_bitrate_limit_key"
android:entries="@array/limit_bitrate_entries"
android:entryValues="@array/limit_bitrate_entry_values" />
android:entryValues="@array/limit_bitrate_entry_values"
android:persistent="false"/>
<PreferenceCategory
android:title="@string/pref_codecs"
android:key="@string/pref_codecs_key"/>
android:key="@string/pref_codecs_key"
android:persistent="false"/>
</PreferenceScreen>
@ -73,55 +86,65 @@
android:title="@string/pref_video_title"
android:key="@string/pref_video_key"
android:dependency="@string/pref_video_enable_key"
android:shouldDisableView="true">
android:shouldDisableView="true"
android:persistent="false">
<CheckBoxPreference
android:title="@string/pref_video_use_front_camera_title"
android:key="@string/pref_video_use_front_camera_key"
android:dependency="@string/pref_video_enable_key"
android:layout="@layout/hidden"/>
android:layout="@layout/hidden"
android:persistent="false"/>
<CheckBoxPreference
android:title="@string/pref_video_initiate_call_with_video_title"
android:key="@string/pref_video_initiate_call_with_video_key"
android:summary="@string/pref_video_initiate_call_with_video"
android:dependency="@string/pref_video_enable_key"/>
android:dependency="@string/pref_video_enable_key"
android:persistent="false"/>
<CheckBoxPreference
android:title="@string/pref_video_automatically_accept_video_title"
android:key="@string/pref_video_automatically_accept_video_key"
android:summary="@string/pref_video_automatically_accept_video"
android:dependency="@string/pref_video_enable_key"/>
android:dependency="@string/pref_video_enable_key"
android:persistent="false"/>
<ListPreference
android:title="@string/pref_video_preset"
android:key="@string/pref_video_preset_key"
android:entries="@array/video_preset_entries"
android:entryValues="@array/video_preset_entries" />
android:entryValues="@array/video_preset_entries"
android:persistent="false"/>
<ListPreference
android:title="@string/pref_preferred_video_size"
android:key="@string/pref_preferred_video_size_key"/>
android:key="@string/pref_preferred_video_size_key"
android:persistent="false"/>
<ListPreference
android:title="@string/pref_preferred_fps"
android:key="@string/pref_preferred_video_fps_key"/>
android:key="@string/pref_preferred_video_fps_key"
android:persistent="false"/>
<EditTextPreference
android:title="@string/pref_bandwidth_limit"
android:key="@string/pref_bandwidth_limit_key"
android:numeric="integer" />
android:numeric="integer"
android:persistent="false"/>
<CheckBoxPreference
android:title="@string/pref_overlay"
android:key="@string/pref_overlay_key"
android:summary="@string/pref_overlay_summary"/>
android:summary="@string/pref_overlay_summary"
android:persistent="false"/>
<PreferenceCategory
android:title="@string/pref_video_codecs_title"
android:key="@string/pref_video_codecs_key"
android:dependency="@string/pref_video_enable_key"
android:shouldDisableView="true"/>
android:shouldDisableView="true"
android:persistent="false"/>
</PreferenceScreen>
@ -130,15 +153,18 @@
<CheckBoxPreference
android:title="@string/pref_sipinfo_dtmf"
android:key="@string/pref_sipinfo_dtmf_key"/>
android:key="@string/pref_sipinfo_dtmf_key"
android:persistent="false"/>
<CheckBoxPreference
android:title="@string/pref_rfc2833_dtmf"
android:key="@string/pref_rfc2833_dtmf_key"/>
android:key="@string/pref_rfc2833_dtmf_key"
android:persistent="false"/>
<EditTextPreference
android:title="@string/pref_voice_mail"
android:key="@string/pref_voice_mail_key"/>
android:key="@string/pref_voice_mail_key"
android:persistent="false"/>
</PreferenceScreen>
@ -148,11 +174,13 @@
<EditTextPreference
android:title="@string/pref_image_sharing_server_title"
android:key="@string/pref_image_sharing_server_key"
android:summary="@string/pref_image_sharing_server_desc"/>
android:summary="@string/pref_image_sharing_server_desc"
android:persistent="false"/>
<ListPreference
android:title="@string/pref_use_lime_encryption"
android:key="@string/pref_use_lime_encryption_key"/>
android:key="@string/pref_use_lime_encryption_key"
android:persistent="false"/>
</PreferenceScreen>
@ -161,52 +189,63 @@
<CheckBoxPreference
android:title="@string/pref_wifi_only"
android:key="@string/pref_wifi_only_key"/>
android:key="@string/pref_wifi_only_key"
android:persistent="false"/>
<EditTextPreference
android:title="@string/pref_stun_server"
android:key="@string/pref_stun_server_key"/>
android:key="@string/pref_stun_server_key"
android:persistent="false"/>
<CheckBoxPreference
android:title="@string/pref_ice_enable"
android:key="@string/pref_ice_enable_key"/>
android:key="@string/pref_ice_enable_key"
android:persistent="false"/>
<CheckBoxPreference
android:title="@string/pref_upnp_enable"
android:key="@string/pref_upnp_enable_key"/>
android:key="@string/pref_upnp_enable_key"
android:persistent="false"/>
<CheckBoxPreference
android:title="@string/pref_transport_use_random_ports"
android:key="@string/pref_transport_use_random_ports_key"/>
android:key="@string/pref_transport_use_random_ports_key"
android:persistent="false"/>
<EditTextPreference
android:title="@string/pref_sip_port_title"
android:key="@string/pref_sip_port_key"
android:numeric="integer"/>
android:numeric="integer"
android:persistent="false"/>
<EditTextPreference
android:title="@string/pref_audio_port_title"
android:key="@string/pref_audio_port_key"
android:summary="@string/pref_audio_port_description"
android:layout="@layout/hidden"/>
android:layout="@layout/hidden"
android:persistent="false"/>
<EditTextPreference
android:title="@string/pref_video_port_title"
android:key="@string/pref_video_port_key"
android:summary="@string/pref_video_port_description"
android:layout="@layout/hidden"/>
android:layout="@layout/hidden"
android:persistent="false"/>
<ListPreference
android:title="@string/pref_media_encryption"
android:key="@string/pref_media_encryption_key"/>
android:key="@string/pref_media_encryption_key"
android:persistent="false"/>
<CheckBoxPreference
android:title="@string/pref_push_notification"
android:key="@string/pref_push_notification_key"/>
android:key="@string/pref_push_notification_key"
android:persistent="false"/>
<CheckBoxPreference
android:title="@string/pref_ipv6_title"
android:key="@string/pref_ipv6_key"/>
android:key="@string/pref_ipv6_key"
android:persistent="false"/>
</PreferenceScreen>
@ -215,43 +254,52 @@
<CheckBoxPreference
android:title="@string/pref_debug"
android:key="@string/pref_debug_key"/>
android:key="@string/pref_debug_key"
android:persistent="false"/>
<CheckBoxPreference
android:title="@string/pref_background_mode"
android:key="@string/pref_background_mode_key"/>
android:key="@string/pref_background_mode_key"
android:persistent="false"/>
<CheckBoxPreference
android:title="@string/pref_service_notification"
android:key="@string/pref_service_notification_key"/>
android:key="@string/pref_service_notification_key"
android:persistent="false"/>
<CheckBoxPreference
android:title="@string/pref_animation_enable_title"
android:key="@string/pref_animation_enable_key"/>
android:key="@string/pref_animation_enable_key"
android:persistent="false"/>
<CheckBoxPreference
android:title="@string/pref_autostart"
android:key="@string/pref_autostart_key"/>
android:key="@string/pref_autostart_key"
android:persistent="false"/>
<EditTextPreference
android:title="@string/pref_incoming_call_timeout_title"
android:key="@string/pref_incoming_call_timeout_key"
android:layout="@layout/hidden"/>
android:layout="@layout/hidden"
android:persistent="false"/>
<EditTextPreference
android:title="@string/pref_remote_provisioning_title"
android:key="@string/pref_remote_provisioning_key"/>
android:key="@string/pref_remote_provisioning_key"
android:persistent="false"/>
<PreferenceCategory
android:title="@string/pref_primary_account_title">
android:title="@string/pref_primary_account_title">
<EditTextPreference
android:title="@string/pref_display_name_title"
android:key="@string/pref_display_name_key"/>
<EditTextPreference
android:title="@string/pref_display_name_title"
android:key="@string/pref_display_name_key"
android:persistent="false"/>
<EditTextPreference
android:title="@string/pref_user_name_title"
android:key="@string/pref_user_name_key"/>
<EditTextPreference
android:title="@string/pref_user_name_title"
android:key="@string/pref_user_name_key"
android:persistent="false"/>
</PreferenceCategory>
@ -261,17 +309,20 @@
<CheckBoxPreference
android:title="@string/pref_audio_hacks_use_routing_api_title"
android:key="@string/pref_audio_hacks_use_routing_api_key"/>
android:key="@string/pref_audio_hacks_use_routing_api_key"
android:persistent="false"/>
<CheckBoxPreference
android:title="@string/pref_audio_hacks_use_galaxys_hack_title"
android:key="@string/pref_audio_hacks_use_galaxys_hack_key"/>
android:key="@string/pref_audio_hacks_use_galaxys_hack_key"
android:persistent="false"/>
<EditTextPreference
android:title="@string/pref_audio_use_specific_mode_title"
android:key="@string/pref_audio_use_specific_mode_key"
android:summary="@string/pref_audio_use_specific_mode_summary"
android:numeric="integer" />
android:numeric="integer"
android:persistent="false"/>
</PreferenceScreen>

View file

@ -70,11 +70,6 @@ public class SettingsFragment extends PreferencesListFragment {
removePreviousPreferencesFile(); // Required when updating the preferences order
addPreferencesFromResource(R.xml.preferences);
// Init the settings page interface
initSettings();
setListeners();
hideSettings();
mListener = new LinphoneCoreListenerBase() {
@Override
public void ecCalibrationStatus(LinphoneCore lc, final EcCalibratorStatus status, final int delayMs, Object data) {
@ -1098,6 +1093,10 @@ public class SettingsFragment extends PreferencesListFragment {
public void onResume() {
super.onResume();
// Init the settings page interface
initSettings();
setListeners();
hideSettings();
initAccounts();
if (LinphoneActivity.isInstanciated()) {
@ -1105,10 +1104,4 @@ public class SettingsFragment extends PreferencesListFragment {
}
}
@Override
public void onPause() {
LinphoneActivity.instance().hideTopBar();
super.onPause();
}
}