Example usage for android.widget RelativeLayout END_OF

List of usage examples for android.widget RelativeLayout END_OF

Introduction

In this page you can find the example usage for android.widget RelativeLayout END_OF.

Prototype

int END_OF

To view the source code for android.widget RelativeLayout END_OF.

Click Source Link

Document

Rule that aligns a child's start edge with another child's end edge.

Usage

From source file:kr.wdream.ui.Components.PasscodeView.java

private void checkFingerprint() {
    Activity parentActivity = (Activity) getContext();
    if (Build.VERSION.SDK_INT >= 23 && parentActivity != null && UserConfig.useFingerprint
            && !ApplicationLoader.mainInterfacePaused) {
        try {/*from w  ww . j a v a 2  s .c  o m*/
            if (fingerprintDialog != null && fingerprintDialog.isShowing()) {
                return;
            }
        } catch (Exception e) {
            FileLog.e("tmessages", e);
        }
        try {
            FingerprintManagerCompat fingerprintManager = FingerprintManagerCompat
                    .from(ApplicationLoader.applicationContext);
            if (fingerprintManager.isHardwareDetected() && fingerprintManager.hasEnrolledFingerprints()) {
                RelativeLayout relativeLayout = new RelativeLayout(getContext());
                relativeLayout.setPadding(AndroidUtilities.dp(24), AndroidUtilities.dp(16),
                        AndroidUtilities.dp(24), AndroidUtilities.dp(8));

                TextView fingerprintTextView = new TextView(getContext());
                fingerprintTextView.setTextColor(0xff939393);
                fingerprintTextView.setId(id_fingerprint_textview);
                fingerprintTextView.setTextAppearance(android.R.style.TextAppearance_Material_Subhead);
                fingerprintTextView.setText(LocaleController.getString("FingerprintInfo",
                        kr.wdream.storyshop.R.string.FingerprintInfo));
                relativeLayout.addView(fingerprintTextView);
                RelativeLayout.LayoutParams layoutParams = LayoutHelper
                        .createRelative(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT);
                layoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP);
                layoutParams.addRule(RelativeLayout.ALIGN_PARENT_START);
                fingerprintTextView.setLayoutParams(layoutParams);

                fingerprintImageView = new ImageView(getContext());
                fingerprintImageView.setImageResource(kr.wdream.storyshop.R.drawable.ic_fp_40px);
                fingerprintImageView.setId(id_fingerprint_imageview);
                relativeLayout.addView(fingerprintImageView,
                        LayoutHelper.createRelative(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, 0, 20,
                                0, 0, RelativeLayout.ALIGN_PARENT_START, RelativeLayout.BELOW,
                                id_fingerprint_textview));

                fingerprintStatusTextView = new TextView(getContext());
                fingerprintStatusTextView.setGravity(Gravity.CENTER_VERTICAL);
                fingerprintStatusTextView.setText(LocaleController.getString("FingerprintHelp",
                        kr.wdream.storyshop.R.string.FingerprintHelp));
                fingerprintStatusTextView.setTextAppearance(android.R.style.TextAppearance_Material_Body1);
                fingerprintStatusTextView.setTextColor(0x42000000);
                relativeLayout.addView(fingerprintStatusTextView);
                layoutParams = LayoutHelper.createRelative(LayoutHelper.WRAP_CONTENT,
                        LayoutHelper.WRAP_CONTENT);
                layoutParams.setMarginStart(AndroidUtilities.dp(16));
                layoutParams.addRule(RelativeLayout.ALIGN_BOTTOM, id_fingerprint_imageview);
                layoutParams.addRule(RelativeLayout.ALIGN_TOP, id_fingerprint_imageview);
                layoutParams.addRule(RelativeLayout.END_OF, id_fingerprint_imageview);
                fingerprintStatusTextView.setLayoutParams(layoutParams);

                AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
                builder.setTitle(LocaleController.getString("AppName", kr.wdream.storyshop.R.string.AppName));
                builder.setView(relativeLayout);
                builder.setNegativeButton(
                        LocaleController.getString("Cancel", kr.wdream.storyshop.R.string.Cancel), null);
                builder.setOnDismissListener(new DialogInterface.OnDismissListener() {
                    @Override
                    public void onDismiss(DialogInterface dialog) {
                        if (cancellationSignal != null) {
                            selfCancelled = true;
                            cancellationSignal.cancel();
                            cancellationSignal = null;
                        }
                    }
                });
                if (fingerprintDialog != null) {
                    try {
                        if (fingerprintDialog.isShowing()) {
                            fingerprintDialog.dismiss();
                        }
                    } catch (Exception e) {
                        FileLog.e("tmessages", e);
                    }
                }
                fingerprintDialog = builder.show();

                cancellationSignal = new CancellationSignal();
                selfCancelled = false;
                fingerprintManager.authenticate(null, 0, cancellationSignal,
                        new FingerprintManagerCompat.AuthenticationCallback() {
                            @Override
                            public void onAuthenticationError(int errMsgId, CharSequence errString) {
                                if (!selfCancelled) {
                                    showFingerprintError(errString);
                                }
                            }

                            @Override
                            public void onAuthenticationHelp(int helpMsgId, CharSequence helpString) {
                                showFingerprintError(helpString);
                            }

                            @Override
                            public void onAuthenticationFailed() {
                                showFingerprintError(LocaleController.getString("FingerprintNotRecognized",
                                        kr.wdream.storyshop.R.string.FingerprintNotRecognized));
                            }

                            @Override
                            public void onAuthenticationSucceeded(
                                    FingerprintManagerCompat.AuthenticationResult result) {
                                try {
                                    if (fingerprintDialog.isShowing()) {
                                        fingerprintDialog.dismiss();
                                    }
                                } catch (Exception e) {
                                    FileLog.e("tmessages", e);
                                }
                                fingerprintDialog = null;
                                processDone(true);
                            }
                        }, null);
            }
        } catch (Throwable e) {
            //ignore
        }
    }
}

