org.telegram.ui.Components.EditTextBoldCursor Java Examples

The following examples show how to use org.telegram.ui.Components.EditTextBoldCursor. 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 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-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 #3
Source File: FilterCreateActivity.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onViewDetachedFromWindow(RecyclerView.ViewHolder holder) {
    if (holder.getItemViewType() == 2) {
        PollEditTextCell editTextCell = (PollEditTextCell) holder.itemView;
        EditTextBoldCursor editText = editTextCell.getTextView();
        if (editText.isFocused()) {
            editText.clearFocus();
            AndroidUtilities.hideKeyboard(editText);
        }
    }
}
 
Example #4
Source File: PollCreateActivity.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onViewDetachedFromWindow(RecyclerView.ViewHolder holder) {
    if (holder.getItemViewType() == 4) {
        PollEditTextCell editTextCell = (PollEditTextCell) holder.itemView;
        EditTextBoldCursor editText = editTextCell.getTextView();
        if (editText.isFocused()) {
            editText.clearFocus();
            AndroidUtilities.hideKeyboard(editText);
        }
    }
}
 
Example #5
Source File: PollCreateActivity.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onViewDetachedFromWindow(RecyclerView.ViewHolder holder) {
    if (holder.getItemViewType() == 4) {
        PollEditTextCell editTextCell = (PollEditTextCell) holder.itemView;
        EditTextBoldCursor editText = editTextCell.getTextView();
        if (editText.isFocused()) {
            editText.clearFocus();
            AndroidUtilities.hideKeyboard(editText);
        }
    }
}
 
Example #6
Source File: FilterCreateActivity.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onViewDetachedFromWindow(RecyclerView.ViewHolder holder) {
    if (holder.getItemViewType() == 2) {
        PollEditTextCell editTextCell = (PollEditTextCell) holder.itemView;
        EditTextBoldCursor editText = editTextCell.getTextView();
        if (editText.isFocused()) {
            editText.clearFocus();
            AndroidUtilities.hideKeyboard(editText);
        }
    }
}
 
Example #7
Source File: ActionBarMenuItem.java    From Telegram-FOSS with GNU General Public License v2.0 4 votes vote down vote up
public EditTextBoldCursor getSearchField() {
    return searchField;
}
 
Example #8
Source File: ActionBarMenuItem.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
public EditTextBoldCursor getSearchField() {
    return searchField;
}
 
Example #9
Source File: EditTextSettingsCell.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
public EditTextBoldCursor getTextView() {
    return textView;
}
 
Example #10
Source File: PollEditTextCell.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
public EditTextBoldCursor getTextView() {
    return textView;
}
 
Example #11
Source File: ActionBarMenuItem.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
public EditTextBoldCursor getSearchField()
{
    return searchField;
}
 
Example #12
Source File: EditTextSettingsCell.java    From Telegram-FOSS with GNU General Public License v2.0 4 votes vote down vote up
public EditTextBoldCursor getTextView() {
    return textView;
}
 
Example #13
Source File: PollEditTextCell.java    From Telegram-FOSS with GNU General Public License v2.0 4 votes vote down vote up
public EditTextBoldCursor getTextView() {
    return textView;
}
 
Example #14
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 #15
Source File: ActionBarMenuItem.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
public EditTextBoldCursor getSearchField()
{
    return searchField;
}
 
Example #16
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 #17
Source File: PollEditTextCell.java    From Telegram-FOSS with GNU General Public License v2.0 2 votes vote down vote up
protected void onFieldTouchUp(EditTextBoldCursor editText) {

    }
 
Example #18
Source File: PollEditTextCell.java    From Telegram-FOSS with GNU General Public License v2.0 2 votes vote down vote up
protected void onEditTextDraw(EditTextBoldCursor editText, Canvas canvas) {

    }
 
Example #19
Source File: PollEditTextCell.java    From Telegram with GNU General Public License v2.0 2 votes vote down vote up
protected void onActionModeStart(EditTextBoldCursor editText, ActionMode actionMode) {

    }
 
Example #20
Source File: PollEditTextCell.java    From Telegram with GNU General Public License v2.0 2 votes vote down vote up
protected void onEditTextDraw(EditTextBoldCursor editText, Canvas canvas) {

    }
 
Example #21
Source File: PollEditTextCell.java    From Telegram with GNU General Public License v2.0 2 votes vote down vote up
protected void onFieldTouchUp(EditTextBoldCursor editText) {

    }
 
Example #22
Source File: PollEditTextCell.java    From Telegram-FOSS with GNU General Public License v2.0 2 votes vote down vote up
protected void onActionModeStart(EditTextBoldCursor editText, ActionMode actionMode) {

    }