<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
    android:background="?attr/color_background_secondary"
    android:key="main_screen">

    <PreferenceCategory
        android:key="general"
        android:title="@string/pref_general">
        <PreferenceScreen
            android:key="huawei"
            android:summary="@string/huawei_protected_apps_summary"
            android:title="@string/huawei_protected_apps">
            <intent
                android:targetClass="com.huawei.systemmanager.optimize.process.ProtectActivity"
                android:targetPackage="com.huawei.systemmanager" />
        </PreferenceScreen>
    </PreferenceCategory>
    <PreferenceCategory android:title="@string/pref_privacy"
        android:key="privacy">
        <CheckBoxPreference
            android:defaultValue="@bool/confirm_messages"
            android:key="confirm_messages"
            android:summary="@string/pref_confirm_messages_summary"
            android:title="@string/pref_confirm_messages" />
        <CheckBoxPreference
            android:defaultValue="@bool/chat_states"
            android:key="chat_states"
            android:summary="@string/pref_chat_states_summary"
            android:title="@string/pref_chat_states" />

        <CheckBoxPreference
            android:defaultValue="@bool/last_activity"
            android:key="last_activity"
            android:summary="@string/pref_broadcast_last_activity_summary"
            android:title="@string/pref_broadcast_last_activity" />

        <CheckBoxPreference
            android:defaultValue="@bool/prevent_screenshots"
            android:key="prevent_screenshots"
            android:summary="@string/pref_prevent_screenshots_summary"
            android:title="@string/pref_prevent_screenshots" />

        <ListPreference
            android:defaultValue="@string/omemo_setting_default"
            android:entries="@array/omemo_setting_entries"
            android:entryValues="@array/omemo_setting_entry_values"
            android:key="omemo"
            android:summary="@string/pref_omemo_setting_summary_default_on"
            android:title="@string/pref_omemo_setting" />
    </PreferenceCategory>
    <PreferenceCategory
        android:key="notification_category"
        android:title="@string/pref_notification_settings">
        <CheckBoxPreference
            android:defaultValue="@bool/notifications_from_strangers"
            android:key="notifications_from_strangers"
            android:summary="@string/pref_notifications_from_strangers_summary"
            android:title="@string/pref_notifications_from_strangers" />
        <CheckBoxPreference
            android:defaultValue="@bool/headsup_notifications"
            android:key="notification_headsup"
            android:summary="@string/pref_headsup_notifications_summary"
            android:title="@string/pref_headsup_notifications" />
        <CheckBoxPreference
            android:defaultValue="@bool/vibrate_on_notification"
            android:key="vibrate_on_notification"
            android:summary="@string/pref_vibrate_summary"
            android:title="@string/pref_vibrate" />
        <CheckBoxPreference
            android:defaultValue="@bool/led"
            android:key="led"
            android:summary="@string/pref_led_summary"
            android:title="@string/pref_led" />
        <ListPreference
            android:defaultValue="@integer/grace_period"
            android:entries="@array/grace_periods"
            android:entryValues="@array/grace_periods_values"
            android:key="grace_period_length"
            android:summary="@string/pref_notification_grace_period_summary"
            android:title="@string/pref_notification_grace_period" />
        <PreferenceScreen
            android:key="quiet_hours"
            android:summary="@string/pref_quiet_hours_summary"
            android:title="@string/title_pref_quiet_hours">
            <CheckBoxPreference
                android:defaultValue="@bool/enable_quiet_hours"
                android:key="enable_quiet_hours"
                android:summary="@string/pref_quiet_hours_summary"
                android:title="@string/title_pref_enable_quiet_hours" />
            <eu.siacs.conversations.ui.TimePreference
                android:dependency="enable_quiet_hours"
                android:key="quiet_hours_start"
                android:negativeButtonText="@string/cancel"
                android:positiveButtonText="@string/set"
                android:title="@string/title_pref_quiet_hours_start_time" />
            <eu.siacs.conversations.ui.TimePreference
                android:dependency="enable_quiet_hours"
                android:key="quiet_hours_end"
                android:negativeButtonText="@string/cancel"
                android:positiveButtonText="@string/set"
                android:title="@string/title_pref_quiet_hours_end_time" />
            <intent
                android:action="android.intent.action.VIEW"
                android:targetClass="eu.siacs.conversations.ui.SettingsActivity"
                android:targetPackage="@string/applicationId">
                <extra
                    android:name="page"
                    android:value="quiet_hours" />
            </intent>
        </PreferenceScreen>
        <PreferenceScreen
            android:key="message_notification_settings"
            android:summary="@string/pref_more_notification_settings_summary"
            android:title="@string/pref_message_notification_settings">
            <intent android:action="android.settings.CHANNEL_NOTIFICATION_SETTINGS">
                <extra
                    android:name="android.provider.extra.APP_PACKAGE"
                    android:value="@string/applicationId" />
                <extra
                    android:name="android.provider.extra.CHANNEL_ID"
                    android:value="messages" />
            </intent>
        </PreferenceScreen>
        <RingtonePreference
            android:defaultValue="@string/notification_ringtone"
            android:key="notification_ringtone"
            android:ringtoneType="notification"
            android:summary="@string/pref_notification_sound_summary"
            android:title="@string/pref_notification_sound" />
        <RingtonePreference
            android:defaultValue="@string/incoming_call_ringtone"
            android:key="call_ringtone"
            android:ringtoneType="ringtone"
            android:summary="@string/pref_call_ringtone_summary"
            android:title="@string/pref_ringtone" />
    </PreferenceCategory>
    <PreferenceCategory
        android:key="attachments"
        android:title="@string/pref_attachments">
        <CheckBoxPreference
            android:defaultValue="@bool/use_share_location_plugin"
            android:key="use_share_location_plugin"
            android:summary="@string/pref_use_share_location_plugin_summary"
            android:title="@string/pref_use_share_location_plugin" />
        <ListPreference
            android:defaultValue="@string/picture_compression"
            android:entries="@array/picture_compression_entries"
            android:entryValues="@array/picture_compression_values"
            android:key="picture_compression"
            android:summary="@string/pref_picture_compression_summary"
            android:title="@string/pref_picture_compression" />
        <ListPreference
            android:defaultValue="@string/video_compression"
            android:entries="@array/video_compression_entries"
            android:entryValues="@array/video_compression_values"
            android:key="video_compression"
            android:summary="@string/pref_video_compression_summary"
            android:title="@string/pref_video_compression" />
        <ListPreference
            android:defaultValue="@integer/auto_accept_filesize"
            android:entries="@array/filesizes"
            android:entryValues="@array/filesizes_values"
            android:key="auto_accept_file_size"
            android:summary="@string/pref_accept_files_summary"
            android:title="@string/pref_accept_files" />
    </PreferenceCategory>
    <PreferenceCategory android:title="@string/pref_ui_options">
        <CheckBoxPreference
            android:defaultValue="@bool/use_green_background"
            android:key="use_green_background"
            android:summary="@string/pref_use_green_background_summary"
            android:title="@string/pref_use_green_background" />
        <CheckBoxPreference
            android:defaultValue="@bool/show_dynamic_tags"
            android:key="show_dynamic_tags"
            android:summary="@string/pref_show_dynamic_tags_summary"
            android:title="@string/pref_show_dynamic_tags" />
        <ListPreference
            android:defaultValue="@string/theme"
            android:entries="@array/themes"
            android:entryValues="@array/themes_values"
            android:key="theme"
            android:summary="@string/pref_theme_options_summary"
            android:title="@string/pref_theme_options" />
        <ListPreference
            android:defaultValue="@string/quick_action"
            android:dialogTitle="@string/choose_quick_action"
            android:entries="@array/quick_actions"
            android:entryValues="@array/quick_action_values"
            android:key="quick_action"
            android:summary="@string/pref_quick_action_summary"
            android:title="@string/pref_quick_action" />
        <ListPreference
            android:defaultValue="@string/default_font_size"
            android:entries="@array/font_size_entries"
            android:entryValues="@array/font_size_entry_values"
            android:key="font_size"
            android:summary="@string/pref_font_size_summary"
            android:title="@string/pref_font_size" />
    </PreferenceCategory>
    <PreferenceCategory
        android:key="backup_category"
        android:title="@string/backup">
        <Preference
            android:key="create_backup"
            android:summary="@string/pref_create_backup_summary"
            android:title="@string/pref_create_backup" />
    </PreferenceCategory>
    <PreferenceCategory
        android:key="unified_push"
        android:title="@string/unified_push_distributor">
        <ListPreference
            android:defaultValue="@string/default_push_account"
            android:key="up_push_account"
            android:summary="@string/pref_up_push_account_summary"
            android:title="@string/pref_up_push_account_title" />
        <EditTextPreference
            android:defaultValue="@string/default_push_server"
            android:key="up_push_server"
            android:summary="@string/pref_up_push_server_summary"
            android:title="@string/pref_up_push_server_title" />

    </PreferenceCategory>
    <PreferenceCategory
        android:key="advanced"
        android:title="@string/pref_advanced_options">
        <CheckBoxPreference
            android:defaultValue="@bool/never_send"
            android:key="never_send"
            android:summary="@string/pref_never_send_crash_summary"
            android:title="@string/pref_never_send_crash" />

        <CheckBoxPreference
            android:defaultValue="@bool/enable_foreground_service"
            android:key="enable_foreground_service"
            android:summary="@string/pref_keep_foreground_service_summary"
            android:title="@string/pref_keep_foreground_service" />

        <PreferenceScreen
            android:key="expert"
            android:summary="@string/pref_expert_options_summary"
            android:title="@string/pref_expert_options">
            <PreferenceCategory
                android:key="security_options"
                android:title="@string/pref_security_settings">
                <CheckBoxPreference
                    android:defaultValue="@bool/btbv"
                    android:key="btbv"
                    android:summary="@string/pref_blind_trust_before_verification_summary"
                    android:title="@string/pref_blind_trust_before_verification" />
                <CheckBoxPreference
                    android:defaultValue="@bool/dont_trust_system_cas"
                    android:key="dont_trust_system_cas"
                    android:summary="@string/pref_dont_trust_system_cas_summary"
                    android:title="@string/pref_dont_trust_system_cas_title" />
                <CheckBoxPreference
                    android:defaultValue="@bool/validate_hostname"
                    android:key="validate_hostname"
                    android:summary="@string/pref_validate_hostname_summary"
                    android:title="@string/pref_validate_hostname" />
                <CheckBoxPreference
                    android:defaultValue="@bool/allow_message_correction"
                    android:key="allow_message_correction"
                    android:summary="@string/pref_allow_message_correction_summary"
                    android:title="@string/pref_allow_message_correction" />
                <ListPreference
                    android:defaultValue="@integer/automatic_message_deletion"
                    android:key="automatic_message_deletion"
                    android:summary="@string/pref_automatically_delete_messages_description"
                    android:title="@string/pref_automatically_delete_messages" />
                <Preference
                    android:key="remove_trusted_certificates"
                    android:summary="@string/pref_remove_trusted_certificates_summary"
                    android:title="@string/pref_remove_trusted_certificates_title" />
                <Preference
                    android:key="clean_cache"
                    android:summary="@string/pref_clean_cache_summary"
                    android:title="@string/pref_clean_cache" />
                <Preference
                    android:key="clean_private_storage"
                    android:summary="@string/pref_clean_private_storage_summary"
                    android:title="@string/pref_clean_private_storage" />
                <Preference
                    android:key="delete_omemo_identities"
                    android:summary="@string/pref_delete_omemo_identities_summary"
                    android:title="@string/pref_delete_omemo_identities" />
            </PreferenceCategory>
            <PreferenceCategory
                android:key="connection_options"
                android:title="@string/pref_connection_options">
                <CheckBoxPreference
                    android:defaultValue="@bool/use_tor"
                    android:key="use_tor"
                    android:summary="@string/pref_use_tor_summary"
                    android:title="@string/pref_use_tor" />
                <CheckBoxPreference
                    android:defaultValue="@bool/show_connection_options"
                    android:key="show_connection_options"
                    android:summary="@string/pref_show_connection_options_summary"
                    android:title="@string/pref_show_connection_options" />
            </PreferenceCategory>
            <PreferenceCategory android:title="@string/pref_input_options">
                <CheckBoxPreference
                    android:defaultValue="@bool/start_searching"
                    android:key="start_searching"
                    android:summary="@string/pref_start_search_summary"
                    android:title="@string/pref_start_search" />
                <CheckBoxPreference
                    android:defaultValue="@bool/enter_is_send"
                    android:key="enter_is_send"
                    android:summary="@string/pref_enter_is_send_summary"
                    android:title="@string/pref_enter_is_send" />
                <CheckBoxPreference
                    android:defaultValue="@bool/display_enter_key"
                    android:key="display_enter_key"
                    android:summary="@string/pref_display_enter_key_summary"
                    android:title="@string/pref_display_enter_key" />
                <CheckBoxPreference
                    android:defaultValue="@bool/scroll_to_bottom"
                    android:key="scroll_to_bottom"
                    android:summary="@string/pref_scroll_to_bottom_summary"
                    android:title="@string/pref_scroll_to_bottom" />
            </PreferenceCategory>
            <PreferenceCategory android:title="@string/pref_presence_settings">
                <CheckBoxPreference
                    android:defaultValue="@bool/manually_change_presence"
                    android:disableDependentsState="true"
                    android:key="manually_change_presence"
                    android:summary="@string/pref_manually_change_presence_summary"
                    android:title="@string/pref_manually_change_presence" />
                <CheckBoxPreference
                    android:defaultValue="@bool/away_when_screen_off"
                    android:dependency="manually_change_presence"
                    android:key="away_when_screen_off"
                    android:summary="@string/pref_away_when_screen_off_summary"
                    android:title="@string/pref_away_when_screen_off" />
                <CheckBoxPreference
                    android:defaultValue="@bool/dnd_on_silent_mode"
                    android:dependency="manually_change_presence"
                    android:key="dnd_on_silent_mode"
                    android:summary="@string/pref_dnd_on_silent_mode_summary"
                    android:title="@string/pref_dnd_on_silent_mode" />
                <CheckBoxPreference
                    android:defaultValue="@bool/treat_vibrate_as_silent"
                    android:dependency="dnd_on_silent_mode"
                    android:key="treat_vibrate_as_silent"
                    android:summary="@string/pref_treat_vibrate_as_dnd_summary"
                    android:title="@string/pref_treat_vibrate_as_silent" />
            </PreferenceCategory>
            <PreferenceCategory
                android:key="group_chats"
                android:title="@string/group_chats_and_channels">
                <CheckBoxPreference
                    android:defaultValue="@bool/autojoin"
                    android:key="autojoin"
                    android:summary="@string/pref_autojoin_summary"
                    android:title="@string/pref_autojoin" />
                <ListPreference
                    android:defaultValue="@string/default_channel_discovery"
                    android:entries="@array/channel_discovery_entries"
                    android:entryValues="@array/channel_discover_values"
                    android:key="channel_discovery_method"
                    android:summary="@string/pref_channel_discovery_summary"
                    android:title="@string/pref_channel_discovery" />
            </PreferenceCategory>
            <intent
                android:action="android.intent.action.VIEW"
                android:targetClass="eu.siacs.conversations.ui.SettingsActivity"
                android:targetPackage="@string/applicationId">
                <extra
                    android:name="page"
                    android:value="expert" />
            </intent>
        </PreferenceScreen>
    </PreferenceCategory>
    <PreferenceCategory android:title="@string/category_about">
        <eu.siacs.conversations.ui.AboutPreference />
    </PreferenceCategory>
</PreferenceScreen>
