mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
feat(android): background color/image handling improvements (#10451)
This commit is contained in:
committed by
GitHub
parent
bb83addb5c
commit
4abcb216da
@@ -61,7 +61,7 @@ export var testFileFromPath = function () {
|
||||
function (error) {
|
||||
TKUnit.assert(false, 'Failed to read/write text');
|
||||
//console.dir(error);
|
||||
}
|
||||
},
|
||||
);
|
||||
// << (hide)
|
||||
},
|
||||
@@ -71,7 +71,7 @@ export var testFileFromPath = function () {
|
||||
TKUnit.assert(false, 'Failed to read/write text');
|
||||
//console.dir(error);
|
||||
// << (hide)
|
||||
}
|
||||
},
|
||||
);
|
||||
// << file-system-create
|
||||
};
|
||||
@@ -106,7 +106,7 @@ export var testFileWrite = function () {
|
||||
function (error) {
|
||||
TKUnit.assert(false, 'Failed to read/write text');
|
||||
//console.dir(error);
|
||||
}
|
||||
},
|
||||
);
|
||||
// << (hide)
|
||||
},
|
||||
@@ -116,7 +116,7 @@ export var testFileWrite = function () {
|
||||
TKUnit.assert(false, 'Failed to read/write text');
|
||||
//console.dir(error);
|
||||
// << (hide)
|
||||
}
|
||||
},
|
||||
);
|
||||
// << file-system-write-string
|
||||
};
|
||||
@@ -172,7 +172,7 @@ export var testFileRead = function () {
|
||||
TKUnit.assert(false, 'Failed to read/write text');
|
||||
//console.dir(error);
|
||||
// << (hide)
|
||||
}
|
||||
},
|
||||
);
|
||||
},
|
||||
function (error) {
|
||||
@@ -181,7 +181,7 @@ export var testFileRead = function () {
|
||||
TKUnit.assert(false, 'Failed to read/write text');
|
||||
//console.dir(error);
|
||||
// << (hide)
|
||||
}
|
||||
},
|
||||
);
|
||||
// << file-system-example-text
|
||||
};
|
||||
@@ -245,13 +245,13 @@ export var testFileReadWriteBinaryAsync = function () {
|
||||
},
|
||||
function (error) {
|
||||
TKUnit.assert(false, 'Failed to read destination binary async');
|
||||
}
|
||||
},
|
||||
);
|
||||
},
|
||||
function (error) {
|
||||
// Failed to write the file.
|
||||
TKUnit.assert(false, 'Failed to write binary async');
|
||||
}
|
||||
},
|
||||
);
|
||||
// << (hide)
|
||||
},
|
||||
@@ -260,7 +260,7 @@ export var testFileReadWriteBinaryAsync = function () {
|
||||
// >> (hide)
|
||||
TKUnit.assert(false, 'Failed to read binary async');
|
||||
// << (hide)
|
||||
}
|
||||
},
|
||||
);
|
||||
// << file-system-read-binary-async
|
||||
};
|
||||
@@ -358,7 +358,7 @@ export var testGetEntities = function () {
|
||||
function (error) {
|
||||
// Failed to obtain folder's contents.
|
||||
// globalConsole.error(error.message);
|
||||
}
|
||||
},
|
||||
);
|
||||
// << file-system-folders-content
|
||||
};
|
||||
@@ -493,7 +493,7 @@ export var testFileRename = function () {
|
||||
// >> (hide)
|
||||
TKUnit.assert(false, 'Failed to rename file');
|
||||
// << (hide)
|
||||
}
|
||||
},
|
||||
);
|
||||
// << file-system-renaming
|
||||
};
|
||||
@@ -517,7 +517,7 @@ export var testFolderRename = function () {
|
||||
// >> (hide)
|
||||
TKUnit.assert(false, 'Folder.rename API not working.');
|
||||
// << (hide)
|
||||
}
|
||||
},
|
||||
);
|
||||
// << file-system-renaming-folder
|
||||
};
|
||||
@@ -538,7 +538,7 @@ export var testFileRemove = function () {
|
||||
// >> (hide)
|
||||
TKUnit.assert(false, 'File.remove API not working.');
|
||||
// << (hide)
|
||||
}
|
||||
},
|
||||
);
|
||||
// << file-system-remove-file
|
||||
};
|
||||
@@ -560,7 +560,7 @@ export var testFolderRemove = function () {
|
||||
// >> (hide)
|
||||
TKUnit.assert(false, 'File.remove API not working.');
|
||||
// << (hide)
|
||||
}
|
||||
},
|
||||
);
|
||||
// << file-system-remove-folder
|
||||
};
|
||||
@@ -587,7 +587,7 @@ export var testFolderClear = function () {
|
||||
// >> (hide)
|
||||
TKUnit.assert(false, error.message);
|
||||
// << (hide)
|
||||
}
|
||||
},
|
||||
);
|
||||
// >> (hide)
|
||||
folder.getEntities().then(function (entities) {
|
||||
@@ -609,7 +609,7 @@ export var testKnownFolderRename = function () {
|
||||
},
|
||||
function (error) {
|
||||
TKUnit.assert(true);
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
};
|
||||
@@ -625,7 +625,7 @@ export function testKnownFolderRemove(done) {
|
||||
},
|
||||
function (error) {
|
||||
done(null);
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ function binding_busy_to_image() {
|
||||
sourceProperty: 'isLoading',
|
||||
targetProperty: 'busy',
|
||||
},
|
||||
image
|
||||
image,
|
||||
);
|
||||
// << activity-indicator-loading
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Color, Button, Utils, CoreTypes } from '@nativescript/core';
|
||||
import { AndroidHelper } from '@nativescript/core/ui/core/view';
|
||||
|
||||
export function getNativeText(button: Button): string {
|
||||
return button.android.getText();
|
||||
@@ -19,15 +20,7 @@ export function getNativeColor(button: Button): Color {
|
||||
}
|
||||
|
||||
export function getNativeBackgroundColor(button: Button): Color {
|
||||
let bg = <any>button.android.getBackground();
|
||||
if (bg instanceof org.nativescript.widgets.BorderDrawable) {
|
||||
return new Color(bg.getBackgroundColor());
|
||||
} else if (bg instanceof android.graphics.drawable.ColorDrawable) {
|
||||
console.log(bg);
|
||||
return new Color(bg.getColor());
|
||||
} else {
|
||||
return new Color(bg.backgroundColor);
|
||||
}
|
||||
return AndroidHelper.getDrawableColor(button.android.getBackground());
|
||||
}
|
||||
|
||||
export function getNativeTextAlignment(button: Button): string {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as labelModule from '@nativescript/core/ui/label';
|
||||
import { CoreTypes } from '@nativescript/core';
|
||||
import * as colorModule from '@nativescript/core/color';
|
||||
import { Color, CoreTypes } from '@nativescript/core';
|
||||
import { AndroidHelper } from '@nativescript/core/ui/core/view';
|
||||
|
||||
export function getNativeTextAlignment(label: labelModule.Label): string {
|
||||
let gravity = label.android.getGravity();
|
||||
@@ -20,13 +20,6 @@ export function getNativeTextAlignment(label: labelModule.Label): string {
|
||||
return 'unexpected value';
|
||||
}
|
||||
|
||||
export function getNativeBackgroundColor(label: labelModule.Label): colorModule.Color {
|
||||
let bg = <any>label.android.getBackground();
|
||||
if (bg instanceof org.nativescript.widgets.BorderDrawable) {
|
||||
return new colorModule.Color(bg.getBackgroundColor());
|
||||
} else if (bg instanceof android.graphics.drawable.ColorDrawable) {
|
||||
return new colorModule.Color(bg.getColor());
|
||||
} else {
|
||||
return new colorModule.Color(bg.backgroundColor);
|
||||
}
|
||||
export function getNativeBackgroundColor(label: labelModule.Label): Color {
|
||||
return AndroidHelper.getDrawableColor(label.android.getBackground());
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ export class SafeAreaTests extends testModule.UITest<any> {
|
||||
waitUntilTestElementLayoutIsValid(ui.root);
|
||||
test(ui);
|
||||
},
|
||||
pageOptions
|
||||
pageOptions,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ export class SafeAreaTests extends testModule.UITest<any> {
|
||||
({ root }) => {
|
||||
this.layout_in_full_screen_test(root, pageOptions);
|
||||
},
|
||||
pageOptions
|
||||
pageOptions,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -151,7 +151,7 @@ export class SafeAreaTests extends testModule.UITest<any> {
|
||||
({ root }) => {
|
||||
this.layout_insets_top_action_bar_test(root);
|
||||
},
|
||||
{ actionBar: true }
|
||||
{ actionBar: true },
|
||||
);
|
||||
}
|
||||
|
||||
@@ -166,7 +166,7 @@ export class SafeAreaTests extends testModule.UITest<any> {
|
||||
({ root }) => {
|
||||
this.layout_insets_top_action_bar_hidden_test(root);
|
||||
},
|
||||
{ actionBarHidden: true }
|
||||
{ actionBarHidden: true },
|
||||
);
|
||||
}
|
||||
|
||||
@@ -181,7 +181,7 @@ export class SafeAreaTests extends testModule.UITest<any> {
|
||||
({ root }) => {
|
||||
this.layout_insets_top_action_bar_test(root);
|
||||
},
|
||||
{ actionBarFlat: true }
|
||||
{ actionBarFlat: true },
|
||||
);
|
||||
}
|
||||
|
||||
@@ -196,7 +196,7 @@ export class SafeAreaTests extends testModule.UITest<any> {
|
||||
({ root }) => {
|
||||
this.layout_insets_top_action_bar_hidden_test(root);
|
||||
},
|
||||
{ tabBar: true }
|
||||
{ tabBar: true },
|
||||
);
|
||||
}
|
||||
|
||||
@@ -211,7 +211,7 @@ export class SafeAreaTests extends testModule.UITest<any> {
|
||||
({ root }) => {
|
||||
this.layout_insets_top_action_bar_test(root);
|
||||
},
|
||||
{ actionBar: true, tabBar: true }
|
||||
{ actionBar: true, tabBar: true },
|
||||
);
|
||||
}
|
||||
|
||||
@@ -233,7 +233,7 @@ export class SafeAreaTests extends testModule.UITest<any> {
|
||||
equal(left(child0), insets.left, `${child0}.left - actual: ${left(child0)} expected: ${insets.left}`);
|
||||
equal(top(child0), insets.top, `${child0}.top - actual: ${top(child0)} expected: ${insets.top}`);
|
||||
},
|
||||
pageOptions
|
||||
pageOptions,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -274,7 +274,7 @@ export class SafeAreaTests extends testModule.UITest<any> {
|
||||
isLeftAlignedWith(root, child0);
|
||||
isTopAlignedWith(root, child0);
|
||||
},
|
||||
pageOptions
|
||||
pageOptions,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -315,7 +315,7 @@ export class SafeAreaTests extends testModule.UITest<any> {
|
||||
({ root }) => {
|
||||
this.layout_in_full_screen_test(root, pageOptions);
|
||||
},
|
||||
pageOptions
|
||||
pageOptions,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -350,7 +350,7 @@ export class SafeAreaTests extends testModule.UITest<any> {
|
||||
({ root }) => {
|
||||
this.layout_insets_top_action_bar_test(root);
|
||||
},
|
||||
{ actionBar: true }
|
||||
{ actionBar: true },
|
||||
);
|
||||
}
|
||||
|
||||
@@ -365,7 +365,7 @@ export class SafeAreaTests extends testModule.UITest<any> {
|
||||
({ root }) => {
|
||||
this.layout_insets_top_action_bar_hidden_test(root);
|
||||
},
|
||||
{ actionBarHidden: true }
|
||||
{ actionBarHidden: true },
|
||||
);
|
||||
}
|
||||
|
||||
@@ -380,7 +380,7 @@ export class SafeAreaTests extends testModule.UITest<any> {
|
||||
({ root }) => {
|
||||
this.layout_insets_top_action_bar_test(root);
|
||||
},
|
||||
{ actionBarFlat: true }
|
||||
{ actionBarFlat: true },
|
||||
);
|
||||
}
|
||||
|
||||
@@ -395,7 +395,7 @@ export class SafeAreaTests extends testModule.UITest<any> {
|
||||
({ root }) => {
|
||||
this.layout_insets_top_action_bar_hidden_test(root);
|
||||
},
|
||||
{ tabBar: true }
|
||||
{ tabBar: true },
|
||||
);
|
||||
}
|
||||
|
||||
@@ -410,7 +410,7 @@ export class SafeAreaTests extends testModule.UITest<any> {
|
||||
({ root }) => {
|
||||
this.layout_insets_top_action_bar_test(root);
|
||||
},
|
||||
{ actionBar: true, tabBar: true }
|
||||
{ actionBar: true, tabBar: true },
|
||||
);
|
||||
}
|
||||
|
||||
@@ -447,7 +447,7 @@ export class SafeAreaTests extends testModule.UITest<any> {
|
||||
isRightWith(childFill, childRight, width(childRight));
|
||||
isAboveWith(childFill, childBottom, height(childBottom));
|
||||
},
|
||||
pageOptions
|
||||
pageOptions,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -505,7 +505,7 @@ export class SafeAreaTests extends testModule.UITest<any> {
|
||||
const sumOfNestedDockWidths = width(childLeft) + width(childFill) + width(childRight);
|
||||
equal(width(root), sumOfNestedDockWidths, `dock width<${width(root)}> sum of nested docks width <${sumOfNestedDockWidths}>`);
|
||||
},
|
||||
pageOptions
|
||||
pageOptions,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -533,7 +533,7 @@ export class SafeAreaTests extends testModule.UITest<any> {
|
||||
({ root }) => {
|
||||
this.layout_in_full_screen_test(root, pageOptions);
|
||||
},
|
||||
pageOptions
|
||||
pageOptions,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -568,7 +568,7 @@ export class SafeAreaTests extends testModule.UITest<any> {
|
||||
({ root }) => {
|
||||
this.layout_insets_top_action_bar_test(root);
|
||||
},
|
||||
{ actionBar: true }
|
||||
{ actionBar: true },
|
||||
);
|
||||
}
|
||||
|
||||
@@ -583,7 +583,7 @@ export class SafeAreaTests extends testModule.UITest<any> {
|
||||
({ root }) => {
|
||||
this.layout_insets_top_action_bar_hidden_test(root);
|
||||
},
|
||||
{ actionBarHidden: true }
|
||||
{ actionBarHidden: true },
|
||||
);
|
||||
}
|
||||
|
||||
@@ -598,7 +598,7 @@ export class SafeAreaTests extends testModule.UITest<any> {
|
||||
({ root }) => {
|
||||
this.layout_insets_top_action_bar_test(root);
|
||||
},
|
||||
{ actionBarFlat: true }
|
||||
{ actionBarFlat: true },
|
||||
);
|
||||
}
|
||||
|
||||
@@ -613,7 +613,7 @@ export class SafeAreaTests extends testModule.UITest<any> {
|
||||
({ root }) => {
|
||||
this.layout_insets_top_action_bar_hidden_test(root);
|
||||
},
|
||||
{ tabBar: true }
|
||||
{ tabBar: true },
|
||||
);
|
||||
}
|
||||
|
||||
@@ -628,7 +628,7 @@ export class SafeAreaTests extends testModule.UITest<any> {
|
||||
({ root }) => {
|
||||
this.layout_insets_top_action_bar_test(root);
|
||||
},
|
||||
{ actionBar: true, tabBar: true }
|
||||
{ actionBar: true, tabBar: true },
|
||||
);
|
||||
}
|
||||
|
||||
@@ -655,7 +655,7 @@ export class SafeAreaTests extends testModule.UITest<any> {
|
||||
equal(bottom(child2), height(root) - insets.bottom, `${child2}.bottom - actual: ${bottom(child2)} expected: ${height(root) - insets.bottom}`);
|
||||
equal(right(child2), width(root) - insets.right, `${child2}.right - actual: ${right(child2)} expected: ${width(root) - insets.right}`);
|
||||
},
|
||||
pageOptions
|
||||
pageOptions,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -694,7 +694,7 @@ export class SafeAreaTests extends testModule.UITest<any> {
|
||||
equal(right(child2), width(root) - insets.right, `${child2}.right - actual: ${right(child2)} expected: ${width(root) - insets.right}`);
|
||||
equal(bottom(child2), height(root) - insets.bottom, `${child2}.bottom - actual: ${bottom(child2)} expected: ${height(root) - insets.bottom}`);
|
||||
},
|
||||
pageOptions
|
||||
pageOptions,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -740,7 +740,7 @@ export class SafeAreaTests extends testModule.UITest<any> {
|
||||
const sumOfChildrenHeights = height(child0) + height(child1) + height(child2);
|
||||
equal(height(root), sumOfChildrenHeights, `flex height <${height(root)}> is NOT equal to sum of its children's heights <${sumOfChildrenHeights}>`);
|
||||
},
|
||||
pageOptions
|
||||
pageOptions,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -786,7 +786,7 @@ export class SafeAreaTests extends testModule.UITest<any> {
|
||||
const sumOfChildrenWidths = width(child0) + width(child1) + width(child2);
|
||||
equal(width(root), sumOfChildrenWidths, `flex width <${width(root)}> is NOT equal to sum of its children's width <${sumOfChildrenWidths}>`);
|
||||
},
|
||||
pageOptions
|
||||
pageOptions,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -828,7 +828,7 @@ export class SafeAreaTests extends testModule.UITest<any> {
|
||||
({ root }) => {
|
||||
this.layout_in_full_screen_test(root, pageOptions);
|
||||
},
|
||||
pageOptions
|
||||
pageOptions,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -863,7 +863,7 @@ export class SafeAreaTests extends testModule.UITest<any> {
|
||||
({ root }) => {
|
||||
this.layout_insets_top_action_bar_test(root);
|
||||
},
|
||||
{ actionBar: true }
|
||||
{ actionBar: true },
|
||||
);
|
||||
}
|
||||
|
||||
@@ -878,7 +878,7 @@ export class SafeAreaTests extends testModule.UITest<any> {
|
||||
({ root }) => {
|
||||
this.layout_insets_top_action_bar_hidden_test(root);
|
||||
},
|
||||
{ actionBarHidden: true }
|
||||
{ actionBarHidden: true },
|
||||
);
|
||||
}
|
||||
|
||||
@@ -893,7 +893,7 @@ export class SafeAreaTests extends testModule.UITest<any> {
|
||||
({ root }) => {
|
||||
this.layout_insets_top_action_bar_test(root);
|
||||
},
|
||||
{ actionBarFlat: true }
|
||||
{ actionBarFlat: true },
|
||||
);
|
||||
}
|
||||
|
||||
@@ -908,7 +908,7 @@ export class SafeAreaTests extends testModule.UITest<any> {
|
||||
({ root }) => {
|
||||
this.layout_insets_top_action_bar_hidden_test(root);
|
||||
},
|
||||
{ tabBar: true }
|
||||
{ tabBar: true },
|
||||
);
|
||||
}
|
||||
|
||||
@@ -923,7 +923,7 @@ export class SafeAreaTests extends testModule.UITest<any> {
|
||||
({ root }) => {
|
||||
this.layout_insets_top_action_bar_test(root);
|
||||
},
|
||||
{ actionBar: true, tabBar: true }
|
||||
{ actionBar: true, tabBar: true },
|
||||
);
|
||||
}
|
||||
|
||||
@@ -974,7 +974,7 @@ export class SafeAreaTests extends testModule.UITest<any> {
|
||||
const sumOfLabelWidthsAndInsets = insets.left + width(cells[1][0]) + width(cells[1][1]) + width(cells[1][2]) + insets.right;
|
||||
equal(width(grid), sumOfLabelWidthsAndInsets, `grid width<${width(grid)}> sum of nested grids width and insets<${sumOfLabelWidthsAndInsets}>`);
|
||||
},
|
||||
pageOptions
|
||||
pageOptions,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1037,7 +1037,7 @@ export class SafeAreaTests extends testModule.UITest<any> {
|
||||
const sumOfNestedGridWidths = width(cells[1][0]) + width(cells[1][1]) + width(cells[1][2]);
|
||||
equal(width(grid), sumOfNestedGridWidths, `grid width<${width(grid)}> sum of nested grids width <${sumOfNestedGridWidths}>`);
|
||||
},
|
||||
pageOptions
|
||||
pageOptions,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1065,7 +1065,7 @@ export class SafeAreaTests extends testModule.UITest<any> {
|
||||
({ root }) => {
|
||||
this.layout_in_full_screen_test(root, pageOptions);
|
||||
},
|
||||
pageOptions
|
||||
pageOptions,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1100,7 +1100,7 @@ export class SafeAreaTests extends testModule.UITest<any> {
|
||||
({ root }) => {
|
||||
this.layout_insets_top_action_bar_test(root);
|
||||
},
|
||||
{ actionBar: true }
|
||||
{ actionBar: true },
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1115,7 +1115,7 @@ export class SafeAreaTests extends testModule.UITest<any> {
|
||||
({ root }) => {
|
||||
this.layout_insets_top_action_bar_hidden_test(root);
|
||||
},
|
||||
{ actionBarHidden: true }
|
||||
{ actionBarHidden: true },
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1130,7 +1130,7 @@ export class SafeAreaTests extends testModule.UITest<any> {
|
||||
({ root }) => {
|
||||
this.layout_insets_top_action_bar_test(root);
|
||||
},
|
||||
{ actionBarFlat: true }
|
||||
{ actionBarFlat: true },
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1145,7 +1145,7 @@ export class SafeAreaTests extends testModule.UITest<any> {
|
||||
({ root }) => {
|
||||
this.layout_insets_top_action_bar_hidden_test(root);
|
||||
},
|
||||
{ tabBar: true }
|
||||
{ tabBar: true },
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1160,7 +1160,7 @@ export class SafeAreaTests extends testModule.UITest<any> {
|
||||
({ root }) => {
|
||||
this.layout_insets_top_action_bar_test(root);
|
||||
},
|
||||
{ actionBar: true, tabBar: true }
|
||||
{ actionBar: true, tabBar: true },
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1182,7 +1182,7 @@ export class SafeAreaTests extends testModule.UITest<any> {
|
||||
equal(bottom(child0), height(root) - insets.bottom, `${child0}.bottom - actual: ${bottom(child0)} expected: ${height(root) - insets.bottom}`);
|
||||
isLeftWith(child0, child1, width(child0));
|
||||
},
|
||||
pageOptions
|
||||
pageOptions,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1216,7 +1216,7 @@ export class SafeAreaTests extends testModule.UITest<any> {
|
||||
equal(right(child0), width(root) - insets.right, `${child0}.right - actual: ${right(child0)} expected: ${width(root) - insets.right}`);
|
||||
isBelowWith(child0, child1, height(child0));
|
||||
},
|
||||
pageOptions
|
||||
pageOptions,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1251,7 +1251,7 @@ export class SafeAreaTests extends testModule.UITest<any> {
|
||||
isTopAlignedWith(root, child0);
|
||||
isRightAlignedWith(root, child0);
|
||||
},
|
||||
pageOptions
|
||||
pageOptions,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1279,7 +1279,7 @@ export class SafeAreaTests extends testModule.UITest<any> {
|
||||
({ root }) => {
|
||||
this.layout_in_full_screen_test(root, pageOptions);
|
||||
},
|
||||
pageOptions
|
||||
pageOptions,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1314,7 +1314,7 @@ export class SafeAreaTests extends testModule.UITest<any> {
|
||||
({ root }) => {
|
||||
this.layout_insets_top_action_bar_test(root);
|
||||
},
|
||||
{ actionBar: true }
|
||||
{ actionBar: true },
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1329,7 +1329,7 @@ export class SafeAreaTests extends testModule.UITest<any> {
|
||||
({ root }) => {
|
||||
this.layout_insets_top_action_bar_hidden_test(root);
|
||||
},
|
||||
{ actionBarHidden: true }
|
||||
{ actionBarHidden: true },
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1344,7 +1344,7 @@ export class SafeAreaTests extends testModule.UITest<any> {
|
||||
({ root }) => {
|
||||
this.layout_insets_top_action_bar_test(root);
|
||||
},
|
||||
{ actionBarFlat: true }
|
||||
{ actionBarFlat: true },
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1359,7 +1359,7 @@ export class SafeAreaTests extends testModule.UITest<any> {
|
||||
({ root }) => {
|
||||
this.layout_insets_top_action_bar_hidden_test(root);
|
||||
},
|
||||
{ tabBar: true }
|
||||
{ tabBar: true },
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1374,7 +1374,7 @@ export class SafeAreaTests extends testModule.UITest<any> {
|
||||
({ root }) => {
|
||||
this.layout_insets_top_action_bar_test(root);
|
||||
},
|
||||
{ actionBar: true, tabBar: true }
|
||||
{ actionBar: true, tabBar: true },
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1398,7 +1398,7 @@ export class SafeAreaTests extends testModule.UITest<any> {
|
||||
equal(height(child1), 0, `${child1} has been laid out, but should not`);
|
||||
equal(width(child1), 0, `${child1} has been laid out, but should not`);
|
||||
},
|
||||
pageOptions
|
||||
pageOptions,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1434,7 +1434,7 @@ export class SafeAreaTests extends testModule.UITest<any> {
|
||||
equal(height(child1), 0, `${child1} has been laid out, but should not`);
|
||||
equal(width(child1), 0, `${child1} has been laid out, but should not`);
|
||||
},
|
||||
pageOptions
|
||||
pageOptions,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1467,7 +1467,7 @@ export class SafeAreaTests extends testModule.UITest<any> {
|
||||
isTopAlignedWith(root, child0);
|
||||
isRightAlignedWith(root, child0);
|
||||
},
|
||||
pageOptions
|
||||
pageOptions,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import * as segmentedBarModule from '@nativescript/core/ui/segmented-bar';
|
||||
import { Color } from '@nativescript/core';
|
||||
import { AndroidHelper } from '@nativescript/core/ui/core/view';
|
||||
|
||||
export function getNativeTabWidget(bar: segmentedBarModule.SegmentedBar): android.widget.TabWidget {
|
||||
return (<android.widget.TabHost>bar.android).getTabWidget();
|
||||
@@ -44,7 +45,7 @@ export var checkBackgroundColorUpdatedAfterItemSelected = function (bar: segment
|
||||
const item = bar.items[i];
|
||||
const textView = item?.nativeViewProtected;
|
||||
|
||||
const newDrawable = tryCloneDrawable(view.getBackground(), view.getResources());
|
||||
const newDrawable = AndroidHelper.getCopyOrDrawable(view.getBackground(), view.getResources());
|
||||
newDrawable.setColorFilter(new android.graphics.Paint(bar.selectedBackgroundColor.android).getColorFilter());
|
||||
|
||||
if (bar.selectedIndex == i) {
|
||||
@@ -68,16 +69,5 @@ export var checkBackgroundColorUpdatedAfterItemSelected = function (bar: segment
|
||||
}
|
||||
}
|
||||
|
||||
function tryCloneDrawable(value: android.graphics.drawable.Drawable, resources: android.content.res.Resources): android.graphics.drawable.Drawable {
|
||||
if (value) {
|
||||
const constantState = value.getConstantState();
|
||||
if (constantState) {
|
||||
return constantState.newDrawable(resources);
|
||||
}
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
return isValid === 0;
|
||||
};
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { TextField, Color, Utils, CoreTypes } from '@nativescript/core';
|
||||
import { AndroidHelper } from '@nativescript/core/ui/core/view';
|
||||
|
||||
export function getNativeText(textField: TextField): string {
|
||||
return textField.android.getText().toString();
|
||||
@@ -29,15 +30,7 @@ export function getNativePlaceholderColor(textField: TextField): Color {
|
||||
}
|
||||
|
||||
export function getNativeBackgroundColor(textField: TextField): Color {
|
||||
let bg = <any>textField.android.getBackground();
|
||||
if (bg instanceof org.nativescript.widgets.BorderDrawable) {
|
||||
return new Color(bg.getBackgroundColor());
|
||||
} else if (bg instanceof android.graphics.drawable.ColorDrawable) {
|
||||
console.log(bg);
|
||||
return new Color(bg.getColor());
|
||||
} else {
|
||||
return new Color(bg.backgroundColor);
|
||||
}
|
||||
return AndroidHelper.getDrawableColor(textField.android.getBackground());
|
||||
}
|
||||
|
||||
export function getNativeTextAlignment(textField: TextField): string {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { TextView, Color, Utils, CoreTypes } from '@nativescript/core';
|
||||
import { AndroidHelper } from '@nativescript/core/ui/core/view';
|
||||
|
||||
export function getNativeText(textView: TextView): string {
|
||||
return textView.android.getText().toString();
|
||||
@@ -27,14 +28,7 @@ export function getNativeColor(textView: TextView): Color {
|
||||
}
|
||||
|
||||
export function getNativeBackgroundColor(textView: TextView): Color {
|
||||
let bg = <any>textView.android.getBackground();
|
||||
if (bg instanceof org.nativescript.widgets.BorderDrawable) {
|
||||
return new Color(bg.getBackgroundColor());
|
||||
} else if (bg instanceof android.graphics.drawable.ColorDrawable) {
|
||||
return new Color(bg.getColor());
|
||||
} else {
|
||||
return new Color(bg.backgroundColor);
|
||||
}
|
||||
return AndroidHelper.getDrawableColor(textView.android.getBackground());
|
||||
}
|
||||
|
||||
export function getNativeTextAlignment(textView: TextView): string {
|
||||
|
||||
Reference in New Issue
Block a user