function ProgressWindow(theme, canForceShutdown) {
        theme = theme || Theme.DEFAULT;
        let thiz = this,
            gradientDrawable = new GradientDrawable_(),
            layout = new LinearLayout_(CONTEXT);
        thiz._theme = theme;
        thiz._window = new PopupWindow_(CONTEXT);
        thiz._textView = new TextView_(CONTEXT);
        thiz._layout = new LinearLayout_(CONTEXT);
        thiz._effect = new TextView_(CONTEXT);
        thiz._isRunning = true;
        thiz._window.setBackgroundDrawable(new ColorDrawable_(theme.getProgressWindow(Theme.BACKGROUND_COLOR)));
        thiz._window.setContentView(layout);
        thiz._window.setWidth(DEVICE_WIDTH);
        thiz._window.setHeight(DEVICE_HEIGHT);
        thiz._textView.setGravity(Gravity_.CENTER);
        thiz._textView.setPadding(DP * 12, DP * 8, DP * 12, DP * 24);
        thiz._textView.setText("Now Loading...");
        thiz._textView.setTextColor(theme.getProgressWindow(Theme.TEXT_COLOR));
        thiz._textView.setTextSize(1, 18);
        gradientDrawable.setColors([theme.getProgressWindow(Theme.EFFECT_COLOR), theme.getProgressWindow(Theme.TEXT_COLOR)]);
        gradientDrawable.setOrientation(GradientDrawable_.Orientation.LEFT_RIGHT);
        thiz._effect.setBackgroundDrawable(gradientDrawable);
        thiz._layout.addView(thiz._effect);
        thiz._layout.setBackgroundDrawable(new ColorDrawable_(theme.getProgressWindow(Theme.TEXT_COLOR)));
        thiz._layout.setGravity(Gravity_.LEFT);
        thiz._layout.setLayoutParams(LinearLayout_.LayoutParams(DP * 304, DP * 28));
        thiz._layout.setPadding(DP * 2, DP * 2, DP * 2, DP * 2);
        layout.addView(thiz._textView);
        layout.addView(thiz._layout);
        layout.setGravity(Gravity_.CENTER);
        layout.setOrientation(1);

        if (typeof canForceShutdown === "undefined" || canForceShutdown) {
            new Thread_({
                run() {
                    let max = DP * 300,
                        isIncreasing,
                        canForceShutdown = false,
                        time = 0,
                        progress = 0;
                    while (thiz._isRunning) {
                        Thread_.sleep(5);
                        if (progress >= max) {
                            isIncreasing = false;
                        } else if (progress <= 0) {
                            isIncreasing = true;
                        }
                        time += 5;
                        progress += isIncreasing ? DP : -DP;
                        CONTEXT.runOnUiThread({
                            run() {
                                if (time >= 5000 && !canForceShutdown) {
                                    canForceShutdown = true;
                                    thiz._textView.setText(thiz._textView.getText() + "\n\n[Force shutdown]");
                                    thiz._textView.setOnClickListener(new View_.OnClickListener({
                                        onClick(view) {
                                            thiz._isRunning = false;
                                            thiz._window.dismiss();
                                        }
                                    }));
                                }
                                thiz._effect.setLayoutParams(LinearLayout_.LayoutParams(progress, DP * 24));
                            }
                        });
                    }
                }
            }).start();
        }
    }
/**
     * Class representing a progress window.
     * @since 2016-07-05
     * @class
     * @memberOf me.astro.widget
     * @param {me.astro.design.Theme} [theme=me.astro.design.Theme.DEFAULT] Theme of window
     * @param {Boolean} [canForceShutdown=true] Enables force shutdown
     */
Class representing a progress window.
Class representing a progress window .
function ProgressWindow(theme, canForceShutdown) {
        theme = theme || Theme.DEFAULT;
        let thiz = this,
            gradientDrawable = new GradientDrawable_(),
            layout = new LinearLayout_(CONTEXT);
        thiz._theme = theme;
        thiz._window = new PopupWindow_(CONTEXT);
        thiz._textView = new TextView_(CONTEXT);
        thiz._layout = new LinearLayout_(CONTEXT);
        thiz._effect = new TextView_(CONTEXT);
        thiz._isRunning = true;
        thiz._window.setBackgroundDrawable(new ColorDrawable_(theme.getProgressWindow(Theme.BACKGROUND_COLOR)));
        thiz._window.setContentView(layout);
        thiz._window.setWidth(DEVICE_WIDTH);
        thiz._window.setHeight(DEVICE_HEIGHT);
        thiz._textView.setGravity(Gravity_.CENTER);
        thiz._textView.setPadding(DP * 12, DP * 8, DP * 12, DP * 24);
        thiz._textView.setText("Now Loading...");
        thiz._textView.setTextColor(theme.getProgressWindow(Theme.TEXT_COLOR));
        thiz._textView.setTextSize(1, 18);
        gradientDrawable.setColors([theme.getProgressWindow(Theme.EFFECT_COLOR), theme.getProgressWindow(Theme.TEXT_COLOR)]);
        gradientDrawable.setOrientation(GradientDrawable_.Orientation.LEFT_RIGHT);
        thiz._effect.setBackgroundDrawable(gradientDrawable);
        thiz._layout.addView(thiz._effect);
        thiz._layout.setBackgroundDrawable(new ColorDrawable_(theme.getProgressWindow(Theme.TEXT_COLOR)));
        thiz._layout.setGravity(Gravity_.LEFT);
        thiz._layout.setLayoutParams(LinearLayout_.LayoutParams(DP * 304, DP * 28));
        thiz._layout.setPadding(DP * 2, DP * 2, DP * 2, DP * 2);
        layout.addView(thiz._textView);
        layout.addView(thiz._layout);
        layout.setGravity(Gravity_.CENTER);
        layout.setOrientation(1);
        if (typeof canForceShutdown === "undefined" || canForceShutdown) {
            new Thread_({
                run() {
                    let max = DP * 300,
                        isIncreasing,
                        canForceShutdown = false,
                        time = 0,
                        progress = 0;
                    while (thiz._isRunning) {
                        Thread_.sleep(5);
                        if (progress >= max) {
                            isIncreasing = false;
                        } else if (progress <= 0) {
                            isIncreasing = true;
                        }
                        time += 5;
                        progress += isIncreasing ? DP : -DP;
                        CONTEXT.runOnUiThread({
                            run() {
                                if (time >= 5000 && !canForceShutdown) {
                                    canForceShutdown = true;
                                    thiz._textView.setText(thiz._textView.getText() + "\n\n[Force shutdown]");
                                    thiz._textView.setOnClickListener(new View_.OnClickListener({
                                        onClick(view) {
                                            thiz._isRunning = false;
                                            thiz._window.dismiss();
                                        }
                                    }));
                                }
                                thiz._effect.setLayoutParams(LinearLayout_.LayoutParams(progress, DP * 24));
                            }
                        });
                    }
                }
            }).start();
        }
    }
