-
Notifications
You must be signed in to change notification settings - Fork 1
/
numberpicker.android.ts
54 lines (45 loc) · 1.93 KB
/
numberpicker.android.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import common = require("./numberpicker.common");
import dependencyObservable = require("ui/core/dependency-observable");
import proxy = require("ui/core/proxy");
import utils = require("utils/utils");
import * as types from "utils/types";
global.moduleMerge(common, exports);
export class NumberPicker extends common.NumberPicker {
private _android: android.widget.NumberPicker;
public _listener: android.widget.NumberPicker.OnValueChangeListener;
constructor() {
super();
var that = new WeakRef(this);
this._listener = new android.widget.NumberPicker.OnValueChangeListener(
<utils.Owned & android.widget.NumberPicker.IOnValueChangeListener>{
get owner() {
return that.get();
},
onValueChange: (picker: android.widget.NumberPicker, oldVal: number, newVal: number)=>{
let instance = that.get();
if(instance) {
instance._onPropertyChangedFromNative(NumberPicker.valueProperty, newVal);
}
}
}
);
}
public _createUI() {
this._android = new android.widget.NumberPicker(this._context);
this._android.setOnValueChangedListener(this._listener);
this._android.setDescendantFocusability(android.widget.NumberPicker.FOCUS_BLOCK_DESCENDANTS);
this._android.setWrapSelectorWheel(true);
}
get android(): android.widget.NumberPicker {
return this._android;
}
public _onValuePropertyChanged(data: dependencyObservable.PropertyChangeData){
this._android.setValue(data.newValue);
}
public _onMinValuePropertyChanged(data: dependencyObservable.PropertyChangeData){
this._android.setMinValue(data.newValue);
}
public _onMaxValuePropertyChanged(data: dependencyObservable.PropertyChangeData){
this._android.setMaxValue(data.newValue);
}
}