Java Code Examples for android.widget.FrameLayout#setScaleX()

The following examples show how to use android.widget.FrameLayout#setScaleX() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UpdateAppAlertDialog.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
public UpdateAppAlertDialog(final Activity activity, TLRPC.TL_help_appUpdate update, int account) {
    super(activity, 0);
    appUpdate = update;
    accountNum = account;
    if (update.document instanceof TLRPC.TL_document) {
        fileName = FileLoader.getAttachFileName(update.document);
    }
    parentActivity = activity;

    setTopImage(R.drawable.update, Theme.getColor(Theme.key_dialogTopBackground));
    setTopHeight(175);
    setMessage(appUpdate.text);
    if (appUpdate.document instanceof TLRPC.TL_document) {
        setSecondTitle(AndroidUtilities.formatFileSize(appUpdate.document.size));
    }
    setDismissDialogByButtons(false);
    setTitle(LocaleController.getString("UpdateTelegram", R.string.UpdateTelegram));
    setPositiveButton(LocaleController.getString("UpdateNow", R.string.UpdateNow), (dialog, which) ->
    {
        if (!BlockingUpdateView.checkApkInstallPermissions(getContext())) {
            return;
        }
        if (appUpdate.document instanceof TLRPC.TL_document) {
            if (!BlockingUpdateView.openApkInstall(parentActivity, appUpdate.document)) {
                FileLoader.getInstance(accountNum).loadFile(appUpdate.document, true, 1);
                showProgress(true);
            }
        } else if (appUpdate.url != null) {
            Browser.openUrl(getContext(), appUpdate.url);
            dialog.dismiss();
        }
    });
    setNeutralButton(LocaleController.getString("Later", R.string.Later), (dialog, which) ->
    {
        if (appUpdate.document instanceof TLRPC.TL_document) {
            FileLoader.getInstance(accountNum).cancelLoadFile(appUpdate.document);
        }
        dialog.dismiss();
    });

    radialProgressView = new FrameLayout(parentActivity) {
        @Override
        protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
            super.onLayout(changed, left, top, right, bottom);
            int width = right - left;
            int height = bottom - top;
            int w = AndroidUtilities.dp(24);
            int l = (width - w) / 2;
            int t = (height - w) / 2 + AndroidUtilities.dp(2);
            radialProgress.setProgressRect(l, t, l + w, t + w);
        }

        @Override
        protected void onDraw(Canvas canvas) {
            radialProgress.draw(canvas);
        }
    };
    radialProgressView.setWillNotDraw(false);
    radialProgressView.setAlpha(0.0f);
    radialProgressView.setScaleX(0.1f);
    radialProgressView.setScaleY(0.1f);
    radialProgressView.setVisibility(View.INVISIBLE);
    radialProgress = new RadialProgress(radialProgressView);
    radialProgress.setStrokeWidth(AndroidUtilities.dp(2));
    radialProgress.setBackground(null, true, false);
    radialProgress.setProgressColor(Theme.getColor(Theme.key_dialogButton));
}
 
