<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools">

    <PreferenceCategory
        android:title="@string/pref_account_header"
        android:key="account_prefs"
        android:layout="@layout/preference_category">

        <PreferenceScreen
            android:key="my_account"
            android:layout="@layout/preference_child_summary"
            android:title="@string/my_account">
            <PreferenceCategory
                android:title="@string/account_info"
                android:key="account_info"
                android:layout="@layout/preference_category">
                <Preference
                    android:key="username"
                    android:title="@string/username"
                    android:selectable="true"
                    android:persistent="false"
                    android:shouldDisableView="false"
                    android:layout="@layout/preference_child_summary" />
                <Preference android:title="@string/confirm_username"
                    android:key="confirm_username"
                    app:isPreferenceVisible="false"
                    android:layout="@layout/preference_child_summary" />
                <Preference
                    android:key="email"
                    android:title="@string/email"
                    android:selectable="true"
                    android:persistent="false"
                    android:shouldDisableView="false"
                    android:layout="@layout/preference_child_summary"/>
            </PreferenceCategory>

            <PreferenceCategory
                android:title="@string/login_methods"
                android:key="account_info"
                android:layout="@layout/preference_category">
                <com.habitrpg.android.habitica.ui.views.ExtraLabelPreference
                    android:title="@string/password"
                    android:key="password"
                    android:layout="@layout/preference_button"
                    />
                <com.habitrpg.android.habitica.ui.views.ExtraLabelPreference
                    android:title="@string/google"
                    android:key="google_auth"
                    android:layout="@layout/preference_button"
                    />
                <com.habitrpg.android.habitica.ui.views.ExtraLabelPreference
                    android:title="@string/facebook"
                    android:key="facebook_auth"
                    />
                <com.habitrpg.android.habitica.ui.views.ExtraLabelPreference
                    android:title="@string/apple"
                    android:key="apple_auth"
                    />
            </PreferenceCategory>
            <PreferenceCategory
                android:title="@string/public_profile"
                android:key="public_profile"
                android:layout="@layout/preference_category">
                <Preference
                    android:key="display_name"
                    android:layout="@layout/preference_child_summary"
                    android:persistent="false"
                    android:title="@string/display_name" />
                <Preference
                    android:key="about"
                    android:layout="@layout/preference_child_summary"
                    android:persistent="false"
                    android:title="@string/about_me" />
                <Preference
                    android:key="photo_url"
                    android:layout="@layout/preference_child_summary"
                    android:persistent="false"
                    android:title="@string/photo_url" />
            </PreferenceCategory>
            <PreferenceCategory
                android:title="@string/api"
                android:key="api"
                android:layout="@layout/preference_category">
                <Preference
                    android:key="@string/SP_userID"
                    android:title="@string/SP_userID_title"
                    android:selectable="true"
                    android:persistent="false"
                    android:shouldDisableView="false"
                    android:layout="@layout/preference_child_summary"/>

                <Preference
                    android:key="@string/SP_APIToken"
                    android:title="@string/SP_APIToken_title"
                    android:selectable="true"
                    android:persistent="false"
                    android:shouldDisableView="false"
                    android:summary="@string/apitoken_summary"
                    android:layout="@layout/preference_child_summary"/>
                <Preference android:title="@string/fix_character_values"
                    app:key="fixCharacterValues"
                    android:layout="@layout/preference_child_summary"/>
            </PreferenceCategory>
            <PreferenceCategory android:title="@string/danger_zone"
                android:layout="@layout/preference_category">
                <Preference android:title="@string/reset_account"
                    android:persistent="false"
                    android:key="reset_account"
                    android:layout="@layout/preference_child_summary_danger" />
                <Preference android:title="@string/delete_account"
                    android:persistent="false"
                    android:key="delete_account"
                    android:layout="@layout/preference_child_summary_danger" />
            </PreferenceCategory>
        </PreferenceScreen>
        <Preference
            android:key="pause_damage"
            tools:title="@string/tavern_inn_rest"
            android:layout="@layout/preference_child_summary"/>
        <Preference
            android:key="choose_class"
            tools:title="Change Class"
            android:layout="@layout/preference_child_summary"
            app:isPreferenceVisible="false"/>
        <Preference android:title="@string/logout"
            android:key="logout"
            android:layout="@layout/preference_child_summary_danger"/>

    </PreferenceCategory>

    <PreferenceCategory
        android:title="@string/app_settings"
        android:layout="@layout/preference_category">
        <ListPreference
            android:title="@string/task_display"
            android:key="task_display"
            android:entries="@array/TaskDisplayTypes"
            android:entryValues="@array/TaskDisplayValues"
            android:defaultValue="standard"
            android:layout="@layout/preference_child_summary"/>
        <ListPreference
            android:title="@string/launch_screen"
            android:key="launch_screen"
            android:entries="@array/launch_screen_types"
            android:entryValues="@array/launch_screen_values"
            android:defaultValue="/user/tasks/habits"
            android:layout="@layout/preference_child_summary"/>
        <ListPreference android:title="@string/Language_title"
            android:key="language"
            android:entries="@array/Language"
            android:entryValues="@array/LanguageValues"
            android:summary="@string/Language_summary"
            android:layout="@layout/preference_child_summary"/>
        <ListPreference android:title="@string/AudioTheme_title"
            android:key="audioTheme"
            android:entries="@array/AudioThemes"
            android:entryValues="@array/AudioValues"
            android:summary="@string/AudioTheme_summary"
            android:layout="@layout/preference_child_summary"/>
        <ListPreference android:title="@string/theme_color"
            android:key="theme_name"
            android:entries="@array/AppThemes"
            android:entryValues="@array/AppThemeValues"
            android:defaultValue="purple"
            android:layout="@layout/preference_child_summary"/>
        <ListPreference android:title="@string/theme_mode"
            android:key="theme_mode"
            android:entries="@array/AppThemeModes"
            android:entryValues="@array/AppThemeModeValues"
            android:defaultValue="system"
            android:layout="@layout/preference_child_summary" />
        <CheckBoxPreference android:title="@string/disablePrivateMessages"
            android:key="disablePMs"
            android:layout="@layout/preference_child_summary"
            />
        <ListPreference
            android:entries="@array/weekdays"
            android:entryValues="@array/weekdayValues"
            android:key="@string/pref_first_day_of_the_week_key"
            android:layout="@layout/preference_child_summary"
            android:summary="@string/pref_first_day_of_the_week_summary"
            android:title="@string/pref_first_day_of_the_week_title" />

        <com.habitrpg.android.habitica.ui.views.HabiticaListPreference
            android:key="cds_time"
            android:entries="@array/cds_labels"
            android:entryValues="@array/cds_values"
            android:layout="@layout/preference_child_summary"
            android:title="@string/day_start_adjustment"/>
    </PreferenceCategory>

    <PreferenceCategory
        android:key="groups_category"
        android:title="@string/group_plan_settings"
        android:layout="@layout/preference_category"
        app:isPreferenceVisible="false">
        <Preference android:title="@string/copy_tasks_description"
            android:key="groups_footer"
            android:layout="@layout/preference_group_footer"/>
    </PreferenceCategory>

    <PreferenceCategory
        android:title="@string/pref_reminder_header"
        android:layout="@layout/preference_category">

        <CheckBoxPreference
            android:key="use_reminder"
            android:defaultValue="false"
            android:title="@string/pref_reminder_checkbox"
            android:layout="@layout/preference_child_summary"/>

        <com.habitrpg.android.habitica.prefs.TimePreference
            android:key="reminder_time"
            android:defaultValue="19:30"
            android:title="@string/pref_reminder_picker"
            android:layout="@layout/preference_child_summary" />

    </PreferenceCategory>

    <PreferenceCategory
        android:title="@string/push_notifications"
        android:layout="@layout/preference_category">

        <CheckBoxPreference
            android:key="usePushNotifications"
            android:defaultValue="true"
            android:title="@string/pref_push_notifications_checkbox"
            android:layout="@layout/preference_child_summary"/>

        <PreferenceScreen
            android:key="pushNotifications"
            android:title="@string/push_notifications"
            android:summary="@string/push_notifications_sum"
            android:layout="@layout/preference_child_summary">

            <PreferenceCategory android:title="Push Notifications"
                android:layout="@layout/preference_category">
                <CheckBoxPreference
                    android:key="preference_push_you_won_challenge"
                    android:defaultValue="true"
                    android:title="@string/preference_push_you_won_challenge"
                    android:layout="@layout/preference_child_summary"/>
                <CheckBoxPreference
                    android:key="preference_push_received_a_private_message"
                    android:defaultValue="true"
                    android:title="@string/preference_push_received_a_private_message"
                    android:layout="@layout/preference_child_summary"/>
                <CheckBoxPreference
                    android:key="preference_push_gifted_gems"
                    android:defaultValue="true"
                    android:title="@string/preference_push_gifted_gems"
                    android:layout="@layout/preference_child_summary"/>
                <CheckBoxPreference
                    android:key="preference_push_gifted_subscription"
                    android:defaultValue="true"
                    android:title="@string/preference_push_gifted_subscription"
                    android:layout="@layout/preference_child_summary"/>
                <CheckBoxPreference
                    android:key="preference_push_invited_to_party"
                    android:defaultValue="true"
                    android:title="@string/preference_push_invited_to_party"
                    android:layout="@layout/preference_child_summary"/>
                <CheckBoxPreference
                    android:key="preference_push_invited_to_guild"
                    android:defaultValue="true"
                    android:title="@string/preference_push_invited_to_group_plan"
                    android:layout="@layout/preference_child_summary"/>
                <CheckBoxPreference
                    android:key="preference_push_your_quest_has_begun"
                    android:defaultValue="true"
                    android:title="@string/preference_push_your_quest_has_begun"
                    android:layout="@layout/preference_child_summary"/>
                <CheckBoxPreference
                    android:key="preference_push_invited_to_quest"
                    android:defaultValue="true"
                    android:title="@string/preference_push_invited_to_quest"
                    android:layout="@layout/preference_child_summary"/>
                <CheckBoxPreference
                    android:key="preference_push_important_announcements"
                    android:defaultValue="true"
                    android:title="@string/preference_push_important_announcements"
                    android:layout="@layout/preference_child_summary"/>
                <CheckBoxPreference
                    android:key="preference_push_party_activity"
                    android:defaultValue="true"
                    android:title="@string/preference_push_party_activity"
                    android:layout="@layout/preference_child_summary"/>
                <CheckBoxPreference
                    android:key="preference_push_party_mention"
                    android:defaultValue="true"
                    android:title="@string/preference_push_party_mention"
                    android:layout="@layout/preference_child_summary"/>
                <CheckBoxPreference
                    android:key="preference_push_joined_guild_mention"
                    android:defaultValue="true"
                    android:title="@string/preference_push_joined_group_plan_mention"
                    android:layout="@layout/preference_child_summary"/>
                <CheckBoxPreference
                    android:key="preference_push_content_release"
                    android:defaultValue="true"
                    android:title="@string/preference_email_content_release"
                    android:layout="@layout/preference_child_summary"/>
            </PreferenceCategory>
        </PreferenceScreen>
    </PreferenceCategory>


    <PreferenceCategory
        android:title="@string/emails"
        android:layout="@layout/preference_category">

        <CheckBoxPreference
            android:key="useEmails"
            android:defaultValue="true"
            android:title="@string/pref_emails_checkbox"
            android:layout="@layout/preference_child_summary"/>

        <PreferenceScreen
            android:key="emailNotifications"
            android:title="@string/emails"
            android:layout="@layout/preference_child_summary">

            <PreferenceCategory android:title="@string/emails"
                android:layout="@layout/preference_category">
                <CheckBoxPreference
                    android:key="preference_email_you_won_challenge"
                    android:defaultValue="true"
                    android:title="@string/preference_push_you_won_challenge"
                    android:layout="@layout/preference_child_summary"/>
                <CheckBoxPreference
                    android:key="preference_email_onboarding"
                    android:defaultValue="true"
                    android:title="@string/preference_email_onboarding"
                    android:layout="@layout/preference_child_summary"/>
                <CheckBoxPreference
                    android:key="preference_email_received_a_private_message"
                    android:defaultValue="true"
                    android:title="@string/preference_push_received_a_private_message"
                    android:layout="@layout/preference_child_summary"/>
                <CheckBoxPreference
                    android:key="preference_email_gifted_gems"
                    android:defaultValue="true"
                    android:title="@string/preference_push_gifted_gems"
                    android:layout="@layout/preference_child_summary"/>
                <CheckBoxPreference
                    android:key="preference_email_gifted_subscription"
                    android:defaultValue="true"
                    android:title="@string/preference_push_gifted_subscription"
                    android:layout="@layout/preference_child_summary"/>
                <CheckBoxPreference
                    android:key="preference_email_invited_to_party"
                    android:defaultValue="true"
                    android:title="@string/preference_push_invited_to_party"
                    android:layout="@layout/preference_child_summary"/>
                <CheckBoxPreference
                    android:key="preference_email_invited_to_guild"
                    android:defaultValue="true"
                    android:title="@string/preference_push_invited_to_guild"
                    android:layout="@layout/preference_child_summary"/>
                <CheckBoxPreference
                    android:key="preference_email_kicked_group"
                    android:defaultValue="true"
                    android:title="@string/preference_email_kicked_group"
                    android:layout="@layout/preference_child_summary"/>
                <CheckBoxPreference
                    android:key="preference_email_your_quest_has_begun"
                    android:defaultValue="true"
                    android:title="@string/preference_push_your_quest_has_begun"
                    android:layout="@layout/preference_child_summary"/>
                <CheckBoxPreference
                    android:key="preference_email_invited_to_quest"
                    android:defaultValue="true"
                    android:title="@string/preference_push_invited_to_quest"
                    android:layout="@layout/preference_child_summary"/>
                <CheckBoxPreference
                    android:key="preference_email_important_announcements"
                    android:defaultValue="true"
                    android:title="@string/preference_push_important_announcements"
                    android:layout="@layout/preference_child_summary"/>
                <CheckBoxPreference
                    android:key="preference_email_subscription_reminder"
                    android:defaultValue="true"
                    android:title="@string/preference_email_subscription_reminder"
                    android:layout="@layout/preference_child_summary"/>
                <CheckBoxPreference
                    android:key="preference_email_content_release"
                    android:defaultValue="true"
                    android:title="@string/preference_email_content_release"
                    android:layout="@layout/preference_child_summary"/>
            </PreferenceCategory>
        </PreferenceScreen>
    </PreferenceCategory>

    <PreferenceCategory
        android:title="@string/maintenance"
        android:layout="@layout/preference_category">
        <Preference
                android:key="clear_database"
                android:title="@string/clear_cache_settings"
                android:layout="@layout/preference_child_summary" />
        <Preference android:title="@string/reload_content"
            android:key="reload_content"
            android:layout="@layout/preference_child_summary"/>
        <ListPreference android:title="@string/server"
            android:key="server_url"
            android:entries="@array/server_urls"
            android:entryValues="@array/server_urls"
            android:layout="@layout/preference_child_summary" />
    </PreferenceCategory>
</PreferenceScreen>
