Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function getRippleColor(color: string | Color) {
if (color) {
const temp = typeof color === 'string' ? new Color(color) : color;
// return android.graphics.Color.argb(temp.a !== 255 ? temp.a / 255 : 0.14, temp.r / 255, temp.g / 255, temp.b); // default alpha is 0.14
return new Color(temp.a !== 255 ? temp.a : 61.5, temp.r, temp.g, temp.b).android; // default alpha is 0.24
}
return null;
}
public initSnack(options: SnackBarOptions, resolve?: Function) {
if (this._snackbar) {
return;
}
// options.actionText = options.actionText ? options.actionText : 'Close';
options.hideDelay = options.hideDelay ? options.hideDelay : 3000;
const attachToView = (options.view && options.view.android) || topmost().currentPage.android;
this._snackbar = com.google.android.material.snackbar.Snackbar.make(attachToView, options.message, options.hideDelay);
this._snackbar.setText(options.message);
this._snackbar.setDuration(options.hideDelay);
// set text color of the TextView in the Android SnackBar
if (options.textColor && Color.isValid(options.textColor)) {
const color = (options.textColor instanceof Color ? options.textColor : new Color(options.textColor)).android;
if ((this._snackbar as any).setTextColor) {
(this._snackbar as any).setTextColor(color);
} else {
const mainTextView = this._snackbar.getView().findViewById(SnackBar.SNACKBAR_TEXT_ID) as android.widget.TextView;
if (mainTextView) {
mainTextView.setTextColor(color);
}
}
// this._snackbar.setTextColor(color);
}
if (options.actionTextColor && Color.isValid(options.actionTextColor)) {
const color = (options.actionTextColor instanceof Color ? options.actionTextColor : new Color(options.actionTextColor)).android;
this._snackbar.setActionTextColor(color);
}
export function getRippleColor(color: string | Color) {
if (color) {
const temp = typeof color === 'string' ? new Color(color) : color;
// return android.graphics.Color.argb(temp.a !== 255 ? temp.a / 255 : 0.14, temp.r / 255, temp.g / 255, temp.b); // default alpha is 0.14
return new Color(temp.a !== 255 ? temp.a : 61.5, temp.r, temp.g, temp.b).android; // default alpha is 0.24
}
return null;
}
export function getRippleColor(color: string | Color): UIColor {
if (color) {
const temp = typeof color === 'string' ? new Color(color) : color;
// return UIColor.colorWithRedGreenBlueAlpha(temp.r / 255, temp.g / 255, temp.b, temp.a !== 255 ? temp.a / 255 : 0.14);
return new Color(temp.a !== 255 ? temp.a : 61.5, temp.r, temp.g, temp.b).ios; // default alpha is 0.24
}
return null;
}
span = new Span();
span.fontFamily = "serif";
span.fontSize = 10;
span.fontWeight = "bold";
span.color = new Color("red");
span.backgroundColor = new Color("blue");
span.textDecoration = "line-through";
span.text = "Formatted";
formattedString.spans.push(span);
span = new Span();
span.fontFamily = "sans-serif";
span.fontSize = 20;
span.fontStyle = "italic";
span.color = new Color("green");
span.backgroundColor = new Color("yellow");
span.textDecoration = "underline";
span.text = "Text";
formattedString.spans.push(span);
return formattedString;
}
span = new Span();
span.fontFamily = "serif";
span.fontSize = 10;
span.fontWeight = "bold";
span.color = new Color("red");
span.backgroundColor = new Color("blue");
span.textDecoration = "line-through";
span.text = "Formatted";
formattedString.spans.push(span);
span = new Span();
span.fontFamily = "sans-serif";
span.fontSize = 20;
span.fontStyle = "italic";
span.color = new Color("green");
span.backgroundColor = new Color("yellow");
span.textDecoration = "underline";
span.text = "Text";
formattedString.spans.push(span);
return formattedString;
}
valueConverter: v => new Color(v)
});
valueConverter: v => new Color(v)
});
setOnSurfaceColor(value: string | Color) {
this.onSurfaceColor = value;
const colorTheme = this.getOrcreateAppColorScheme();
const color = value instanceof Color ? value : new Color(value);
colorTheme.onSurfaceColor = color.ios;
}
getOnSurfaceColor(): string | Color {