Example 2
Source File: UpdateAppAlertDialog.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
public UpdateAppAlertDialog(final Activity activity, TLRPC.TL_help_appUpdate update, int account) {
    super(activity, 0);
    appUpdate = update;
    accountNum = account;
    if (update.document instanceof TLRPC.TL_document) {
        fileName = FileLoader.getAttachFileName(update.document);
    }
    parentActivity = activity;

    setTopImage(R.drawable.update, Theme.getColor(Theme.key_dialogTopBackground));
    setTopHeight(175);
    setMessage(appUpdate.text);
    if (appUpdate.document instanceof TLRPC.TL_document) {
        setSecondTitle(AndroidUtilities.formatFileSize(appUpdate.document.size));
    }
    setDismissDialogByButtons(false);
    setTitle(LocaleController.getString("UpdateTelegram", R.string.UpdateTelegram));
    setPositiveButton(LocaleController.getString("UpdateNow", R.string.UpdateNow), (dialog, which) ->
    {
        if (!BlockingUpdateView.checkApkInstallPermissions(getContext())) {
            return;
        }
        if (appUpdate.document instanceof TLRPC.TL_document) {
            if (!BlockingUpdateView.openApkInstall(parentActivity, appUpdate.document)) {
                FileLoader.getInstance(accountNum).loadFile(appUpdate.document, true, 1);
                showProgress(true);
            }
        } else if (appUpdate.url != null) {
            Browser.openUrl(getContext(), appUpdate.url);
            dialog.dismiss();
        }
    });
    setNeutralButton(LocaleController.getString("Later", R.string.Later), (dialog, which) ->
    {
        if (appUpdate.document instanceof TLRPC.TL_document) {
            FileLoader.getInstance(accountNum).cancelLoadFile(appUpdate.document);
        }
        dialog.dismiss();
    });

    radialProgressView = new FrameLayout(parentActivity) {
        @Override
        protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
            super.onLayout(changed, left, top, right, bottom);
            int width = right - left;
            int height = bottom - top;
            int w = AndroidUtilities.dp(24);
            int l = (width - w) / 2;
            int t = (height - w) / 2 + AndroidUtilities.dp(2);
            radialProgress.setProgressRect(l, t, l + w, t + w);
        }

        @Override
        protected void onDraw(Canvas canvas) {
            radialProgress.draw(canvas);
        }
    };
    radialProgressView.setWillNotDraw(false);
    radialProgressView.setAlpha(0.0f);
    radialProgressView.setScaleX(0.1f);
    radialProgressView.setScaleY(0.1f);
    radialProgressView.setVisibility(View.INVISIBLE);
    radialProgress = new RadialProgress(radialProgressView);
    radialProgress.setStrokeWidth(AndroidUtilities.dp(2));
    radialProgress.setBackground(null, true, false);
    radialProgress.setProgressColor(Theme.getColor(Theme.key_dialogButton));
}
 
Example 3
Source File: UpdateAppAlertDialog.java    From Telegram-FOSS with GNU General Public License v2.0 4 votes vote down vote up
public UpdateAppAlertDialog(final Activity activity, TLRPC.TL_help_appUpdate update, int account) {
    super(activity, 0);
    appUpdate = update;
    accountNum = account;
    if (update.document instanceof TLRPC.TL_document) {
        fileName = FileLoader.getAttachFileName(update.document);
    }
    parentActivity = activity;

    setTopImage(R.drawable.update, Theme.getColor(Theme.key_dialogTopBackground));
    setTopHeight(175);
    setMessage(appUpdate.text);
    if (appUpdate.document instanceof TLRPC.TL_document) {
        setSecondTitle(AndroidUtilities.formatFileSize(appUpdate.document.size));
    }
    setDismissDialogByButtons(false);
    setTitle(LocaleController.getString("UpdateTelegram", R.string.UpdateTelegram));
    setPositiveButton(LocaleController.getString("UpdateNow", R.string.UpdateNow), (dialog, which) -> {
        if (!BlockingUpdateView.checkApkInstallPermissions(getContext())) {
            return;
        }
        if (appUpdate.document instanceof TLRPC.TL_document) {
            if (!BlockingUpdateView.openApkInstall(parentActivity, appUpdate.document)) {
                FileLoader.getInstance(accountNum).loadFile(appUpdate.document, "update", 1, 1);
                showProgress(true);
            }
        } else if (appUpdate.url != null) {
            Browser.openUrl(getContext(), appUpdate.url);
            dialog.dismiss();
        }
    });
    setNeutralButton(LocaleController.getString("Later", R.string.Later), (dialog, which) -> {
        if (appUpdate.document instanceof TLRPC.TL_document) {
            FileLoader.getInstance(accountNum).cancelLoadFile(appUpdate.document);
        }
        dialog.dismiss();
    });

    radialProgressView = new FrameLayout(parentActivity) {
        @Override
        protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
            super.onLayout(changed, left, top, right, bottom);
            int width = right - left;
            int height = bottom - top;
            int w = AndroidUtilities.dp(24);
            int l = (width - w) / 2;
            int t = (height - w) / 2 + AndroidUtilities.dp(2);
            radialProgress.setProgressRect(l, t, l + w, t + w);
        }

        @Override
        protected void onDraw(Canvas canvas) {
            radialProgress.draw(canvas);
        }
    };
    radialProgressView.setWillNotDraw(false);
    radialProgressView.setAlpha(0.0f);
    radialProgressView.setScaleX(0.1f);
    radialProgressView.setScaleY(0.1f);
    radialProgressView.setVisibility(View.INVISIBLE);
    radialProgress = new RadialProgress(radialProgressView);
    radialProgress.setStrokeWidth(AndroidUtilities.dp(2));
    radialProgress.setBackground(null, true, false);
    radialProgress.setProgressColor(Theme.getColor(Theme.key_dialogButton));
}
 
