diff --git a/CrossPlatformModules.csproj b/CrossPlatformModules.csproj
index b1df7e578..72a63583b 100644
--- a/CrossPlatformModules.csproj
+++ b/CrossPlatformModules.csproj
@@ -79,6 +79,7 @@
data-binding.xml
+
modal-page.xml
@@ -117,6 +118,12 @@
+
+
+ Designer
+
+
+
Designer
@@ -2104,7 +2111,7 @@
False
-
+
-
+
\ No newline at end of file
diff --git a/apps/animations/bkg.png b/apps/animations/bkg.png
new file mode 100644
index 000000000..fa059ba75
Binary files /dev/null and b/apps/animations/bkg.png differ
diff --git a/apps/animations/main-page.ts b/apps/animations/main-page.ts
index 40da5d9ac..1a63abb8f 100644
--- a/apps/animations/main-page.ts
+++ b/apps/animations/main-page.ts
@@ -6,6 +6,7 @@ import animationModule = require("ui/animation");
import colorModule = require("color");
import model = require("./model");
import enums = require("ui/enums");
+import frame = require("ui/frame");
var vm = new model.ViewModel();
@@ -162,4 +163,8 @@ export function onInterrupted(args: observable.EventData) {
duration: 1000
})
}, 700 * 3);
-}
\ No newline at end of file
+}
+
+export function onOpacity(args: observable.EventData) {
+ frame.topmost().navigate("./opacity");
+}
diff --git a/apps/animations/main-page.xml b/apps/animations/main-page.xml
index c6f0ad165..8b939ab70 100644
--- a/apps/animations/main-page.xml
+++ b/apps/animations/main-page.xml
@@ -18,6 +18,7 @@
+
>
diff --git a/apps/animations/opacity.css b/apps/animations/opacity.css
new file mode 100644
index 000000000..31c075f8f
--- /dev/null
+++ b/apps/animations/opacity.css
@@ -0,0 +1,27 @@
+.complex {
+ width: 45;
+ height: 45;
+ margin: 1;
+ background-image: url('~/bkg.png');
+ background-repeat:repeat-x;
+ background-position: 20% 80%;
+ background-color: lightyellow;
+ background-size: 25% 50%;
+ border-radius: 20;
+ border-width: 4;
+ border-color: red;
+}
+
+.simple {
+ width: 45;
+ height: 45;
+ margin: 1;
+ border-radius: 20;
+ background-color: lightgreen;
+}
+
+.none {
+ width: 45;
+ height: 45;
+ margin: 1;
+}
\ No newline at end of file
diff --git a/apps/animations/opacity.ts b/apps/animations/opacity.ts
new file mode 100644
index 000000000..ed8cd14f8
--- /dev/null
+++ b/apps/animations/opacity.ts
@@ -0,0 +1,53 @@
+import observable = require("data/observable");
+import pages = require("ui/page");
+import view = require("ui/core/view");
+import buttonModule = require("ui/button");
+import abs = require("ui/layouts/absolute-layout");
+import animationModule = require("ui/animation");
+import colorModule = require("color");
+import model = require("./model");
+import enums = require("ui/enums");
+import frame = require("ui/frame");
+import slider = require("ui/slider");
+import wrapLayout = require("ui/layouts/wrap-layout");
+
+var page: pages.Page;
+var opacitySlider: slider.Slider;
+var red = new colorModule.Color("red");
+var green = new colorModule.Color("green");
+var container: wrapLayout.WrapLayout;
+
+export function pageLoaded(args: observable.EventData) {
+ page = args.object;
+ opacitySlider = page.getViewById("opacitySlider");
+ container = page.getViewById("container");
+}
+
+export function onSetOpacity(args: observable.EventData) {
+ var newOpacity = opacitySlider.value / 100;
+ container._eachChildView((childView: view.View) => {
+ childView.opacity = newOpacity;
+ return true;
+ });
+}
+
+var animationSet: animationModule.Animation;
+export function onAnimateOpacity(args: observable.EventData) {
+ var newOpacity = opacitySlider.value / 100;
+ var animationDefinitions = new Array();
+ container._eachChildView((childView: view.View) => {
+ animationDefinitions.push({
+ target: childView,
+ opacity: newOpacity,
+ duration: 5000
+ });
+ return true;
+ });
+
+ animationSet = new animationModule.Animation(animationDefinitions);
+ animationSet.play();
+}
+
+export function onReset(args: observable.EventData) {
+ animationSet.cancel();
+}
diff --git a/apps/animations/opacity.xml b/apps/animations/opacity.xml
new file mode 100644
index 000000000..a7dd16d3b
--- /dev/null
+++ b/apps/animations/opacity.xml
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/apps/animations/test-icon.png b/apps/animations/test-icon.png
new file mode 100644
index 000000000..bf42af4ae
Binary files /dev/null and b/apps/animations/test-icon.png differ
diff --git a/tsconfig.json b/tsconfig.json
index 86f098620..97427c6cf 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -48,6 +48,7 @@
"apps/animations/app.ts",
"apps/animations/main-page.ts",
"apps/animations/model.ts",
+ "apps/animations/opacity.ts",
"apps/connectivity-demo/app.ts",
"apps/connectivity-demo/main-page.ts",
"apps/cuteness.io/app.ts",
@@ -319,9 +320,9 @@
"apps/tests/xml-declaration/mainPage.ts",
"apps/tests/xml-declaration/mymodule/MyControl.ts",
"apps/tests/xml-declaration/mymodulewithxml/MyControl.ts",
- "apps/tests/xml-declaration/template-builder-tests/template-view.ts",
- "apps/tests/xml-declaration/template-builder-tests/event-in-template.ts",
"apps/tests/xml-declaration/template-builder-tests/event-in-codeless-fragment.ts",
+ "apps/tests/xml-declaration/template-builder-tests/event-in-template.ts",
+ "apps/tests/xml-declaration/template-builder-tests/template-view.ts",
"apps/tests/xml-declaration/xml-declaration-tests.ts",
"apps/tests/xml-parser-tests/xml-parser-tests.ts",
"apps/transforms/app.ts",
diff --git a/ui/animation/animation.android.ts b/ui/animation/animation.android.ts
index bcb0702f2..be762396d 100644
--- a/ui/animation/animation.android.ts
+++ b/ui/animation/animation.android.ts
@@ -159,11 +159,18 @@ export class Animation extends common.Animation implements definition.Animation
case common.Properties.opacity:
originalValue1 = nativeView.getAlpha();
- nativeArray = java.lang.reflect.Array.newInstance(floatType, 1);
- nativeArray[0] = propertyAnimation.value;
- propertyUpdateCallbacks.push(checkAnimation(() => { propertyAnimation.target.opacity = propertyAnimation.value }));
- propertyResetCallbacks.push(checkAnimation(() => { nativeView.setAlpha(originalValue1); }));
- animators.push(android.animation.ObjectAnimator.ofFloat(nativeView, "alpha", nativeArray));
+ nativeArray = java.lang.reflect.Array.newInstance(floatType, 2);
+ nativeArray[0] = originalValue1;
+ nativeArray[1] = propertyAnimation.value;
+ animator = android.animation.ValueAnimator.ofFloat(nativeArray);
+ animator.addUpdateListener(new android.animation.ValueAnimator.AnimatorUpdateListener({
+ onAnimationUpdate(animator: android.animation.ValueAnimator) {
+ propertyAnimation.target.opacity = (animator.getAnimatedValue()).floatValue();
+ }
+ }));
+ propertyUpdateCallbacks.push(checkAnimation(() => { propertyAnimation.target.opacity = propertyAnimation.value; }));
+ propertyResetCallbacks.push(checkAnimation(() => { propertyAnimation.target.opacity = originalValue1; }));
+ animators.push(animator);
break;
case common.Properties.backgroundColor:
diff --git a/ui/styling/stylers.android.ts b/ui/styling/stylers.android.ts
index 42d03f21a..1fc6e75fe 100644
--- a/ui/styling/stylers.android.ts
+++ b/ui/styling/stylers.android.ts
@@ -341,6 +341,25 @@ export class ImageStyler implements definition.stylers.Styler {
onBackgroundOrBorderPropertyChanged(view);
}
+ //Opacity methods
+ private static setOpacityProperty(view: view.View, newValue: any) {
+ ImageStyler._setOpacity(view, newValue);
+ }
+
+ private static resetOpacityProperty(view: view.View, nativeValue: any) {
+ ImageStyler._setOpacity(view, 1.0);
+ }
+
+ private static _setOpacity(view: view.View, value: any) {
+ let opacity = float(value);
+ let nativeView = view._nativeView;
+ nativeView.setAlpha(opacity);
+ let background = nativeView.getBackground();
+ if (background) {
+ background.setAlpha(opacity);
+ }
+ }
+
public static registerHandlers() {
// Use the same handler for all background/border properties
// Note: There is no default value getter - the default value is handled in onBackgroundOrBorderPropertyChanged
@@ -352,6 +371,10 @@ export class ImageStyler implements definition.stylers.Styler {
style.registerHandler(style.borderWidthProperty, new stylersCommon.StylePropertyChangedHandler(
ImageStyler.setBorderWidthProperty,
ImageStyler.resetBorderWidthProperty), "Image");
+
+ style.registerHandler(style.opacityProperty, new stylersCommon.StylePropertyChangedHandler(
+ ImageStyler.setOpacityProperty,
+ ImageStyler.resetOpacityProperty), "Image");
}
}