Remove internal references from DatePicker
Bug: 15675746
Change-Id: I92d22d25c140a82831eb6086772d66cf4ea62b86
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 696ea08..afd0f40 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -675,4 +675,8 @@
<string name="date_time_fmt">"<xliff:g id="date">%s</xliff:g>, <xliff:g id="time_interval">%s</xliff:g>"</string>
<!-- Title for untitled calendar interactions [CHAR LIMIT=40] -->
<string name="untitled_event">(Untitled event)</string>
+
+ <!-- Name of the button in the date/time picker to accept the date/time change [CHAR LIMIT=15] -->
+ <string name="date_time_set">Set</string>
+
</resources>
diff --git a/src/com/android/contacts/datepicker/DatePicker.java b/src/com/android/contacts/datepicker/DatePicker.java
index d662c3a..1b3b807 100644
--- a/src/com/android/contacts/datepicker/DatePicker.java
+++ b/src/com/android/contacts/datepicker/DatePicker.java
@@ -171,6 +171,8 @@
updateDaySpinner();
}
});
+ mYearPicker.setMinValue(DEFAULT_START_YEAR);
+ mYearPicker.setMaxValue(DEFAULT_END_YEAR);
mYearToggle = (CheckBox) findViewById(R.id.yearToggle);
mYearToggle.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@@ -183,19 +185,6 @@
}
});
- // attributes
- TypedArray a = context.obtainStyledAttributes(attrs,
- com.android.internal.R.styleable.DatePicker);
-
- int mStartYear =
- a.getInt(com.android.internal.R.styleable.DatePicker_startYear, DEFAULT_START_YEAR);
- int mEndYear =
- a.getInt(com.android.internal.R.styleable.DatePicker_endYear, DEFAULT_END_YEAR);
- mYearPicker.setMinValue(mStartYear);
- mYearPicker.setMaxValue(mEndYear);
-
- a.recycle();
-
// initialize to current date
Calendar cal = Calendar.getInstance();
init(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH), null);
diff --git a/src/com/android/contacts/datepicker/DatePickerDialog.java b/src/com/android/contacts/datepicker/DatePickerDialog.java
index 5ed143b..2b470d5 100644
--- a/src/com/android/contacts/datepicker/DatePickerDialog.java
+++ b/src/com/android/contacts/datepicker/DatePickerDialog.java
@@ -17,18 +17,15 @@
package com.android.contacts.datepicker;
// This is a fork of the standard Android DatePicker that additionally allows toggling the year
-// on/off. It uses some private API so that not everything has to be copied.
+// on/off.
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
-import android.os.Build;
import android.os.Bundle;
-import android.text.TextUtils.TruncateAt;
import android.view.LayoutInflater;
import android.view.View;
-import android.widget.TextView;
import com.android.contacts.R;
import com.android.contacts.common.util.DateUtils;
@@ -108,10 +105,8 @@
int monthOfYear,
int dayOfMonth,
boolean yearOptional) {
- this(context, context.getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.HONEYCOMB
- ? com.android.internal.R.style.Theme_Holo_Light_Dialog_Alert
- : com.android.internal.R.style.Theme_Dialog_Alert,
- callBack, year, monthOfYear, dayOfMonth, yearOptional);
+ this(context, THEME_DEVICE_DEFAULT_LIGHT, callBack, year, monthOfYear, dayOfMonth,
+ yearOptional);
}
/**
@@ -160,7 +155,7 @@
mTitleNoYearDateFormat = DateUtils.getLocalizedDateFormatWithoutYear(getContext());
updateTitle(mInitialYear, mInitialMonth, mInitialDay);
- setButton(BUTTON_POSITIVE, context.getText(com.android.internal.R.string.date_time_set),
+ setButton(BUTTON_POSITIVE, context.getText(R.string.date_time_set),
this);
setButton(BUTTON_NEGATIVE, context.getText(android.R.string.cancel),
(OnClickListener) null);
@@ -174,19 +169,6 @@
}
@Override
- public void show() {
- super.show();
-
- /* Sometimes the full month is displayed causing the title
- * to be very long, in those cases ensure it doesn't wrap to
- * 2 lines (as that looks jumpy) and ensure we ellipsize the end.
- */
- TextView title = (TextView) findViewById(com.android.internal.R.id.alertTitle);
- title.setSingleLine();
- title.setEllipsize(TruncateAt.END);
- }
-
- @Override
public void onClick(DialogInterface dialog, int which) {
if (mCallBack != null) {
mDatePicker.clearFocus();