* commit '1ebd8c11f73625050035b4fca35841a9e30bca04': Updated the Time/Date pickers to be backwards compatible
This commit is contained in:
283
api/11.xml
283
api/11.xml
@@ -2721,6 +2721,17 @@
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="calendarViewStyle"
|
||||
type="int"
|
||||
transient="false"
|
||||
volatile="false"
|
||||
value="16843613"
|
||||
static="true"
|
||||
final="true"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="candidatesTextStyleSpans"
|
||||
type="int"
|
||||
transient="false"
|
||||
@@ -3282,6 +3293,17 @@
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="datePickerStyle"
|
||||
type="int"
|
||||
transient="false"
|
||||
volatile="false"
|
||||
value="16843612"
|
||||
static="true"
|
||||
final="true"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="dateTextAppearance"
|
||||
type="int"
|
||||
transient="false"
|
||||
@@ -8727,17 +8749,6 @@
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="solidColor"
|
||||
type="int"
|
||||
transient="false"
|
||||
volatile="false"
|
||||
value="16843594"
|
||||
static="true"
|
||||
final="true"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="soundEffectsEnabled"
|
||||
type="int"
|
||||
transient="false"
|
||||
@@ -10905,6 +10916,17 @@
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="windowCloseOnTouchOutside"
|
||||
type="int"
|
||||
transient="false"
|
||||
volatile="false"
|
||||
value="16843611"
|
||||
static="true"
|
||||
final="true"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="windowContentOverlay"
|
||||
type="int"
|
||||
transient="false"
|
||||
@@ -15982,7 +16004,7 @@
|
||||
type="int"
|
||||
transient="false"
|
||||
volatile="false"
|
||||
value="16974069"
|
||||
value="16974060"
|
||||
static="true"
|
||||
final="true"
|
||||
deprecated="not deprecated"
|
||||
@@ -16033,6 +16055,17 @@
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="Widget_DatePicker"
|
||||
type="int"
|
||||
transient="false"
|
||||
volatile="false"
|
||||
value="16974063"
|
||||
static="true"
|
||||
final="true"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="Widget_DropDownItem"
|
||||
type="int"
|
||||
transient="false"
|
||||
@@ -16066,17 +16099,6 @@
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="Widget_EditText_NumberPickerInputText"
|
||||
type="int"
|
||||
transient="false"
|
||||
volatile="false"
|
||||
value="16974061"
|
||||
static="true"
|
||||
final="true"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="Widget_ExpandableListView"
|
||||
type="int"
|
||||
transient="false"
|
||||
@@ -16268,7 +16290,7 @@
|
||||
type="int"
|
||||
transient="false"
|
||||
volatile="false"
|
||||
value="16974070"
|
||||
value="16974061"
|
||||
static="true"
|
||||
final="true"
|
||||
deprecated="not deprecated"
|
||||
@@ -16308,6 +16330,17 @@
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="Widget_Holo_DatePicker"
|
||||
type="int"
|
||||
transient="false"
|
||||
volatile="false"
|
||||
value="16974064"
|
||||
static="true"
|
||||
final="true"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="Widget_Holo_DropDownItem"
|
||||
type="int"
|
||||
transient="false"
|
||||
@@ -16341,17 +16374,6 @@
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="Widget_Holo_EditText_NumberPickerInputText"
|
||||
type="int"
|
||||
transient="false"
|
||||
volatile="false"
|
||||
value="16974064"
|
||||
static="true"
|
||||
final="true"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="Widget_Holo_ExpandableListView"
|
||||
type="int"
|
||||
transient="false"
|
||||
@@ -16396,28 +16418,6 @@
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="Widget_Holo_ImageButton_NumberPickerDownButton"
|
||||
type="int"
|
||||
transient="false"
|
||||
volatile="false"
|
||||
value="16974065"
|
||||
static="true"
|
||||
final="true"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="Widget_Holo_ImageButton_NumberPickerUpButton"
|
||||
type="int"
|
||||
transient="false"
|
||||
volatile="false"
|
||||
value="16974063"
|
||||
static="true"
|
||||
final="true"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="Widget_Holo_Light"
|
||||
type="int"
|
||||
transient="false"
|
||||
@@ -16543,7 +16543,7 @@
|
||||
type="int"
|
||||
transient="false"
|
||||
volatile="false"
|
||||
value="16974071"
|
||||
value="16974062"
|
||||
static="true"
|
||||
final="true"
|
||||
deprecated="not deprecated"
|
||||
@@ -16616,17 +16616,6 @@
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="Widget_Holo_Light_EditText_NumberPickerInputText"
|
||||
type="int"
|
||||
transient="false"
|
||||
volatile="false"
|
||||
value="16974067"
|
||||
static="true"
|
||||
final="true"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="Widget_Holo_Light_ExpandableListView"
|
||||
type="int"
|
||||
transient="false"
|
||||
@@ -16671,28 +16660,6 @@
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="Widget_Holo_Light_ImageButton_NumberPickerDownButton"
|
||||
type="int"
|
||||
transient="false"
|
||||
volatile="false"
|
||||
value="16974068"
|
||||
static="true"
|
||||
final="true"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="Widget_Holo_Light_ImageButton_NumberPickerUpButton"
|
||||
type="int"
|
||||
transient="false"
|
||||
volatile="false"
|
||||
value="16974066"
|
||||
static="true"
|
||||
final="true"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="Widget_Holo_Light_ListPopupWindow"
|
||||
type="int"
|
||||
transient="false"
|
||||
@@ -17221,28 +17188,6 @@
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="Widget_ImageButton_NumberPickerDownButton"
|
||||
type="int"
|
||||
transient="false"
|
||||
volatile="false"
|
||||
value="16974062"
|
||||
static="true"
|
||||
final="true"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="Widget_ImageButton_NumberPickerUpButton"
|
||||
type="int"
|
||||
transient="false"
|
||||
volatile="false"
|
||||
value="16974060"
|
||||
static="true"
|
||||
final="true"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="Widget_ImageWell"
|
||||
type="int"
|
||||
transient="false"
|
||||
@@ -24311,6 +24256,19 @@
|
||||
<parameter name="uri" type="android.net.Uri">
|
||||
</parameter>
|
||||
</method>
|
||||
<method name="setFinishOnTouchOutside"
|
||||
return="void"
|
||||
abstract="false"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
static="false"
|
||||
final="false"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<parameter name="finish" type="boolean">
|
||||
</parameter>
|
||||
</method>
|
||||
<method name="setIntent"
|
||||
return="void"
|
||||
abstract="false"
|
||||
@@ -136099,6 +136057,17 @@
|
||||
visibility="public"
|
||||
>
|
||||
</method>
|
||||
<method name="getPreserveEGLContextOnPause"
|
||||
return="boolean"
|
||||
abstract="false"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
static="false"
|
||||
final="false"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
</method>
|
||||
<method name="getRenderMode"
|
||||
return="int"
|
||||
abstract="false"
|
||||
@@ -136270,6 +136239,19 @@
|
||||
<parameter name="glWrapper" type="android.opengl.GLSurfaceView.GLWrapper">
|
||||
</parameter>
|
||||
</method>
|
||||
<method name="setPreserveEGLContextOnPause"
|
||||
return="void"
|
||||
abstract="false"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
static="false"
|
||||
final="false"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<parameter name="preserveOnPause" type="boolean">
|
||||
</parameter>
|
||||
</method>
|
||||
<method name="setRenderMode"
|
||||
return="void"
|
||||
abstract="false"
|
||||
@@ -146702,6 +146684,16 @@
|
||||
visibility="public"
|
||||
>
|
||||
</constructor>
|
||||
<constructor name="StrictMode.VmPolicy.Builder"
|
||||
type="android.os.StrictMode.VmPolicy.Builder"
|
||||
static="false"
|
||||
final="false"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<parameter name="base" type="android.os.StrictMode.VmPolicy">
|
||||
</parameter>
|
||||
</constructor>
|
||||
<method name="build"
|
||||
return="android.os.StrictMode.VmPolicy"
|
||||
abstract="false"
|
||||
@@ -146779,6 +146771,21 @@
|
||||
visibility="public"
|
||||
>
|
||||
</method>
|
||||
<method name="setClassInstanceLimit"
|
||||
return="android.os.StrictMode.VmPolicy.Builder"
|
||||
abstract="false"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
static="false"
|
||||
final="false"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<parameter name="klass" type="java.lang.Class">
|
||||
</parameter>
|
||||
<parameter name="instanceLimit" type="int">
|
||||
</parameter>
|
||||
</method>
|
||||
</class>
|
||||
<class name="SystemClock"
|
||||
extends="java.lang.Object"
|
||||
@@ -219396,6 +219403,14 @@
|
||||
<parameter name="view" type="android.view.View">
|
||||
</parameter>
|
||||
</constructor>
|
||||
<constructor name="View.DragShadowBuilder"
|
||||
type="android.view.View.DragShadowBuilder"
|
||||
static="false"
|
||||
final="false"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
</constructor>
|
||||
<method name="getView"
|
||||
return="android.view.View"
|
||||
abstract="false"
|
||||
@@ -236046,6 +236061,48 @@
|
||||
</parameter>
|
||||
</method>
|
||||
</class>
|
||||
<class name="WebStorage.Origin"
|
||||
extends="java.lang.Object"
|
||||
abstract="false"
|
||||
static="true"
|
||||
final="false"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<method name="getOrigin"
|
||||
return="java.lang.String"
|
||||
abstract="false"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
static="false"
|
||||
final="false"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
</method>
|
||||
<method name="getQuota"
|
||||
return="long"
|
||||
abstract="false"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
static="false"
|
||||
final="false"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
</method>
|
||||
<method name="getUsage"
|
||||
return="long"
|
||||
abstract="false"
|
||||
native="false"
|
||||
synchronized="false"
|
||||
static="false"
|
||||
final="false"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
</method>
|
||||
</class>
|
||||
<interface name="WebStorage.QuotaUpdater"
|
||||
abstract="true"
|
||||
static="true"
|
||||
|
||||
160
api/current.xml
160
api/current.xml
@@ -2721,6 +2721,17 @@
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="calendarViewStyle"
|
||||
type="int"
|
||||
transient="false"
|
||||
volatile="false"
|
||||
value="16843613"
|
||||
static="true"
|
||||
final="true"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="candidatesTextStyleSpans"
|
||||
type="int"
|
||||
transient="false"
|
||||
@@ -3282,6 +3293,17 @@
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="datePickerStyle"
|
||||
type="int"
|
||||
transient="false"
|
||||
volatile="false"
|
||||
value="16843612"
|
||||
static="true"
|
||||
final="true"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="dateTextAppearance"
|
||||
type="int"
|
||||
transient="false"
|
||||
@@ -8727,17 +8749,6 @@
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="solidColor"
|
||||
type="int"
|
||||
transient="false"
|
||||
volatile="false"
|
||||
value="16843594"
|
||||
static="true"
|
||||
final="true"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="soundEffectsEnabled"
|
||||
type="int"
|
||||
transient="false"
|
||||
@@ -15993,7 +16004,7 @@
|
||||
type="int"
|
||||
transient="false"
|
||||
volatile="false"
|
||||
value="16974069"
|
||||
value="16974060"
|
||||
static="true"
|
||||
final="true"
|
||||
deprecated="not deprecated"
|
||||
@@ -16044,6 +16055,17 @@
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="Widget_DatePicker"
|
||||
type="int"
|
||||
transient="false"
|
||||
volatile="false"
|
||||
value="16974063"
|
||||
static="true"
|
||||
final="true"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="Widget_DropDownItem"
|
||||
type="int"
|
||||
transient="false"
|
||||
@@ -16077,17 +16099,6 @@
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="Widget_EditText_NumberPickerInputText"
|
||||
type="int"
|
||||
transient="false"
|
||||
volatile="false"
|
||||
value="16974061"
|
||||
static="true"
|
||||
final="true"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="Widget_ExpandableListView"
|
||||
type="int"
|
||||
transient="false"
|
||||
@@ -16279,7 +16290,7 @@
|
||||
type="int"
|
||||
transient="false"
|
||||
volatile="false"
|
||||
value="16974070"
|
||||
value="16974061"
|
||||
static="true"
|
||||
final="true"
|
||||
deprecated="not deprecated"
|
||||
@@ -16319,6 +16330,17 @@
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="Widget_Holo_DatePicker"
|
||||
type="int"
|
||||
transient="false"
|
||||
volatile="false"
|
||||
value="16974064"
|
||||
static="true"
|
||||
final="true"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="Widget_Holo_DropDownItem"
|
||||
type="int"
|
||||
transient="false"
|
||||
@@ -16352,17 +16374,6 @@
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="Widget_Holo_EditText_NumberPickerInputText"
|
||||
type="int"
|
||||
transient="false"
|
||||
volatile="false"
|
||||
value="16974064"
|
||||
static="true"
|
||||
final="true"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="Widget_Holo_ExpandableListView"
|
||||
type="int"
|
||||
transient="false"
|
||||
@@ -16407,28 +16418,6 @@
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="Widget_Holo_ImageButton_NumberPickerDownButton"
|
||||
type="int"
|
||||
transient="false"
|
||||
volatile="false"
|
||||
value="16974065"
|
||||
static="true"
|
||||
final="true"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="Widget_Holo_ImageButton_NumberPickerUpButton"
|
||||
type="int"
|
||||
transient="false"
|
||||
volatile="false"
|
||||
value="16974063"
|
||||
static="true"
|
||||
final="true"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="Widget_Holo_Light"
|
||||
type="int"
|
||||
transient="false"
|
||||
@@ -16554,7 +16543,7 @@
|
||||
type="int"
|
||||
transient="false"
|
||||
volatile="false"
|
||||
value="16974071"
|
||||
value="16974062"
|
||||
static="true"
|
||||
final="true"
|
||||
deprecated="not deprecated"
|
||||
@@ -16627,17 +16616,6 @@
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="Widget_Holo_Light_EditText_NumberPickerInputText"
|
||||
type="int"
|
||||
transient="false"
|
||||
volatile="false"
|
||||
value="16974067"
|
||||
static="true"
|
||||
final="true"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="Widget_Holo_Light_ExpandableListView"
|
||||
type="int"
|
||||
transient="false"
|
||||
@@ -16682,28 +16660,6 @@
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="Widget_Holo_Light_ImageButton_NumberPickerDownButton"
|
||||
type="int"
|
||||
transient="false"
|
||||
volatile="false"
|
||||
value="16974068"
|
||||
static="true"
|
||||
final="true"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="Widget_Holo_Light_ImageButton_NumberPickerUpButton"
|
||||
type="int"
|
||||
transient="false"
|
||||
volatile="false"
|
||||
value="16974066"
|
||||
static="true"
|
||||
final="true"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="Widget_Holo_Light_ListPopupWindow"
|
||||
type="int"
|
||||
transient="false"
|
||||
@@ -17232,28 +17188,6 @@
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="Widget_ImageButton_NumberPickerDownButton"
|
||||
type="int"
|
||||
transient="false"
|
||||
volatile="false"
|
||||
value="16974062"
|
||||
static="true"
|
||||
final="true"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="Widget_ImageButton_NumberPickerUpButton"
|
||||
type="int"
|
||||
transient="false"
|
||||
volatile="false"
|
||||
value="16974060"
|
||||
static="true"
|
||||
final="true"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="Widget_ImageWell"
|
||||
type="int"
|
||||
transient="false"
|
||||
|
||||
@@ -129,27 +129,30 @@ public class DatePicker extends FrameLayout {
|
||||
}
|
||||
|
||||
public DatePicker(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
this(context, attrs, R.attr.datePickerStyle);
|
||||
}
|
||||
|
||||
public DatePicker(Context context, AttributeSet attrs, int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
|
||||
TypedArray attributesArray = context.obtainStyledAttributes(attrs, R.styleable.DatePicker);
|
||||
TypedArray attributesArray = context.obtainStyledAttributes(attrs, R.styleable.DatePicker,
|
||||
defStyle, 0);
|
||||
boolean spinnersShown = attributesArray.getBoolean(R.styleable.DatePicker_spinnersShown,
|
||||
DEFAULT_SPINNERS_SHOWN);
|
||||
boolean calendarViewShown = attributesArray.getBoolean(
|
||||
R.styleable.DatePicker_calendarViewShown, DEFAULT_CALENDAR_VIEW_SHOWN);
|
||||
int startYear = attributesArray
|
||||
.getInt(R.styleable.DatePicker_startYear, DEFAULT_START_YEAR);
|
||||
int startYear = attributesArray.getInt(R.styleable.DatePicker_startYear,
|
||||
DEFAULT_START_YEAR);
|
||||
int endYear = attributesArray.getInt(R.styleable.DatePicker_endYear, DEFAULT_END_YEAR);
|
||||
String minDate = attributesArray.getString(R.styleable.DatePicker_minDate);
|
||||
String maxDate = attributesArray.getString(R.styleable.DatePicker_maxDate);
|
||||
int layoutResourceId = attributesArray.getResourceId(R.styleable.DatePicker_layout,
|
||||
R.layout.date_picker);
|
||||
attributesArray.recycle();
|
||||
|
||||
LayoutInflater inflater = (LayoutInflater) context
|
||||
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
inflater.inflate(R.layout.date_picker, this, true);
|
||||
inflater.inflate(layoutResourceId, this, true);
|
||||
|
||||
OnValueChangedListener onChangeListener = new OnValueChangedListener() {
|
||||
public void onValueChange(NumberPicker picker, int oldVal, int newVal) {
|
||||
|
||||
@@ -62,8 +62,6 @@ import android.view.inputmethod.InputMethodManager;
|
||||
* <p>
|
||||
* For an example of using this widget, see {@link android.widget.TimePicker}.
|
||||
* </p>
|
||||
*
|
||||
* @attr ref android.R.styleable#NumberPicker_solidColor
|
||||
*/
|
||||
@Widget
|
||||
public class NumberPicker extends LinearLayout {
|
||||
@@ -324,6 +322,11 @@ public class NumberPicker extends LinearLayout {
|
||||
*/
|
||||
private final int mSolidColor;
|
||||
|
||||
/**
|
||||
* Flag indicating if this widget supports flinging.
|
||||
*/
|
||||
private final boolean mFlingable;
|
||||
|
||||
/**
|
||||
* Reusable {@link Rect} instance.
|
||||
*/
|
||||
@@ -427,9 +430,8 @@ public class NumberPicker extends LinearLayout {
|
||||
// process style attributes
|
||||
TypedArray attributesArray = context.obtainStyledAttributes(attrs,
|
||||
R.styleable.NumberPicker, defStyle, 0);
|
||||
int orientation = attributesArray.getInt(R.styleable.NumberPicker_orientation, VERTICAL);
|
||||
setOrientation(orientation);
|
||||
mSolidColor = attributesArray.getColor(R.styleable.NumberPicker_solidColor, 0);
|
||||
mFlingable = attributesArray.getBoolean(R.styleable.NumberPicker_flingable, true);
|
||||
attributesArray.recycle();
|
||||
|
||||
// By default Linearlayout that we extend is not drawn. This is
|
||||
@@ -563,7 +565,7 @@ public class NumberPicker extends LinearLayout {
|
||||
|
||||
@Override
|
||||
public boolean onInterceptTouchEvent(MotionEvent event) {
|
||||
if (!isEnabled()) {
|
||||
if (!isEnabled() || !mFlingable) {
|
||||
return false;
|
||||
}
|
||||
switch (event.getActionMasked()) {
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.android.internal.R;
|
||||
|
||||
import android.annotation.Widget;
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.util.AttributeSet;
|
||||
@@ -31,50 +32,55 @@ import java.text.DateFormatSymbols;
|
||||
import java.util.Calendar;
|
||||
|
||||
/**
|
||||
* A view for selecting the time of day, in either 24 hour or AM/PM mode.
|
||||
*
|
||||
* The hour, each minute digit, and AM/PM (if applicable) can be conrolled by
|
||||
* vertical spinners.
|
||||
*
|
||||
* The hour can be entered by keyboard input. Entering in two digit hours
|
||||
* can be accomplished by hitting two digits within a timeout of about a
|
||||
* second (e.g. '1' then '2' to select 12).
|
||||
*
|
||||
* The minutes can be entered by entering single digits.
|
||||
*
|
||||
* Under AM/PM mode, the user can hit 'a', 'A", 'p' or 'P' to pick.
|
||||
*
|
||||
* For a dialog using this view, see {@link android.app.TimePickerDialog}.
|
||||
*
|
||||
* <p>See the <a href="{@docRoot}resources/tutorials/views/hello-timepicker.html">Time Picker
|
||||
* tutorial</a>.</p>
|
||||
* A view for selecting the time of day, in either 24 hour or AM/PM mode. The
|
||||
* hour, each minute digit, and AM/PM (if applicable) can be conrolled by
|
||||
* vertical spinners. The hour can be entered by keyboard input. Entering in two
|
||||
* digit hours can be accomplished by hitting two digits within a timeout of
|
||||
* about a second (e.g. '1' then '2' to select 12). The minutes can be entered
|
||||
* by entering single digits. Under AM/PM mode, the user can hit 'a', 'A", 'p'
|
||||
* or 'P' to pick. For a dialog using this view, see
|
||||
* {@link android.app.TimePickerDialog}.
|
||||
*<p>
|
||||
* See the <a href="{@docRoot}
|
||||
* resources/tutorials/views/hello-timepicker.html">Time Picker tutorial</a>.
|
||||
* </p>
|
||||
*/
|
||||
@Widget
|
||||
public class TimePicker extends FrameLayout {
|
||||
|
||||
private static final boolean DEFAULT_ENABLED_STATE = true;
|
||||
|
||||
private static final int HOURS_IN_HALF_DAY = 12;
|
||||
|
||||
/**
|
||||
* A no-op callback used in the constructor to avoid null checks
|
||||
* later in the code.
|
||||
* A no-op callback used in the constructor to avoid null checks later in
|
||||
* the code.
|
||||
*/
|
||||
private static final OnTimeChangedListener NO_OP_CHANGE_LISTENER = new OnTimeChangedListener() {
|
||||
public void onTimeChanged(TimePicker view, int hourOfDay, int minute) {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// state
|
||||
private int mCurrentHour = 0; // 0-23
|
||||
private int mCurrentMinute = 0; // 0-59
|
||||
private Boolean mIs24HourView = false;
|
||||
private boolean mIs24HourView;
|
||||
|
||||
private boolean mIsAm;
|
||||
|
||||
// ui components
|
||||
private final NumberPicker mHourSpinner;
|
||||
|
||||
private final NumberPicker mMinuteSpinner;
|
||||
|
||||
private final NumberPicker mAmPmSpinner;
|
||||
|
||||
private final TextView mDivider;
|
||||
|
||||
// Note that the legacy implementation of the TimePicker is
|
||||
// using a button for toggling between AM/PM while the new
|
||||
// version uses a NumberPicker spinner. Therefore the code
|
||||
// accommodates these two cases to be backwards compatible.
|
||||
private final Button mAmPmButton;
|
||||
|
||||
private final String[] mAmPmStrings;
|
||||
|
||||
private boolean mIsEnabled = DEFAULT_ENABLED_STATE;
|
||||
@@ -98,45 +104,51 @@ public class TimePicker extends FrameLayout {
|
||||
public TimePicker(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
|
||||
public TimePicker(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
this(context, attrs, R.attr.timePickerStyle);
|
||||
}
|
||||
|
||||
public TimePicker(Context context, AttributeSet attrs, int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
|
||||
LayoutInflater inflater =
|
||||
(LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
inflater.inflate(R.layout.time_picker,
|
||||
this, // we are the parent
|
||||
true);
|
||||
// process style attributes
|
||||
TypedArray attributesArray = context.obtainStyledAttributes(
|
||||
attrs, R.styleable.TimePicker, defStyle, 0);
|
||||
int layoutResourceId = attributesArray.getResourceId(
|
||||
R.styleable.TimePicker_layout, R.layout.time_picker);
|
||||
attributesArray.recycle();
|
||||
|
||||
LayoutInflater inflater = (LayoutInflater) context.getSystemService(
|
||||
Context.LAYOUT_INFLATER_SERVICE);
|
||||
inflater.inflate(layoutResourceId, this, true);
|
||||
|
||||
// hour
|
||||
mHourSpinner = (NumberPicker) findViewById(R.id.hour);
|
||||
mHourSpinner.setOnValueChangedListener(new NumberPicker.OnValueChangedListener() {
|
||||
public void onValueChange(NumberPicker spinner, int oldVal, int newVal) {
|
||||
mCurrentHour = newVal;
|
||||
if (!mIs24HourView) {
|
||||
// adjust from [1-12] to [0-11] internally, with the times
|
||||
// written "12:xx" being the start of the half-day
|
||||
if (mCurrentHour == 12) {
|
||||
mCurrentHour = 0;
|
||||
}
|
||||
if (!mIsAm) {
|
||||
// PM means 12 hours later than nominal
|
||||
mCurrentHour += 12;
|
||||
if (!is24HourView()) {
|
||||
int minValue = mHourSpinner.getMinValue();
|
||||
int maxValue = mHourSpinner.getMaxValue();
|
||||
// toggle AM/PM if the spinner has wrapped and not in 24
|
||||
// format
|
||||
if ((oldVal == maxValue && newVal == minValue)
|
||||
|| (oldVal == minValue && newVal == maxValue)) {
|
||||
mIsAm = !mIsAm;
|
||||
updateAmPmControl();
|
||||
}
|
||||
}
|
||||
onTimeChanged();
|
||||
}
|
||||
});
|
||||
|
||||
// divider
|
||||
// divider (only for the new widget style)
|
||||
mDivider = (TextView) findViewById(R.id.divider);
|
||||
mDivider.setText(R.string.time_picker_separator);
|
||||
if (mDivider != null) {
|
||||
mDivider.setText(R.string.time_picker_separator);
|
||||
}
|
||||
|
||||
// digits of minute
|
||||
// minute
|
||||
mMinuteSpinner = (NumberPicker) findViewById(R.id.minute);
|
||||
mMinuteSpinner.setMinValue(0);
|
||||
mMinuteSpinner.setMaxValue(59);
|
||||
@@ -144,28 +156,25 @@ public class TimePicker extends FrameLayout {
|
||||
mMinuteSpinner.setFormatter(NumberPicker.TWO_DIGIT_FORMATTER);
|
||||
mMinuteSpinner.setOnValueChangedListener(new NumberPicker.OnValueChangedListener() {
|
||||
public void onValueChange(NumberPicker spinner, int oldVal, int newVal) {
|
||||
mCurrentMinute = newVal;
|
||||
onTimeChanged();
|
||||
}
|
||||
});
|
||||
|
||||
// am/pm
|
||||
mAmPmSpinner = (NumberPicker) findViewById(R.id.amPm);
|
||||
mAmPmSpinner.setOnValueChangedListener(new OnValueChangedListener() {
|
||||
public void onValueChange(NumberPicker picker, int oldVal, int newVal) {
|
||||
picker.requestFocus();
|
||||
if (mIsAm) {
|
||||
// Currently AM switching to PM
|
||||
if (mCurrentHour < 12) {
|
||||
mCurrentHour += 12;
|
||||
int minValue = mMinuteSpinner.getMinValue();
|
||||
int maxValue = mMinuteSpinner.getMaxValue();
|
||||
if (oldVal == maxValue && newVal == minValue) {
|
||||
int currentHour = mHourSpinner.getValue();
|
||||
// toggle AM/PM if the spinner is about to wrap
|
||||
if (!is24HourView() && currentHour == mHourSpinner.getMaxValue()) {
|
||||
mIsAm = !mIsAm;
|
||||
updateAmPmControl();
|
||||
}
|
||||
} else {
|
||||
// Currently PM switching to AM
|
||||
if (mCurrentHour >= 12) {
|
||||
mCurrentHour -= 12;
|
||||
mHourSpinner.setValue(currentHour + 1);
|
||||
} else if (oldVal == minValue && newVal == maxValue) {
|
||||
int currentHour = mHourSpinner.getValue();
|
||||
// toggle AM/PM if the spinner is about to wrap
|
||||
if (!is24HourView() && currentHour == mHourSpinner.getMinValue()) {
|
||||
mIsAm = !mIsAm;
|
||||
updateAmPmControl();
|
||||
}
|
||||
mHourSpinner.setValue(currentHour - 1);
|
||||
}
|
||||
mIsAm = !mIsAm;
|
||||
onTimeChanged();
|
||||
}
|
||||
});
|
||||
@@ -173,17 +182,44 @@ public class TimePicker extends FrameLayout {
|
||||
/* Get the localized am/pm strings and use them in the spinner */
|
||||
mAmPmStrings = new DateFormatSymbols().getAmPmStrings();
|
||||
|
||||
// now that the hour/minute picker objects have been initialized, set
|
||||
// the hour range properly based on the 12/24 hour display mode.
|
||||
configurePickerRanges();
|
||||
// am/pm
|
||||
View amPmView = findViewById(R.id.amPm);
|
||||
if (amPmView instanceof Button) {
|
||||
mAmPmSpinner = null;
|
||||
mAmPmButton = (Button) amPmView;
|
||||
mAmPmButton.setOnClickListener(new OnClickListener() {
|
||||
public void onClick(View button) {
|
||||
button.requestFocus();
|
||||
mIsAm = !mIsAm;
|
||||
updateAmPmControl();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
mAmPmButton = null;
|
||||
mAmPmSpinner = (NumberPicker) amPmView;
|
||||
mAmPmSpinner.setMinValue(0);
|
||||
mAmPmSpinner.setMaxValue(1);
|
||||
mAmPmSpinner.setDisplayedValues(mAmPmStrings);
|
||||
mAmPmSpinner.setOnValueChangedListener(new OnValueChangedListener() {
|
||||
public void onValueChange(NumberPicker picker, int oldVal, int newVal) {
|
||||
picker.requestFocus();
|
||||
mIsAm = !mIsAm;
|
||||
updateAmPmControl();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// update controls to initial state
|
||||
updateHourControl();
|
||||
updateAmPmControl();
|
||||
|
||||
// initialize to current time
|
||||
Calendar cal = Calendar.getInstance();
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
setOnTimeChangedListener(NO_OP_CHANGE_LISTENER);
|
||||
|
||||
// by default we're not in 24 hour mode
|
||||
setCurrentHour(cal.get(Calendar.HOUR_OF_DAY));
|
||||
setCurrentMinute(cal.get(Calendar.MINUTE));
|
||||
// set to current time
|
||||
setCurrentHour(calendar.get(Calendar.HOUR_OF_DAY));
|
||||
setCurrentMinute(calendar.get(Calendar.MINUTE));
|
||||
|
||||
if (!isEnabled()) {
|
||||
setEnabled(false);
|
||||
@@ -197,9 +233,15 @@ public class TimePicker extends FrameLayout {
|
||||
}
|
||||
super.setEnabled(enabled);
|
||||
mMinuteSpinner.setEnabled(enabled);
|
||||
mDivider.setEnabled(enabled);
|
||||
if (mDivider != null) {
|
||||
mDivider.setEnabled(enabled);
|
||||
}
|
||||
mHourSpinner.setEnabled(enabled);
|
||||
mAmPmSpinner.setEnabled(enabled);
|
||||
if (mAmPmSpinner != null) {
|
||||
mAmPmSpinner.setEnabled(enabled);
|
||||
} else {
|
||||
mAmPmButton.setEnabled(enabled);
|
||||
}
|
||||
mIsEnabled = enabled;
|
||||
}
|
||||
|
||||
@@ -214,6 +256,7 @@ public class TimePicker extends FrameLayout {
|
||||
private static class SavedState extends BaseSavedState {
|
||||
|
||||
private final int mHour;
|
||||
|
||||
private final int mMinute;
|
||||
|
||||
private SavedState(Parcelable superState, int hour, int minute) {
|
||||
@@ -221,7 +264,7 @@ public class TimePicker extends FrameLayout {
|
||||
mHour = hour;
|
||||
mMinute = minute;
|
||||
}
|
||||
|
||||
|
||||
private SavedState(Parcel in) {
|
||||
super(in);
|
||||
mHour = in.readInt();
|
||||
@@ -244,8 +287,7 @@ public class TimePicker extends FrameLayout {
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public static final Parcelable.Creator<SavedState> CREATOR
|
||||
= new Creator<SavedState>() {
|
||||
public static final Parcelable.Creator<SavedState> CREATOR = new Creator<SavedState>() {
|
||||
public SavedState createFromParcel(Parcel in) {
|
||||
return new SavedState(in);
|
||||
}
|
||||
@@ -259,7 +301,7 @@ public class TimePicker extends FrameLayout {
|
||||
@Override
|
||||
protected Parcelable onSaveInstanceState() {
|
||||
Parcelable superState = super.onSaveInstanceState();
|
||||
return new SavedState(superState, mCurrentHour, mCurrentMinute);
|
||||
return new SavedState(superState, getCurrentHour(), getCurrentMinute());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -272,6 +314,7 @@ public class TimePicker extends FrameLayout {
|
||||
|
||||
/**
|
||||
* Set the callback that indicates the time has been adjusted by the user.
|
||||
*
|
||||
* @param onTimeChangedListener the callback, should not be null.
|
||||
*/
|
||||
public void setOnTimeChangedListener(OnTimeChangedListener onTimeChangedListener) {
|
||||
@@ -279,30 +322,58 @@ public class TimePicker extends FrameLayout {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The current hour (0-23).
|
||||
* @return The current hour in the range (0-23).
|
||||
*/
|
||||
public Integer getCurrentHour() {
|
||||
return mCurrentHour;
|
||||
int currentHour = mHourSpinner.getValue();
|
||||
if (is24HourView() || mIsAm) {
|
||||
return currentHour;
|
||||
} else {
|
||||
return (currentHour == HOURS_IN_HALF_DAY) ? 0 : currentHour + HOURS_IN_HALF_DAY;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the current hour.
|
||||
*/
|
||||
public void setCurrentHour(Integer currentHour) {
|
||||
this.mCurrentHour = currentHour;
|
||||
updateHourDisplay();
|
||||
// why was Integer used in the first place?
|
||||
if (currentHour == null || currentHour == getCurrentHour()) {
|
||||
return;
|
||||
}
|
||||
if (!is24HourView()) {
|
||||
// convert [0,23] ordinal to wall clock display
|
||||
if (currentHour > HOURS_IN_HALF_DAY) {
|
||||
currentHour -= HOURS_IN_HALF_DAY;
|
||||
mIsAm = false;
|
||||
} else {
|
||||
if (currentHour == 0) {
|
||||
currentHour = HOURS_IN_HALF_DAY;
|
||||
}
|
||||
mIsAm = true;
|
||||
}
|
||||
updateAmPmControl();
|
||||
}
|
||||
mHourSpinner.setValue(currentHour);
|
||||
onTimeChanged();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set whether in 24 hour or AM/PM mode.
|
||||
*
|
||||
* @param is24HourView True = 24 hour mode. False = AM/PM.
|
||||
*/
|
||||
public void setIs24HourView(Boolean is24HourView) {
|
||||
if (mIs24HourView != is24HourView) {
|
||||
mIs24HourView = is24HourView;
|
||||
configurePickerRanges();
|
||||
updateHourDisplay();
|
||||
if (mIs24HourView == is24HourView) {
|
||||
return;
|
||||
}
|
||||
mIs24HourView = is24HourView;
|
||||
// cache the current hour since spinner range changes
|
||||
int currentHour = getCurrentHour();
|
||||
updateHourControl();
|
||||
// set value after spinner range is updated
|
||||
setCurrentHour(currentHour);
|
||||
updateAmPmControl();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -311,20 +382,23 @@ public class TimePicker extends FrameLayout {
|
||||
public boolean is24HourView() {
|
||||
return mIs24HourView;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return The current minute.
|
||||
*/
|
||||
public Integer getCurrentMinute() {
|
||||
return mCurrentMinute;
|
||||
return mMinuteSpinner.getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the current minute (0-59).
|
||||
*/
|
||||
public void setCurrentMinute(Integer currentMinute) {
|
||||
this.mCurrentMinute = currentMinute;
|
||||
updateMinuteDisplay();
|
||||
if (currentMinute == getCurrentMinute()) {
|
||||
return;
|
||||
}
|
||||
mMinuteSpinner.setValue(currentMinute);
|
||||
onTimeChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -332,39 +406,34 @@ public class TimePicker extends FrameLayout {
|
||||
return mHourSpinner.getBaseline();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the state of the spinners appropriate to the current hour.
|
||||
*/
|
||||
private void updateHourDisplay() {
|
||||
int currentHour = mCurrentHour;
|
||||
if (!mIs24HourView) {
|
||||
// convert [0,23] ordinal to wall clock display
|
||||
if (currentHour > 12) {
|
||||
currentHour -= 12;
|
||||
} else if (currentHour == 0) {
|
||||
currentHour = 12;
|
||||
}
|
||||
}
|
||||
mHourSpinner.setValue(currentHour);
|
||||
mIsAm = mCurrentHour < 12;
|
||||
mAmPmSpinner.setValue(mIsAm ? Calendar.AM : Calendar.PM);
|
||||
onTimeChanged();
|
||||
}
|
||||
|
||||
private void configurePickerRanges() {
|
||||
if (mIs24HourView) {
|
||||
private void updateHourControl() {
|
||||
if (is24HourView()) {
|
||||
mHourSpinner.setMinValue(0);
|
||||
mHourSpinner.setMaxValue(23);
|
||||
mHourSpinner.setFormatter(NumberPicker.TWO_DIGIT_FORMATTER);
|
||||
mAmPmSpinner.setVisibility(View.GONE);
|
||||
} else {
|
||||
mHourSpinner.setMinValue(1);
|
||||
mHourSpinner.setMaxValue(12);
|
||||
mHourSpinner.setFormatter(null);
|
||||
mAmPmSpinner.setVisibility(View.VISIBLE);
|
||||
mAmPmSpinner.setMinValue(0);
|
||||
mAmPmSpinner.setMaxValue(1);
|
||||
mAmPmSpinner.setDisplayedValues(mAmPmStrings);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateAmPmControl() {
|
||||
if (is24HourView()) {
|
||||
if (mAmPmSpinner != null) {
|
||||
mAmPmSpinner.setVisibility(View.GONE);
|
||||
} else {
|
||||
mAmPmButton.setVisibility(View.GONE);
|
||||
}
|
||||
} else {
|
||||
int index = mIsAm ? Calendar.AM : Calendar.PM;
|
||||
if (mAmPmSpinner != null) {
|
||||
mAmPmSpinner.setValue(index);
|
||||
mAmPmSpinner.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
mAmPmButton.setText(mAmPmStrings[index]);
|
||||
mAmPmButton.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -373,12 +442,4 @@ public class TimePicker extends FrameLayout {
|
||||
mOnTimeChangedListener.onTimeChanged(this, getCurrentHour(), getCurrentMinute());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the state of the spinners appropriate to the current minute.
|
||||
*/
|
||||
private void updateMinuteDisplay() {
|
||||
mMinuteSpinner.setValue(mCurrentMinute);
|
||||
onTimeChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,10 +40,10 @@
|
||||
<!-- Month -->
|
||||
<NumberPicker
|
||||
android:id="@+id/month"
|
||||
android:layout_width="48dip"
|
||||
android:layout_width="80dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="22dip"
|
||||
android:layout_marginRight="22dip"
|
||||
android:layout_marginLeft="1dip"
|
||||
android:layout_marginRight="1dip"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
/>
|
||||
@@ -51,10 +51,10 @@
|
||||
<!-- Day -->
|
||||
<NumberPicker
|
||||
android:id="@+id/day"
|
||||
android:layout_width="48dip"
|
||||
android:layout_width="80dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="22dip"
|
||||
android:layout_marginRight="22dip"
|
||||
android:layout_marginLeft="1dip"
|
||||
android:layout_marginRight="1dip"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
/>
|
||||
@@ -62,10 +62,10 @@
|
||||
<!-- Year -->
|
||||
<NumberPicker
|
||||
android:id="@+id/year"
|
||||
android:layout_width="48dip"
|
||||
android:layout_width="95dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="22dip"
|
||||
android:layout_marginRight="22dip"
|
||||
android:layout_marginLeft="1dip"
|
||||
android:layout_marginRight="1dip"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
/>
|
||||
@@ -81,6 +81,7 @@
|
||||
android:layout_weight="1"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
86
core/res/res/layout/date_picker_holo.xml
Normal file
86
core/res/res/layout/date_picker_holo.xml
Normal file
@@ -0,0 +1,86 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
**
|
||||
** Copyright 2011, The Android Open Source Project
|
||||
**
|
||||
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||
** you may not use this file except in compliance with the License.
|
||||
** You may obtain a copy of the License at
|
||||
**
|
||||
** http://www.apache.org/licenses/LICENSE-2.0
|
||||
**
|
||||
** Unless required by applicable law or agreed to in writing, software
|
||||
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
** See the License for the specific language governing permissions and
|
||||
** limitations under the License.
|
||||
*/
|
||||
-->
|
||||
|
||||
<!-- Layout of date picker-->
|
||||
|
||||
<!-- Warning: everything within the "pickers" layout is removed and re-ordered
|
||||
depending on the date format selected by the user.
|
||||
-->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center">
|
||||
|
||||
<LinearLayout android:id="@+id/pickers"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="22dip"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center">
|
||||
|
||||
<!-- Month -->
|
||||
<NumberPicker
|
||||
android:id="@+id/month"
|
||||
android:layout_width="48dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="22dip"
|
||||
android:layout_marginRight="22dip"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
/>
|
||||
|
||||
<!-- Day -->
|
||||
<NumberPicker
|
||||
android:id="@+id/day"
|
||||
android:layout_width="48dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="22dip"
|
||||
android:layout_marginRight="22dip"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
/>
|
||||
|
||||
<!-- Year -->
|
||||
<NumberPicker
|
||||
android:id="@+id/year"
|
||||
android:layout_width="48dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="22dip"
|
||||
android:layout_marginRight="22dip"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- calendar view -->
|
||||
<CalendarView
|
||||
android:id="@+id/calendar_view"
|
||||
android:layout_width="245dip"
|
||||
android:layout_height="280dip"
|
||||
android:layout_marginLeft="22dip"
|
||||
android:layout_weight="1"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -28,42 +28,33 @@
|
||||
<!-- hour -->
|
||||
<NumberPicker
|
||||
android:id="@+id/hour"
|
||||
android:layout_width="48dip"
|
||||
android:layout_width="70dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="22dip"
|
||||
android:layout_marginRight="20dip"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
/>
|
||||
|
||||
<!-- divider -->
|
||||
<TextView
|
||||
android:id="@+id/divider"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
/>
|
||||
|
||||
<!-- minute -->
|
||||
<NumberPicker
|
||||
android:id="@+id/minute"
|
||||
android:layout_width="48dip"
|
||||
android:layout_width="70dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="20dip"
|
||||
android:layout_marginRight="22dip"
|
||||
android:layout_marginLeft="5dip"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
/>
|
||||
|
||||
<!-- AM / PM -->
|
||||
<NumberPicker
|
||||
<Button
|
||||
android:id="@+id/amPm"
|
||||
android:layout_width="48dip"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="22dip"
|
||||
android:layout_marginRight="22dip"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
android:layout_marginTop="43dip"
|
||||
android:layout_marginLeft="5dip"
|
||||
android:paddingLeft="20dip"
|
||||
android:paddingRight="20dip"
|
||||
style="?android:attr/textAppearanceLargeInverse"
|
||||
android:textColor="@android:color/primary_text_light_nodisable"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
69
core/res/res/layout/time_picker_holo.xml
Normal file
69
core/res/res/layout/time_picker_holo.xml
Normal file
@@ -0,0 +1,69 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
**
|
||||
** Copyright 2011, The Android Open Source Project
|
||||
**
|
||||
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||
** you may not use this file except in compliance with the License.
|
||||
** You may obtain a copy of the License at
|
||||
**
|
||||
** http://www.apache.org/licenses/LICENSE-2.0
|
||||
**
|
||||
** Unless required by applicable law or agreed to in writing, software
|
||||
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
** See the License for the specific language governing permissions and
|
||||
** limitations under the License.
|
||||
*/
|
||||
-->
|
||||
|
||||
<!-- Layout of time picker -->
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="horizontal"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<!-- hour -->
|
||||
<NumberPicker
|
||||
android:id="@+id/hour"
|
||||
android:layout_width="48dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="22dip"
|
||||
android:layout_marginRight="20dip"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
/>
|
||||
|
||||
<!-- divider -->
|
||||
<TextView
|
||||
android:id="@+id/divider"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
/>
|
||||
|
||||
<!-- minute -->
|
||||
<NumberPicker
|
||||
android:id="@+id/minute"
|
||||
android:layout_width="48dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="20dip"
|
||||
android:layout_marginRight="22dip"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
/>
|
||||
|
||||
<!-- AM / PM -->
|
||||
<NumberPicker
|
||||
android:id="@+id/amPm"
|
||||
android:layout_width="48dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="22dip"
|
||||
android:layout_marginRight="22dip"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -534,6 +534,12 @@
|
||||
<!-- The CalndarView style. -->
|
||||
<attr name="calendarViewStyle" format="reference" />
|
||||
|
||||
<!-- The TimePicker style. -->
|
||||
<attr name="timePickerStyle" format="reference" />
|
||||
|
||||
<!-- The DatePicker style. -->
|
||||
<attr name="datePickerStyle" format="reference" />
|
||||
|
||||
<!-- Fast scroller styles -->
|
||||
<eat-comment />
|
||||
|
||||
@@ -2885,6 +2891,7 @@
|
||||
<!-- Gravity setting for positioning the currently selected item. -->
|
||||
<attr name="gravity" />
|
||||
</declare-styleable>
|
||||
|
||||
<declare-styleable name="DatePicker">
|
||||
<!-- The first year (inclusive), for example "1940". -->
|
||||
<attr name="startYear" format="integer" />
|
||||
@@ -2898,6 +2905,8 @@
|
||||
<attr name="minDate" format="string" />
|
||||
<!-- The minimal date shown by this calendar view in mm/dd/yyyy format. -->
|
||||
<attr name="maxDate" format="string" />
|
||||
<!-- @hide The layout of the time picker. -->
|
||||
<attr name="layout" />
|
||||
</declare-styleable>
|
||||
|
||||
<declare-styleable name="TwoLineListItem">
|
||||
@@ -3096,9 +3105,20 @@
|
||||
</declare-styleable>
|
||||
|
||||
<declare-styleable name="NumberPicker">
|
||||
<attr name="orientation" />
|
||||
<!-- Color for the solid color background if such for optimized rendering. -->
|
||||
<!-- @hide Color for the solid color background if such for optimized rendering. -->
|
||||
<attr name="solidColor" format="color|reference" />
|
||||
<!-- @hide Whether the number picker supports fligning. -->
|
||||
<attr name="flingable" format="boolean" />
|
||||
</declare-styleable>
|
||||
|
||||
<declare-styleable name="TimePicker">
|
||||
<!-- @hide The layout of the time picker. -->
|
||||
<attr name="layout" />
|
||||
</declare-styleable>
|
||||
|
||||
<declare-styleable name="DatePicker">
|
||||
<!-- @hide The layout of the time picker. -->
|
||||
<attr name="layout" />
|
||||
</declare-styleable>
|
||||
|
||||
<!-- ========================= -->
|
||||
|
||||
@@ -1426,6 +1426,8 @@
|
||||
<public type="attr" name="fastScrollTextColor" />
|
||||
<public type="attr" name="largeHeap" />
|
||||
<public type="attr" name="windowCloseOnTouchOutside" />
|
||||
<public type="attr" name="datePickerStyle" />
|
||||
<public type="attr" name="calendarViewStyle" />
|
||||
|
||||
<!-- A simple fade-in animation. -->
|
||||
<public type="animator" name="fade_in" id="0x010b0000" />
|
||||
@@ -1627,21 +1629,15 @@
|
||||
<public type="style" name="Holo.Light.ButtonBar.AlertDialog" />
|
||||
<public type="style" name="Holo.SegmentedButton" />
|
||||
<public type="style" name="Holo.Light.SegmentedButton" />
|
||||
<public type="style" name="Widget.ImageButton.NumberPickerUpButton" />
|
||||
<public type="style" name="Widget.EditText.NumberPickerInputText" />
|
||||
<public type="style" name="Widget.ImageButton.NumberPickerDownButton" />
|
||||
<public type="style" name="Widget.Holo.ImageButton.NumberPickerUpButton" />
|
||||
<public type="style" name="Widget.Holo.EditText.NumberPickerInputText" />
|
||||
<public type="style" name="Widget.Holo.ImageButton.NumberPickerDownButton" />
|
||||
<public type="style" name="Widget.Holo.Light.ImageButton.NumberPickerUpButton" />
|
||||
<public type="style" name="Widget.Holo.Light.EditText.NumberPickerInputText" />
|
||||
<public type="style" name="Widget.Holo.Light.ImageButton.NumberPickerDownButton" />
|
||||
<public type="style" name="Widget.CalendarView" />
|
||||
<public type="style" name="Widget.Holo.CalendarView" />
|
||||
<public type="style" name="Widget.Holo.Light.CalendarView" />
|
||||
<public type="style" name="Widget.DatePicker" />
|
||||
<public type="style" name="Widget.Holo.DatePicker" />
|
||||
|
||||
<public type="string" name="selectTextMode" />
|
||||
|
||||
<!-- Default icon for applications that don't specify an icon. -->
|
||||
<public type="mipmap" name="sym_def_app_icon" id="0x010d0000" />
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -489,7 +489,16 @@
|
||||
<item name="android:orientation">vertical</item>
|
||||
<item name="android:fadingEdge">vertical</item>
|
||||
<item name="android:fadingEdgeLength">50dip</item>
|
||||
<item name="android:solidColor">@android:color/transparent</item>
|
||||
<item name="android:flingable">false</item>
|
||||
</style>
|
||||
|
||||
<style name="Widget.TimePicker">
|
||||
<item name="android:layout">@android:layout/time_picker</item>
|
||||
</style>
|
||||
|
||||
<style name="Widget.DatePicker">
|
||||
<item name="android:layout">@android:layout/date_picker</item>
|
||||
<item name="android:calendarViewShown">false</item>
|
||||
</style>
|
||||
|
||||
<style name="Widget.ImageButton.NumberPickerUpButton">
|
||||
@@ -1502,6 +1511,20 @@
|
||||
<item name="android:background">@android:drawable/btn_default_holo_dark</item>
|
||||
</style>
|
||||
|
||||
<style name="Widget.Holo.NumberPicker" parent="Widget.NumberPicker">
|
||||
<item name="android:solidColor">@android:color/transparent</item>
|
||||
<item name="android:flingable">true</item>
|
||||
</style>
|
||||
|
||||
<style name="Widget.Holo.TimePicker" parent="Widget.TimePicker">
|
||||
<item name="android:layout">@android:layout/time_picker_holo</item>
|
||||
</style>
|
||||
|
||||
<style name="Widget.Holo.DatePicker" parent="Widget.DatePicker">
|
||||
<item name="android:layout">@android:layout/date_picker_holo</item>
|
||||
<item name="android:calendarViewShown">true</item>
|
||||
</style>
|
||||
|
||||
<style name="Widget.Holo.ImageButton.NumberPickerUpButton">
|
||||
<item name="android:background">@null</item>
|
||||
<item name="android:src">@android:drawable/numberpicker_up_btn_holo_dark</item>
|
||||
@@ -1870,6 +1893,15 @@
|
||||
<item name="android:weekDayTextAppearance">@android:style/TextAppearance.Holo.Light.CalendarViewWeekDayView</item>
|
||||
</style>
|
||||
|
||||
<style name="Widget.Holo.Light.NumberPicker" parent="Widget.Holo.NumberPicker">
|
||||
</style>
|
||||
|
||||
<style name="Widget.Holo.Light.TimePicker" parent="Widget.Holo.TimePicker">
|
||||
</style>
|
||||
|
||||
<style name="Widget.Holo.Light.DatePicker" parent="Widget.Holo.DatePicker">
|
||||
</style>
|
||||
|
||||
<style name="Widget.Holo.Light.ImageButton.NumberPickerUpButton" parent="Widget.Holo.ImageButton.NumberPickerUpButton">
|
||||
<item name="android:src">@android:drawable/numberpicker_up_btn_holo_light</item>
|
||||
</style>
|
||||
|
||||
@@ -290,6 +290,12 @@
|
||||
<!-- CalendarView style-->
|
||||
<item name="calendarViewStyle">@style/Widget.CalendarView</item>
|
||||
|
||||
<!-- TimePicker style -->
|
||||
<item name="timePickerStyle">@style/Widget.TimePicker</item>
|
||||
|
||||
<!-- DatePicker style -->
|
||||
<item name="datePickerStyle">@style/Widget.DatePicker</item>
|
||||
|
||||
<item name="fastScrollThumbDrawable">@android:drawable/scrollbar_handle_accelerated_anim2</item>
|
||||
<item name="fastScrollTrackDrawable">@null</item>
|
||||
<item name="fastScrollPreviewBackgroundRight">@android:drawable/menu_submenu_background</item>
|
||||
@@ -978,10 +984,17 @@
|
||||
<item name="numberPickerUpButtonStyle">@style/Widget.Holo.ImageButton.NumberPickerUpButton</item>
|
||||
<item name="numberPickerDownButtonStyle">@style/Widget.Holo.ImageButton.NumberPickerDownButton</item>
|
||||
<item name="numberPickerInputTextStyle">@style/Widget.Holo.EditText.NumberPickerInputText</item>
|
||||
<item name="numberPickerStyle">@style/Widget.Holo.NumberPicker</item>
|
||||
|
||||
<!-- CalendarView style-->
|
||||
<item name="calendarViewStyle">@style/Widget.Holo.CalendarView</item>
|
||||
|
||||
<!-- TimePicker style -->
|
||||
<item name="timePickerStyle">@style/Widget.Holo.TimePicker</item>
|
||||
|
||||
<!-- DatePicker style -->
|
||||
<item name="datePickerStyle">@style/Widget.Holo.DatePicker</item>
|
||||
|
||||
<item name="fastScrollThumbDrawable">@android:drawable/fastscroll_thumb_holo</item>
|
||||
<item name="fastScrollPreviewBackgroundLeft">@android:drawable/fastscroll_label_left_holo_dark</item>
|
||||
<item name="fastScrollPreviewBackgroundRight">@android:drawable/fastscroll_label_right_holo_dark</item>
|
||||
@@ -1003,6 +1016,7 @@
|
||||
<item name="disabledAlpha">0.5</item>
|
||||
<item name="backgroundDimAmount">0.6</item>
|
||||
|
||||
|
||||
<!-- Text styles -->
|
||||
<item name="textAppearance">@android:style/TextAppearance.Holo.Light</item>
|
||||
<item name="textAppearanceInverse">@android:style/TextAppearance.Holo.Light.Inverse</item>
|
||||
@@ -1236,10 +1250,17 @@
|
||||
<item name="numberPickerUpButtonStyle">@style/Widget.Holo.Light.ImageButton.NumberPickerUpButton</item>
|
||||
<item name="numberPickerDownButtonStyle">@style/Widget.Holo.Light.ImageButton.NumberPickerDownButton</item>
|
||||
<item name="numberPickerInputTextStyle">@style/Widget.Holo.Light.EditText.NumberPickerInputText</item>
|
||||
<item name="numberPickerStyle">@style/Widget.Holo.Light.NumberPicker</item>
|
||||
|
||||
<!-- CalendarView style-->
|
||||
<item name="calendarViewStyle">@style/Widget.Holo.Light.CalendarView</item>
|
||||
|
||||
<!-- TimePicker style -->
|
||||
<item name="timePickerStyle">@style/Widget.Holo.Light.TimePicker</item>
|
||||
|
||||
<!-- DatePicker style -->
|
||||
<item name="datePickerStyle">@style/Widget.Holo.Light.DatePicker</item>
|
||||
|
||||
<item name="fastScrollThumbDrawable">@android:drawable/fastscroll_thumb_holo</item>
|
||||
<item name="fastScrollPreviewBackgroundLeft">@android:drawable/fastscroll_label_left_holo_light</item>
|
||||
<item name="fastScrollPreviewBackgroundRight">@android:drawable/fastscroll_label_right_holo_light</item>
|
||||
|
||||
Reference in New Issue
Block a user