OSDN Git Service

create eclipse project master
authortamanegisoul <tamanegisoul@users.sourceforge.jp>
Sat, 26 Jan 2013 01:23:36 +0000 (10:23 +0900)
committertamanegisoul <tamanegisoul@users.sourceforge.jp>
Sat, 26 Jan 2013 01:23:36 +0000 (10:23 +0900)
21 files changed:
TinyLock/.classpath [new file with mode: 0644]
TinyLock/.gitignore [new file with mode: 0644]
TinyLock/.project [new file with mode: 0644]
TinyLock/AndroidManifest.xml [new file with mode: 0644]
TinyLock/ic_launcher-web.png [new file with mode: 0644]
TinyLock/proguard-project.txt [new file with mode: 0644]
TinyLock/project.properties [new file with mode: 0644]
TinyLock/res/drawable-hdpi/ic_launcher.png [new file with mode: 0644]
TinyLock/res/drawable-ldpi/ic_launcher.png [new file with mode: 0644]
TinyLock/res/drawable-mdpi/ic_launcher.png [new file with mode: 0644]
TinyLock/res/drawable-xhdpi/ic_launcher.png [new file with mode: 0644]
TinyLock/res/values-v11/styles.xml [new file with mode: 0644]
TinyLock/res/values-v14/styles.xml [new file with mode: 0644]
TinyLock/res/values/strings.xml [new file with mode: 0644]
TinyLock/res/values/strings_activity_settings.xml [new file with mode: 0644]
TinyLock/res/values/styles.xml [new file with mode: 0644]
TinyLock/res/xml/pref_data_sync.xml [new file with mode: 0644]
TinyLock/res/xml/pref_general.xml [new file with mode: 0644]
TinyLock/res/xml/pref_headers.xml [new file with mode: 0644]
TinyLock/res/xml/pref_notification.xml [new file with mode: 0644]
TinyLock/src/jp/sourceforge/tamanegisoul/tinylock/SettingsActivity.java [new file with mode: 0644]

