Content-Length: 635037 | pFad | http://github.com/NativeScript/NativeScript/pull/10451/files

00 feat(android): background color/image handling improvements by CatchABus · Pull Request #10451 · NativeScript/NativeScript · GitHub
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(android): background color/image handling improvements #10451

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions apps/automated/src/file-system/file-system-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export var testFileFromPath = function () {
function (error) {
TKUnit.assert(false, 'Failed to read/write text');
//console.dir(error);
}
},
);
// << (hide)
},
Expand All @@ -71,7 +71,7 @@ export var testFileFromPath = function () {
TKUnit.assert(false, 'Failed to read/write text');
//console.dir(error);
// << (hide)
}
},
);
// << file-system-create
};
Expand Down Expand Up @@ -106,7 +106,7 @@ export var testFileWrite = function () {
function (error) {
TKUnit.assert(false, 'Failed to read/write text');
//console.dir(error);
}
},
);
// << (hide)
},
Expand All @@ -116,7 +116,7 @@ export var testFileWrite = function () {
TKUnit.assert(false, 'Failed to read/write text');
//console.dir(error);
// << (hide)
}
},
);
// << file-system-write-string
};
Expand Down Expand Up @@ -172,7 +172,7 @@ export var testFileRead = function () {
TKUnit.assert(false, 'Failed to read/write text');
//console.dir(error);
// << (hide)
}
},
);
},
function (error) {
Expand All @@ -181,7 +181,7 @@ export var testFileRead = function () {
TKUnit.assert(false, 'Failed to read/write text');
//console.dir(error);
// << (hide)
}
},
);
// << file-system-example-text
};
Expand Down Expand Up @@ -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)
},
Expand All @@ -260,7 +260,7 @@ export var testFileReadWriteBinaryAsync = function () {
// >> (hide)
TKUnit.assert(false, 'Failed to read binary async');
// << (hide)
}
},
);
// << file-system-read-binary-async
};
Expand Down Expand Up @@ -358,7 +358,7 @@ export var testGetEntities = function () {
function (error) {
// Failed to obtain folder's contents.
// globalConsole.error(error.message);
}
},
);
// << file-system-folders-content
};
Expand Down Expand Up @@ -493,7 +493,7 @@ export var testFileRename = function () {
// >> (hide)
TKUnit.assert(false, 'Failed to rename file');
// << (hide)
}
},
);
// << file-system-renaming
};
Expand All @@ -517,7 +517,7 @@ export var testFolderRename = function () {
// >> (hide)
TKUnit.assert(false, 'Folder.rename API not working.');
// << (hide)
}
},
);
// << file-system-renaming-folder
};
Expand All @@ -538,7 +538,7 @@ export var testFileRemove = function () {
// >> (hide)
TKUnit.assert(false, 'File.remove API not working.');
// << (hide)
}
},
);
// << file-system-remove-file
};
Expand All @@ -560,7 +560,7 @@ export var testFolderRemove = function () {
// >> (hide)
TKUnit.assert(false, 'File.remove API not working.');
// << (hide)
}
},
);
// << file-system-remove-folder
};
Expand All @@ -587,7 +587,7 @@ export var testFolderClear = function () {
// >> (hide)
TKUnit.assert(false, error.message);
// << (hide)
}
},
);
// >> (hide)
folder.getEntities().then(function (entities) {
Expand All @@ -609,7 +609,7 @@ export var testKnownFolderRename = function () {
},
function (error) {
TKUnit.assert(true);
}
},
);
}
};
Expand All @@ -625,7 +625,7 @@ export function testKnownFolderRemove(done) {
},
function (error) {
done(null);
}
},
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ function binding_busy_to_image() {
sourceProperty: 'isLoading',
targetProperty: 'busy',
},
image
image,
);
// << activity-indicator-loading
}
Expand Down
11 changes: 2 additions & 9 deletions apps/automated/src/ui/button/button-tests-native.android.ts
Original file line number Diff line number Diff line change
@@ -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();
Expand All @@ -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 {
Expand Down
15 changes: 4 additions & 11 deletions apps/automated/src/ui/label/label-tests-native.android.ts
Original file line number Diff line number Diff line change
@@ -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();
Expand All @@ -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());
}
Loading
Loading








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/NativeScript/NativeScript/pull/10451/files

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy