first custom dialogs implementation

This commit is contained in:
Vladimir Enchev
2014-06-06 10:01:33 +03:00
parent 459e03d8ed
commit df1d0923d1
4 changed files with 93 additions and 0 deletions

View File

@@ -98,4 +98,36 @@ export function prompt(arg: any): promises.Promise<string> {
}
return d.promise();
}
export class Dialog {
private _dialog: android.app.AlertDialog;
private _android: android.app.AlertDialog.Builder;
private _title: string;
constructor() {
this._android = new android.app.AlertDialog.Builder(appmodule.android.foregroundActivity);
}
get android(): android.app.AlertDialog.Builder {
return this._android;
}
get title(): string {
return this._title;
}
set title(value: string) {
this._title = value;
this.android.setTitle(this._title);
}
public show() {
this._dialog = this.android.show();
}
public hide() {
if (this._dialog) {
this._dialog.hide();
}
}
}