Java Code Examples for org.telegram.ui.Components.EditTextBoldCursor#setPadding()

The following examples show how to use org.telegram.ui.Components.EditTextBoldCursor#setPadding() . 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: EditTextSettingsCell.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
public EditTextSettingsCell(Context context) {
    super(context);

    textView = new EditTextBoldCursor(context);
    textView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
    textView.setHintTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteHintText));
    textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
    textView.setLines(1);
    textView.setMaxLines(1);
    textView.setSingleLine(true);
    textView.setEllipsize(TextUtils.TruncateAt.END);
    textView.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL);
    textView.setBackgroundDrawable(null);
    textView.setPadding(0, 0, 0, 0);
    textView.setInputType(textView.getInputType() | EditorInfo.TYPE_TEXT_FLAG_CAP_SENTENCES);
    addView(textView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, 21, 0, 21, 0));
}
 
Example 2
Source File: EditTextSettingsCell.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
public EditTextSettingsCell(Context context) {
    super(context);

    textView = new EditTextBoldCursor(context);
    textView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
    textView.setHintTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteHintText));
    textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
    textView.setLines(1);
    textView.setMaxLines(1);
    textView.setSingleLine(true);
    textView.setEllipsize(TextUtils.TruncateAt.END);
    textView.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL);
    textView.setBackgroundDrawable(null);
    textView.setPadding(0, 0, 0, 0);
    textView.setInputType(textView.getInputType() | EditorInfo.TYPE_TEXT_FLAG_CAP_SENTENCES);
    addView(textView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, 21, 0, 21, 0));
}
 
Example 3
Source File: LoginActivity.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
public LoginActivityRecoverView(Context context)
{
    super(context);

    setOrientation(VERTICAL);

    confirmTextView = new TextView(context);
    confirmTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText6));
    confirmTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
    confirmTextView.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT));
    confirmTextView.setLineSpacing(AndroidUtilities.dp(2), 1.0f);
    confirmTextView.setText(LocaleController.getString("RestoreEmailSentInfo", R.string.RestoreEmailSentInfo));
    addView(confirmTextView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT)));

    codeField = new EditTextBoldCursor(context);
    codeField.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
    codeField.setCursorColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
    codeField.setCursorSize(AndroidUtilities.dp(20));
    codeField.setCursorWidth(1.5f);
    codeField.setHintTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteHintText));
    codeField.setBackgroundDrawable(Theme.createEditTextDrawable(context, false));
    codeField.setHint(LocaleController.getString("PasswordCode", R.string.PasswordCode));
    codeField.setImeOptions(EditorInfo.IME_ACTION_NEXT | EditorInfo.IME_FLAG_NO_EXTRACT_UI);
    codeField.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
    codeField.setMaxLines(1);
    codeField.setPadding(0, 0, 0, 0);
    codeField.setInputType(InputType.TYPE_CLASS_PHONE);
    codeField.setTransformationMethod(PasswordTransformationMethod.getInstance());
    codeField.setTypeface(Typeface.DEFAULT);
    codeField.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
    addView(codeField, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 36, Gravity.CENTER_HORIZONTAL, 0, 20, 0, 0));
    codeField.setOnEditorActionListener((textView, i, keyEvent) ->
    {
        if (i == EditorInfo.IME_ACTION_NEXT)
        {
            onNextPressed();
            return true;
        }
        return false;
    });

    cancelButton = new TextView(context);
    cancelButton.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.BOTTOM);
    cancelButton.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlueText4));
    cancelButton.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
    cancelButton.setLineSpacing(AndroidUtilities.dp(2), 1.0f);
    cancelButton.setPadding(0, AndroidUtilities.dp(14), 0, 0);
    addView(cancelButton, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.BOTTOM | (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT), 0, 0, 0, 14));
    cancelButton.setOnClickListener(view ->
    {
        AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
        builder.setMessage(LocaleController.getString("RestoreEmailTroubleText", R.string.RestoreEmailTroubleText));
        builder.setTitle(LocaleController.getString("RestorePasswordNoEmailTitle", R.string.RestorePasswordNoEmailTitle));
        builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), (dialogInterface, i) -> setPage(6, true, new Bundle(), true));
        Dialog dialog = showDialog(builder.create());
        if (dialog != null)
        {
            dialog.setCanceledOnTouchOutside(false);
            dialog.setCancelable(false);
        }
    });
}
 
Example 4
Source File: LoginActivity.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
public LoginActivityRecoverView(Context context)
{
    super(context);

    setOrientation(VERTICAL);

    confirmTextView = new TextView(context);
    confirmTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText6));
    confirmTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
    confirmTextView.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT));
    confirmTextView.setLineSpacing(AndroidUtilities.dp(2), 1.0f);
    confirmTextView.setText(LocaleController.getString("RestoreEmailSentInfo", R.string.RestoreEmailSentInfo));
    addView(confirmTextView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT)));

    codeField = new EditTextBoldCursor(context);
    codeField.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
    codeField.setCursorColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
    codeField.setCursorSize(AndroidUtilities.dp(20));
    codeField.setCursorWidth(1.5f);
    codeField.setHintTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteHintText));
    codeField.setBackgroundDrawable(Theme.createEditTextDrawable(context, false));
    codeField.setHint(LocaleController.getString("PasswordCode", R.string.PasswordCode));
    codeField.setImeOptions(EditorInfo.IME_ACTION_NEXT | EditorInfo.IME_FLAG_NO_EXTRACT_UI);
    codeField.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
    codeField.setMaxLines(1);
    codeField.setPadding(0, 0, 0, 0);
    codeField.setInputType(InputType.TYPE_CLASS_PHONE);
    codeField.setTransformationMethod(PasswordTransformationMethod.getInstance());
    codeField.setTypeface(Typeface.DEFAULT);
    codeField.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
    addView(codeField, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 36, Gravity.CENTER_HORIZONTAL, 0, 20, 0, 0));
    codeField.setOnEditorActionListener((textView, i, keyEvent) ->
    {
        if (i == EditorInfo.IME_ACTION_NEXT)
        {
            onNextPressed();
            return true;
        }
        return false;
    });

    cancelButton = new TextView(context);
    cancelButton.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.BOTTOM);
    cancelButton.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlueText4));
    cancelButton.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
    cancelButton.setLineSpacing(AndroidUtilities.dp(2), 1.0f);
    cancelButton.setPadding(0, AndroidUtilities.dp(14), 0, 0);
    addView(cancelButton, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.BOTTOM | (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT), 0, 0, 0, 14));
    cancelButton.setOnClickListener(view ->
    {
        AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
        builder.setMessage(LocaleController.getString("RestoreEmailTroubleText", R.string.RestoreEmailTroubleText));
        builder.setTitle(LocaleController.getString("RestorePasswordNoEmailTitle", R.string.RestorePasswordNoEmailTitle));
        builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), (dialogInterface, i) -> setPage(6, true, new Bundle(), true));
        Dialog dialog = showDialog(builder.create());
        if (dialog != null)
        {
            dialog.setCanceledOnTouchOutside(false);
            dialog.setCancelable(false);
        }
    });
}