Skip to content

Commit 257a3c5

Browse files
Android CSS support!
1 parent 3cd6a73 commit 257a3c5

File tree

4 files changed

+35
-47
lines changed

4 files changed

+35
-47
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ FakesAssemblies/
202202
.vs
203203
.vs/
204204
nativescript-fab.sln
205+
.vscode
205206

206207
# Demo application build files
207208
demo/platforms/*

app/App_Resources/iOS/Info.plist

Lines changed: 0 additions & 45 deletions
This file was deleted.

demo/app/main-page.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
row="1"
1515
icon="res://ic_add_white"
1616
tap="fabTap"
17-
backColor="#ff4081"
1817
rippleColor="blue"
1918
class="fab-button" />
2019
</grid-layout>

fab.android.js

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
*************************************************************************************/
88

99
var common = require("./fab-common");
10-
var color = require("color");
10+
var style = require("ui/styling/style");
11+
var utils = require("utils/utils");
12+
var color = require("color");
1113
var ImageSource = require("image-source");
1214

1315
require("utils/module-merge").merge(common, module.exports);
@@ -51,6 +53,37 @@
5153

5254
exports.Fab = FloatingActionButton;
5355

56+
57+
/* SETUP CSS */
58+
var FloatingActionButtonStyler = (function () {
59+
function FloatingActionButtonStyler() {
60+
}
61+
// BACKGROUND COLOR
62+
FloatingActionButtonStyler.setBackgroundColorProperty = function (view, newValue) {
63+
debugger;
64+
var fab = view.android;
65+
fab.setBackgroundTintList(android.content.res.ColorStateList.valueOf(newValue));
66+
};
67+
FloatingActionButtonStyler.resetBackgroundColorProperty = function (view, nativeValue) {
68+
debugger;
69+
var fab = view.android;
70+
fab.setBackgroundTintList(android.content.res.ColorStateList.valueOf(nativeValue));
71+
};
72+
FloatingActionButtonStyler.getNativeBackgroundColorValue = function (view) {
73+
debugger;
74+
var fab = view.android;
75+
return fab.getBackgroundTintList();
76+
};
77+
78+
FloatingActionButtonStyler.registerHandlers = function () {
79+
style.registerHandler(style.backgroundColorProperty, new style.StylePropertyChangedHandler(FloatingActionButtonStyler.setBackgroundColorProperty, FloatingActionButtonStyler.resetBackgroundColorProperty, FloatingActionButtonStyler.getNativeBackgroundColorValue), "FloatingActionButton");
80+
style.registerHandler(style.backgroundInternalProperty, style.ignorePropertyHandler, "FloatingActionButton");
81+
};
82+
return FloatingActionButtonStyler;
83+
})();
84+
exports.FloatingActionButtonStyler = FloatingActionButtonStyler;
85+
FloatingActionButtonStyler.registerHandlers();
86+
5487
/* SETUP PROPERTIES */
5588
//Background Color
5689
function onBackColorPropertyChanged(data) {

0 commit comments

Comments
 (0)