Commit 8bb13b84 authored by Michael Chan's avatar Michael Chan
Browse files

b/2293262 Add About section to Calendar Settings

Change-Id: I5f797b67bd4887b37949905d151a2409949090fc
parent d52c59d8
......@@ -369,4 +369,8 @@
<!-- Default value for the number of reminder minutes -->
<string name="preferences_default_reminder_default">10</string>
<!-- This is the title of a section in the Settings screen for "About" this application -->
<string name="preferences_about_title">About</string>
<!-- Build version of the application -->
<string name="preferences_build_version">Build version</string>
</resources>
......@@ -21,7 +21,7 @@
android:defaultValue="false"
android:title="@string/preferences_hide_declined_title" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/preferences_alerts_title">
<ListPreference
android:key="preferences_alerts_type"
......@@ -30,20 +30,20 @@
android:entries="@array/preferences_alert_type_labels"
android:entryValues="@array/preferences_alert_type_values"
android:dialogTitle="@string/preferences_alerts_type_dialog" />
<RingtonePreference
android:layout="?android:attr/preferenceLayoutChild"
android:key="preferences_alerts_ringtone"
android:title="@string/preferences_alerts_ringtone_title"
android:ringtoneType="notification"
android:defaultValue="content://settings/system/notification_sound" />
<CheckBoxPreference
android:layout="?android:attr/preferenceLayoutChild"
android:key="preferences_alerts_vibrate"
android:defaultValue="false"
android:title="@string/preferences_alerts_vibrate_title" />
<ListPreference
android:key="preferences_default_reminder"
android:defaultValue="@string/preferences_default_reminder_default"
......@@ -52,4 +52,12 @@
android:entryValues="@array/preferences_default_reminder_values"
android:dialogTitle="@string/preferences_default_reminder_dialog" />
</PreferenceCategory>
<PreferenceCategory
android:title="@string/preferences_about_title">
<Preference
android:key="build_version"
android:title="@string/preferences_build_version" />
</PreferenceCategory>
</PreferenceScreen>
......@@ -19,6 +19,8 @@ package com.android.calendar;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager.NameNotFoundException;
import android.os.Bundle;
import android.preference.CheckBoxPreference;
import android.preference.ListPreference;
......@@ -28,6 +30,8 @@ import android.preference.PreferenceScreen;
import android.preference.RingtonePreference;
public class CalendarPreferenceActivity extends PreferenceActivity implements OnSharedPreferenceChangeListener {
private static final String BUILD_VERSION = "build_version";
// The name of the shared preferences file. This name must be maintained for historical
// reasons, as it's what PreferenceManager assigned the first time the file was created.
private static final String SHARED_PREFS_NAME = "com.android.calendar_preferences";
......@@ -75,7 +79,7 @@ public class CalendarPreferenceActivity extends PreferenceActivity implements On
// Make sure to always use the same preferences file regardless of the package name
// we're running under
getPreferenceManager().setSharedPreferencesName(SHARED_PREFS_NAME);
// Load the preferences from an XML resource
addPreferencesFromResource(R.xml.preferences);
......@@ -85,6 +89,13 @@ public class CalendarPreferenceActivity extends PreferenceActivity implements On
mVibrate = (CheckBoxPreference) preferenceScreen.findPreference(KEY_ALERTS_VIBRATE);
mRingtone = (RingtonePreference) preferenceScreen.findPreference(KEY_ALERTS_RINGTONE);
try {
PackageInfo packageInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
findPreference(BUILD_VERSION).setSummary(packageInfo.versionName);
} catch (NameNotFoundException e) {
findPreference(BUILD_VERSION).setSummary("?");
}
updateChildPreferences();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment