Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/**************************************************************************************
* Made for the {N} community by Brad Martin @BradWayneMartin
* https://twitter.com/BradWayneMartin
* https://github.com/bradmartin
* Pull requests are welcome. Enjoy!
*************************************************************************************/
var view = require("ui/core/view");
var platform = require("platform");
var dependencyObservable = require("ui/core/dependency-observable");
var proxy = require("ui/core/proxy");
// on Android we explicitly set propertySettings to None because android will invalidate its layout (skip unnecessary native call).
var AffectsLayout = platform.device.os === platform.platformNames.android ? dependencyObservable.PropertyMetadataSettings.None : dependencyObservable.PropertyMetadataSettings.AffectsLayout;
var Video = (function (_super) {
__extends(Video, _super);
function Video(options) {
_super.call(this, options);
}
Object.defineProperty(Video.prototype, "src", {
get: function () {
return this._getValue(Video.srcProperty);
},
set: function (value) {
this._setValue(Video.srcProperty, value);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Video.prototype, "isLoading", {
export function changeTranslucent() {
if (platform.device.os === platform.platformNames.ios) {
frameModule.topmost().ios.controller.navigationBar.translucent = frameModule.topmost().ios.controller.navigationBar.translucent === true ? false : true;
}
}
function Repeater() {
_super.call(this);
this.isDirty = true;
if (platform.device.os === platform.platformNames.ios) {
this._ios = UIView.new();
}
}
Object.defineProperty(Repeater.prototype, "items", {
var proxy = require("ui/core/proxy");
var imageSource = require("image-source");
var imageAssetModule = require("image-asset");
var enums = require("ui/enums");
var platform = require("platform");
var utils = require("utils/utils");
var types = require("utils/types");
var SRC = "src";
var IMAGE_SOURCE = "imageSource";
var LOAD_MODE = "loadMode";
var SYNC = "sync";
var ASYNC = "async";
var IMAGE = "Image";
var ISLOADING = "isLoading";
var STRETCH = "stretch";
var AffectsLayout = platform.device.os === platform.platformNames.android ? dependencyObservable.PropertyMetadataSettings.None : dependencyObservable.PropertyMetadataSettings.AffectsLayout;
function onSrcPropertyChanged(data) {
var image = data.object;
image._createImageSourceFromSrc();
}
var Image = (function (_super) {
__extends(Image, _super);
function Image() {
_super.apply(this, arguments);
}
Object.defineProperty(Image.prototype, "imageSource", {
get: function () {
return this._getValue(Image.imageSourceProperty);
},
set: function (value) {
this._setValue(Image.imageSourceProperty, value);
},
PlatformFilter.isPlatform = function (value) {
return value && (value.toLowerCase() === platform_1.platformNames.android.toLowerCase()
|| value.toLowerCase() === platform_1.platformNames.ios.toLowerCase());
};
PlatformFilter.isCurentPlatform = function (value) {
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var dependencyObservable = require("ui/core/dependency-observable");
var proxy = require("ui/core/proxy");
var view = require("ui/core/view");
var gifSource = require("./gif-source");
var platform = require("platform");
var types = require("utils/types");
var SRC = "src";
var GIF_SOURCE = "gifSource";
var GIF = "Gif";
var ISLOADING = "isLoading";
var AffectsLayout = platform.device.os === platform.platformNames.android ? dependencyObservable.PropertyMetadataSettings.None : dependencyObservable.PropertyMetadataSettings.AffectsLayout;
function onSrcPropertyChanged(data) {
var gif = data.object;
var value = data.newValue;
if (types.isString(value)) {
value = value.trim();
gif.gifSource = null;
gif["_url"] = value;
gif._setValue(Gif.isLoadingProperty, true);
if (gifSource.isFileOrResourcePath(value)) {
gif.gifSource = gifSource.fromFileOrResource(value);
gif._setValue(Gif.isLoadingProperty, false);
}
else {
gifSource.fromUrl(value).then(function (r) {
if (gif["_url"] === value) {
gif.gifSource = r;
PlatformFilter.isPlatform = function (value) {
return value && (value.toLowerCase() === platform_1.platformNames.android.toLowerCase()
|| value.toLowerCase() === platform_1.platformNames.ios.toLowerCase());
};
PlatformFilter.isCurentPlatform = function (value) {
function Repeater() {
_super.call(this);
this.isDirty = true;
if (platform.device.os === platform.platformNames.ios) {
this._ios = UIView.new();
}
}
Object.defineProperty(Repeater.prototype, "items", {
export function linearGradient(view:View, colors:(Color|string)[]) {
var _colors:any[] = [];
var nativeView = view['_nativeView'];
if (!nativeView) {
return;
}
colors.forEach(function (c, idx) {
if (!(c instanceof Color)) {
colors[idx] = new Color(c);
}
});
if (platform.device.os === platform.platformNames.android) {
var backgroundDrawable = nativeView.getBackground(),
LINEAR_GRADIENT = 0;
colors.forEach(function (c:Color) {
_colors.push(c.android);
});
if (!(backgroundDrawable instanceof android.graphics.drawable.GradientDrawable)) {
backgroundDrawable = new android.graphics.drawable.GradientDrawable();
backgroundDrawable.setColors(_colors);
backgroundDrawable.setGradientType(LINEAR_GRADIENT);
nativeView.setBackgroundDrawable(backgroundDrawable);
}
} else if (platform.device.os === platform.platformNames.ios) {
var iosView:UIView = view.ios;
var colorsArray = NSMutableArray.alloc().initWithCapacity(2);
PlatformFilter.isPlatform = function (value) {
return value && (value.toLowerCase() === platform_1.platformNames.android.toLowerCase()
|| value.toLowerCase() === platform_1.platformNames.ios.toLowerCase());
};
PlatformFilter.isCurentPlatform = function (value) {