@5.01.15 Dennis Thießen: SettingsActivity modifiziert und durch PreferenceFragment ersetzt

This commit is contained in:
Dennis Thießen
2016-01-05 16:11:25 +01:00
parent 0dc3761e64
commit 405ff4bc91
8 changed files with 460 additions and 375 deletions

View File

@@ -16,130 +16,13 @@
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" />
<LinearLayout
android:id="@+id/layoutMain"
android:layout_below="@+id/toolbar"
<FrameLayout
android:id="@+id/fragment_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
android:layout_gravity="center_horizontal"
android:layout_below="@id/toolbar">
<RelativeLayout
android:id="@+id/layoutContent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_centerInParent="true"
android:layout_margin="10dp"
android:layout_marginBottom="20dp">
<android.support.design.widget.TextInputLayout
android:id="@+id/til_settings_username"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/txt_settings_username"
android:hint="Username"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="@+id/til_settings_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/til_settings_username">
<EditText
android:id="@+id/txt_settings_name"
android:hint="@string/lbl_settings_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="@+id/til_settings_surname"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/til_settings_name">
<EditText
android:id="@+id/txt_settings_surname"
android:hint="@string/lbl_settings_surname"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/til_settings_name"
android:layout_toRightOf="@+id/til_settings_name"
android:layout_toEndOf="@+id/til_settings_name" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="@+id/til_settings_email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/til_settings_surname">
<EditText
android:id="@+id/txt_settings_email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/lbl_settings_email"/>
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="@+id/til_settings_password"
android:layout_marginTop="40dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/til_settings_email">
</android.support.design.widget.TextInputLayout>
<com.beardedhen.androidbootstrap.BootstrapButton
android:id="@+id/btn_settings_req_password"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
bootstrap:bootstrapText="@string/btn_settings_req_password"
bootstrap:bootstrapBrand="primary"
bootstrap:roundedCorners="true"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>
<LinearLayout
android:id="@+id/layoutFooter"
android:gravity="center"
android:layout_height="wrap_content"
android:background="#7fbfbfbf"
android:layout_width="match_parent"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
<Button
android:id="@+id/btn_settings_change"
android:layout_weight="1"
android:textColor="@color/white"
android:background="@color/bg_common_trans"
android:layout_marginRight="1dp"
android:paddingLeft="10dp"
android:layout_width="0dp"
android:layout_height="wrap_content"
style="?android:attr/borderlessButtonStyle"
android:text="@string/btn_settings_change" />
</LinearLayout>
</LinearLayout>
</FrameLayout>
</RelativeLayout>

View File

@@ -313,6 +313,96 @@
<item>Tiere</item>
<item>Sonstiges…</item>
</string-array>
<string name="title_activity_settings_activityv2">Settings</string>
<!-- Strings related to Settings -->
<!-- Example General settings -->
<string name="pref_header_general">General</string>
<string name="pref_title_social_recommendations">Enable social recommendations</string>
<string name="pref_description_social_recommendations">Recommendations for people to contact
based on your message history
</string>
<string name="pref_title_display_name">Display name</string>
<string name="pref_default_display_name">John Smith</string>
<string name="pref_title_add_friends_to_messages">Add friends to messages</string>
<string-array name="pref_example_list_titles">
<item>Always</item>
<item>When possible</item>
<item>Never</item>
</string-array>
<string-array name="pref_example_list_values">
<item>1</item>
<item>0</item>
<item>-1</item>
</string-array>
<!-- Example settings for Data & Sync -->
<string name="pref_header_data_sync">Data &amp; sync</string>
<string name="pref_title_sync_frequency">Sync frequency</string>
<string-array name="pref_sync_frequency_titles">
<item>15 minutes</item>
<item>30 minutes</item>
<item>1 hour</item>
<item>3 hours</item>
<item>6 hours</item>
<item>Never</item>
</string-array>
<string-array name="pref_sync_frequency_values">
<item>15</item>
<item>30</item>
<item>60</item>
<item>180</item>
<item>360</item>
<item>-1</item>
</string-array>
<string name="pref_title_system_sync_settings">System sync settings</string>
<!-- Example settings for Notifications -->
<string name="pref_header_notifications">Notifications</string>
<string name="pref_title_new_message_notifications">New message notifications</string>
<string name="pref_title_ringtone">Ringtone</string>
<string name="pref_ringtone_silent">Silent</string>
<string name="pref_title_vibrate">Vibrate</string>
<string name="title_activity_settings_activity_v2">Settings</string>
<string-array name="notification_radius">
<item>1 KM</item>
<item>5 KM</item>
<item>10 KM</item>
<item>15 KM</item>
</string-array>
<string-array name="notification_radius_entry">
<item>1</item>
<item>5</item>
<item>10</item>
<item>15</item>
</string-array>
<string-array name="notification_freq">
<item>Every 5 Minutes</item>
<item>Every 10 Minutes</item>
<item>Every 15 Minutes</item>
<item>Every 30 Minutes</item>
<item>Every hour</item>
</string-array>
<string-array name="notification_freq_entry">
<item>5</item>
<item>10</item>
<item>15</item>
<item>30</item>
<item>60</item>
</string-array>
</resources>

View File

@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory
android:title="Account Settings">
<EditTextPreference
android:key="usernamePref"
android:title="Username"
android:summary="Please enter your username"
android:dialogTitle="Enter your username" />
<EditTextPreference
android:key="namePref"
android:title="Name"
android:summary="Please enter your name"
android:dialogTitle="Enter your name" />
<EditTextPreference
android:key="surnamePref"
android:title="Surname"
android:summary="Please enter your surname"
android:dialogTitle="Enter your surname" />
<EditTextPreference
android:key="emailPref"
android:inputType="textEmailAddress"
android:title="E-Mail"
android:summary="Please enter your email"
android:dialogTitle="Enter your email" />
<Preference
android:key="resetPassword"
android:title="Reset Password"
android:summary="Request a new password" />
</PreferenceCategory>
<PreferenceCategory
android:title="Notifications">
<SwitchPreference
android:key="notfiyEnable"
android:title="Show Notifications"
android:summary="Enable notifications in your area" />
<ListPreference
android:key="notifyRadius"
android:title="Radius"
android:entries="@array/notification_radius"
android:entryValues="@array/notification_radius_entry"
android:summary="Choose the radius from your last known location in which notifications will be displayed"
android:dialogTitle="Notification Radius" />
<ListPreference
android:key="notifyFrequency"
android:title="Poll Frequency"
android:entries="@array/notification_freq"
android:entryValues="@array/notification_freq_entry"
android:summary="Decide how often notification updates should be received from server"
android:dialogTitle="Poll Frequency" />
</PreferenceCategory>
</PreferenceScreen>