Skip to content

Commit f88ff37

Browse files
committed
fix(progress): upgraded material lib to improve the progress component. Now you can change its height
1 parent c4197a7 commit f88ff37

File tree

5 files changed

+12191
-36695
lines changed

5 files changed

+12191
-36695
lines changed

packages/core/platforms/android/include.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
dependencies {
33
def androidXAppCompatVersion = project.hasProperty("androidXAppCompatVersion") ? project.androidXAppCompatVersion : "1.2.0"
4-
def androidXMaterial = project.hasProperty("androidXMaterial") ? project.androidXMaterial : "1.2.1"
4+
def androidXMaterial = project.hasProperty("androidXMaterial") ? project.androidXMaterial : "1.3.0"
55

66
compile "androidx.appcompat:appcompat:$androidXAppCompatVersion"
77
compile "com.google.android.material:material:$androidXMaterial"

src/progress/progress-common.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export const progressBackgroundColorProperty = new CssProperty<Style, Color>({
2929
});
3030
export const busyProperty = new Property<ProgressBase, boolean>({
3131
name: 'busy',
32+
defaultValue: false,
3233
valueConverter: booleanConverter
3334
});
3435
export const indeterminateProperty = new Property<ProgressBase, boolean>({

src/progress/progress.android.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { themer } from '@nativescript-community/ui-material-core';
2-
import { Color, colorProperty, visibilityProperty } from '@nativescript/core';
2+
import { Color, PercentLength, colorProperty, heightProperty, visibilityProperty } from '@nativescript/core';
33
import { Visibility } from '@nativescript/core/ui/enums';
44
import { ProgressBase, busyProperty, indeterminateProperty, progressBackgroundColorProperty, progressColorProperty } from './progress-common';
55

@@ -8,7 +8,13 @@ export class Progress extends ProgressBase {
88
super();
99
this.color = themer.getPrimaryColor() as Color;
1010
}
11-
nativeViewProtected: android.widget.ProgressBar;
11+
nativeViewProtected: com.google.android.material.progressindicator.LinearProgressIndicator;
12+
13+
14+
// added in 1.3.0
15+
createNativeView() {
16+
return new com.google.android.material.progressindicator.LinearProgressIndicator(this._context);
17+
}
1218

1319
[progressColorProperty.setNative](color: Color) {
1420
this.nativeViewProtected.setProgressTintList(color ? android.content.res.ColorStateList.valueOf(color.android) : null);
@@ -23,9 +29,10 @@ export class Progress extends ProgressBase {
2329
return false;
2430
}
2531
[busyProperty.setNative](value) {
26-
// if (value) {
2732
this.nativeViewProtected.setVisibility(value ? android.view.View.VISIBLE : android.view.View.INVISIBLE);
28-
// }
33+
}
34+
[heightProperty.setNative](value) {
35+
this.nativeViewProtected.setTrackThickness(PercentLength.toDevicePixels(value));
2936
}
3037
// [visibilityProperty.setNative](value) {
3138
// switch (value) {

src/typings/android-declarations.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
declare module native { export class Array<T> { constructor(); length: number; [index: number]: T; } }
2+

0 commit comments

Comments
 (0)