Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct of summary format. #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.bostonandroid.datepreference;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
Expand Down Expand Up @@ -34,7 +35,7 @@ public DatePreference(Context context, AttributeSet attrs) {
/**
* Produces a DatePicker set to the date produced by {@link #getDate()}. When
* overriding be sure to call the super.
*
*
* @return a DatePicker with the date set
*/
@Override
Expand All @@ -51,7 +52,7 @@ protected View onCreateDialogView() {
* date, produces the default from the XML's android:defaultValue. If the
* default is not set in the XML or if the XML's default is invalid it uses
* the value produced by {@link #defaultCalendar()}.
*
*
* @return the Calendar for the date picker
*/
public Calendar getDate() {
Expand All @@ -67,7 +68,7 @@ public Calendar getDate() {

/**
* Set the selected date to the specified string.
*
*
* @param dateString
* The date, represented as a string, in the format specified by
* {@link #formatter()}.
Expand All @@ -79,7 +80,7 @@ public void setDate(String dateString) {
/**
* Produces the date formatter used for dates in the XML. The default is yyyy.MM.dd.
* Override this to change that.
*
*
* @return the SimpleDateFormat used for XML dates
*/
public static SimpleDateFormat formatter() {
Expand All @@ -89,11 +90,11 @@ public static SimpleDateFormat formatter() {
/**
* Produces the date formatter used for showing the date in the summary. The default is MMMM dd, yyyy.
* Override this to change it.
*
*
* @return the SimpleDateFormat used for summary dates
*/
public static SimpleDateFormat summaryFormatter() {
return new SimpleDateFormat("MMMM dd, yyyy");
return (SimpleDateFormat)DateFormat.getDateInstance();
}

@Override
Expand Down Expand Up @@ -177,7 +178,7 @@ private void persistDate(String s) {
/**
* The default date to use when the XML does not set it or the XML has an
* error.
*
*
* @return the Calendar set to the default date
*/
public static Calendar defaultCalendar() {
Expand All @@ -186,7 +187,7 @@ public static Calendar defaultCalendar() {

/**
* The defaultCalendar() as a string using the {@link #formatter()}.
*
*
* @return a String representation of the default date
*/
public static String defaultCalendarString() {
Expand Down Expand Up @@ -215,7 +216,7 @@ public void onClick(DialogInterface dialog, int which) {
/**
* Produces the date the user has selected for the given preference, as a
* calendar.
*
*
* @param preferences
* the SharedPreferences to get the date from
* @param field
Expand Down Expand Up @@ -267,4 +268,4 @@ public SavedState[] newArray(int size) {
}
};
}
}
}