Skip to content

fix[animated-circle] Android plugin is not changing text size #584

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

Merged
Changes from 1 commit
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
Next Next commit
fix(android): textColor and textSize
  • Loading branch information
vallemar authored May 8, 2024
commit 796046e07f9f94e69ad546fb71dfc3e79942db76
12 changes: 7 additions & 5 deletions packages/animated-circle/index.android.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Color, Property, booleanConverter } from '@nativescript/core';
import { Color, Property, booleanConverter, Utils } from '@nativescript/core';
import { AnimatedCircleCommon, barColorProperty, rimColorProperty, spinBarColorProperty } from './common';

declare const at;
Expand Down Expand Up @@ -26,7 +26,7 @@ export class AnimatedCircle extends AnimatedCircleCommon {
private _startAngle = 0;
private _text = '';
private _textColor = new Color('orange');
private _textSize = 8;
private _textSize = Utils.layout.toDevicePixels(8);
private _fillColor = new Color('transparent');
private _clockwise = true;

Expand All @@ -47,6 +47,8 @@ export class AnimatedCircle extends AnimatedCircleCommon {
this.android.setOuterContourSize(0);
this.android.setInnerContourSize(0);
this.android.setText(this.text);
this.android.setTextSize(this._textSize);
this.android.setTextColor(this._textColor.argb);
if (this.animated) {
this.android.setValueAnimated(this.progress);
} else {
Expand Down Expand Up @@ -225,9 +227,9 @@ export class AnimatedCircle extends AnimatedCircleCommon {
this.android?.setTextColor(this._textColor.argb);
}

set textSize(value: number) {
this._textSize = value;
this.android?.setTextSize(value);
set textSize(value: number | string) {
this._textSize = Utils.layout.toDevicePixels(typeof value === 'string' ? parseInt(value) : value);
this.android?.setTextSize(this._textSize);
}

get textSize() {
Expand Down