-
Notifications
You must be signed in to change notification settings - Fork 0
/
marshmallow-loader.android.ts
75 lines (61 loc) · 2.47 KB
/
marshmallow-loader.android.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/***************************************************************************************
* Made for the {N} community by Brad Martin @BradWayneMartin
* https://twitter.com/BradWayneMartin
* https://github.com/bradmartin
* http://bradmartin.net
* Open Source Lib : https://github.com/Cleveroad/CRAndroidMBootAnimationView
*************************************************************************************/
import { View } from "ui/core/view";
import { Color } from "color";
import { Page } from "ui/page";
import { Frame, AndroidFrame } from "ui/frame";
import * as app from "application";
declare var android, com: any;
interface DialogOptions {
backgroundColor: string,
firstColor: string,
secondColor: string,
thirdColor: string,
fourthColor: string,
speedCoefficient: number
}
export class MarshmallowLoader extends View {
private _androidViewId: number;
private _android: com.cleveroad.androidmanimation.LoadingAnimationView;
get android(): any {
return this._android;
}
get _nativeView(): any {
return this._android;
}
public _createUI() {
let LoadingAnimationView = com.cleveroad.androidmanimation.LoadingAnimationView;
this._android = new LoadingAnimationView(this._context);
if (!this._androidViewId) {
this._androidViewId = android.view.View.generateViewId();
}
this._android.setId(this._androidViewId);
}
public startAnimation() {
this._android.startAnimation();
}
public pauseAnimation() {
this._android.pauseAnimation();
}
public stopAnimation() {
this._android.stopAnimation();
}
// public showDialog(DialogOptions) {
// let fragMgr = app.android.startActivity || app.android.foregroundActivity;
// let AnimationDialogFragment = com.cleveroad.androidmanimation.AnimationDialogFragment;
// let fragment = new AnimationDialogFragment.Builder()
// .setBackgroundColor(new Color(DialogOptions.backgroundColor).android)
// .setFirstColor(new Color(DialogOptions.firstColor).android)
// .setSecondColor(new Color(DialogOptions.secondColor).android)
// .setThirdColor(new Color(DialogOptions.thirdColor).android)
// .setFourthColor(new Color(DialogOptions.fourthColor).android)
// .setSpeedCoefficient(DialogOptions.speedCoefficient)
// .build();
// fragment.show(fragMgr.getFragmentManager(), "Animation");
// }
}