function ProgressWindow ( theme , canForceShutdown ) { theme = theme || Theme . DEFAULT ; let thiz = this , gradientDrawable = new GradientDrawable_ ( ) , layout = new LinearLayout_ ( CONTEXT ) ; thiz . _theme = theme ; thiz . _window = new PopupWindow_ ( CONTEXT ) ; thiz . _textView = new TextView_ ( CONTEXT ) ; thiz . _layout = new LinearLayout_ ( CONTEXT ) ; thiz . _effect = new TextView_ ( CONTEXT ) ; thiz . _isRunning = true ; thiz . _window . setBackgroundDrawable ( new ColorDrawable_ ( theme . getProgressWindow ( Theme . BACKGROUND_COLOR ) ) ) ; thiz . _window . setContentView ( layout ) ; thiz . _window . setWidth ( DEVICE_WIDTH ) ; thiz . _window . setHeight ( DEVICE_HEIGHT ) ; thiz . _textView . setGravity ( Gravity_ . CENTER ) ; thiz . _textView . setPadding ( DP * 12 , DP * 8 , DP * 12 , DP * 24 ) ; thiz . _textView . setText ( "Now Loading..." ) ; thiz . _textView . setTextColor ( theme . getProgressWindow ( Theme . TEXT_COLOR ) ) ; thiz . _textView . setTextSize ( 1 , 18 ) ; gradientDrawable . setColors ( [ theme . getProgressWindow ( Theme . EFFECT_COLOR ) , theme . getProgressWindow ( Theme . TEXT_COLOR ) ] ) ; gradientDrawable . setOrientation ( GradientDrawable_ . Orientation . LEFT_RIGHT ) ; thiz . _effect . setBackgroundDrawable ( gradientDrawable ) ; thiz . _layout . addView ( thiz . _effect ) ; thiz . _layout . setBackgroundDrawable ( new ColorDrawable_ ( theme . getProgressWindow ( Theme . TEXT_COLOR ) ) ) ; thiz . _layout . setGravity ( Gravity_ . LEFT ) ; thiz . _layout . setLayoutParams ( LinearLayout_ . LayoutParams ( DP * 304 , DP * 28 ) ) ; thiz . _layout . setPadding ( DP * 2 , DP * 2 , DP * 2 , DP * 2 ) ; layout . addView ( thiz . _textView ) ; layout . addView ( thiz . _layout ) ; layout . setGravity ( Gravity_ . CENTER ) ; layout . setOrientation ( 1 ) ; if ( typeof canForceShutdown === "undefined" || canForceShutdown ) { new Thread_ ( { run ( ) { let max = DP * 300 , isIncreasing , canForceShutdown = false , time = 0 , progress = 0 ; while ( thiz . _isRunning ) { Thread_ . sleep ( 5 ) ; if ( progress >= max ) { isIncreasing = false ; } else if ( progress <= 0 ) { isIncreasing = true ; } time += 5 ; progress += isIncreasing ? DP : - DP ; CONTEXT . runOnUiThread ( { run ( ) { if ( time >= 5000 && ! canForceShutdown ) { canForceShutdown = true ; thiz . _textView . setText ( thiz . _textView . getText ( ) + "\n\n[Force shutdown]" ) ; thiz . _textView . setOnClickListener ( new View_ . OnClickListener ( { onClick ( view ) { thiz . _isRunning = false ; thiz . _window . dismiss ( ) ; } } ) ) ; } thiz . _effect . setLayoutParams ( LinearLayout_ . LayoutParams ( progress , DP * 24 ) ) ; } } ) ; } } } ) . start ( ) ; } }
Class representing a progress window.
Class representing a progress window .