From source file:ir.besteveryeverapp.ui.Components.PasscodeView.java

private void checkFingerprint() {
    Activity parentActivity = (Activity) getContext();
    if (Build.VERSION.SDK_INT >= 23 && parentActivity != null && UserConfig.useFingerprint
            && !ApplicationLoader.mainInterfacePaused) {
        try {//from  w w  w  .j a  va2s.  co m
            if (fingerprintDialog != null && fingerprintDialog.isShowing()) {
                return;
            }
        } catch (Exception e) {
            FileLog.e("tmessages", e);
        }
        try {
            FingerprintManagerCompat fingerprintManager = FingerprintManagerCompat
                    .from(ApplicationLoader.applicationContext);
            if (fingerprintManager.isHardwareDetected() && fingerprintManager.hasEnrolledFingerprints()) {
                RelativeLayout relativeLayout = new RelativeLayout(getContext());
                relativeLayout.setPadding(AndroidUtilities.dp(24), AndroidUtilities.dp(16),
                        AndroidUtilities.dp(24), AndroidUtilities.dp(8));

                TextView fingerprintTextView = new TextView(getContext());
                fingerprintTextView.setTypeface(FontManager.instance().getTypeface());
                fingerprintTextView.setTextColor(0xff939393);
                fingerprintTextView.setId(id_fingerprint_textview);
                fingerprintTextView.setTextAppearance(android.R.style.TextAppearance_Material_Subhead);
                fingerprintTextView
                        .setText(LocaleController.getString("FingerprintInfo", R.string.FingerprintInfo));
                relativeLayout.addView(fingerprintTextView);
                RelativeLayout.LayoutParams layoutParams = LayoutHelper
                        .createRelative(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT);
                layoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP);
                layoutParams.addRule(RelativeLayout.ALIGN_PARENT_START);
                fingerprintTextView.setLayoutParams(layoutParams);

                fingerprintImageView = new ImageView(getContext());
                fingerprintImageView.setImageResource(R.drawable.ic_fp_40px);
                fingerprintImageView.setId(id_fingerprint_imageview);
                relativeLayout.addView(fingerprintImageView,
                        LayoutHelper.createRelative(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, 0, 20,
                                0, 0, RelativeLayout.ALIGN_PARENT_START, RelativeLayout.BELOW,
                                id_fingerprint_textview));

                fingerprintStatusTextView = new TextView(getContext());
                fingerprintStatusTextView.setTypeface(FontManager.instance().getTypeface());
                fingerprintStatusTextView.setGravity(Gravity.CENTER_VERTICAL);
                fingerprintStatusTextView
                        .setText(LocaleController.getString("FingerprintHelp", R.string.FingerprintHelp));
                fingerprintStatusTextView.setTextAppearance(android.R.style.TextAppearance_Material_Body1);
                fingerprintStatusTextView.setTextColor(0x42000000);
                relativeLayout.addView(fingerprintStatusTextView);
                layoutParams = LayoutHelper.createRelative(LayoutHelper.WRAP_CONTENT,
                        LayoutHelper.WRAP_CONTENT);
                layoutParams.setMarginStart(AndroidUtilities.dp(16));
                layoutParams.addRule(RelativeLayout.ALIGN_BOTTOM, id_fingerprint_imageview);
                layoutParams.addRule(RelativeLayout.ALIGN_TOP, id_fingerprint_imageview);
                layoutParams.addRule(RelativeLayout.END_OF, id_fingerprint_imageview);
                fingerprintStatusTextView.setLayoutParams(layoutParams);

                AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
                builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
                builder.setView(relativeLayout);
                builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
                builder.setOnDismissListener(new DialogInterface.OnDismissListener() {
                    @Override
                    public void onDismiss(DialogInterface dialog) {
                        if (cancellationSignal != null) {
                            selfCancelled = true;
                            cancellationSignal.cancel();
                            cancellationSignal = null;
                        }
                    }
                });
                if (fingerprintDialog != null) {
                    try {
                        if (fingerprintDialog.isShowing()) {
                            fingerprintDialog.dismiss();
                        }
                    } catch (Exception e) {
                        FileLog.e("tmessages", e);
                    }
                }
                fingerprintDialog = builder.show();

                cancellationSignal = new CancellationSignal();
                selfCancelled = false;
                fingerprintManager.authenticate(null, 0, cancellationSignal,
                        new FingerprintManagerCompat.AuthenticationCallback() {
                            @Override
                            public void onAuthenticationError(int errMsgId, CharSequence errString) {
                                if (!selfCancelled) {
                                    showFingerprintError(errString);
                                }
                            }

                            @Override
                            public void onAuthenticationHelp(int helpMsgId, CharSequence helpString) {
                                showFingerprintError(helpString);
                            }

                            @Override
                            public void onAuthenticationFailed() {
                                showFingerprintError(LocaleController.getString("FingerprintNotRecognized",
                                        R.string.FingerprintNotRecognized));
                            }

                            @Override
                            public void onAuthenticationSucceeded(
                                    FingerprintManagerCompat.AuthenticationResult result) {
                                try {
                                    if (fingerprintDialog.isShowing()) {
                                        fingerprintDialog.dismiss();
                                    }
                                } catch (Exception e) {
                                    FileLog.e("tmessages", e);
                                }
                                fingerprintDialog = null;
                                processDone(true);
                            }
                        }, null);
            }
        } catch (Throwable e) {
            //ignore
        }
    }
}

From source file:com.goftagram.telegram.ui.Components.PasscodeView.java

private void checkFingerprint() {
    Activity parentActivity = (Activity) getContext();
    if (Build.VERSION.SDK_INT >= 23 && parentActivity != null && UserConfig.useFingerprint
            && !ApplicationLoader.mainInterfacePaused) {
        try {/*from  w  w  w .  j a v a2  s  .c  o m*/
            if (fingerprintDialog != null && fingerprintDialog.isShowing()) {
                return;
            }
        } catch (Exception e) {
            FileLog.e("tmessages", e);
        }
        try {
            FingerprintManagerCompat fingerprintManager = FingerprintManagerCompat
                    .from(ApplicationLoader.applicationContext);
            if (fingerprintManager.isHardwareDetected() && fingerprintManager.hasEnrolledFingerprints()) {
                RelativeLayout relativeLayout = new RelativeLayout(getContext());
                relativeLayout.setPadding(AndroidUtilities.dp(24), AndroidUtilities.dp(16),
                        AndroidUtilities.dp(24), AndroidUtilities.dp(8));

                TextView fingerprintTextView = new TextView(getContext());
                fingerprintTextView.setTextColor(0xff939393);
                fingerprintTextView.setId(id_fingerprint_textview);
                fingerprintTextView.setTextAppearance(android.R.style.TextAppearance_Material_Subhead);
                fingerprintTextView
                        .setText(LocaleController.getString("FingerprintInfo", R.string.FingerprintInfo));
                relativeLayout.addView(fingerprintTextView);
                RelativeLayout.LayoutParams layoutParams = LayoutHelper
                        .createRelative(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT);
                layoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP);
                layoutParams.addRule(RelativeLayout.ALIGN_PARENT_START);
                fingerprintTextView.setLayoutParams(layoutParams);

                fingerprintImageView = new ImageView(getContext());
                fingerprintImageView.setImageResource(R.drawable.ic_fp_40px);
                fingerprintImageView.setId(id_fingerprint_imageview);
                relativeLayout.addView(fingerprintImageView,
                        LayoutHelper.createRelative(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, 0, 20,
                                0, 0, RelativeLayout.ALIGN_PARENT_START, RelativeLayout.BELOW,
                                id_fingerprint_textview));

                fingerprintStatusTextView = new TextView(getContext());
                fingerprintStatusTextView.setGravity(Gravity.CENTER_VERTICAL);
                fingerprintStatusTextView
                        .setText(LocaleController.getString("FingerprintHelp", R.string.FingerprintHelp));
                fingerprintStatusTextView.setTextAppearance(android.R.style.TextAppearance_Material_Body1);
                fingerprintStatusTextView.setTextColor(0x42000000);
                relativeLayout.addView(fingerprintStatusTextView);
                layoutParams = LayoutHelper.createRelative(LayoutHelper.WRAP_CONTENT,
                        LayoutHelper.WRAP_CONTENT);
                layoutParams.setMarginStart(AndroidUtilities.dp(16));
                layoutParams.addRule(RelativeLayout.ALIGN_BOTTOM, id_fingerprint_imageview);
                layoutParams.addRule(RelativeLayout.ALIGN_TOP, id_fingerprint_imageview);
                layoutParams.addRule(RelativeLayout.END_OF, id_fingerprint_imageview);
                fingerprintStatusTextView.setLayoutParams(layoutParams);

                AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
                builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
                builder.setView(relativeLayout);
                builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
                builder.setOnDismissListener(new DialogInterface.OnDismissListener() {
                    @Override
                    public void onDismiss(DialogInterface dialog) {
                        if (cancellationSignal != null) {
                            selfCancelled = true;
                            cancellationSignal.cancel();
                            cancellationSignal = null;
                        }
                    }
                });
                if (fingerprintDialog != null) {
                    try {
                        if (fingerprintDialog.isShowing()) {
                            fingerprintDialog.dismiss();
                        }
                    } catch (Exception e) {
                        FileLog.e("tmessages", e);
                    }
                }
                fingerprintDialog = builder.show();

                cancellationSignal = new CancellationSignal();
                selfCancelled = false;
                fingerprintManager.authenticate(null, 0, cancellationSignal,
                        new FingerprintManagerCompat.AuthenticationCallback() {
                            @Override
                            public void onAuthenticationError(int errMsgId, CharSequence errString) {
                                if (!selfCancelled) {
                                    showFingerprintError(errString);
                                }
                            }

                            @Override
                            public void onAuthenticationHelp(int helpMsgId, CharSequence helpString) {
                                showFingerprintError(helpString);
                            }

                            @Override
                            public void onAuthenticationFailed() {
                                showFingerprintError(LocaleController.getString("FingerprintNotRecognized",
                                        R.string.FingerprintNotRecognized));
                            }

                            @Override
                            public void onAuthenticationSucceeded(
                                    FingerprintManagerCompat.AuthenticationResult result) {
                                try {
                                    if (fingerprintDialog.isShowing()) {
                                        fingerprintDialog.dismiss();
                                    }
                                } catch (Exception e) {
                                    FileLog.e("tmessages", e);
                                }
                                fingerprintDialog = null;
                                processDone(true);
                            }
                        }, null);
            }
        } catch (Throwable e) {
            //ignore
        }
    }
}