mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-17 21:01:34 +08:00
Merge pull request #1052 from NativeScript/feature/andrid-R-constants
Usages of android.R replaced with constatns
This commit is contained in:
@ -9,6 +9,8 @@ import application = require("application");
|
|||||||
import dts = require("ui/action-bar");
|
import dts = require("ui/action-bar");
|
||||||
import view = require("ui/core/view");
|
import view = require("ui/core/view");
|
||||||
|
|
||||||
|
const R_ID_HOME = 0x0102002c;
|
||||||
|
|
||||||
var ACTION_ITEM_ID_OFFSET = 1000;
|
var ACTION_ITEM_ID_OFFSET = 1000;
|
||||||
|
|
||||||
global.moduleMerge(common, exports);
|
global.moduleMerge(common, exports);
|
||||||
@ -126,7 +128,7 @@ export class ActionBar extends common.ActionBar {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.navigationButton && itemId === (<any>android).R.id.home) {
|
if (this.navigationButton && itemId === R_ID_HOME) {
|
||||||
this.navigationButton._raiseTap();
|
this.navigationButton._raiseTap();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
import dependencyObservable = require("ui/core/dependency-observable");
|
import dependencyObservable = require("ui/core/dependency-observable");
|
||||||
import proxy = require("ui/core/proxy");
|
import proxy = require("ui/core/proxy");
|
||||||
|
|
||||||
|
const R_ATTR_PROGRESS_BAR_STYLE_HORIZONTAL = 0x01010078;
|
||||||
|
|
||||||
function onValuePropertyChanged(data: dependencyObservable.PropertyChangeData) {
|
function onValuePropertyChanged(data: dependencyObservable.PropertyChangeData) {
|
||||||
var progress = <Progress>data.object;
|
var progress = <Progress>data.object;
|
||||||
if (!progress.android) {
|
if (!progress.android) {
|
||||||
@ -30,7 +32,7 @@ export class Progress extends common.Progress {
|
|||||||
private _android: android.widget.ProgressBar;
|
private _android: android.widget.ProgressBar;
|
||||||
|
|
||||||
public _createUI() {
|
public _createUI() {
|
||||||
this._android = new android.widget.ProgressBar(this._context, null, (<any>android).R.attr.progressBarStyleHorizontal);
|
this._android = new android.widget.ProgressBar(this._context, null, R_ATTR_PROGRESS_BAR_STYLE_HORIZONTAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
get android(): android.widget.ProgressBar {
|
get android(): android.widget.ProgressBar {
|
||||||
|
@ -5,6 +5,10 @@ import proxy = require("ui/core/proxy");
|
|||||||
import types = require("utils/types");
|
import types = require("utils/types");
|
||||||
import observable = require("data/observable");
|
import observable = require("data/observable");
|
||||||
|
|
||||||
|
const R_ID_TABS = 0x01020013;
|
||||||
|
const R_ID_TABCONTENT = 0x01020011;
|
||||||
|
const R_ATTR_STATE_SELECTED = 0x010100a1;
|
||||||
|
|
||||||
global.moduleMerge(common, exports);
|
global.moduleMerge(common, exports);
|
||||||
|
|
||||||
function onSelectedIndexPropertyChanged(data: dependencyObservable.PropertyChangeData) {
|
function onSelectedIndexPropertyChanged(data: dependencyObservable.PropertyChangeData) {
|
||||||
@ -79,8 +83,7 @@ function onItemsPropertyChanged(data: dependencyObservable.PropertyChangeData) {
|
|||||||
var stateDrawable = new android.graphics.drawable.StateListDrawable();
|
var stateDrawable = new android.graphics.drawable.StateListDrawable();
|
||||||
|
|
||||||
var arr = java.lang.reflect.Array.newInstance(java.lang.Integer.class.getField("TYPE").get(null), 1);
|
var arr = java.lang.reflect.Array.newInstance(java.lang.Integer.class.getField("TYPE").get(null), 1);
|
||||||
arr[0] = (<any>android).R.attr.state_selected;
|
arr[0] = R_ATTR_STATE_SELECTED;
|
||||||
|
|
||||||
var colorDrawable = new SegmentedBarColorDrawable(view.selectedBackgroundColor.android)
|
var colorDrawable = new SegmentedBarColorDrawable(view.selectedBackgroundColor.android)
|
||||||
stateDrawable.addState(arr, colorDrawable);
|
stateDrawable.addState(arr, colorDrawable);
|
||||||
stateDrawable.setBounds(0, 15, vg.getRight(), vg.getBottom());
|
stateDrawable.setBounds(0, 15, vg.getRight(), vg.getBottom());
|
||||||
@ -154,11 +157,11 @@ export class SegmentedBar extends common.SegmentedBar {
|
|||||||
tabHostLayout.setOrientation(android.widget.LinearLayout.VERTICAL);
|
tabHostLayout.setOrientation(android.widget.LinearLayout.VERTICAL);
|
||||||
|
|
||||||
var tabWidget = new android.widget.TabWidget(this._context);
|
var tabWidget = new android.widget.TabWidget(this._context);
|
||||||
tabWidget.setId((<any>android).R.id.tabs);
|
tabWidget.setId(R_ID_TABS);
|
||||||
tabHostLayout.addView(tabWidget);
|
tabHostLayout.addView(tabWidget);
|
||||||
|
|
||||||
var frame = new android.widget.FrameLayout(this._context);
|
var frame = new android.widget.FrameLayout(this._context);
|
||||||
frame.setId((<any>android).R.id.tabcontent);
|
frame.setId(R_ID_TABCONTENT);
|
||||||
frame.setVisibility(android.view.View.GONE);
|
frame.setVisibility(android.view.View.GONE);
|
||||||
tabHostLayout.addView(frame);
|
tabHostLayout.addView(frame);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user