<!-- 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>
android:defaultValue="false"
android:title="@string/preferences_hide_declined_title" />
</PreferenceCategory>
-
+
<PreferenceCategory android:title="@string/preferences_alerts_title">
<ListPreference
android:key="preferences_alerts_type"
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"
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>
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;
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";
// 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);
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();
}