Reorganize settings menu

Mostly xml work, with one small hack to fix the sub menu themes, found
here: http://code.google.com/p/android/issues/detail?id=4611#c35
This commit is contained in:
Lilia Markham 2013-03-28 05:45:07 -07:00
parent e3c5e837e1
commit 815613cfaa
3 changed files with 113 additions and 102 deletions

View File

@ -381,7 +381,7 @@
<string name="preferences__pref_timeout_interval_dialogtitle">Select Passphrase Timeout</string>
<string name="preferences__pref_timeout_interval_title">Timeout interval</string>
<string name="preferences__the_amount_of_time_to_wait_before_forgetting_passphrase">The amount of time to wait before forgetting passphrase from memory</string>
<string name="preferences__identity_key_settings">Identity Key Settings</string>
<string name="preferences__identity_key_settings">Identity Keys</string>
<string name="preferences__view_my_identity_key">View my identity key</string>
<string name="preferences__export_my_identity_key">Export my identity key</string>
<string name="preferences__import_contacts_key">Import Contact\'s Key</string>
@ -412,7 +412,9 @@
<string name="preferences__normal">Normal</string>
<string name="preferences__slow">Slow</string>
<string name="preferences__custom">Custom</string>
<string name="preferences__advanced_mms_access_point_names">Advanced: MMS Access Point Names</string>
<string name="preferences__advanced">Advanced</string>
<string name="preferences__passphrase">Passphrase</string>
<string name="preferences__advanced_mms_access_point_names">Fallback MMSC</string>
<string name="preferences__enable_fallback_mmsc">Enable Fallback MMSC</string>
<string name="preferences__use_mmsc_information_configured_here_when_system_apn_information_is_unavailable">Use MMSC information configured here when system APN information is unavailable.</string>
<string name="preferences__mmsc_url_required">MMSC URL (Required)</string>

View File

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory android:title="@string/preferences__use_settings">
<CheckBoxPreference android:defaultValue="true"
android:key="pref_all_sms"
android:summary="@string/preferences__use_textsecure_for_viewing_and_storing_all_incoming_text_messages"
@ -12,95 +11,17 @@
android:summary="@string/preferences__use_textsecure_for_viewing_and_storing_all_incoming_multimedia_messages"
android:title="@string/preferences__pref_all_mms_title" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/preferences__delivery_reports">
<CheckBoxPreference android:defaultValue="false"
android:key="pref_delivery_report_sms"
android:summary="@string/preferences__request_a_delivery_report_for_each_sms_message_you_send"
android:title="@string/preferences__sms_delivery_reports" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/preferences__storage">
<CheckBoxPreference android:defaultValue="false"
android:key="pref_trim_threads"
android:summary="@string/preferences__automatically_delete_older_messages_once_a_conversation_thread_exceeds_a_specified_length"
android:title="@string/preferences__delete_old_messages" />
<EditTextPreference android:defaultValue="500"
android:key="pref_trim_length"
android:title="@string/preferences__conversation_length_limit"
android:inputType="number"
android:dependency="pref_trim_threads" />
<Preference android:key="pref_trim_now"
android:title="@string/preferences__trim_all_threads_now"
android:summary="@string/preferences__scan_through_all_conversation_threads_and_enforce_conversation_length_limits"
android:dependency="pref_trim_threads" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/preferences__input_settings">
<CheckBoxPreference android:defaultValue="false"
android:key="pref_enter_sends"
android:summary="@string/preferences__pressing_the_enter_key_will_send_text_messages"
android:title="@string/preferences__pref_enter_sends_title" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/preferences__display_settings" android:key="pref_display_category">
<Preference android:key="pref_choose_identity"
android:title="@string/preferences__choose_identity"
android:summary="@string/preferences__choose_your_contact_entry_from_the_contacts_list"/>
</PreferenceCategory>
<PreferenceCategory android:title="@string/preferences__encryption_settings">
<Preference android:key="pref_change_passphrase"
android:title="@string/preferences__change_passphrase"
android:summary="@string/preferences__change_my_passphrase"/>
<CheckBoxPreference android:defaultValue="true"
android:key="pref_auto_complete_key_exchange"
android:title="@string/preferences__complete_key_exchanges"
android:summary="@string/preferences__automatically_complete_key_exchanges_for_new_sessions_or_for_existing_sessions_with_the_same_identity_key" />
<CheckBoxPreference android:defaultValue="false"
android:key="pref_timeout_passphrase"
android:summary="@string/preferences__forget_passphrase_from_memory_after_some_interval"
android:title="@string/preferences__timeout_passphrase" />
<org.thoughtcrime.securesms.preferences.PassphraseTimeoutPreference
android:key="pref_timeout_interval"
android:defaultValue="300"
android:title="@string/preferences__pref_timeout_interval_title"
android:summary="@string/preferences__the_amount_of_time_to_wait_before_forgetting_passphrase"
android:dependency="pref_timeout_passphrase"
android:dialogTitle="@string/preferences__pref_timeout_interval_dialogtitle" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/preferences__identity_key_settings">
<Preference android:key="pref_view_identity"
android:title="@string/preferences__view_my_identity_key"
android:summary="@string/preferences__view_my_identity_key"/>
<Preference android:key="pref_export_identity"
android:title="@string/preferences__export_my_identity_key"
android:summary="@string/preferences__export_my_identity_key"/>
<Preference android:key="pref_import_identity"
android:title="@string/preferences__import_contacts_key"
android:summary="@string/preferences__import_an_identity_key_from_a_contact"/>
<Preference android:key="pref_manage_identity"
android:title="@string/preferences__manage_identity_keys"
android:summary="@string/preferences__manage_configured_identity_keys"/>
</PreferenceCategory>
<PreferenceCategory android:title="@string/preferences__notification_settings">
<PreferenceScreen android:title="@string/preferences__notifications">
<CheckBoxPreference android:key="pref_key_enable_notifications"
android:title="@string/preferences__notifications"
android:summary="@string/preferences__display_message_notifications_in_status_bar"
@ -138,26 +59,100 @@
android:defaultValue="true"
android:title="@string/preferences__vibrate"
android:summary="@string/preferences__also_vibrate_when_notified" />
</PreferenceScreen>
<PreferenceCategory android:title="@string/preferences__storage">
<CheckBoxPreference android:defaultValue="false"
android:key="pref_trim_threads"
android:summary="@string/preferences__automatically_delete_older_messages_once_a_conversation_thread_exceeds_a_specified_length"
android:title="@string/preferences__delete_old_messages" />
<EditTextPreference android:defaultValue="500"
android:key="pref_trim_length"
android:title="@string/preferences__conversation_length_limit"
android:inputType="number"
android:dependency="pref_trim_threads" />
<Preference android:key="pref_trim_now"
android:title="@string/preferences__trim_all_threads_now"
android:summary="@string/preferences__scan_through_all_conversation_threads_and_enforce_conversation_length_limits"
android:dependency="pref_trim_threads" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/preferences__display_settings" android:key="pref_display_category">
<Preference android:key="pref_choose_identity"
android:title="@string/preferences__choose_identity"
android:summary="@string/preferences__choose_your_contact_entry_from_the_contacts_list"/>
</PreferenceCategory>
<PreferenceCategory android:title="@string/preferences__advanced_mms_access_point_names">
<CheckBoxPreference android:key="pref_use_local_apns"
android:defaultValue="false"
android:title="@string/preferences__enable_fallback_mmsc"
android:summary="@string/preferences__use_mmsc_information_configured_here_when_system_apn_information_is_unavailable"/>
<EditTextPreference android:key="pref_apn_mmsc_host"
android:title="@string/preferences__mmsc_url_required"
android:dependency="pref_use_local_apns" />
<EditTextPreference android:key="pref_apn_mms_proxy"
android:title="@string/preferences__mms_proxy_host_optional"
android:dependency="pref_use_local_apns" />
<EditTextPreference android:key="pref_apn_mms_proxy_port"
android:title="@string/preferences__mms_proxy_port_optional"
android:dependency="pref_use_local_apns"
android:inputType="number" />
<PreferenceCategory android:title="@string/preferences__passphrase">
<Preference android:key="pref_change_passphrase"
android:title="@string/preferences__change_passphrase"
android:summary="@string/preferences__change_my_passphrase"/>
<CheckBoxPreference android:defaultValue="false"
android:key="pref_timeout_passphrase"
android:summary="@string/preferences__forget_passphrase_from_memory_after_some_interval"
android:title="@string/preferences__timeout_passphrase" />
<org.thoughtcrime.securesms.preferences.PassphraseTimeoutPreference
android:key="pref_timeout_interval"
android:defaultValue="300"
android:title="@string/preferences__pref_timeout_interval_title"
android:summary="@string/preferences__the_amount_of_time_to_wait_before_forgetting_passphrase"
android:dependency="pref_timeout_passphrase"
android:dialogTitle="@string/preferences__pref_timeout_interval_dialogtitle" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/preferences__advanced">
<CheckBoxPreference android:defaultValue="true"
android:key="pref_auto_complete_key_exchange"
android:title="@string/preferences__complete_key_exchanges"
android:summary="@string/preferences__automatically_complete_key_exchanges_for_new_sessions_or_for_existing_sessions_with_the_same_identity_key" />
<PreferenceScreen android:title="@string/preferences__identity_key_settings">
<Preference android:key="pref_view_identity"
android:title="@string/preferences__view_my_identity_key"
android:summary="@string/preferences__view_my_identity_key"/>
<Preference android:key="pref_export_identity"
android:title="@string/preferences__export_my_identity_key"
android:summary="@string/preferences__export_my_identity_key"/>
<Preference android:key="pref_import_identity"
android:title="@string/preferences__import_contacts_key"
android:summary="@string/preferences__import_an_identity_key_from_a_contact"/>
<Preference android:key="pref_manage_identity"
android:title="@string/preferences__manage_identity_keys"
android:summary="@string/preferences__manage_configured_identity_keys"/>
</PreferenceScreen>
<PreferenceScreen android:title="@string/preferences__advanced_mms_access_point_names">
<CheckBoxPreference android:key="pref_use_local_apns"
android:defaultValue="false"
android:title="@string/preferences__enable_fallback_mmsc"
android:summary="@string/preferences__use_mmsc_information_configured_here_when_system_apn_information_is_unavailable"/>
<EditTextPreference android:key="pref_apn_mmsc_host"
android:title="@string/preferences__mmsc_url_required"
android:dependency="pref_use_local_apns" />
<EditTextPreference android:key="pref_apn_mms_proxy"
android:title="@string/preferences__mms_proxy_host_optional"
android:dependency="pref_use_local_apns" />
<EditTextPreference android:key="pref_apn_mms_proxy_port"
android:title="@string/preferences__mms_proxy_port_optional"
android:dependency="pref_use_local_apns"
android:inputType="number" />
</PreferenceScreen>
</PreferenceCategory>
</PreferenceScreen>

View File

@ -25,6 +25,7 @@ import android.net.Uri;
import android.os.Bundle;
import android.preference.EditTextPreference;
import android.preference.Preference;
import android.preference.PreferenceScreen;
import android.preference.PreferenceManager;
import android.provider.ContactsContract;
import android.util.Log;
@ -383,4 +384,17 @@ public class ApplicationPreferencesActivity extends PassphraseRequiredSherlockPr
}
}
/* http://code.google.com/p/android/issues/detail?id=4611#c35 */
@SuppressWarnings("deprecation")
@Override
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference)
{
super.onPreferenceTreeClick(preferenceScreen, preference);
if (preference!=null)
if (preference instanceof PreferenceScreen)
if (((PreferenceScreen)preference).getDialog()!=null)
((PreferenceScreen)preference).getDialog().getWindow().getDecorView().setBackgroundDrawable(this.getWindow().getDecorView().getBackground().getConstantState().newDrawable());
return false;
}
}