Example 4
Source File: UpdateAppAlertDialog.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
public UpdateAppAlertDialog(final Activity activity, TLRPC.TL_help_appUpdate update, int account) {
    super(activity, 0);
    appUpdate = update;
    accountNum = account;
    if (update.document instanceof TLRPC.TL_document) {
        fileName = FileLoader.getAttachFileName(update.document);
    }
    parentActivity = activity;

    setTopImage(R.drawable.update, Theme.getColor(Theme.key_dialogTopBackground));
    setTopHeight(175);
    setMessage(appUpdate.text);
    if (appUpdate.document instanceof TLRPC.TL_document) {
        setSecondTitle(AndroidUtilities.formatFileSize(appUpdate.document.size));
    }
    setDismissDialogByButtons(false);
    setTitle(LocaleController.getString("UpdateTelegram", R.string.UpdateTelegram));
    setPositiveButton(LocaleController.getString("UpdateNow", R.string.UpdateNow), (dialog, which) -> {
        if (!BlockingUpdateView.checkApkInstallPermissions(getContext())) {
            return;
        }
        if (appUpdate.document instanceof TLRPC.TL_document) {
            if (!BlockingUpdateView.openApkInstall(parentActivity, appUpdate.document)) {
                FileLoader.getInstance(accountNum).loadFile(appUpdate.document, "update", 1, 1);
                showProgress(true);
            }
        } else if (appUpdate.url != null) {
            Browser.openUrl(getContext(), appUpdate.url);
            dialog.dismiss();
        }
    });
    setNeutralButton(LocaleController.getString("Later", R.string.Later), (dialog, which) -> {
        if (appUpdate.document instanceof TLRPC.TL_document) {
            FileLoader.getInstance(accountNum).cancelLoadFile(appUpdate.document);
        }
        dialog.dismiss();
    });

    radialProgressView = new FrameLayout(parentActivity) {
        @Override
        protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
            super.onLayout(changed, left, top, right, bottom);
            int width = right - left;
            int height = bottom - top;
            int w = AndroidUtilities.dp(24);
            int l = (width - w) / 2;
            int t = (height - w) / 2 + AndroidUtilities.dp(2);
            radialProgress.setProgressRect(l, t, l + w, t + w);
        }

        @Override
        protected void onDraw(Canvas canvas) {
            radialProgress.draw(canvas);
        }
    };
    radialProgressView.setWillNotDraw(false);
    radialProgressView.setAlpha(0.0f);
    radialProgressView.setScaleX(0.1f);
    radialProgressView.setScaleY(0.1f);
    radialProgressView.setVisibility(View.INVISIBLE);
    radialProgress = new RadialProgress(radialProgressView);
    radialProgress.setStrokeWidth(AndroidUtilities.dp(2));
    radialProgress.setBackground(null, true, false);
    radialProgress.setProgressColor(Theme.getColor(Theme.key_dialogButton));
}