├── .gitignore
├── .npmignore
├── LICENSE
├── README.md
├── README_cn.md
├── buildtool
├── README.md
└── typescript
│ ├── bin
│ ├── tsc
│ └── tsserver
│ └── lib
│ ├── lib.d.ts
│ ├── lib.es6.d.ts
│ ├── tsc.js
│ ├── tsserver.js
│ └── typescriptServices.js
├── dist
├── android-ui.d.ts
├── android-ui.es5.js
├── android-ui.es5.js.map
└── android-ui.js
├── package.json
└── src
├── android
├── R
│ ├── anim.ts
│ ├── attr.ts
│ ├── color.ts
│ ├── drawable.ts
│ ├── id.ts
│ ├── image.ts
│ ├── image_base64.ts
│ ├── interpolator.ts
│ ├── layout.ts
│ └── string.ts
├── app
│ ├── ActionBar.ts
│ ├── ActionBarActivity.ts
│ ├── Activity.ts
│ ├── ActivityThread.ts
│ ├── AlertController.ts
│ ├── AlertDialog.ts
│ ├── Application.ts
│ └── Dialog.ts
├── content
│ ├── Context.ts
│ ├── DialogInterface.ts
│ ├── Intent.ts
│ └── res
│ │ ├── ColorStateList.ts
│ │ ├── Resources.ts
│ │ └── TypedArray.ts
├── database
│ ├── DataSetObservable.ts
│ ├── DataSetObserver.ts
│ └── Observable.ts
├── graphics
│ ├── Canvas.ts
│ ├── Color.ts
│ ├── Matrix.ts
│ ├── Paint.ts
│ ├── Path.ts
│ ├── PixelFormat.ts
│ ├── Point.ts
│ ├── Rect.ts
│ ├── RectF.ts
│ └── drawable
│ │ ├── Animatable.ts
│ │ ├── AnimationDrawable.ts
│ │ ├── ClipDrawable.ts
│ │ ├── ClipRoundRectDrawable.ts
│ │ ├── ColorDrawable.ts
│ │ ├── Drawable.ts
│ │ ├── DrawableContainer.ts
│ │ ├── InsetDrawable.ts
│ │ ├── LayerDrawable.ts
│ │ ├── RotateDrawable.ts
│ │ ├── RoundRectDrawable.ts
│ │ ├── ScaleDrawable.ts
│ │ ├── ScrollBarDrawable.ts
│ │ ├── ShadowDrawable.ts
│ │ └── StateListDrawable.ts
├── os
│ ├── Bundle.ts
│ ├── Handler.ts
│ ├── Message.ts
│ ├── MessageQueue.ts
│ ├── SystemClock.ts
│ └── Trace.ts
├── support
│ └── v4
│ │ ├── view
│ │ ├── PagerAdapter.ts
│ │ └── ViewPager.ts
│ │ └── widget
│ │ ├── DrawerLayout.ts
│ │ └── ViewDragHelper.ts
├── text
│ ├── BoringLayout.ts
│ ├── DynamicLayout.ts
│ ├── InputType.ts
│ ├── Layout.ts
│ ├── MeasuredText.ts
│ ├── PackedIntVector.ts
│ ├── PackedObjectVector.ts
│ ├── SpanSet.ts
│ ├── SpanWatcher.ts
│ ├── Spannable.ts
│ ├── Spanned.ts
│ ├── StaticLayout.ts
│ ├── TextDirectionHeuristic.ts
│ ├── TextDirectionHeuristics.ts
│ ├── TextLine.ts
│ ├── TextPaint.ts
│ ├── TextUtils.ts
│ ├── TextWatcher.ts
│ ├── method
│ │ ├── AllCapsTransformationMethod.ts
│ │ ├── MovementMethod.ts
│ │ ├── PasswordTransformationMethod.ts
│ │ ├── ReplacementTransformationMethod.ts
│ │ ├── SingleLineTransformationMethod.ts
│ │ ├── TransformationMethod.ts
│ │ └── TransformationMethod2.ts
│ └── style
│ │ ├── CharacterStyle.ts
│ │ ├── LeadingMarginSpan.ts
│ │ ├── LineBackgroundSpan.ts
│ │ ├── LineHeightSpan.ts
│ │ ├── MetricAffectingSpan.ts
│ │ ├── ParagraphStyle.ts
│ │ ├── ReplacementSpan.ts
│ │ ├── TabStopSpan.ts
│ │ ├── UpdateAppearance.ts
│ │ ├── UpdateLayout.ts
│ │ └── WrapTogetherSpan.ts
├── util
│ ├── ArrayMap.ts
│ ├── CopyOnWriteArray.ts
│ ├── DisplayMetrics.ts
│ ├── LayoutDirection.ts
│ ├── Log.ts
│ ├── LongSparseArray.ts
│ ├── MathUtils.ts
│ ├── Pools.ts
│ ├── SparseArray.ts
│ ├── SparseBooleanArray.ts
│ ├── SparseMap.ts
│ ├── StateSet.ts
│ └── TypedValue.ts
├── view
│ ├── FocusFinder.ts
│ ├── GestureDetector.ts
│ ├── Gravity.ts
│ ├── HapticFeedbackConstants.ts
│ ├── KeyEvent.ts
│ ├── LayoutInflater.ts
│ ├── Menu.ts
│ ├── MenuItem.ts
│ ├── MotionEvent.ts
│ ├── ScaleGestureDetector.ts
│ ├── SoundEffectConstants.ts
│ ├── Surface.ts
│ ├── TouchDelegate.ts
│ ├── VelocityTracker.ts
│ ├── View.ts
│ ├── ViewConfiguration.ts
│ ├── ViewGroup.ts
│ ├── ViewOverlay.ts
│ ├── ViewParent.ts
│ ├── ViewRootImpl.ts
│ ├── ViewTreeObserver.ts
│ ├── Window.ts
│ ├── WindowManager.ts
│ ├── animation
│ │ ├── AccelerateDecelerateInterpolator.ts
│ │ ├── AccelerateInterpolator.ts
│ │ ├── AlphaAnimation.ts
│ │ ├── Animation.ts
│ │ ├── AnimationSet.ts
│ │ ├── AnimationUtils.ts
│ │ ├── AnticipateInterpolator.ts
│ │ ├── AnticipateOvershootInterpolator.ts
│ │ ├── BounceInterpolator.ts
│ │ ├── CycleInterpolator.ts
│ │ ├── DecelerateInterpolator.ts
│ │ ├── Interpolator.ts
│ │ ├── LinearInterpolator.ts
│ │ ├── OvershootInterpolator.ts
│ │ ├── RotateAnimation.ts
│ │ ├── ScaleAnimation.ts
│ │ ├── Transformation.ts
│ │ └── TranslateAnimation.ts
│ └── menu
│ │ └── MenuPopupHelper.ts
├── webkit
│ ├── WebView.ts
│ └── WebViewClient.ts
└── widget
│ ├── AbsListView.ts
│ ├── AbsSeekBar.ts
│ ├── AbsSpinner.ts
│ ├── Adapter.ts
│ ├── AdapterView.ts
│ ├── ArrayAdapter.ts
│ ├── BaseAdapter.ts
│ ├── BaseExpandableListAdapter.ts
│ ├── Button.ts
│ ├── CheckBox.ts
│ ├── Checkable.ts
│ ├── CheckedTextView.ts
│ ├── CompoundButton.ts
│ ├── EditText.ts
│ ├── ExpandableListAdapter.ts
│ ├── ExpandableListConnector.ts
│ ├── ExpandableListPosition.ts
│ ├── ExpandableListView.ts
│ ├── FrameLayout.ts
│ ├── GridView.ts
│ ├── HeaderViewListAdapter.ts
│ ├── HeterogeneousExpandableList.ts
│ ├── HorizontalScrollView.ts
│ ├── ImageButton.ts
│ ├── ImageView.ts
│ ├── LinearLayout.ts
│ ├── ListAdapter.ts
│ ├── ListPopupWindow.ts
│ ├── ListView.ts
│ ├── NumberPicker.ts
│ ├── OverScroller.ts
│ ├── PopupWindow.ts
│ ├── ProgressBar.ts
│ ├── RadioButton.ts
│ ├── RadioGroup.ts
│ ├── RatingBar.ts
│ ├── RelativeLayout.ts
│ ├── ScrollView.ts
│ ├── Scroller.ts
│ ├── SeekBar.ts
│ ├── Spinner.ts
│ ├── SpinnerAdapter.ts
│ ├── TextView.ts
│ ├── Toast.ts
│ └── WrapperListAdapter.ts
├── androidui
├── AndroidUI.ts
├── AndroidUIElement.ts
├── attr
│ ├── AttrBinder.ts
│ ├── AttrValueParser.ts
│ ├── StateAttr.ts
│ └── StateAttrList.ts
├── image
│ ├── ChangeImageSizeDrawable.ts
│ ├── NetDrawable.ts
│ ├── NetImage.ts
│ ├── NinePatchDrawable.ts
│ └── RegionImageDrawable.ts
├── native
│ ├── NativeApi.ts
│ ├── NativeCanvas.ts
│ ├── NativeEditText.ts
│ ├── NativeHtmlView.ts
│ ├── NativeImage.ts
│ ├── NativeSurface.ts
│ └── NativeWebView.ts
├── util
│ ├── ArrayCreator.ts
│ ├── ClassFinder.ts
│ ├── Long.ts
│ ├── NumberChecker.ts
│ ├── PageStack.ts
│ ├── PerformanceAdjuster.ts
│ └── Platform.ts
└── widget
│ ├── HtmlBaseView.ts
│ ├── HtmlDataAdapter.ts
│ ├── HtmlDataListAdapter.ts
│ ├── HtmlDataPagerAdapter.ts
│ ├── HtmlDataPickerAdapter.ts
│ ├── HtmlImageView.ts
│ ├── HtmlView.ts
│ ├── OverScrollLocker.ts
│ └── PullRefreshLoadLayout.ts
├── build_sdk_res.js
├── insert_sdk_version_dist.js
├── java
├── lang
│ ├── Comparable.ts
│ ├── Float.ts
│ ├── Integer.ts
│ ├── Long.ts
│ ├── Object.ts
│ ├── Runnable.ts
│ ├── StringBuilder.ts
│ ├── System.ts
│ ├── ref
│ │ └── WeakReference.ts
│ └── util
│ │ └── concurrent
│ │ └── CopyOnWriteArrayList.ts
└── util
│ ├── ArrayDeque.ts
│ ├── ArrayList.ts
│ ├── Arrays.ts
│ ├── Collections.ts
│ ├── Comparator.ts
│ └── List.ts
├── lib
├── com
│ └── jakewharton
│ │ └── salvage
│ │ └── RecyclingPagerAdapter.ts
└── uk
│ └── co
│ └── senab
│ └── photoview
│ ├── GestureDetector.ts
│ ├── IPhotoView.ts
│ ├── PhotoView.ts
│ └── PhotoViewAttacher.ts
├── pack_enter.ts
├── res
├── image
│ ├── actionbar_ic_back_white@3x.png
│ ├── btn_check_off_disabled_focused_holo_light@3x.png
│ ├── btn_check_off_disabled_holo_light@3x.png
│ ├── btn_check_off_focused_holo_light@3x.png
│ ├── btn_check_off_holo_light@3x.png
│ ├── btn_check_off_pressed_holo_light@3x.png
│ ├── btn_check_on_disabled_focused_holo_light@3x.png
│ ├── btn_check_on_disabled_holo_light@3x.png
│ ├── btn_check_on_focused_holo_light@3x.png
│ ├── btn_check_on_holo_light@3x.png
│ ├── btn_check_on_pressed_holo_light@3x.png
│ ├── btn_default_disabled_focused_holo_light@3x.9.png
│ ├── btn_default_disabled_holo_light@3x.9.png
│ ├── btn_default_focused_holo_light@3x.9.png
│ ├── btn_default_normal_holo_light@3x.9.png
│ ├── btn_default_pressed_holo_light@3x.9.png
│ ├── btn_radio_off_disabled_focused_holo_light@3x.png
│ ├── btn_radio_off_disabled_holo_light@3x.png
│ ├── btn_radio_off_focused_holo_light@3x.png
│ ├── btn_radio_off_holo_light@3x.png
│ ├── btn_radio_off_pressed_holo_light@3x.png
│ ├── btn_radio_on_disabled_focused_holo_light@3x.png
│ ├── btn_radio_on_disabled_holo_light@3x.png
│ ├── btn_radio_on_focused_holo_light@3x.png
│ ├── btn_radio_on_holo_light@3x.png
│ ├── btn_radio_on_pressed_holo_light@3x.png
│ ├── btn_rating_star_off_normal_holo_light@3x.png
│ ├── btn_rating_star_off_pressed_holo_light@3x.png
│ ├── btn_rating_star_on_normal_holo_light@3x.png
│ ├── btn_rating_star_on_pressed_holo_light@3x.png
│ ├── dropdown_background_dark@2x.9.png
│ ├── editbox_background_focus_yellow@2x.9.png
│ ├── editbox_background_normal@2x.9.png
│ ├── ic_menu_moreoverflow_normal_holo_dark@3x.png
│ ├── menu_panel_holo_dark@2x.9.png
│ ├── menu_panel_holo_light@2x.9.png
│ ├── popup_bottom_bright@2x.9.png
│ ├── popup_center_bright@2x.9.png
│ ├── popup_full_bright@2x.9.png
│ ├── popup_top_bright@2x.9.png
│ ├── progressbar_indeterminate_holo1@3x.png
│ ├── progressbar_indeterminate_holo2@3x.png
│ ├── progressbar_indeterminate_holo3@3x.png
│ ├── progressbar_indeterminate_holo4@3x.png
│ ├── progressbar_indeterminate_holo5@3x.png
│ ├── progressbar_indeterminate_holo6@3x.png
│ ├── progressbar_indeterminate_holo7@3x.png
│ ├── progressbar_indeterminate_holo8@3x.png
│ ├── rate_star_big_half_holo_light@3x.png
│ ├── rate_star_big_off_holo_light@3x.png
│ ├── rate_star_big_on_holo_light@3x.png
│ ├── scrubber_control_disabled_holo@3x.png
│ ├── scrubber_control_focused_holo@3x.png
│ ├── scrubber_control_normal_holo@3x.png
│ ├── scrubber_control_pressed_holo@3x.png
│ ├── spinner_76_inner_holo@3x.png
│ └── spinner_76_outer_holo@3x.png
└── layout
│ ├── _id_defined.xml
│ ├── action_bar.xml
│ ├── alert_dialog.xml
│ ├── alert_dialog_progress.xml
│ ├── popup_menu_item_layout.xml
│ ├── select_dialog.xml
│ ├── select_dialog_item.xml
│ ├── select_dialog_multichoice.xml
│ ├── select_dialog_singlechoice.xml
│ ├── simple_spinner_dropdown_item.xml
│ ├── simple_spinner_item.xml
│ └── transient_notification.xml
└── tsconfig.json
/.gitignore:
--------------------------------------------------------------------------------
1 | test/
2 | node_modules/
3 | .idea
4 | .DS_Store
5 | .outjs
--------------------------------------------------------------------------------
/.npmignore:
--------------------------------------------------------------------------------
1 | test/
2 | node_modules/
3 | .idea
4 | .DS_Store
5 | .outjs
6 |
7 | src/
8 | buildtool/
9 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2014 Vladimir Kharlampidi
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | this software and associated documentation files (the "Software"), to deal in
7 | the Software without restriction, including without limitation the rights to
8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | the Software, and to permit persons to whom the Software is furnished to do so,
10 | subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # AndroidUIX
2 | [中文文档](https://github.com/linfaxin/AndroidUIX/blob/master/README_cn.md)
3 |
4 | Make a high-performance web app with Android UI.
5 |
6 | Site: http://linfaxin.github.io/AndroidUIX/
7 |
8 |
9 | ### Feature
10 |
11 | 1. Native app experience & performance.
12 | 2. Render with web canvas, high-performance web app.
13 | 3. Same api as Android, you can find its question & usage on the internet.
14 |
15 |
16 | ### Getting Started
17 |
18 | Look wiki: [Getting Started](https://github.com/linfaxin/AndroidUIX/wiki/1.-Getting-Started)
19 |
20 |
21 | ### 60fps
22 |
23 | the sample app's fps:
24 |
25 | 1. IOS: 50-60fps
26 | 2. Android Chrome: 50fps
27 | 3. Android WebView(with [Runtime](https://github.com/linfaxin/AndroidUIRuntimeAndroid)): 50fps
28 |
29 | You can test [Showcase](http://androiduix.com/showcase/index.html) on your device.
30 |
31 |
32 | ### Showcase
33 |
34 | * [Showcase](http://linfaxin.github.io/AndroidUIX/showcase/index.html)
35 |
36 |
37 |
38 | ### LICENSE
39 |
40 | MIT.
41 |
--------------------------------------------------------------------------------
/README_cn.md:
--------------------------------------------------------------------------------
1 | # AndroidUIX
2 |
3 | 移植Android的UI组件到Web端, 以Android的方式来制作高性能优体验的WebApp
4 |
5 | 网站: http://linfaxin.github.io/AndroidUIX
6 |
7 |
8 | ### 特点
9 |
10 | 1. 完整Native端组件体验
11 | 2. 使用Web Canvas绘制界面
12 | 3. 与Android SDK相同的API,相关用法和问题都可以在网络轻易找到。
13 |
14 | ### 开始
15 |
16 | [快速起步](https://github.com/linfaxin/AndroidUIX/wiki/%E4%B8%AD%E6%96%87_1.-%E5%BF%AB%E9%80%9F%E5%BC%80%E5%A7%8B)
17 |
18 | ### 60fps
19 |
20 | Sample页在移动端的fps:
21 |
22 | 1. IOS: 50-60fps
23 | 2. Android Chrome: 50fps
24 | 3. Android WebView(App嵌入[Runtime](https://github.com/linfaxin/AndroidUIRuntimeAndroid)运行时): 50fps
25 |
26 | 你也可以在自己的手机浏览器上测试 [Showcase](http://androiduix.com/showcase/index.html)。
27 |
28 | ### Showcase
29 |
30 | * [Showcase](http://linfaxin.github.io/AndroidUIX/showcase/index.html)
31 |
32 |
33 | ### LICENSE
34 |
35 | MIT.
36 |
--------------------------------------------------------------------------------
/buildtool/README.md:
--------------------------------------------------------------------------------
1 | ### AndroidUIX Modified Note
2 |
3 | The packed typescript's 'checkClassPropertyAccess' was closed, so you can access private/protected property out a class.
4 |
--------------------------------------------------------------------------------
/buildtool/typescript/bin/tsc:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 | require('../lib/tsc.js')
3 |
--------------------------------------------------------------------------------
/buildtool/typescript/bin/tsserver:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 | require('../lib/tsserver.js')
3 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "androiduix",
3 | "version": "0.7.0",
4 | "description": "Framework to make high-performance SPA/WebApp. Render with web canvas.",
5 | "keywords": [
6 | "webapp",
7 | "app",
8 | "canvas",
9 | "spa"
10 | ],
11 | "author": "LinFaXin",
12 | "maintainers": [
13 | "LinFaXin (http://linfaxin.com)"
14 | ],
15 | "license": "MIT",
16 | "repository": {
17 | "type": "git",
18 | "url": "https://github.com/linfaxin/AndroidUIX"
19 | },
20 | "bugs": {
21 | "url": "https://github.com/linfaxin/AndroidUIX/issues"
22 | },
23 | "devDependencies": {
24 | "jsdom": "^7.2.2",
25 | "babel-cli": "^6.18.0",
26 | "babel-preset-es2015": "^6.18.0"
27 | },
28 | "scripts": {
29 | "build" : "npm install --registry=https://registry.npm.taobao.org && npm run buildRes && npm run buildTS2ES6 && npm run buildES62ES5",
30 | "buildRes" : "cd src && node build_sdk_res.js",
31 | "buildTS2ES6" : "cd src && \"../buildtool/typescript/bin/tsc\" -p ./",
32 | "buildES62ES5" : "cd src && node insert_sdk_version_dist.js && babel ../dist/android-ui.js -o ../dist/android-ui.es5.js -s --presets=es2015"
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/android/R/color.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by linfaxin on 15/11/15.
3 | */
4 | ///
5 | ///
6 | ///
7 | ///
8 | ///
9 | ///
10 | ///
11 | ///
12 | module android.R{
13 | import Resources = android.content.res.Resources;
14 | import ColorStateList = android.content.res.ColorStateList;
15 | import Color = android.graphics.Color;
16 | import Drawable = android.graphics.drawable.Drawable;
17 | import InsetDrawable = android.graphics.drawable.InsetDrawable;
18 | import ColorDrawable = android.graphics.drawable.ColorDrawable;
19 | import StateListDrawable = android.graphics.drawable.StateListDrawable;
20 | import Gravity = android.view.Gravity;
21 |
22 | export class color {
23 | static get textView_textColor():ColorStateList {
24 | let _defaultStates = [[-android.view.View.VIEW_STATE_ENABLED], []];
25 | let _defaultColors = [0xffc0c0c0, 0xff333333];
26 | class DefaultStyleTextColor extends ColorStateList{
27 | constructor() {
28 | super(_defaultStates, _defaultColors);
29 | }
30 | }
31 | return new DefaultStyleTextColor();
32 | }
33 |
34 | static get primary_text_light_disable_only():ColorStateList {
35 | let _defaultStates = [[-android.view.View.VIEW_STATE_ENABLED], []];
36 | let _defaultColors = [0x80000000, 0xff000000];
37 | class DefaultStyleTextColor extends ColorStateList{
38 | constructor() {
39 | super(_defaultStates, _defaultColors);
40 | }
41 | }
42 | return new DefaultStyleTextColor();
43 | }
44 |
45 | static get primary_text_dark_disable_only():ColorStateList {
46 | let _defaultStates = [[-android.view.View.VIEW_STATE_ENABLED], []];
47 | let _defaultColors = [0x80000000, 0xffffffff];
48 | class DefaultStyleTextColor extends ColorStateList{
49 | constructor() {
50 | super(_defaultStates, _defaultColors);
51 | }
52 | }
53 | return new DefaultStyleTextColor();
54 | }
55 |
56 | static white = Color.WHITE;
57 | static black = Color.BLACK;
58 | static transparent = Color.TRANSPARENT;
59 | }
60 | }
--------------------------------------------------------------------------------
/src/android/R/id.ts:
--------------------------------------------------------------------------------
1 | module android.R {
2 | export const id = {
3 | "content": "content",
4 | "background": "background",
5 | "secondaryProgress": "secondaryProgress",
6 | "progress": "progress",
7 | "contentPanel": "contentPanel",
8 | "topPanel": "topPanel",
9 | "buttonPanel": "buttonPanel",
10 | "customPanel": "customPanel",
11 | "custom": "custom",
12 | "titleDivider": "titleDivider",
13 | "titleDividerTop": "titleDividerTop",
14 | "title_template": "title_template",
15 | "icon": "icon",
16 | "alertTitle": "alertTitle",
17 | "scrollView": "scrollView",
18 | "message": "message",
19 | "button1": "button1",
20 | "button2": "button2",
21 | "button3": "button3",
22 | "leftSpacer": "leftSpacer",
23 | "rightSpacer": "rightSpacer",
24 | "text1": "text1",
25 | "action_bar_center_layout": "action_bar_center_layout",
26 | "action_bar_title": "action_bar_title",
27 | "action_bar_sub_title": "action_bar_sub_title",
28 | "action_bar_left": "action_bar_left",
29 | "action_bar_right": "action_bar_right",
30 | "parentPanel": "parentPanel",
31 | "progress_percent": "progress_percent",
32 | "progress_number": "progress_number",
33 | "title": "title",
34 | "shortcut": "shortcut",
35 | "select_dialog_listview": "select_dialog_listview"
36 | };
37 | }
--------------------------------------------------------------------------------
/src/android/R/interpolator.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by linfaxin on 16/1/10.
3 | */
4 | ///
5 | ///
6 | ///
7 | ///
8 | ///
9 | ///
10 | ///
11 | ///
12 | ///
13 | ///
14 |
15 | module android.R{
16 | import Interpolator = android.view.animation.Interpolator;
17 | import AccelerateDecelerateInterpolator = android.view.animation.AccelerateDecelerateInterpolator;
18 | import AccelerateInterpolator = android.view.animation.AccelerateInterpolator;
19 | import AnticipateInterpolator = android.view.animation.AnticipateInterpolator;
20 | import AnticipateOvershootInterpolator = android.view.animation.AnticipateOvershootInterpolator;
21 | import BounceInterpolator = android.view.animation.BounceInterpolator;
22 | import CycleInterpolator = android.view.animation.CycleInterpolator;
23 | import DecelerateInterpolator = android.view.animation.DecelerateInterpolator;
24 | import LinearInterpolator = android.view.animation.LinearInterpolator;
25 | import OvershootInterpolator = android.view.animation.OvershootInterpolator;
26 |
27 | export class interpolator {
28 | static accelerate_cubic = new AccelerateInterpolator(1.5);
29 | static accelerate_decelerate = new AccelerateDecelerateInterpolator();
30 | static accelerate_quad = new AccelerateInterpolator();
31 | static accelerate_quint = new AccelerateInterpolator(2.5);
32 | static anticipate_overshoot = new AnticipateOvershootInterpolator();
33 | static anticipate = new AnticipateInterpolator();
34 | static bounce = new BounceInterpolator();
35 | static cycle = new CycleInterpolator(1);
36 | static decelerate_cubic = new DecelerateInterpolator(1.5);
37 | static decelerate_quad = new DecelerateInterpolator();
38 | static decelerate_quint = new DecelerateInterpolator(2.5);
39 | static linear = new LinearInterpolator();
40 | static overshoot = new OvershootInterpolator();
41 | }
42 | }
--------------------------------------------------------------------------------
/src/android/R/string.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by linfaxin on 15/11/21.
3 | */
4 | module android.R{
5 | export class string_{
6 | static ok = 'OK';
7 | static cancel = 'Cancel';
8 | static close = 'Close';
9 | static back = 'Back';
10 | static crash_catch_alert = 'Some error happen, will refresh page:';
11 |
12 | static prll_header_state_normal = 'Pull to refresh';
13 | static prll_header_state_ready = 'Release to refresh';
14 | static prll_header_state_loading = 'Loading';
15 | static prll_header_state_fail = 'Refresh fail';
16 | static prll_footer_state_normal = 'Load more';
17 | static prll_footer_state_loading = 'Loading';
18 | static prll_footer_state_ready = 'Pull to load more';
19 | static prll_footer_state_fail = 'Click to reload';
20 | static prll_footer_state_no_more = 'Load Finish';
21 |
22 | private static zh(){
23 | this.ok = '确定';
24 | this.cancel = '取消';
25 | this.close = '关闭';
26 | this.back = '返回';
27 | this.crash_catch_alert = '程序发生错误, 即将重载网页:';
28 |
29 | this.prll_header_state_normal = '下拉以刷新';
30 | this.prll_header_state_ready = '松开马上刷新';
31 | this.prll_header_state_loading = '正在刷新...';
32 | this.prll_header_state_fail = '刷新失败';
33 | this.prll_footer_state_normal = '点击加载更多';
34 | this.prll_footer_state_loading = '正在加载...';
35 | this.prll_footer_state_ready = '松开加载更多';
36 | this.prll_footer_state_no_more = '加载完毕';
37 | this.prll_footer_state_fail = '加载失败,点击重试';
38 | }
39 | }
40 |
41 | //merge language special to main
42 | const lang = navigator.language.split('-')[0].toLowerCase();
43 | if(typeof string_[lang] === 'function') string_[lang].call(string_);
44 | }
--------------------------------------------------------------------------------
/src/android/app/ActionBarActivity.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by linfaxin on 16/1/21.
3 | * androidui NOTE: ActionBarActivity is not same style as android's
4 | */
5 | ///
6 | ///
7 |
8 |
9 | module android.app {
10 | import View = android.view.View;
11 | import ViewGroup = android.view.ViewGroup;
12 | import MarginLayoutParams = android.view.ViewGroup.MarginLayoutParams;
13 |
14 | export class ActionBarActivity extends Activity {
15 | private mActionBar:ActionBar;
16 |
17 | protected onCreate(savedInstanceState?:android.os.Bundle):void {
18 | super.onCreate(savedInstanceState);
19 | this.initActionBar();
20 | }
21 |
22 | private initActionBar(){
23 | this.setActionBar(new ActionBar(this));
24 | this.initDefaultBackFinish();
25 | }
26 |
27 | private initDefaultBackFinish(){
28 | if(this.androidUI.mActivityThread.mLaunchedActivities.size === 0) return;//xxx not do check here
29 | const activity = this;
30 | this.mActionBar.setActionLeft(android.R.string_.back, android.R.image.actionbar_ic_back_white, {
31 | onClick(view:View){
32 | activity.finish();
33 | }
34 | });
35 | }
36 |
37 | setActionBar(actionBar:ActionBar){
38 | const activity = this;
39 | let w = this.getWindow();
40 | let decorView:ViewGroup = w.mDecor;
41 | this.mActionBar = actionBar;
42 | decorView.addView(actionBar, -1, -2);
43 | const onMeasure = decorView.onMeasure;
44 | decorView.onMeasure = (widthMeasureSpec:number, heightMeasureSpec:number)=>{
45 | onMeasure.call(decorView, widthMeasureSpec, heightMeasureSpec);
46 | if(activity.mActionBar === actionBar){
47 | let params = w.mContentParent.getLayoutParams();
48 | if(params.topMargin != actionBar.getMeasuredHeight()){
49 | params.topMargin = actionBar.getMeasuredHeight();
50 | onMeasure.call(decorView, widthMeasureSpec, heightMeasureSpec);
51 | }
52 | }
53 | };
54 | }
55 |
56 |
57 | protected invalidateOptionsMenuPopupHelper(menu:android.view.Menu):android.view.menu.MenuPopupHelper {
58 | let menuPopuoHelper = new android.view.menu.MenuPopupHelper(this, menu, this.getActionBar().mActionRight);
59 | if(menu.hasVisibleItems()){
60 | this.getActionBar().setActionRight('', android.R.image.ic_menu_moreoverflow_normal_holo_dark, {
61 | onClick: function (view) {
62 | menuPopuoHelper.show();
63 | }
64 | });
65 | }
66 | return menuPopuoHelper;
67 | }
68 |
69 | getActionBar():ActionBar {
70 | return this.mActionBar;
71 | }
72 |
73 | protected onTitleChanged(title:string, color:number):void {
74 | super.onTitleChanged(title, color);
75 | this.mActionBar.setTitle(title);
76 | }
77 | }
78 | }
--------------------------------------------------------------------------------
/src/android/content/Context.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by linfaxin on 16/1/4.
3 | * lite impl of Android's Content
4 | */
5 | ///
6 | ///
7 | ///
8 | ///
9 | ///
10 | ///
11 |
12 |
13 | module android.content {
14 | import Intent = android.content.Intent;
15 | import Bundle = android.os.Bundle;
16 | import LayoutInflater = android.view.LayoutInflater;
17 |
18 | export abstract class Context {
19 | androidUI: androidui.AndroidUI;
20 | private mLayoutInflater:LayoutInflater;
21 | private mResources:android.content.res.Resources;
22 |
23 | constructor(androidUI:androidui.AndroidUI) {
24 | this.androidUI = androidUI;
25 | this.mLayoutInflater = new LayoutInflater(this);
26 | this.mResources = new android.content.res.Resources(this);
27 | }
28 |
29 | abstract getWindowManager():android.view.WindowManager;
30 |
31 | getApplicationContext():android.app.Application{
32 | return this.androidUI.mApplication;
33 | }
34 |
35 | /** Return a Resources instance for your application's package. */
36 | getResources():android.content.res.Resources{
37 | return this.mResources;
38 | }
39 |
40 | getLayoutInflater():LayoutInflater{
41 | return this.mLayoutInflater;
42 | }
43 |
44 | /**
45 | * Retrieve styled attribute information.
46 | */
47 | public obtainStyledAttributes(attrs:HTMLElement, defStyleAttr?:Map):res.TypedArray {
48 | return res.TypedArray.obtain(this.mResources, attrs, defStyleAttr);
49 | }
50 |
51 | }
52 | }
--------------------------------------------------------------------------------
/src/android/database/DataSetObservable.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2007 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | ///
18 | ///
19 | ///
20 |
21 | module android.database{
22 | import ArrayList = java.util.ArrayList;
23 | import Observable = android.database.Observable;
24 | import DataSetObserver = android.database.DataSetObserver;
25 |
26 | /**
27 | * A specialization of {@link Observable} for {@link DataSetObserver}
28 | * that provides methods for sending notifications to a list of
29 | * {@link DataSetObserver} objects.
30 | */
31 | export class DataSetObservable extends Observable{
32 | /**
33 | * Invokes {@link DataSetObserver#onChanged} on each observer.
34 | * Called when the contents of the data set have changed. The recipient
35 | * will obtain the new contents the next time it queries the data set.
36 | */
37 | notifyChanged():void {
38 | // to avoid such problems, just march thru the list in the reverse order.
39 | for (let i = this.mObservers.size() - 1; i >= 0; i--) {
40 | this.mObservers.get(i).onChanged();
41 | }
42 | }
43 | /**
44 | * Invokes {@link DataSetObserver#onInvalidated} on each observer.
45 | * Called when the data set is no longer valid and cannot be queried again,
46 | * such as when the data set has been closed.
47 | */
48 | notifyInvalidated():void {
49 | for (let i = this.mObservers.size() - 1; i >= 0; i--) {
50 | this.mObservers.get(i).onInvalidated();
51 | }
52 | }
53 | }
54 | }
--------------------------------------------------------------------------------
/src/android/database/DataSetObserver.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2007 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | module android.database{
18 | export class DataSetObserver {
19 | /**
20 | * This method is called when the entire data set has changed,
21 | * most likely through a call to {@link Cursor#requery()} on a {@link Cursor}.
22 | */
23 | onChanged():void {
24 | // Do nothing
25 | }
26 |
27 | /**
28 | * This method is called when the entire data becomes invalid,
29 | * most likely through a call to {@link Cursor#deactivate()} or {@link Cursor#close()} on a
30 | * {@link Cursor}.
31 | */
32 | onInvalidated():void {
33 | // Do nothing
34 | }
35 | }
36 | }
--------------------------------------------------------------------------------
/src/android/database/Observable.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2007 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | ///
18 |
19 | module android.database{
20 | import ArrayList = java.util.ArrayList;
21 |
22 | /**
23 | * Provides methods for registering or unregistering arbitrary observers in an {@link ArrayList}.
24 | *
25 | * This abstract class is intended to be subclassed and specialized to maintain
26 | * a registry of observers of specific types and dispatch notifications to them.
27 | *
28 | * @param T The observer type.
29 | */
30 | export abstract class Observable{
31 | /**
32 | * The list of observers. An observer can be in the list at most
33 | * once and will never be null.
34 | */
35 | protected mObservers = new ArrayList()
36 |
37 | /**
38 | * Adds an observer to the list. The observer cannot be null and it must not already
39 | * be registered.
40 | * @param observer the observer to register
41 | * @throws IllegalArgumentException the observer is null
42 | * @throws IllegalStateException the observer is already registered
43 | */
44 | registerObserver(observer:T):void {
45 | if (observer == null) {
46 | throw new Error("The observer is null.");
47 | }
48 | if (this.mObservers.contains(observer)) {
49 | throw new Error("Observer " + observer + " is already registered.");
50 | }
51 | this.mObservers.add(observer);
52 | }
53 |
54 | /**
55 | * Removes a previously registered observer. The observer must not be null and it
56 | * must already have been registered.
57 | * @param observer the observer to unregister
58 | * @throws IllegalArgumentException the observer is null
59 | * @throws IllegalStateException the observer is not yet registered
60 | */
61 | unregisterObserver(observer:T) {
62 | if (observer == null) {
63 | throw new Error("The observer is null.");
64 | }
65 | let index = this.mObservers.indexOf(observer);
66 | if (index == -1) {
67 | throw new Error("Observer " + observer + " was not registered.");
68 | }
69 | this.mObservers.remove(index);
70 | }
71 |
72 | /**
73 | * Remove all registered observers.
74 | */
75 | unregisterAll():void {
76 | this.mObservers.clear();
77 | }
78 | }
79 | }
--------------------------------------------------------------------------------
/src/android/graphics/Path.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by linfaxin on 15/12/6.
3 | * empty class: not support draw/clip path now.
4 | */
5 | module android.graphics{
6 | export class Path{
7 |
8 | reset(){
9 |
10 | }
11 | }
12 | }
--------------------------------------------------------------------------------
/src/android/graphics/PixelFormat.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2006 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | module android.graphics {
18 | export class PixelFormat {
19 | static UNKNOWN = 0;
20 | static TRANSLUCENT = -3;
21 | static TRANSPARENT = -2;
22 | static OPAQUE = -1;
23 | static RGBA_8888 = 1;
24 | static RGBX_8888 = 2;
25 | static RGB_888 = 3;
26 | static RGB_565 = 4;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/android/graphics/Point.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2007 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | module android.graphics {
18 | /**
19 | * Point holds two integer coordinates
20 | */
21 | export class Point {
22 | x:number = 0;
23 | y:number = 0;
24 |
25 | constructor();
26 | constructor(x:number, y:number);
27 | constructor(src:Point);
28 | constructor(...args) {
29 | if (args.length === 1) {
30 | let src:Point = args[0];
31 | this.x = src.x;
32 | this.y = src.y;
33 | } else {
34 | let [x=0, y=0] = args;
35 | this.x = x;
36 | this.y = y;
37 | }
38 | }
39 |
40 | /**
41 | * Set the point's x and y coordinates
42 | */
43 | set(x:number, y:number) {
44 | this.x = x;
45 | this.y = y;
46 | }
47 |
48 | /**
49 | * Negate the point's coordinates
50 | */
51 | negate() {
52 | this.x = -this.x;
53 | this.y = -this.y;
54 | }
55 |
56 | /**
57 | * Offset the point's coordinates by dx, dy
58 | */
59 | offset(dx:number, dy:number) {
60 | this.x += dx;
61 | this.y += dy;
62 | }
63 |
64 | /**
65 | * Returns true if the point's coordinates equal (x,y)
66 | */
67 | equals(x:number, y:number):boolean ;
68 | equals(o:any):boolean;
69 | equals(...args):boolean {
70 | if (args.length === 2) {
71 | let [x=0,y=0] = args;
72 | return this.x == x && this.y == y
73 | } else {
74 | let o = args[0];
75 | if (this === o) return true;
76 | if (!o || !(o instanceof Point)) return false;
77 | let point = o;
78 | if (this.x != point.x) return false;
79 | if (this.y != point.y) return false;
80 | return true;
81 | }
82 | }
83 |
84 | toString():String {
85 | return "Point(" + this.x + ", " + this.y + ")";
86 | }
87 | }
88 | }
--------------------------------------------------------------------------------
/src/android/graphics/RectF.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by linfaxin on 15/12/6.
3 | * NOTE: only extends Rect, Rect no integer vale limit now.
4 | */
5 | ///
6 |
7 | module android.graphics{
8 | export class RectF extends Rect{
9 | }
10 | }
--------------------------------------------------------------------------------
/src/android/graphics/drawable/Animatable.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2009 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 |
18 | module android.graphics.drawable {
19 | /**
20 | * Interface that drawables suporting animations should implement.
21 | */
22 | export interface Animatable {
23 |
24 | /**
25 | * Starts the drawable's animation.
26 | */
27 | start():void ;
28 |
29 | /**
30 | * Stops the drawable's animation.
31 | */
32 | stop():void ;
33 |
34 | /**
35 | * Indicates whether the animation is running.
36 | *
37 | * @return True if the animation is running, false otherwise.
38 | */
39 | isRunning():boolean ;
40 | }
41 | export module Animatable{
42 | export function isImpl(obj){
43 | return obj && obj['start'] && obj['stop'] && obj['isRunning'];
44 | }
45 | }
46 | }
--------------------------------------------------------------------------------
/src/android/os/Bundle.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2007 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 |
18 | module android.os{
19 | /**
20 | * A mapping from String values to various Parcelable types.
21 | * NOTE: lite impl of Android Bundle
22 | */
23 | export class Bundle{
24 | constructor(copy?:Bundle){
25 | if(copy) Object.assign(this, copy);
26 | }
27 |
28 | get(key:string, defaultValue:any){
29 | if(this.containsKey(key)){
30 | return this[key];
31 | }
32 | return defaultValue;
33 | }
34 |
35 | put(key:string, value:any){
36 | this[key] = value;
37 | }
38 |
39 | containsKey(key:string){
40 | return key in this;
41 | }
42 | }
43 | }
--------------------------------------------------------------------------------
/src/android/os/SystemClock.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by linfaxin on 15/10/5.
3 | * AndroidUI's impl.
4 | */
5 | module android.os{
6 | export class SystemClock{
7 | static uptimeMillis() : number{
8 | return new Date().getTime();
9 | }
10 | }
11 | }
--------------------------------------------------------------------------------
/src/android/text/SpanWatcher.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2006 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | ///
18 |
19 | module android.text {
20 | import Spannable = android.text.Spannable;
21 | /**
22 | * When an object of this type is attached to a Spannable, its methods
23 | * will be called to notify it that other markup objects have been
24 | * added, changed, or removed.
25 | */
26 | export interface SpanWatcher {
27 |
28 | /**
29 | * This method is called to notify you that the specified object
30 | * has been attached to the specified range of the text.
31 | */
32 | onSpanAdded(text:Spannable, what:any, start:number, end:number):void ;
33 |
34 | /**
35 | * This method is called to notify you that the specified object
36 | * has been detached from the specified range of the text.
37 | */
38 | onSpanRemoved(text:Spannable, what:any, start:number, end:number):void ;
39 |
40 | /**
41 | * This method is called to notify you that the specified object
42 | * has been relocated from the range ostart…oend
43 | * to the new range nstart…nend of the text.
44 | */
45 | onSpanChanged(text:Spannable, what:any, ostart:number, oend:number, nstart:number, nend:number):void ;
46 | }
47 | }
--------------------------------------------------------------------------------
/src/android/text/Spannable.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2006 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | ///
18 | ///
19 |
20 | module android.text {
21 | import Spanned = android.text.Spanned;
22 | import TextWatcher = android.text.TextWatcher;
23 | /**
24 | * This is the interface for text to which markup objects can be
25 | * attached and detached. Not all Spannable classes have mutable text;
26 | * see {@link Editable} for that.
27 | */
28 | export interface Spannable extends Spanned {
29 |
30 | /**
31 | * Attach the specified markup object to the range start…end
32 | * of the text, or move the object to that range if it was already
33 | * attached elsewhere. See {@link Spanned} for an explanation of
34 | * what the flags mean. The object can be one that has meaning only
35 | * within your application, or it can be one that the text system will
36 | * use to affect text display or behavior. Some noteworthy ones are
37 | * the subclasses of {@link android.text.style.CharacterStyle} and
38 | * {@link android.text.style.ParagraphStyle}, and
39 | * {@link android.text.TextWatcher} and
40 | * {@link android.text.SpanWatcher}.
41 | */
42 | setSpan(what:any, start:number, end:number, flags:number):void ;
43 |
44 | /**
45 | * Remove the specified object from the range of text to which it
46 | * was attached, if any. It is OK to remove an object that was never
47 | * attached in the first place.
48 | */
49 | removeSpan(what:any):void ;
50 |
51 |
52 | }
53 |
54 | export module Spannable{
55 | export function isImpl(obj):boolean {
56 | return obj && obj['setSpan'] && obj['removeSpan'];
57 | }
58 | /**
59 | * Factory used by TextView to create new Spannables. You can subclass
60 | * it to provide something other than SpannableString.
61 | */
62 | export class Factory {
63 |
64 | private static sInstance:Spannable.Factory = new Factory();
65 |
66 | /**
67 | * Returns the standard Spannable Factory.
68 | */
69 | static getInstance():Spannable.Factory {
70 | return Factory.sInstance;
71 | }
72 |
73 | /**
74 | * Returns a new SpannableString from the specified CharSequence.
75 | * You can override this to provide a different kind of Spannable.
76 | */
77 | newSpannable(source:String):Spannable {
78 | return source;//FIXME when SpannableString impl
79 | //return new SpannableString(source);
80 | }
81 | }
82 | }
83 |
84 | }
--------------------------------------------------------------------------------
/src/android/text/TextDirectionHeuristic.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 |
18 | module android.text {
19 | /**
20 | * Interface for objects that use a heuristic for guessing at the paragraph direction by examining text.
21 | */
22 | export interface TextDirectionHeuristic {
23 |
24 | /**
25 | * Guess if a {@code CharSequence} is in the RTL direction or not.
26 | *
27 | * @param cs the CharSequence.
28 | * @param start start index, inclusive.
29 | * @param count the length to check, must not be negative and not greater than
30 | * {@code CharSequence.length() - start}.
31 | * @return true if all chars in the range are to be considered in a RTL direction,
32 | * false otherwise.
33 | */
34 | isRtl(cs:string, start:number, count:number):boolean ;
35 | }
36 | }
--------------------------------------------------------------------------------
/src/android/text/TextPaint.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2006 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 |
18 | ///
19 |
20 | module android.text{
21 |
22 | /**
23 | * TextPaint is an extension of Paint that leaves room for some extra
24 | * data used during text measuring and drawing.
25 | */
26 | export class TextPaint extends android.graphics.Paint{
27 | baselineShift = 0;
28 | // Special value 0 means no background paint
29 | bgColor = 0;
30 | linkColor:number = 0;
31 |
32 | /**
33 | * Special value 0 means no custom underline
34 | * @hide
35 | */
36 | underlineColor = 0;
37 | /**
38 | * Defined as a multiplier of the default underline thickness. Use 1.0f for default thickness.
39 | * @hide
40 | */
41 | underlineThickness:number = 0;
42 |
43 |
44 | /**
45 | * Copy the fields from tp into this TextPaint, including the
46 | * fields inherited from Paint.
47 | */
48 | set(tp:TextPaint):void {
49 | super.set(tp);
50 | this.bgColor = tp.bgColor;
51 | this.baselineShift = tp.baselineShift;
52 | this.linkColor = tp.linkColor;
53 | //this.drawableState = tp.drawableState;
54 | //this.density = tp.density;
55 | this.underlineColor = tp.underlineColor;
56 | this.underlineThickness = tp.underlineThickness;
57 | }
58 |
59 | /**
60 | * Defines a custom underline for this Paint.
61 | * @param color underline solid color
62 | * @param thickness underline thickness
63 | * @hide
64 | */
65 | setUnderlineText(color:number, thickness:number):void {
66 | this.underlineColor = color;
67 | this.underlineThickness = thickness;
68 | }
69 | }
70 | }
--------------------------------------------------------------------------------
/src/android/text/TextWatcher.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2006 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 |
18 | module android.text {
19 | /**
20 | * When an object of a type is attached to an Editable, its methods will
21 | * be called when the text is changed.
22 | */
23 | export interface TextWatcher {
24 |
25 | /**
26 | * This method is called to notify you that, within s,
27 | * the count characters beginning at start
28 | * are about to be replaced by new text with length after.
29 | * It is an error to attempt to make changes to s from
30 | * this callback.
31 | */
32 | beforeTextChanged(s:String, start:number, count:number, after:number):void ;
33 |
34 | /**
35 | * This method is called to notify you that, within s,
36 | * the count characters beginning at start
37 | * have just replaced old text that had length before.
38 | * It is an error to attempt to make changes to s from
39 | * this callback.
40 | */
41 | onTextChanged(s:String, start:number, before:number, count:number):void ;
42 |
43 | /**
44 | * This method is called to notify you that, somewhere within
45 | * s, the text has been changed.
46 | * It is legitimate to make further changes to s from
47 | * this callback, but be careful not to get yourself into an infinite
48 | * loop, because any changes you make will cause this method to be
49 | * called again recursively.
50 | * (You are not told where the change took place because other
51 | * afterTextChanged() methods may already have made other changes
52 | * and invalidated the offsets. But if you need to know here,
53 | * you can use {@link Spannable#setSpan} in {@link #onTextChanged}
54 | * to mark your place and then look up from here where the span
55 | * ended up.
56 | */
57 | afterTextChanged(s:String):void ;//Editable
58 | }
59 | }
--------------------------------------------------------------------------------
/src/android/text/method/AllCapsTransformationMethod.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | ///
18 | ///
19 | ///
20 | ///
21 | ///
22 |
23 | module android.text.method {
24 | import Rect = android.graphics.Rect;
25 | import Log = android.util.Log;
26 | import View = android.view.View;
27 | import TransformationMethod = android.text.method.TransformationMethod;
28 | import TransformationMethod2 = android.text.method.TransformationMethod2;
29 | /**
30 | * Transforms source text into an ALL CAPS string, locale-aware.
31 | *
32 | * @hide
33 | */
34 | export class AllCapsTransformationMethod implements TransformationMethod2 {
35 |
36 | private static TAG:string = "AllCapsTransformationMethod";
37 |
38 | private mEnabled:boolean;
39 |
40 |
41 | constructor(context?:any) {
42 | }
43 |
44 | getTransformation(source:String, view:View):String {
45 | if (this.mEnabled) {
46 | return source != null ? source.toLocaleUpperCase() : null;
47 | }
48 | Log.w(AllCapsTransformationMethod.TAG, "Caller did not enable length changes; not transforming text");
49 | return source;
50 | }
51 |
52 | onFocusChanged(view:View, sourceText:String, focused:boolean, direction:number, previouslyFocusedRect:Rect):void {
53 | }
54 |
55 | setLengthChangesAllowed(allowLengthChanges:boolean):void {
56 | this.mEnabled = allowLengthChanges;
57 | }
58 | }
59 | }
--------------------------------------------------------------------------------
/src/android/text/method/MovementMethod.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2006 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | ///
18 | ///
19 | ///
20 | ///
21 |
22 | module android.text.method {
23 | import TextView = android.widget.TextView;
24 | import KeyEvent = android.view.KeyEvent;
25 | import MotionEvent = android.view.MotionEvent;
26 | import Spannable = android.text.Spannable;
27 | /**
28 | * Provides cursor positioning, scrolling and text selection functionality in a {@link TextView}.
29 | *
30 | * The {@link TextView} delegates handling of key events, trackball motions and touches to
31 | * the movement method for purposes of content navigation. The framework automatically
32 | * selects an appropriate movement method based on the content of the {@link TextView}.
33 | *
34 | * This interface is intended for use by the framework; it should not be implemented
35 | * directly by applications.
36 | *
37 | */
38 | export interface MovementMethod {
39 |
40 | initialize(widget:TextView, text:Spannable):void ;
41 |
42 | onKeyDown(widget:TextView, text:Spannable, keyCode:number, event:KeyEvent):boolean ;
43 |
44 | onKeyUp(widget:TextView, text:Spannable, keyCode:number, event:KeyEvent):boolean ;
45 |
46 | /**
47 | * If the key listener wants to other kinds of key events, return true,
48 | * otherwise return false and the caller (i.e. the widget host)
49 | * will handle the key.
50 | */
51 | onKeyOther(view:TextView, text:Spannable, event:KeyEvent):boolean ;
52 |
53 | onTakeFocus(widget:TextView, text:Spannable, direction:number):void ;
54 |
55 | onTrackballEvent(widget:TextView, text:Spannable, event:MotionEvent):boolean ;
56 |
57 | onTouchEvent(widget:TextView, text:Spannable, event:MotionEvent):boolean ;
58 |
59 | onGenericMotionEvent(widget:TextView, text:Spannable, event:MotionEvent):boolean ;
60 |
61 | /**
62 | * Returns true if this movement method allows arbitrary selection
63 | * of any text; false if it has no selection (like a movement method
64 | * that only scrolls) or a constrained selection (for example
65 | * limited to links. The "Select All" menu item is disabled
66 | * if arbitrary selection is not allowed.
67 | */
68 | canSelectArbitrarily():boolean ;
69 | }
70 | }
--------------------------------------------------------------------------------
/src/android/text/method/PasswordTransformationMethod.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2006 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | ///
18 |
19 | module android.text.method {
20 | export class PasswordTransformationMethod extends SingleLineTransformationMethod {
21 | private static instance:PasswordTransformationMethod;
22 |
23 | getTransformation(source:String, v:android.view.View):String {
24 | let transform = super.getTransformation(source, v);
25 | if(transform) transform = new Array(transform.length+1).join('•');
26 | return transform;
27 | }
28 |
29 | static getInstance():PasswordTransformationMethod {
30 | if (PasswordTransformationMethod.instance != null) return PasswordTransformationMethod.instance;
31 | PasswordTransformationMethod.instance = new PasswordTransformationMethod();
32 | return PasswordTransformationMethod.instance;
33 | }
34 | }
35 | }
--------------------------------------------------------------------------------
/src/android/text/method/SingleLineTransformationMethod.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2006 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | ///
18 | ///
19 | ///
20 | ///
21 | ///
22 | ///
23 | ///
24 |
25 | module android.text.method {
26 | import Rect = android.graphics.Rect;
27 | import Spannable = android.text.Spannable;
28 | import Spanned = android.text.Spanned;
29 | import TextUtils = android.text.TextUtils;
30 | import View = android.view.View;
31 | import ReplacementTransformationMethod = android.text.method.ReplacementTransformationMethod;
32 | import TransformationMethod = android.text.method.TransformationMethod;
33 | /**
34 | * This transformation method causes any newline characters (\n) to be
35 | * displayed as spaces instead of causing line breaks, and causes
36 | * carriage return characters (\r) to have no appearance.
37 | */
38 | export class SingleLineTransformationMethod extends ReplacementTransformationMethod {
39 |
40 | private static ORIGINAL:string[] = [ '\n', '\r' ];
41 |
42 | private static REPLACEMENT:string[] = [ ' ', '' ];
43 |
44 | /**
45 | * The characters to be replaced are \n and \r.
46 | */
47 | protected getOriginal():string[] {
48 | return SingleLineTransformationMethod.ORIGINAL;
49 | }
50 |
51 | /**
52 | * The character \n is replaced with is space;
53 | * the character \r is replaced with is FEFF (zero width space).
54 | */
55 | protected getReplacement():string[] {
56 | return SingleLineTransformationMethod.REPLACEMENT;
57 | }
58 |
59 | static getInstance():SingleLineTransformationMethod {
60 | if (SingleLineTransformationMethod.sInstance != null)
61 | return SingleLineTransformationMethod.sInstance;
62 | SingleLineTransformationMethod.sInstance = new SingleLineTransformationMethod();
63 | return SingleLineTransformationMethod.sInstance;
64 | }
65 |
66 | private static sInstance:SingleLineTransformationMethod;
67 | }
68 | }
--------------------------------------------------------------------------------
/src/android/text/method/TransformationMethod.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2006 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | ///
18 | ///
19 |
20 | module android.text.method {
21 | import Rect = android.graphics.Rect;
22 | import View = android.view.View;
23 | /**
24 | * TextView uses TransformationMethods to do things like replacing the
25 | * characters of passwords with dots, or keeping the newline characters
26 | * from causing line breaks in single-line text fields.
27 | */
28 | export interface TransformationMethod {
29 |
30 | /**
31 | * Returns a CharSequence that is a transformation of the source text --
32 | * for example, replacing each character with a dot in a password field.
33 | * Beware that the returned text must be exactly the same length as
34 | * the source text, and that if the source text is Editable, the returned
35 | * text must mirror it dynamically instead of doing a one-time copy.
36 | */
37 | getTransformation(source:String, view:View):String ;
38 |
39 | /**
40 | * This method is called when the TextView that uses this
41 | * TransformationMethod gains or loses focus.
42 | */
43 | onFocusChanged(view:View, sourceText:String, focused:boolean, direction:number, previouslyFocusedRect:Rect):void ;
44 | }
45 | export module TransformationMethod{
46 | export function isImpl(obj):boolean {
47 | return obj && obj['getTransformation'] && obj['onFocusChanged'];
48 | }
49 | }
50 | }
--------------------------------------------------------------------------------
/src/android/text/method/TransformationMethod2.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | ///
18 |
19 | module android.text.method {
20 | import TransformationMethod = android.text.method.TransformationMethod;
21 | /**
22 | * TransformationMethod2 extends the TransformationMethod interface
23 | * and adds the ability to relax restrictions of TransformationMethod.
24 | *
25 | * @hide
26 | */
27 | export interface TransformationMethod2 extends TransformationMethod {
28 |
29 | /**
30 | * Relax the contract of TransformationMethod to allow length changes,
31 | * or revert to the length-restricted behavior.
32 | *
33 | * @param allowLengthChanges true to allow the transformation to change the length
34 | * of the input string.
35 | */
36 | setLengthChangesAllowed(allowLengthChanges:boolean):void ;
37 | }
38 | export module TransformationMethod2 {
39 | export function isImpl(obj):boolean {
40 | return TransformationMethod.isImpl(obj) && obj['setLengthChangesAllowed'];
41 | }
42 | }
43 | }
--------------------------------------------------------------------------------
/src/android/text/style/LineBackgroundSpan.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2006 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | ///
18 | ///
19 | ///
20 |
21 | module android.text.style {
22 | import Paint = android.graphics.Paint;
23 | import Canvas = android.graphics.Canvas;
24 | import ParagraphStyle = android.text.style.ParagraphStyle;
25 | export interface LineBackgroundSpan extends ParagraphStyle {
26 |
27 | drawBackground(c:Canvas, p:Paint, left:number, right:number, top:number, baseline:number, bottom:number,
28 | text:String, start:number, end:number, lnum:number):void ;
29 | }
30 |
31 | export module LineBackgroundSpan{
32 | export var type = Symbol();
33 | }
34 | }
--------------------------------------------------------------------------------
/src/android/text/style/LineHeightSpan.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2006 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | ///
18 | ///
19 | ///
20 | ///
21 | ///
22 | ///
23 |
24 | module android.text.style {
25 | import Paint = android.graphics.Paint;
26 | import Canvas = android.graphics.Canvas;
27 | import Layout = android.text.Layout;
28 | import TextPaint = android.text.TextPaint;
29 | import ParagraphStyle = android.text.style.ParagraphStyle;
30 | import WrapTogetherSpan = android.text.style.WrapTogetherSpan;
31 |
32 | export interface LineHeightSpan extends ParagraphStyle, WrapTogetherSpan {
33 | chooseHeight(text:String, start:number, end:number, spanstartv:number, v:number, fm:Paint.FontMetricsInt):void ;
34 | }
35 |
36 | export module LineHeightSpan {
37 | export var type = Symbol();
38 | export interface WithDensity extends LineHeightSpan {
39 | chooseHeight(text:String, start:number, end:number, spanstartv:number, v:number, fm:Paint.FontMetricsInt, paint?:TextPaint):void ;
40 | }
41 | }
42 |
43 | }
--------------------------------------------------------------------------------
/src/android/text/style/MetricAffectingSpan.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2006 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | ///
18 | ///
19 | ///
20 | ///
21 |
22 | module android.text.style {
23 | import Paint = android.graphics.Paint;
24 | import TextPaint = android.text.TextPaint;
25 | import CharacterStyle = android.text.style.CharacterStyle;
26 | import UpdateLayout = android.text.style.UpdateLayout;
27 | /**
28 | * The classes that affect character-level text formatting in a way that
29 | * changes the width or height of characters extend this class.
30 | */
31 | export abstract class MetricAffectingSpan extends CharacterStyle implements UpdateLayout {
32 | static type = Symbol();
33 | mType = MetricAffectingSpan.type;
34 |
35 | abstract updateMeasureState(p:TextPaint):void;
36 |
37 | /**
38 | * Returns "this" for most MetricAffectingSpans, but for
39 | * MetricAffectingSpans that were generated by {@link #wrap},
40 | * returns the underlying MetricAffectingSpan.
41 | */
42 | getUnderlying():MetricAffectingSpan {
43 | return this;
44 | }
45 |
46 |
47 | }
48 |
49 | export module MetricAffectingSpan {
50 | /* package */
51 | export class Passthrough_MetricAffectingSpan extends MetricAffectingSpan {
52 |
53 | private mStyle:MetricAffectingSpan;
54 |
55 | /**
56 | * Creates a new Passthrough of the specfied MetricAffectingSpan.
57 | */
58 | constructor(cs:MetricAffectingSpan) {
59 | super();
60 | this.mStyle = cs;
61 | }
62 |
63 | /**
64 | * Passes updateDrawState through to the underlying MetricAffectingSpan.
65 | */
66 | updateDrawState(tp:TextPaint):void {
67 | this.mStyle.updateDrawState(tp);
68 | }
69 |
70 | /**
71 | * Passes updateMeasureState through to the underlying MetricAffectingSpan.
72 | */
73 | updateMeasureState(tp:TextPaint):void {
74 | this.mStyle.updateMeasureState(tp);
75 | }
76 |
77 | /**
78 | * Returns the MetricAffectingSpan underlying this one, or the one
79 | * underlying it if it too is a Passthrough.
80 | */
81 | getUnderlying():MetricAffectingSpan {
82 | return this.mStyle.getUnderlying();
83 | }
84 | }
85 | }
86 |
87 | }
--------------------------------------------------------------------------------
/src/android/text/style/ParagraphStyle.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2006 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 |
18 | module android.text.style {
19 | /**
20 | * The classes that affect paragraph-level text formatting implement
21 | * this interface.
22 | */
23 | export interface ParagraphStyle {
24 | }
25 | export module ParagraphStyle{
26 | export var type = Symbol();
27 | }
28 | }
--------------------------------------------------------------------------------
/src/android/text/style/ReplacementSpan.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2006 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | ///
18 | ///
19 | ///
20 | ///
21 |
22 | module android.text.style {
23 | import Paint = android.graphics.Paint;
24 | import Canvas = android.graphics.Canvas;
25 | import TextPaint = android.text.TextPaint;
26 | import MetricAffectingSpan = android.text.style.MetricAffectingSpan;
27 |
28 | export abstract class ReplacementSpan extends MetricAffectingSpan {
29 | static type = Symbol();
30 | mType = ReplacementSpan.type;
31 |
32 | abstract getSize(paint:Paint, text:String, start:number, end:number, fm:Paint.FontMetricsInt):number ;
33 |
34 | abstract draw(canvas:Canvas, text:String, start:number, end:number, x:number, top:number, y:number, bottom:number, paint:Paint):void ;
35 |
36 | /**
37 | * This method does nothing, since ReplacementSpans are measured
38 | * explicitly instead of affecting Paint properties.
39 | */
40 | updateMeasureState(p:TextPaint):void {
41 | }
42 |
43 | /**
44 | * This method does nothing, since ReplacementSpans are drawn
45 | * explicitly instead of affecting Paint properties.
46 | */
47 | updateDrawState(ds:TextPaint):void {
48 | }
49 | }
50 | }
--------------------------------------------------------------------------------
/src/android/text/style/TabStopSpan.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2006 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | ///
18 |
19 | module android.text.style {
20 | import ParagraphStyle = android.text.style.ParagraphStyle;
21 | /**
22 | * Represents a single tab stop on a line.
23 | */
24 | export interface TabStopSpan extends ParagraphStyle {
25 |
26 | /**
27 | * Returns the offset of the tab stop from the leading margin of the
28 | * line.
29 | * @return the offset
30 | */
31 | getTabStop():number ;
32 |
33 |
34 | }
35 |
36 | export module TabStopSpan {
37 | export var type = Symbol();
38 | export function isImpl(obj):boolean{
39 | return obj && obj['getTabStop'];
40 | }
41 |
42 | /**
43 | * The default implementation of TabStopSpan.
44 | */
45 | export class Standard implements TabStopSpan {
46 |
47 | /**
48 | * Constructor.
49 | *
50 | * @param where the offset of the tab stop from the leading margin of
51 | * the line
52 | */
53 | constructor(where:number) {
54 | this.mTab = where;
55 | }
56 |
57 | getTabStop():number {
58 | return this.mTab;
59 | }
60 |
61 | private mTab:number = 0;
62 | }
63 | }
64 |
65 | }
--------------------------------------------------------------------------------
/src/android/text/style/UpdateAppearance.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2008 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | ///
18 |
19 | module android.text.style {
20 | import UpdateLayout = android.text.style.UpdateLayout;
21 | /**
22 | * The classes that affect character-level text in a way that modifies their
23 | * appearance when one is added or removed must implement this interface. Note
24 | * that if the class also impacts size or other metrics, it should instead
25 | * implement {@link UpdateLayout}.
26 | */
27 | export interface UpdateAppearance {
28 | }
29 | }
--------------------------------------------------------------------------------
/src/android/text/style/UpdateLayout.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2006 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | ///
18 |
19 | module android.text.style {
20 | import UpdateAppearance = android.text.style.UpdateAppearance;
21 | /**
22 | * The classes that affect character-level text formatting in a way that
23 | * triggers a text layout update when one is added or removed must implement
24 | * this interface. This interface also includes {@link UpdateAppearance}
25 | * since such a change implicitly also impacts the appearance.
26 | */
27 | export interface UpdateLayout extends UpdateAppearance {
28 | }
29 | }
--------------------------------------------------------------------------------
/src/android/text/style/WrapTogetherSpan.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2006 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | ///
18 |
19 | module android.text.style {
20 | import ParagraphStyle = android.text.style.ParagraphStyle;
21 | export interface WrapTogetherSpan extends ParagraphStyle {
22 | }
23 | }
--------------------------------------------------------------------------------
/src/android/util/ArrayMap.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by linfaxin on 15/12/12.
3 | * AndroidUI's impl.
4 | */
5 | module android.util{
6 | export class ArrayMap{
7 | private map = new Map();
8 |
9 | constructor(capacity?:number){
10 | }
11 | clear() {
12 | this.map.clear();
13 | }
14 | erase() {
15 | this.map.clear();
16 | }
17 |
18 |
19 | ensureCapacity(minimumCapacity:number):void {
20 | //do nothing
21 | }
22 |
23 | containsKey(key:K):boolean {
24 | return this.map.has(key);
25 | }
26 |
27 |
28 | indexOfValue(value:V):number {
29 | return [...this.map.values()].indexOf(value);
30 | }
31 |
32 | containsValue(value:V):boolean {
33 | return this.indexOfValue(value) >= 0;
34 | }
35 | get(key:K):V {
36 | return this.map.get(key);
37 | }
38 |
39 | keyAt(index:number):K {
40 | return [...this.map.keys()][index];
41 | }
42 |
43 | valueAt(index:number):V {
44 | return [...this.map.values()][index];
45 | }
46 |
47 | setValueAt(index:number, value:V):V {
48 | let key = this.keyAt(index);
49 | if(key==null) throw Error('index error');
50 | let oldV = this.get(key);
51 | this.map.set(key, value);
52 | return oldV;
53 | }
54 |
55 | isEmpty():boolean {
56 | return this.map.size <= 0;
57 | }
58 |
59 | put(key:K, value:V):V {
60 | let oldV = this.get(key);
61 | this.map.set(key, value);
62 | return oldV;
63 | }
64 |
65 | append(key:K, value:V):void {
66 | this.map.set(key, value);
67 | }
68 |
69 | remove(key:K):V {
70 | let oldV = this.get(key);
71 | this.map.delete(key);
72 | return oldV;
73 | }
74 |
75 | removeAt(index:number):V {
76 | let key = this.keyAt(index);
77 | if(key==null) throw Error('index error');
78 | let oldV = this.get(key);
79 | this.map.delete(key);
80 | return oldV;
81 | }
82 |
83 | keySet():Set {
84 | return new Set(this.map.keys());
85 | }
86 | size() {
87 | return this.map.size;
88 | }
89 |
90 |
91 | }
92 | }
--------------------------------------------------------------------------------
/src/android/util/CopyOnWriteArray.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by linfaxin on 15/10/6.
3 | * AndroidUI's impl.
4 | */
5 | module android.util {
6 |
7 | class Access{
8 | mData:Array;
9 | mSize:number;
10 |
11 | get(index:number):T {
12 | return this.mData[index];
13 | }
14 |
15 | size():number {
16 | return this.mSize;
17 | }
18 |
19 | }
20 | export class CopyOnWriteArray {
21 | private mData:Array = [];
22 | private mDataCopy:Array;
23 | private mAccess = new Access();
24 |
25 | private mStart:boolean;
26 |
27 | private getArray():Array {
28 | if (this.mStart) {
29 | if (this.mDataCopy == null) this.mDataCopy = [...this.mData];
30 | return this.mDataCopy;
31 | }
32 | return this.mData;
33 | }
34 |
35 | start():Array {
36 | if (this.mStart) throw new Error("Iteration already started");
37 | this.mStart = true;
38 | this.mDataCopy = null;
39 | this.mAccess.mData = this.mData;
40 | this.mAccess.mSize = this.mData.length;
41 |
42 | return this.mAccess.mData;
43 | }
44 | end() {
45 | if (!this.mStart) throw new Error("Iteration not started");
46 | this.mStart = false;
47 | if (this.mDataCopy != null) {
48 | this.mData = this.mDataCopy;
49 | this.mAccess.mData = [];
50 | this.mAccess.mSize = 0;
51 | }
52 | this.mDataCopy = null;
53 | }
54 |
55 | //[Symbol.iterator](){
56 | // return this.start()[Symbol.iterator]();
57 | //}
58 |
59 | size():number {
60 | return this.getArray().length;
61 | }
62 | add(...items: T[]) {
63 | this.getArray().push(...items);
64 | }
65 | addAll(array:CopyOnWriteArray) {
66 | this.getArray().push(...array.mData);
67 | }
68 | remove(item:T ) {
69 | this.getArray().splice(this.getArray().indexOf(item), 1);
70 | }
71 |
72 | }
73 | }
--------------------------------------------------------------------------------
/src/android/util/DisplayMetrics.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by linfaxin on 15/10/5.
3 | * AndroidUI's impl.
4 | */
5 | module android.util{
6 | export class DisplayMetrics{
7 | static DENSITY_LOW = 120;
8 | static DENSITY_MEDIUM = 160;
9 | static DENSITY_HIGH = 240;
10 | static DENSITY_XHIGH = 320;
11 | static DENSITY_XXHIGH = 480;
12 | static DENSITY_XXXHIGH = 640;
13 | static DENSITY_DEFAULT = DisplayMetrics.DENSITY_MEDIUM;
14 |
15 | widthPixels:number;
16 | heightPixels:number;
17 | density:number;
18 | densityDpi:number;
19 | scaledDensity:number;
20 | xdpi:number;
21 | ydpi:number;
22 | }
23 | }
--------------------------------------------------------------------------------
/src/android/util/LayoutDirection.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2013 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 |
18 | module android.util {
19 | /**
20 | * A class for defining layout directions. A layout direction can be left-to-right (LTR)
21 | * or right-to-left (RTL). It can also be inherited (from a parent) or deduced from the default
22 | * language script of a locale.
23 | */
24 | export class LayoutDirection {
25 |
26 | /**
27 | * Horizontal layout direction is from Left to Right.
28 | */
29 | static LTR:number = 0;
30 |
31 | /**
32 | * Horizontal layout direction is from Right to Left.
33 | */
34 | static RTL:number = 1;
35 |
36 | /**
37 | * Horizontal layout direction is inherited.
38 | */
39 | static INHERIT:number = 2;
40 |
41 | /**
42 | * Horizontal layout direction is deduced from the default language script for the locale.
43 | */
44 | static LOCALE:number = 3;
45 | }
46 | }
--------------------------------------------------------------------------------
/src/android/util/LongSparseArray.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by linfaxin on 15/10/3.
3 | * AndroidUI's impl
4 | */
5 | ///
6 |
7 | module android.util {
8 | export class LongSparseArray extends SparseArray{
9 | }
10 | }
--------------------------------------------------------------------------------
/src/android/util/SparseArray.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by linfaxin on 15/10/3.
3 | * AndroidUI's impl.
4 | */
5 | ///
6 |
7 | module android.util {
8 |
9 | export class SparseArray extends SparseMap {
10 |
11 | }
12 | }
--------------------------------------------------------------------------------
/src/android/util/SparseBooleanArray.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by linfaxin on 15/10/3.
3 | * AndroidUI's impl.
4 | */
5 | ///
6 |
7 | module android.util {
8 | export class SparseBooleanArray extends SparseArray{
9 | }
10 | }
--------------------------------------------------------------------------------
/src/android/util/SparseMap.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by linfaxin on 15/10/3.
3 | * AndroidUI's impl.
4 | */
5 | module android.util {
6 |
7 | //AndroidUI only.
8 | export class SparseMap {
9 | map:Map;
10 |
11 | constructor(initialCapacity?:number) {
12 | this.map = new Map();
13 | }
14 |
15 | clone():SparseMap {
16 | let clone = new SparseMap();
17 | clone.map = new Map(this.map);
18 | return clone;
19 | }
20 |
21 | get(key:K, valueIfKeyNotFound:T=null) {
22 | let value = this.map.get(key);
23 | if(value===undefined) return valueIfKeyNotFound;
24 | return value;
25 | }
26 |
27 | delete(key:K) {
28 | this.map.delete(key);
29 | }
30 |
31 | remove(key:K) {
32 | this.delete(key);
33 | }
34 |
35 | removeAt(index:number) {
36 | this.removeAtRange(index);
37 | }
38 |
39 | removeAtRange(index:number, size = 1) {
40 | let keys = [...this.map.keys()];
41 | let end = Math.min(this.map.size, index + size);
42 | for (let i = index; i < end; i++) {
43 | this.map.delete(keys[i]);
44 | }
45 | }
46 |
47 | put(key:K, value:T) {
48 | this.map.set(key, value);
49 | }
50 |
51 | size():number {
52 | return this.map.size;
53 | }
54 |
55 | keyAt(index:number):K {
56 | return [...this.map.keys()][index];
57 | }
58 |
59 | valueAt(index:number):T {
60 | return [...this.map.values()][index];
61 | }
62 |
63 | setValueAt(index:number, value:T) {
64 | let key = this.keyAt(index);
65 | this.map.set(key, value);
66 | }
67 |
68 | indexOfKey(key:K):number {
69 | return [...this.map.keys()].indexOf(key);
70 | }
71 |
72 | indexOfValue(value:T):number {
73 | return [...this.map.values()].indexOf(value);
74 | }
75 |
76 | clear() {
77 | this.map.clear();
78 | }
79 |
80 | append(key, value) {
81 | this.put(key, value);
82 | }
83 | }
84 | }
--------------------------------------------------------------------------------
/src/android/view/HapticFeedbackConstants.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2009 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | ///
18 |
19 | module android.view {
20 | import View = android.view.View;
21 | /**
22 | * Constants to be used to perform haptic feedback effects via
23 | * {@link View#performHapticFeedback(int)}
24 | */
25 | export class HapticFeedbackConstants {
26 |
27 | /**
28 | * The user has performed a long press on an object that is resulting
29 | * in an action being performed.
30 | */
31 | static LONG_PRESS:number = 0;
32 |
33 | /**
34 | * The user has pressed on a virtual on-screen key.
35 | */
36 | static VIRTUAL_KEY:number = 1;
37 |
38 | /**
39 | * The user has pressed a soft keyboard key.
40 | */
41 | static KEYBOARD_TAP:number = 3;
42 |
43 | /**
44 | * This is a private constant. Feel free to renumber as desired.
45 | * @hide
46 | */
47 | static SAFE_MODE_DISABLED:number = 10000;
48 |
49 | /**
50 | * This is a private constant. Feel free to renumber as desired.
51 | * @hide
52 | */
53 | static SAFE_MODE_ENABLED:number = 10001;
54 |
55 | /**
56 | * Flag for {@link View#performHapticFeedback(int, int)
57 | * View.performHapticFeedback(int, int)}: Ignore the setting in the
58 | * view for whether to perform haptic feedback, do it always.
59 | */
60 | static FLAG_IGNORE_VIEW_SETTING:number = 0x0001;
61 |
62 | /**
63 | * Flag for {@link View#performHapticFeedback(int, int)
64 | * View.performHapticFeedback(int, int)}: Ignore the global setting
65 | * for whether to perform haptic feedback, do it always.
66 | */
67 | static FLAG_IGNORE_GLOBAL_SETTING:number = 0x0002;
68 | }
69 | }
--------------------------------------------------------------------------------
/src/android/view/SoundEffectConstants.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2008 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | ///
17 |
18 |
19 | module android.view {
20 | /**
21 | * Constants to be used to play sound effects via {@link View#playSoundEffect(int)}
22 | */
23 | export class SoundEffectConstants {
24 |
25 | static CLICK:number = 0;
26 |
27 | static NAVIGATION_LEFT:number = 1;
28 |
29 | static NAVIGATION_UP:number = 2;
30 |
31 | static NAVIGATION_RIGHT:number = 3;
32 |
33 | static NAVIGATION_DOWN:number = 4;
34 |
35 | /**
36 | * Get the sonification constant for the focus directions.
37 | * @param direction One of {@link View#FOCUS_UP}, {@link View#FOCUS_DOWN},
38 | * {@link View#FOCUS_LEFT}, {@link View#FOCUS_RIGHT}, {@link View#FOCUS_FORWARD}
39 | * or {@link View#FOCUS_BACKWARD}
40 |
41 | * @return The appropriate sonification constant.
42 | */
43 | static getContantForFocusDirection(direction:number):number {
44 | switch(direction) {
45 | case View.FOCUS_RIGHT:
46 | return SoundEffectConstants.NAVIGATION_RIGHT;
47 | case View.FOCUS_FORWARD:
48 | case View.FOCUS_DOWN:
49 | return SoundEffectConstants.NAVIGATION_DOWN;
50 | case View.FOCUS_LEFT:
51 | return SoundEffectConstants.NAVIGATION_LEFT;
52 | case View.FOCUS_BACKWARD:
53 | case View.FOCUS_UP:
54 | return SoundEffectConstants.NAVIGATION_UP;
55 | }
56 | throw Error(`new IllegalArgumentException("direction must be one of " + "{FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT, FOCUS_FORWARD, FOCUS_BACKWARD}.")`);
57 | }
58 | }
59 | }
--------------------------------------------------------------------------------
/src/android/view/animation/AccelerateDecelerateInterpolator.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2007 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | ///
18 |
19 | module android.view.animation{
20 | /**
21 | * An interpolator where the rate of change starts and ends slowly but
22 | * accelerates through the middle.
23 | *
24 | */
25 | export class AccelerateDecelerateInterpolator implements Interpolator{
26 | getInterpolation(input:number):number {
27 | return (Math.cos((input + 1) * Math.PI) / 2) + 0.5;
28 | }
29 | }
30 | }
--------------------------------------------------------------------------------
/src/android/view/animation/AccelerateInterpolator.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2006 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | ///
18 |
19 | module android.view.animation {
20 | /**
21 | * An interpolator where the rate of change starts out slowly and
22 | * and then accelerates.
23 | *
24 | */
25 | export class AccelerateInterpolator implements Interpolator {
26 | private mFactor:number;
27 | private mDoubleFactor:number;
28 |
29 | /**
30 | * Constructor
31 | *
32 | * @param factor Degree to which the animation should be eased. Seting
33 | * factor to 1.0f produces a y=x^2 parabola. Increasing factor above
34 | * 1.0f exaggerates the ease-in effect (i.e., it starts even
35 | * slower and ends evens faster)
36 | */
37 | constructor(factor = 1) {
38 | this.mFactor = factor;
39 | this.mDoubleFactor = factor * 2;
40 | }
41 |
42 | getInterpolation(input:number):number {
43 |
44 | if (this.mFactor == 1.0) {
45 | return input * input;
46 | } else {
47 | return Math.pow(input, this.mDoubleFactor);
48 | }
49 | }
50 | }
51 | }
--------------------------------------------------------------------------------
/src/android/view/animation/AlphaAnimation.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2006 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | ///
18 | ///
19 |
20 | module android.view.animation {
21 | import Animation = android.view.animation.Animation;
22 | import Transformation = android.view.animation.Transformation;
23 | /**
24 | * An animation that controls the alpha level of an object.
25 | * Useful for fading things in and out. This animation ends up
26 | * changing the alpha property of a {@link Transformation}
27 | *
28 | */
29 | export class AlphaAnimation extends Animation {
30 |
31 | private mFromAlpha:number = 0;
32 |
33 | private mToAlpha:number = 0;
34 |
35 | ///**
36 | // * Constructor used when an AlphaAnimation is loaded from a resource.
37 | // *
38 | // * @param context Application context to use
39 | // * @param attrs Attribute set from which to read values
40 | // */
41 | //constructor( context:Context, attrs:AttributeSet) {
42 | // super(context, attrs);
43 | // let a:TypedArray = context.obtainStyledAttributes(attrs, com.android.internal.R.styleable.AlphaAnimation);
44 | // this.mFromAlpha = a.getFloat(com.android.internal.R.styleable.AlphaAnimation_fromAlpha, 1.0);
45 | // this.mToAlpha = a.getFloat(com.android.internal.R.styleable.AlphaAnimation_toAlpha, 1.0);
46 | // a.recycle();
47 | //}
48 |
49 | /**
50 | * Constructor to use when building an AlphaAnimation from code
51 | *
52 | * @param fromAlpha Starting alpha value for the animation, where 1.0 means
53 | * fully opaque and 0.0 means fully transparent.
54 | * @param toAlpha Ending alpha value for the animation.
55 | */
56 | constructor(fromAlpha:number, toAlpha:number) {
57 | super();
58 | this.mFromAlpha = fromAlpha;
59 | this.mToAlpha = toAlpha;
60 | }
61 |
62 | /**
63 | * Changes the alpha property of the supplied {@link Transformation}
64 | */
65 | protected applyTransformation(interpolatedTime:number, t:Transformation):void {
66 | const alpha:number = this.mFromAlpha;
67 | t.setAlpha(alpha + ((this.mToAlpha - alpha) * interpolatedTime));
68 | }
69 |
70 | willChangeTransformationMatrix():boolean {
71 | return false;
72 | }
73 |
74 | willChangeBounds():boolean {
75 | return false;
76 | }
77 |
78 | /**
79 | * @hide
80 | */
81 | hasAlpha():boolean {
82 | return true;
83 | }
84 | }
85 | }
--------------------------------------------------------------------------------
/src/android/view/animation/AnimationUtils.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2007 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | ///
18 |
19 | module android.view.animation {
20 | import SystemClock = android.os.SystemClock;
21 | /**
22 | * Defines common utilities for working with animations.
23 | *
24 | */
25 | export class AnimationUtils {
26 | /**
27 | * Returns the current animation time in milliseconds. This time should be used when invoking
28 | * {@link Animation#setStartTime(long)}. Refer to {@link android.os.SystemClock} for more
29 | * information about the different available clocks. The clock used by this method is
30 | * not the "wall" clock (it is not {@link System#currentTimeMillis}).
31 | *
32 | * @return the current animation time in milliseconds
33 | *
34 | * @see android.os.SystemClock
35 | */
36 | static currentAnimationTimeMillis():number {
37 | return SystemClock.uptimeMillis();
38 | }
39 |
40 | /**
41 | * Loads an {@link Animation} object from a resource
42 | *
43 | * @param context Application context used to access resources
44 | * @param id The resource id of the animation to load
45 | * @return The animation object reference by the specified id
46 | * @throws NotFoundException when the animation cannot be loaded
47 | */
48 | public static loadAnimation(context:android.content.Context, id:string):Animation {
49 | return context.getResources().getAnimation(id);
50 | }
51 | }
52 | }
--------------------------------------------------------------------------------
/src/android/view/animation/AnticipateInterpolator.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2009 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | ///
18 |
19 | module android.view.animation{
20 | /**
21 | * An interpolator where the change starts backward then flings forward.
22 | */
23 | export class AnticipateInterpolator implements Interpolator{
24 | private mTension:number;
25 | /**
26 | * @param tension Amount of anticipation. When tension equals 0.0f, there is
27 | * no anticipation and the interpolator becomes a simple
28 | * acceleration interpolator.
29 | */
30 | constructor(tension=2) {
31 | this.mTension = tension;
32 | }
33 |
34 | getInterpolation(t:number):number {
35 | // a(t) = t * t * ((tension + 1) * t - tension)
36 | return t * t * ((this.mTension + 1) * t - this.mTension);
37 | }
38 | }
39 | }
--------------------------------------------------------------------------------
/src/android/view/animation/AnticipateOvershootInterpolator.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2009 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | ///
18 |
19 | module android.view.animation{
20 | /**
21 | * An interpolator where the change starts backward then flings forward and overshoots
22 | * the target value and finally goes back to the final value.
23 | */
24 | export class AnticipateOvershootInterpolator implements Interpolator{
25 | private mTension:number;
26 | /**
27 | * @param tension Amount of anticipation/overshoot. When tension equals 0.0f,
28 | * there is no anticipation/overshoot and the interpolator becomes
29 | * a simple acceleration/deceleration interpolator.
30 | * @param extraTension Amount by which to multiply the tension. For instance,
31 | * to get the same overshoot as an OvershootInterpolator with
32 | * a tension of 2.0f, you would use an extraTension of 1.5f.
33 | */
34 | constructor(tension=2, extraTension=1.5) {
35 | this.mTension = tension * extraTension;
36 | }
37 |
38 | private static a(t:number, s:number):number{
39 | return t * t * ((s + 1) * t - s);
40 | }
41 | private static o(t:number, s:number):number{
42 | return t * t * ((s + 1) * t + s);
43 | }
44 |
45 |
46 | getInterpolation(t:number):number {
47 | // a(t, s) = t * t * ((s + 1) * t - s)
48 | // o(t, s) = t * t * ((s + 1) * t + s)
49 | // f(t) = 0.5 * a(t * 2, tension * extraTension), when t < 0.5
50 | // f(t) = 0.5 * (o(t * 2 - 2, tension * extraTension) + 2), when t <= 1.0
51 | if (t < 0.5) return 0.5 * AnticipateOvershootInterpolator.a(t * 2.0, this.mTension);
52 | else return 0.5 * (AnticipateOvershootInterpolator.o(t * 2.0 - 2.0, this.mTension) + 2.0);
53 | }
54 | }
55 | }
--------------------------------------------------------------------------------
/src/android/view/animation/BounceInterpolator.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2009 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | ///
17 |
18 | module android.view.animation {
19 | /**
20 | * An interpolator where the change bounces at the end.
21 | */
22 | export class BounceInterpolator implements Interpolator {
23 | private static bounce(t:number):number {
24 | return t * t * 8.0;
25 | }
26 |
27 | getInterpolation(t:number):number {
28 | // _b(t) = t * t * 8
29 | // bs(t) = _b(t) for t < 0.3535
30 | // bs(t) = _b(t - 0.54719) + 0.7 for t < 0.7408
31 | // bs(t) = _b(t - 0.8526) + 0.9 for t < 0.9644
32 | // bs(t) = _b(t - 1.0435) + 0.95 for t <= 1.0
33 | // b(t) = bs(t * 1.1226)
34 | t *= 1.1226;
35 | if (t < 0.3535) return BounceInterpolator.bounce(t);
36 | else if (t < 0.7408) return BounceInterpolator.bounce(t - 0.54719) + 0.7;
37 | else if (t < 0.9644) return BounceInterpolator.bounce(t - 0.8526) + 0.9;
38 | else return BounceInterpolator.bounce(t - 1.0435) + 0.95;
39 | }
40 |
41 | }
42 | }
--------------------------------------------------------------------------------
/src/android/view/animation/CycleInterpolator.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2007 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | ///
17 |
18 | module android.view.animation{
19 | /**
20 | * Repeats the animation for a specified number of cycles. The
21 | * rate of change follows a sinusoidal pattern.
22 | *
23 | */
24 | export class CycleInterpolator implements Interpolator{
25 | private mCycles:number;
26 | constructor(mCycles:number) {
27 | this.mCycles = mCycles;
28 | }
29 |
30 | getInterpolation(input:number):number {
31 | return (Math.sin(2 * this.mCycles * Math.PI * input));
32 | }
33 | }
34 | }
--------------------------------------------------------------------------------
/src/android/view/animation/DecelerateInterpolator.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2007 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | ///
18 |
19 | module android.view.animation {
20 | /**
21 | * An interpolator where the rate of change starts out quickly and
22 | * and then decelerates.
23 | *
24 | */
25 | export class DecelerateInterpolator implements Interpolator {
26 | private mFactor:number;
27 |
28 | /**
29 | * Constructor
30 | *
31 | * @param factor Degree to which the animation should be eased. Setting factor to 1.0f produces
32 | * an upside-down y=x^2 parabola. Increasing factor above 1.0f makes exaggerates the
33 | * ease-out effect (i.e., it starts even faster and ends evens slower)
34 | */
35 | constructor(factor = 1) {
36 | this.mFactor = factor;
37 | }
38 |
39 | getInterpolation(input:number):number {
40 | let result;
41 | if (this.mFactor == 1.0) {
42 | result = (1.0 - (1.0 - input) * (1.0 - input));
43 | } else {
44 | result = (1.0 - Math.pow((1.0 - input), 2 * this.mFactor));
45 | }
46 | return result;
47 | }
48 | }
49 | }
--------------------------------------------------------------------------------
/src/android/view/animation/Interpolator.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2006 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | module android.view.animation{
18 | /**
19 | * An interpolator defines the rate of change of an animation. This allows
20 | * the basic animation effects (alpha, scale, translate, rotate) to be
21 | * accelerated, decelerated, repeated, etc.
22 | */
23 | export interface Interpolator{
24 | /**
25 | * Maps a value representing the elapsed fraction of an animation to a value that represents
26 | * the interpolated fraction. This interpolated value is then multiplied by the change in
27 | * value of an animation to derive the animated value at the current elapsed animation time.
28 | *
29 | * @param input A value between 0 and 1.0 indicating our current point
30 | * in the animation where 0 represents the start and 1.0 represents
31 | * the end
32 | * @return The interpolation value. This value can be more than 1.0 for
33 | * interpolators which overshoot their targets, or less than 0 for
34 | * interpolators that undershoot their targets.
35 | */
36 | getInterpolation(input:number):number;
37 | }
38 | }
--------------------------------------------------------------------------------
/src/android/view/animation/LinearInterpolator.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2006 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | ///
18 |
19 | module android.view.animation{
20 | /**
21 | * An interpolator where the rate of change is constant
22 | *
23 | */
24 | export class LinearInterpolator implements Interpolator{
25 | getInterpolation(input:number):number {
26 | return input;
27 | }
28 | }
29 | }
--------------------------------------------------------------------------------
/src/android/view/animation/OvershootInterpolator.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2009 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | ///
18 |
19 | module android.view.animation {
20 | /**
21 | * An interpolator where the change flings forward and overshoots the last value
22 | * then comes back.
23 | */
24 | export class OvershootInterpolator implements Interpolator {
25 | private mTension:number;
26 |
27 | /**
28 | * @param tension Amount of overshoot. When tension equals 0.0f, there is
29 | * no overshoot and the interpolator becomes a simple
30 | * deceleration interpolator.
31 | */
32 | constructor(tension = 2) {
33 | this.mTension = tension;
34 | }
35 |
36 | getInterpolation(t:number):number {
37 | // _o(t) = t * t * ((tension + 1) * t + tension)
38 | // o(t) = _o(t - 1) + 1
39 | t -= 1.0;
40 | return t * t * ((this.mTension + 1) * t + this.mTension) + 1.0;
41 | }
42 | }
43 | }
--------------------------------------------------------------------------------
/src/android/webkit/WebViewClient.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
3 | module android.webkit {
4 | export class WebViewClient {
5 | onPageFinished(view:WebView, url:string):void {
6 |
7 | }
8 |
9 | /**
10 | * Notify the host application of a change in the document title.
11 | * @param view The WebView that initiated the callback.
12 | * @param title A String containing the new title of the document.
13 | */
14 | onReceivedTitle(view:WebView, title:string):void {
15 | }
16 | }
17 | }
--------------------------------------------------------------------------------
/src/android/widget/CheckBox.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2006 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | ///
18 | ///
19 | ///
20 | ///
21 |
22 | module android.widget {
23 | import Button = android.widget.Button;
24 | import CompoundButton = android.widget.CompoundButton;
25 | import TextView = android.widget.TextView;
26 | /**
27 | *
28 | * A checkbox is a specific type of two-states button that can be either
29 | * checked or unchecked. A example usage of a checkbox inside your activity
30 | * would be the following:
31 | *
58 | */
59 | export class CheckBox extends CompoundButton {
60 |
61 | constructor(context:android.content.Context, bindElement?:HTMLElement, defStyle = android.R.attr.checkboxStyle) {
62 | super(context, bindElement, defStyle);
63 | }
64 | }
65 | }
--------------------------------------------------------------------------------
/src/android/widget/Checkable.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2007 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 |
18 | module android.widget {
19 | /**
20 | * Defines an extension for views that make them checkable.
21 | *
22 | */
23 | export interface Checkable {
24 |
25 | /**
26 | * Change the checked state of the view
27 | *
28 | * @param checked The new checked state
29 | */
30 | setChecked(checked:boolean):void ;
31 |
32 | /**
33 | * @return The current checked state of the view
34 | */
35 | isChecked():boolean ;
36 |
37 | /**
38 | * Change the checked state of the view to the inverse of its current state
39 | *
40 | */
41 | toggle():void ;
42 | }
43 | }
--------------------------------------------------------------------------------
/src/android/widget/ImageButton.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2007 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | ///
18 | ///
19 | ///
20 |
21 | module android.widget{
22 |
23 | /**
24 | *
25 | * Displays a button with an image (instead of text) that can be pressed
26 | * or clicked by the user. By default, an ImageButton looks like a regular
27 | * {@link android.widget.Button}, with the standard button background
28 | * that changes color during different button states. The image on the surface
29 | * of the button is defined either by the {@code android:src} attribute in the
30 | * {@code } XML element or by the
31 | * {@link #setImageResource(int)} method.
32 | *
33 | *
To remove the standard button background image, define your own
34 | * background image or set the background color to be transparent.
35 | *
To indicate the different button states (focused, selected, etc.), you can
36 | * define a different image for each state. E.g., a blue image by default, an
37 | * orange one for when focused, and a yellow one for when pressed. An easy way to
38 | * do this is with an XML drawable "selector." For example:
Save the XML file in your project {@code res/drawable/} folder and then
50 | * reference it as a drawable for the source of your ImageButton (in the
51 | * {@code android:src} attribute). Android will automatically change the image
52 | * based on the state of the button and the corresponding images
53 | * defined in the XML.
54 | *
55 | *
The order of the {@code } elements is important because they are
56 | * evaluated in order. This is why the "normal" button image comes last, because
57 | * it will only be applied after {@code android:state_pressed} and {@code
58 | * android:state_focused} have both evaluated false.
68 | */
69 | export class ImageButton extends ImageView {
70 | constructor(context:android.content.Context, bindElement?:HTMLElement, defStyle = android.R.attr.imageButtonStyle){
71 | super(context, bindElement, defStyle);
72 | }
73 | }
74 | }
--------------------------------------------------------------------------------
/src/android/widget/ListAdapter.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2006 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | ///
18 |
19 | module android.widget {
20 | import Adapter = android.widget.Adapter;
21 | /**
22 | * Extended {@link Adapter} that is the bridge between a {@link ListView}
23 | * and the data that backs the list. Frequently that data comes from a Cursor,
24 | * but that is not
25 | * required. The ListView can display any data provided that it is wrapped in a
26 | * ListAdapter.
27 | */
28 | export interface ListAdapter extends Adapter {
29 |
30 | /**
31 | * Indicates whether all the items in this adapter are enabled. If the
32 | * value returned by this method changes over time, there is no guarantee
33 | * it will take effect. If true, it means all items are selectable and
34 | * clickable (there is no separator.)
35 | *
36 | * @return True if all items are enabled, false otherwise.
37 | *
38 | * @see #isEnabled(int)
39 | */
40 | areAllItemsEnabled():boolean ;
41 |
42 | /**
43 | * Returns true if the item at the specified position is not a separator.
44 | * (A separator is a non-selectable, non-clickable item).
45 | *
46 | * The result is unspecified if position is invalid. An {@link ArrayIndexOutOfBoundsException}
47 | * should be thrown in that case for fast failure.
48 | *
49 | * @param position Index of the item
50 | *
51 | * @return True if the item is not a separator
52 | *
53 | * @see #areAllItemsEnabled()
54 | */
55 | isEnabled(position:number):boolean ;
56 | }
57 | export module ListAdapter{
58 | export function isImpl(obj){
59 | return obj && obj['areAllItemsEnabled'] && obj['isEnabled'];
60 | }
61 | }
62 | }
--------------------------------------------------------------------------------
/src/android/widget/RadioButton.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2006 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | ///
18 | ///
19 | ///
20 | ///
21 |
22 | module android.widget {
23 | import Button = android.widget.Button;
24 | import CheckBox = android.widget.CheckBox;
25 | import CompoundButton = android.widget.CompoundButton;
26 | import TextView = android.widget.TextView;
27 | /**
28 | *
29 | * A radio button is a two-states button that can be either checked or
30 | * unchecked. When the radio button is unchecked, the user can press or click it
31 | * to check it. However, contrary to a {@link android.widget.CheckBox}, a radio
32 | * button cannot be unchecked by the user once checked.
33 | *
34 | *
35 | *
36 | * Radio buttons are normally used together in a
37 | * {@link android.widget.RadioGroup}. When several radio buttons live inside
38 | * a radio group, checking one radio button unchecks all the others.
61 | * If the radio button is already checked, this method will not toggle the radio button.
62 | */
63 | toggle():void {
64 | // checked (as opposed to check boxes widgets)
65 | if (!this.isChecked()) {
66 | super.toggle();
67 | }
68 | }
69 | }
70 | }
--------------------------------------------------------------------------------
/src/android/widget/Scroller.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by linfaxin on 16/1/15.
3 | * AndroidUI's impl
4 | */
5 | ///
6 |
7 | module android.widget {
8 | export class Scroller extends OverScroller{
9 | }
10 | }
--------------------------------------------------------------------------------
/src/android/widget/SpinnerAdapter.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2007 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | ///
18 | ///
19 | ///
20 |
21 | module android.widget {
22 | import View = android.view.View;
23 | import ViewGroup = android.view.ViewGroup;
24 | import Adapter = android.widget.Adapter;
25 | /**
26 | * Extended {@link Adapter} that is the bridge between a
27 | * {@link android.widget.Spinner} and its data. A spinner adapter allows to
28 | * define two different views: one that shows the data in the spinner itself and
29 | * one that shows the data in the drop down list when the spinner is pressed.