diff --git a/TinyLock/.classpath b/TinyLock/.classpath
new file mode 100644 (file)
index 0000000..a4763d1
--- /dev/null
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+       <classpathentry kind="src" path="src"/>
+       <classpathentry kind="src" path="gen"/>
+       <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
+       <classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
+       <classpathentry kind="output" path="bin/classes"/>
+</classpath>
diff --git a/TinyLock/.gitignore b/TinyLock/.gitignore
new file mode 100644 (file)
index 0000000..0cd236b
--- /dev/null
@@ -0,0 +1,4 @@
+/bin
+/libs
+/.settings
+/gen
diff --git a/TinyLock/.project b/TinyLock/.project
new file mode 100644 (file)
index 0000000..40366a4
--- /dev/null
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+       <name>TinyLock</name>
+       <comment></comment>
+       <projects>
+       </projects>
+       <buildSpec>
+               <buildCommand>
+                       <name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.jdt.core.javabuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>com.android.ide.eclipse.adt.ApkBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+       </buildSpec>
+       <natures>
+               <nature>com.android.ide.eclipse.adt.AndroidNature</nature>
+               <nature>org.eclipse.jdt.core.javanature</nature>
+       </natures>
+</projectDescription>
diff --git a/TinyLock/AndroidManifest.xml b/TinyLock/AndroidManifest.xml
new file mode 100644 (file)
index 0000000..d71e32a
--- /dev/null
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    package="jp.sourceforge.tamanegisoul.tinylock"
+    android:versionCode="1"
+    android:versionName="1.0" >
+
+    <uses-sdk
+        android:minSdkVersion="8"
+        android:targetSdkVersion="17" />
+
+    <application
+        android:allowBackup="true"
+        android:icon="@drawable/ic_launcher"
+        android:label="@string/app_name"
+        android:theme="@style/AppTheme" >
+        <activity
+            android:name="jp.sourceforge.tamanegisoul.tinylock.SettingsActivity"
+            android:label="@string/app_name" >
+        </activity>
+    </application>
+
+</manifest>
\ No newline at end of file
diff --git a/TinyLock/ic_launcher-web.png b/TinyLock/ic_launcher-web.png
new file mode 100644 (file)
index 0000000..424f260
Binary files /dev/null and b/TinyLock/ic_launcher-web.png differ
diff --git a/TinyLock/proguard-project.txt b/TinyLock/proguard-project.txt
new file mode 100644 (file)
index 0000000..f2fe155
--- /dev/null
@@ -0,0 +1,20 @@
+# To enable ProGuard in your project, edit project.properties
+# to define the proguard.config property as described in that file.
+#
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in ${sdk.dir}/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the ProGuard
+# include property in project.properties.
+#
+# For more details, see
+#   http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+#   public *;
+#}
diff --git a/TinyLock/project.properties b/TinyLock/project.properties
new file mode 100644 (file)
index 0000000..a3ee5ab
--- /dev/null
@@ -0,0 +1,14 @@
+# This file is automatically generated by Android Tools.
+# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
+#
+# This file must be checked in Version Control Systems.
+#
+# To customize properties used by the Ant build system edit
+# "ant.properties", and override values to adapt the script to your
+# project structure.
+#
+# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
+#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
+
+# Project target.
+target=android-17
diff --git a/TinyLock/res/drawable-hdpi/ic_launcher.png b/TinyLock/res/drawable-hdpi/ic_launcher.png
new file mode 100644 (file)
index 0000000..0e79b18
Binary files /dev/null and b/TinyLock/res/drawable-hdpi/ic_launcher.png differ
diff --git a/TinyLock/res/drawable-ldpi/ic_launcher.png b/TinyLock/res/drawable-ldpi/ic_launcher.png
new file mode 100644 (file)
index 0000000..ebfac7d
Binary files /dev/null and b/TinyLock/res/drawable-ldpi/ic_launcher.png differ
diff --git a/TinyLock/res/drawable-mdpi/ic_launcher.png b/TinyLock/res/drawable-mdpi/ic_launcher.png
new file mode 100644 (file)
index 0000000..1183441
Binary files /dev/null and b/TinyLock/res/drawable-mdpi/ic_launcher.png differ
diff --git a/TinyLock/res/drawable-xhdpi/ic_launcher.png b/TinyLock/res/drawable-xhdpi/ic_launcher.png
new file mode 100644 (file)
index 0000000..c8ab2a1
Binary files /dev/null and b/TinyLock/res/drawable-xhdpi/ic_launcher.png differ
diff --git a/TinyLock/res/values-v11/styles.xml b/TinyLock/res/values-v11/styles.xml
new file mode 100644 (file)
index 0000000..541752f
--- /dev/null
@@ -0,0 +1,11 @@
+<resources>
+
+    <!--
+        Base application theme for API 11+. This theme completely replaces
+        AppBaseTheme from res/values/styles.xml on API 11+ devices.
+    -->
+    <style name="AppBaseTheme" parent="android:Theme.Holo.Light">
+        <!-- API 11 theme customizations can go here. -->
+    </style>
+
+</resources>
\ No newline at end of file
diff --git a/TinyLock/res/values-v14/styles.xml b/TinyLock/res/values-v14/styles.xml
new file mode 100644 (file)
index 0000000..f20e015
--- /dev/null
@@ -0,0 +1,12 @@
+<resources>
+
+    <!--
+        Base application theme for API 14+. This theme completely replaces
+        AppBaseTheme from BOTH res/values/styles.xml and
+        res/values-v11/styles.xml on API 14+ devices.
+    -->
+    <style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
+        <!-- API 14 theme customizations can go here. -->
+    </style>
+
+</resources>
\ No newline at end of file
diff --git a/TinyLock/res/values/strings.xml b/TinyLock/res/values/strings.xml
new file mode 100644 (file)
index 0000000..6d6731e
--- /dev/null
@@ -0,0 +1,5 @@
+<resources>
+
+    <string name="app_name">TinyLock</string>
+
+</resources>
\ No newline at end of file
diff --git a/TinyLock/res/values/strings_activity_settings.xml b/TinyLock/res/values/strings_activity_settings.xml
new file mode 100644 (file)
index 0000000..4a7b1c7
--- /dev/null
@@ -0,0 +1,55 @@
+<resources>
+
+    <!-- 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>
+
+</resources>
\ No newline at end of file
diff --git a/TinyLock/res/values/styles.xml b/TinyLock/res/values/styles.xml
new file mode 100644 (file)
index 0000000..4a10ca4
--- /dev/null
@@ -0,0 +1,20 @@
+<resources>
+
+    <!--
+        Base application theme, dependent on API level. This theme is replaced
+        by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
+    -->
+    <style name="AppBaseTheme" parent="android:Theme.Light">
+        <!--
+            Theme customizations available in newer API levels can go in
+            res/values-vXX/styles.xml, while customizations related to
+            backward-compatibility can go here.
+        -->
+    </style>
+
+    <!-- Application theme. -->
+    <style name="AppTheme" parent="AppBaseTheme">
+        <!-- All customizations that are NOT specific to a particular API-level can go here. -->
+    </style>
+
+</resources>
\ No newline at end of file
diff --git a/TinyLock/res/xml/pref_data_sync.xml b/TinyLock/res/xml/pref_data_sync.xml
new file mode 100644 (file)
index 0000000..2d7f041
--- /dev/null
@@ -0,0 +1,25 @@
+<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" >
+
+    <!--
+         NOTE: Hide buttons to simplify the UI. Users can touch outside the dialog to
+         dismiss it.
+    -->
+    <!-- NOTE: ListPreference's summary should be set to its value by the activity code. -->
+    <ListPreference
+        android:defaultValue="180"
+        android:entries="@array/pref_sync_frequency_titles"
+        android:entryValues="@array/pref_sync_frequency_values"
+        android:key="sync_frequency"
+        android:negativeButtonText="@null"
+        android:positiveButtonText="@null"
+        android:title="@string/pref_title_sync_frequency" />
+
+    <!--
+         This preference simply launches an intent when selected. Use this UI sparingly, per
+         design guidelines.
+    -->
+    <Preference android:title="@string/pref_title_system_sync_settings" >
+        <intent android:action="android.settings.SYNC_SETTINGS" />
+    </Preference>
+
+</PreferenceScreen>
\ No newline at end of file
diff --git a/TinyLock/res/xml/pref_general.xml b/TinyLock/res/xml/pref_general.xml
new file mode 100644 (file)
index 0000000..4eb59b4
--- /dev/null
@@ -0,0 +1,35 @@
+<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" >
+
+    <CheckBoxPreference
+        android:defaultValue="true"
+        android:key="example_checkbox"
+        android:summary="@string/pref_description_social_recommendations"
+        android:title="@string/pref_title_social_recommendations" />
+
+    <!-- NOTE: EditTextPreference accepts EditText attributes. -->
+    <!-- NOTE: EditTextPreference's summary should be set to its value by the activity code. -->
+    <EditTextPreference
+        android:capitalize="words"
+        android:defaultValue="@string/pref_default_display_name"
+        android:inputType="textCapWords"
+        android:key="example_text"
+        android:maxLines="1"
+        android:selectAllOnFocus="true"
+        android:singleLine="true"
+        android:title="@string/pref_title_display_name" />
+
+    <!--
+         NOTE: Hide buttons to simplify the UI. Users can touch outside the dialog to
+         dismiss it.
+    -->
+    <!-- NOTE: ListPreference's summary should be set to its value by the activity code. -->
+    <ListPreference
+        android:defaultValue="-1"
+        android:entries="@array/pref_example_list_titles"
+        android:entryValues="@array/pref_example_list_values"
+        android:key="example_list"
+        android:negativeButtonText="@null"
+        android:positiveButtonText="@null"
+        android:title="@string/pref_title_add_friends_to_messages" />
+
+</PreferenceScreen>
\ No newline at end of file
diff --git a/TinyLock/res/xml/pref_headers.xml b/TinyLock/res/xml/pref_headers.xml
new file mode 100644 (file)
index 0000000..05e1241
--- /dev/null
@@ -0,0 +1,15 @@
+<preference-headers xmlns:android="http://schemas.android.com/apk/res/android" >
+
+    <!-- These settings headers are only used on tablets. -->
+
+    <header
+        android:fragment="${packageName}.${activityClass}$GeneralPreferenceFragment"
+        android:title="@string/pref_header_general" />
+    <header
+        android:fragment="${packageName}.${activityClass}$NotificationPreferenceFragment"
+        android:title="@string/pref_header_notifications" />
+    <header
+        android:fragment="${packageName}.${activityClass}$DataSyncPreferenceFragment"
+        android:title="@string/pref_header_data_sync" />
+
+</preference-headers>
\ No newline at end of file
diff --git a/TinyLock/res/xml/pref_notification.xml b/TinyLock/res/xml/pref_notification.xml
new file mode 100644 (file)
index 0000000..6d00357
--- /dev/null
@@ -0,0 +1,29 @@
+<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" >
+
+    <!--
+         A 'parent' preference, which enables/disables child preferences (below)
+         when checked/unchecked.
+    -->
+    <CheckBoxPreference
+        android:defaultValue="true"
+        android:key="notifications_new_message"
+        android:title="@string/pref_title_new_message_notifications" />
+
+    <!-- Allows the user to choose a ringtone in the 'notification' category. -->
+    <!-- NOTE: This preference will be enabled only when the checkbox above is checked. -->
+    <!-- NOTE: RingtonePreference's summary should be set to its value by the activity code. -->
+    <RingtonePreference
+        android:defaultValue="content://settings/system/notification_sound"
+        android:dependency="notifications_new_message"
+        android:key="notifications_new_message_ringtone"
+        android:ringtoneType="notification"
+        android:title="@string/pref_title_ringtone" />
+
+    <!-- NOTE: This preference will be enabled only when the checkbox above is checked. -->
+    <CheckBoxPreference
+        android:defaultValue="true"
+        android:dependency="notifications_new_message"
+        android:key="notifications_new_message_vibrate"
+        android:title="@string/pref_title_vibrate" />
+
+</PreferenceScreen>
\ No newline at end of file
diff --git a/TinyLock/src/jp/sourceforge/tamanegisoul/tinylock/SettingsActivity.java b/TinyLock/src/jp/sourceforge/tamanegisoul/tinylock/SettingsActivity.java
new file mode 100644 (file)
index 0000000..b3ca091
--- /dev/null
@@ -0,0 +1,255 @@
+package jp.sourceforge.tamanegisoul.tinylock;
+
+import android.annotation.TargetApi;
+import android.content.Context;
+import android.content.res.Configuration;
+import android.media.Ringtone;
+import android.media.RingtoneManager;
+import android.net.Uri;
+import android.os.Build;
+import android.os.Bundle;
+import android.preference.ListPreference;
+import android.preference.Preference;
+import android.preference.PreferenceActivity;
+import android.preference.PreferenceCategory;
+import android.preference.PreferenceFragment;
+import android.preference.PreferenceManager;
+import android.preference.RingtonePreference;
+import android.text.TextUtils;
+
+import java.util.List;
+
+/**
+ * A {@link PreferenceActivity} that presents a set of application settings. On
+ * handset devices, settings are presented as a single list. On tablets,
+ * settings are split by category, with category headers shown to the left of
+ * the list of settings.
+ * <p>
+ * See <a href="http://developer.android.com/design/patterns/settings.html">
+ * Android Design: Settings</a> for design guidelines and the <a
+ * href="http://developer.android.com/guide/topics/ui/settings.html">Settings
+ * API Guide</a> for more information on developing a Settings UI.
+ */
+public class SettingsActivity extends PreferenceActivity {
+       /**
+        * Determines whether to always show the simplified settings UI, where
+        * settings are presented in a single list. When false, settings are shown
+        * as a master/detail two-pane view on tablets. When true, a single pane is
+        * shown on tablets.
+        */
+       private static final boolean ALWAYS_SIMPLE_PREFS = false;
+
+       @Override
+       protected void onPostCreate(Bundle savedInstanceState) {
+               super.onPostCreate(savedInstanceState);
+
+               setupSimplePreferencesScreen();
+       }
+
+       /**
+        * Shows the simplified settings UI if the device configuration if the
+        * device configuration dictates that a simplified, single-pane UI should be
+        * shown.
+        */
+       private void setupSimplePreferencesScreen() {
+               if (!isSimplePreferences(this)) {
+                       return;
+               }
+
+               // In the simplified UI, fragments are not used at all and we instead
+               // use the older PreferenceActivity APIs.
+
+               // Add 'general' preferences.
+               addPreferencesFromResource(R.xml.pref_general);
+
+               // Add 'notifications' preferences, and a corresponding header.
+               PreferenceCategory fakeHeader = new PreferenceCategory(this);
+               fakeHeader.setTitle(R.string.pref_header_notifications);
+               getPreferenceScreen().addPreference(fakeHeader);
+               addPreferencesFromResource(R.xml.pref_notification);
+
+               // Add 'data and sync' preferences, and a corresponding header.
+               fakeHeader = new PreferenceCategory(this);
+               fakeHeader.setTitle(R.string.pref_header_data_sync);
+               getPreferenceScreen().addPreference(fakeHeader);
+               addPreferencesFromResource(R.xml.pref_data_sync);
+
+               // Bind the summaries of EditText/List/Dialog/Ringtone preferences to
+               // their values. When their values change, their summaries are updated
+               // to reflect the new value, per the Android Design guidelines.
+               bindPreferenceSummaryToValue(findPreference("example_text"));
+               bindPreferenceSummaryToValue(findPreference("example_list"));
+               bindPreferenceSummaryToValue(findPreference("notifications_new_message_ringtone"));
+               bindPreferenceSummaryToValue(findPreference("sync_frequency"));
+       }
+
+       /** {@inheritDoc} */
+       @Override
+       public boolean onIsMultiPane() {
+               return isXLargeTablet(this) && !isSimplePreferences(this);
+       }
+
+       /**
+        * Helper method to determine if the device has an extra-large screen. For
+        * example, 10" tablets are extra-large.
+        */
+       private static boolean isXLargeTablet(Context context) {
+               return (context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_XLARGE;
+       }
+
+       /**
+        * Determines whether the simplified settings UI should be shown. This is
+        * true if this is forced via {@link #ALWAYS_SIMPLE_PREFS}, or the device
+        * doesn't have newer APIs like {@link PreferenceFragment}, or the device
+        * doesn't have an extra-large screen. In these cases, a single-pane
+        * "simplified" settings UI should be shown.
+        */
+       private static boolean isSimplePreferences(Context context) {
+               return ALWAYS_SIMPLE_PREFS
+                               || Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB
+                               || !isXLargeTablet(context);
+       }
+
+       /** {@inheritDoc} */
+       @Override
+       @TargetApi(Build.VERSION_CODES.HONEYCOMB)
+       public void onBuildHeaders(List<Header> target) {
+               if (!isSimplePreferences(this)) {
+                       loadHeadersFromResource(R.xml.pref_headers, target);
+               }
+       }
+
+       /**
+        * A preference value change listener that updates the preference's summary
+        * to reflect its new value.
+        */
+       private static Preference.OnPreferenceChangeListener sBindPreferenceSummaryToValueListener = new Preference.OnPreferenceChangeListener() {
+               @Override
+               public boolean onPreferenceChange(Preference preference, Object value) {
+                       String stringValue = value.toString();
+
+                       if (preference instanceof ListPreference) {
+                               // For list preferences, look up the correct display value in
+                               // the preference's 'entries' list.
+                               ListPreference listPreference = (ListPreference) preference;
+                               int index = listPreference.findIndexOfValue(stringValue);
+
+                               // Set the summary to reflect the new value.
+                               preference
+                                               .setSummary(index >= 0 ? listPreference.getEntries()[index]
+                                                               : null);
+
+                       } else if (preference instanceof RingtonePreference) {
+                               // For ringtone preferences, look up the correct display value
+                               // using RingtoneManager.
+                               if (TextUtils.isEmpty(stringValue)) {
+                                       // Empty values correspond to 'silent' (no ringtone).
+                                       preference.setSummary(R.string.pref_ringtone_silent);
+
+                               } else {
+                                       Ringtone ringtone = RingtoneManager.getRingtone(
+                                                       preference.getContext(), Uri.parse(stringValue));
+
+                                       if (ringtone == null) {
+                                               // Clear the summary if there was a lookup error.
+                                               preference.setSummary(null);
+                                       } else {
+                                               // Set the summary to reflect the new ringtone display
+                                               // name.
+                                               String name = ringtone
+                                                               .getTitle(preference.getContext());
+                                               preference.setSummary(name);
+                                       }
+                               }
+
+                       } else {
+                               // For all other preferences, set the summary to the value's
+                               // simple string representation.
+                               preference.setSummary(stringValue);
+                       }
+                       return true;
+               }
+       };
+
+       /**
+        * Binds a preference's summary to its value. More specifically, when the
+        * preference's value is changed, its summary (line of text below the
+        * preference title) is updated to reflect the value. The summary is also
+        * immediately updated upon calling this method. The exact display format is
+        * dependent on the type of preference.
+        * 
+        * @see #sBindPreferenceSummaryToValueListener
+        */
+       private static void bindPreferenceSummaryToValue(Preference preference) {
+               // Set the listener to watch for value changes.
+               preference
+                               .setOnPreferenceChangeListener(sBindPreferenceSummaryToValueListener);
+
+               // Trigger the listener immediately with the preference's
+               // current value.
+               sBindPreferenceSummaryToValueListener.onPreferenceChange(
+                               preference,
+                               PreferenceManager.getDefaultSharedPreferences(
+                                               preference.getContext()).getString(preference.getKey(),
+                                               ""));
+       }
+
+       /**
+        * This fragment shows general preferences only. It is used when the
+        * activity is showing a two-pane settings UI.
+        */
+       @TargetApi(Build.VERSION_CODES.HONEYCOMB)
+       public static class GeneralPreferenceFragment extends PreferenceFragment {
+               @Override
+               public void onCreate(Bundle savedInstanceState) {
+                       super.onCreate(savedInstanceState);
+                       addPreferencesFromResource(R.xml.pref_general);
+
+                       // Bind the summaries of EditText/List/Dialog/Ringtone preferences
+                       // to their values. When their values change, their summaries are
+                       // updated to reflect the new value, per the Android Design
+                       // guidelines.
+                       bindPreferenceSummaryToValue(findPreference("example_text"));
+                       bindPreferenceSummaryToValue(findPreference("example_list"));
+               }
+       }
+
+       /**
+        * This fragment shows notification preferences only. It is used when the
+        * activity is showing a two-pane settings UI.
+        */
+       @TargetApi(Build.VERSION_CODES.HONEYCOMB)
+       public static class NotificationPreferenceFragment extends
+                       PreferenceFragment {
+               @Override
+               public void onCreate(Bundle savedInstanceState) {
+                       super.onCreate(savedInstanceState);
+                       addPreferencesFromResource(R.xml.pref_notification);
+
+                       // Bind the summaries of EditText/List/Dialog/Ringtone preferences
+                       // to their values. When their values change, their summaries are
+                       // updated to reflect the new value, per the Android Design
+                       // guidelines.
+                       bindPreferenceSummaryToValue(findPreference("notifications_new_message_ringtone"));
+               }
+       }
+
+       /**
+        * This fragment shows data and sync preferences only. It is used when the
+        * activity is showing a two-pane settings UI.
+        */
+       @TargetApi(Build.VERSION_CODES.HONEYCOMB)
+       public static class DataSyncPreferenceFragment extends PreferenceFragment {
+               @Override
+               public void onCreate(Bundle savedInstanceState) {
+                       super.onCreate(savedInstanceState);
+                       addPreferencesFromResource(R.xml.pref_data_sync);
+
+                       // Bind the summaries of EditText/List/Dialog/Ringtone preferences
+                       // to their values. When their values change, their summaries are
+                       // updated to reflect the new value, per the Android Design
+                       // guidelines.
+                       bindPreferenceSummaryToValue(findPreference("sync_frequency"));
+               }
+       }
+}