Java Code Examples for android.widget.EditText#setHint()

The following examples show how to use android.widget.EditText#setHint() . 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: SearchActivity.java    From Conversations with GNU General Public License v3.0 6 votes vote down vote up
@Override
public boolean onCreateOptionsMenu(final Menu menu) {
	getMenuInflater().inflate(R.menu.activity_search, menu);
	final MenuItem searchActionMenuItem = menu.findItem(R.id.action_search);
	final EditText searchField = searchActionMenuItem.getActionView().findViewById(R.id.search_field);
	final String term = pendingSearchTerm.pop();
	if (term != null) {
		searchField.append(term);
		List<String> searchTerm = FtsUtils.parse(term);
		if (xmppConnectionService != null) {
			if (currentSearch.watch(searchTerm)) {
				xmppConnectionService.search(searchTerm, this);
			}
		} else {
			pendingSearch.push(searchTerm);
		}
	}
	searchField.addTextChangedListener(this);
	searchField.setHint(R.string.search_messages);
	searchField.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE);
	if (term == null) {
		showKeyboard(searchField);
	}
	return super.onCreateOptionsMenu(menu);
}
 
Example 2
Source File: FormFragment.java    From shaky-android with Apache License 2.0 6 votes vote down vote up
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    Toolbar toolbar = (Toolbar) view.findViewById(R.id.shaky_toolbar);
    EditText messageEditText = (EditText) view.findViewById(R.id.shaky_form_message);
    ImageView attachmentImageView = (ImageView) view.findViewById(R.id.shaky_form_attachment);

    Uri screenshotUri = getArguments().getParcelable(KEY_SCREENSHOT_URI);
    int sendIconResource = getArguments().getInt(KEY_MENU);

    String title = getArguments().getString(KEY_TITLE);
    toolbar.setTitle(title);
    toolbar.setNavigationIcon(R.drawable.ic_arrow_back_white_24dp);
    toolbar.setNavigationOnClickListener(createNavigationClickListener());
    toolbar.inflateMenu(sendIconResource);
    toolbar.setOnMenuItemClickListener(createMenuClickListener(messageEditText));

    String hint = getArguments().getString(KEY_HINT);
    messageEditText.setHint(hint);
    messageEditText.requestFocus();

    attachmentImageView.setImageURI(screenshotUri);
    attachmentImageView.setOnClickListener(createNavigationClickListener());
}
 
Example 3
Source File: PublicServerListFragment.java    From Plumble with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void favouriteServer(final Server server) {
    final Settings settings = Settings.getInstance(getActivity());
    final EditText usernameField = new EditText(getActivity());
    usernameField.setHint(settings.getDefaultUsername());
    AlertDialog.Builder adb = new AlertDialog.Builder(getActivity());
    adb.setTitle(R.string.addFavorite);
    adb.setView(usernameField);
    adb.setPositiveButton(R.string.add, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            if(usernameField.getText().length() > 0) {
                server.setUsername(usernameField.getText().toString());
            } else {
                server.setUsername(settings.getDefaultUsername());
            }
            PlumbleDatabase database = mDatabaseProvider.getDatabase();
            database.addServer(server);
        }
    });
    adb.setNegativeButton(android.R.string.cancel, null);
    adb.show();
}
 
Example 4
Source File: BaseDialog.java    From TestChat with Apache License 2.0 6 votes vote down vote up
/**
 * 设置编辑列表VIEW
 *
 * @param names 编辑view 的name
 * @return this
 */
public BaseDialog setEditViewsName(List<String> names) {
        if (middleLayout.getChildCount() > 0) {
                middleLayout.removeAllViews();
        }
        for (String name :
                names) {
                TextView textView = new TextView(getContext());
                textView.setText(name);
                EditText editText = new EditText(getContext());
                editText.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
                editText.setHint("请输入" + name);
                editText.setPadding(10, 0, 0, 0);
                editText.setHintTextColor(Color.BLUE);
                LinearLayout child = new LinearLayout(getContext());
                LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
                child.setOrientation(LinearLayout.HORIZONTAL);
                child.setGravity(Gravity.CENTER_VERTICAL);
                child.setLayoutParams(params);
                child.addView(textView);
                child.addView(editText);
                middleLayout.addView(child);
        }
        return this;
}
 
Example 5
Source File: DlgEditDataMemory.java    From drmips with GNU General Public License v3.0 6 votes vote down vote up
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
	super.onCreateDialog(savedInstanceState);

	Bundle args = getArguments();
	int address = args.getInt("index") * (Data.DATA_SIZE / 8);
	txtDataMemoryValue = new EditText(getActivity());
	txtDataMemoryValue.setHint(R.string.value);
	txtDataMemoryValue.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_SIGNED);
	if(savedInstanceState != null && savedInstanceState.containsKey("val")) {
		txtDataMemoryValue.setText(savedInstanceState.getString("val"));
	} else {
		txtDataMemoryValue.setText("" + args.getInt("value", 0));
	}

	return new AlertDialog.Builder(getActivity())
		.setTitle(getString(R.string.edit_value).replace("#1", "" + address))
		.setView(txtDataMemoryValue)
		.setPositiveButton(android.R.string.ok, this)
		.setNegativeButton(android.R.string.cancel, this)
		.create();
}
 
Example 6
Source File: HyperTextEditor.java    From YCCustomText with Apache License 2.0 6 votes vote down vote up
/**
 * 添加生成文本输入框
 * @param hint								内容
 * @param paddingTop						到顶部高度
 * @return
 */
private EditText createEditText(String hint, int paddingTop) {
	EditText editText = new DeletableEditText(getContext());
	LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
	editText.setLayoutParams(layoutParams);
	editText.setTextSize(16);
	editText.setTextColor(Color.parseColor("#616161"));
	editText.setCursorVisible(true);
	editText.setBackground(null);
	editText.setOnKeyListener(keyListener);
	editText.setOnFocusChangeListener(focusListener);
	editText.addTextChangedListener(textWatcher);
	editText.setTag(viewTagIndex++);
	editText.setPadding(editNormalPadding, paddingTop, editNormalPadding, paddingTop);
	editText.setHint(hint);
	editText.setTextSize(TypedValue.COMPLEX_UNIT_PX, rtTextSize);
	editText.setTextColor(rtTextColor);
	editText.setHintTextColor(rtHintTextColor);
	editText.setLineSpacing(rtTextLineSpace, 1.0f);
	HyperLibUtils.setCursorDrawableColor(editText, cursorColor);
	return editText;
}
 
Example 7
Source File: MeFragment.java    From AndroidPlusJava with GNU General Public License v3.0 6 votes vote down vote up
private void showEditSloganDialog() {
    View content = LayoutInflater.from(getContext()).inflate(R.layout.dialog_edit, null);
    final EditText editText = content.findViewById(R.id.dialog_edit);
    editText.setHint(R.string.input_slogan);
    if (mUser.getSlogan() != null) {
        editText.setText(mUser.getSlogan());
        editText.setSelection(editText.getText().length());
    }
    new AlertDialog.Builder(getContext())
            .setTitle(R.string.edit_slogan)
            .setNegativeButton(R.string.cancel, null)
            .setPositiveButton(R.string.confirm, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    String updateSlogan = editText.getText().toString().trim();
                    if (mUser.getSlogan() == null || !mUser.getSlogan().equals(updateSlogan)) {
                        mSlogan.setText(updateSlogan);
                        mUser.setSlogan(updateSlogan);
                    }
                }
            })
            .setView(content)
            .show();
}
 
Example 8
Source File: MainActivity.java    From shadowsocks-android-java with Apache License 2.0 5 votes vote down vote up
private void showProxyUrlInputDialog() {
    final EditText editText = new EditText(this);
    editText.setInputType(InputType.TYPE_TEXT_VARIATION_URI);
    editText.setHint(getString(R.string.config_url_hint));
    editText.setText(readProxyUrl());

    new AlertDialog.Builder(this)
            .setTitle(R.string.config_url)
            .setView(editText)
            .setPositiveButton(R.string.btn_ok, new OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    if (editText.getText() == null) {
                        return;
                    }

                    String ProxyUrl = editText.getText().toString().trim();
                    if (isValidUrl(ProxyUrl)) {
                        setProxyUrl(ProxyUrl);
                        textViewProxyUrl.setText(ProxyUrl);
                    } else {
                        Toast.makeText(MainActivity.this, R.string.err_invalid_url, Toast.LENGTH_SHORT).show();
                    }
                }
            })
            .setNegativeButton(R.string.btn_cancel, null)
            .show();
}
 
Example 9
Source File: GeocodingBaseActivity.java    From mobile-android-samples with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    inputField = new EditText(this);
    inputField.setTextColor(Color.WHITE);
    inputField.setBackgroundColor(Colors.DARK_TRANSPARENT_GRAY);
    inputField.setHint("Type address...");
    inputField.setHintTextColor(Color.LTGRAY);
    inputField.setSingleLine();
    inputField.setImeOptions(EditorInfo.IME_ACTION_DONE);

    int totalWidth = getResources().getDisplayMetrics().widthPixels;
    int padding = (int)(5 * getResources().getDisplayMetrics().density);

    int width = totalWidth - 2 * padding;
    int height = (int)(45 * getResources().getDisplayMetrics().density);

    RelativeLayout.LayoutParams parameters = new RelativeLayout.LayoutParams(width, height);
    parameters.setMargins(padding, padding, 0, 0);
    addContentView(inputField, parameters);

    resultTable = new ListView(this);
    resultTable.setBackgroundColor(Colors.LIGHT_TRANSPARENT_GRAY);

    height = (int)(200 * getResources().getDisplayMetrics().density);

    parameters = new RelativeLayout.LayoutParams(width, height);
    parameters.setMargins(padding, 2 * padding + inputField.getLayoutParams().height, 0, 0);

    addContentView(resultTable, parameters);

    adapter = new GeocodingResultAdapter(this);
    adapter.width = width;
    resultTable.setAdapter(adapter);

    hideTable();
}
 
Example 10
Source File: MonitorActivity.java    From secureit with MIT License 5 votes vote down vote up
/**
 * Shows a dialog prompting the unlock code
 */
private void createUnlockDialog() {
	final AlertDialog.Builder builder = new AlertDialog.Builder(this);
	builder.setTitle("Stop monitoring?");
	final EditText input = new EditText(this);
	input.setHint("Unlock code");
	input.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
	builder.setView(input);

	builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
		public void onClick(DialogInterface dialog, int whichButton) {
			if (input.getText().toString().equals(preferences.getUnlockCode())) {
				Log.i("MonitorActivity", "INPUT "+input.getText().toString());
				Log.i("MonitorActivity", "STORED "+preferences.getUnlockCode());
				dialog.dismiss();
				close();
			} else {
				dialog.dismiss();
				Toast.makeText(
						getApplicationContext(), 
						"Wrong unlock code", 
						Toast.LENGTH_SHORT).show();
	        }
		}
	});

	builder.show();
}
 
Example 11
Source File: PinCodeLayout.java    From ResearchStack with Apache License 2.0 5 votes vote down vote up
@CallSuper
protected void init() {
    config = StorageAccess.getInstance().getPinCodeConfig();
    imm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);

    LayoutInflater.from(getContext()).inflate(R.layout.rsb_step_layout_pincode, this, true);

    title = (TextView) findViewById(R.id.title);
    title.setText(R.string.rsb_pincode_enter_title);

    resetSummaryText();

    editText = (EditText) findViewById(R.id.pincode);
    editText.requestFocus();

    PinCodeConfig.Type pinType = config.getPinType();
    editText.setInputType(pinType.getInputType() | pinType.getVisibleVariationType(false));

    char[] chars = new char[config.getPinLength()];
    Arrays.fill(chars, '◦');
    editText.setHint(new String(chars));

    InputFilter[] filters = ViewUtils.addFilter(editText.getFilters(),
            new InputFilter.LengthFilter(config.getPinLength()));
    filters = ViewUtils.addFilter(filters, config.getPinType().getInputFilter());
    editText.setFilters(filters);

    progress = findViewById(R.id.progress);
}
 
Example 12
Source File: ShareActivity.java    From Shaarlier with GNU General Public License v3.0 5 votes vote down vote up
private void updateDescription(String description, boolean isError) {
    EditText descriptionEdit = findViewById(R.id.description);
    descriptionEdit.setHint(R.string.description_hint);


    if (isError) {
        descriptionEdit.setHint(R.string.error_retrieving_description);
    } else {
        descriptionEdit.setText(description);
    }
    updateLoadersVisibility();

}
 
Example 13
Source File: FragmentDelegate.java    From AndroidStudyDemo with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void initWidget() {
    super.initWidget();
    EditText et = get(R.id.editText);
    EditText et2 = get(R.id.editText2);
    et.setHint("姓名");
    et2.setHint("年龄");
}
 
Example 14
Source File: OEditTextField.java    From hr with GNU Affero General Public License v3.0 5 votes vote down vote up
public void initControl() {
    // Creating control
    LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT,
            LayoutParams.WRAP_CONTENT);
    removeAllViews();
    setOrientation(VERTICAL);
    if (mEditable) {
        edtText = new EditText(mContext);
        edtText.setTypeface(OControlHelper.lightFont());
        edtText.setLayoutParams(params);
        edtText.setBackgroundColor(Color.TRANSPARENT);
        edtText.setPadding(0, 10, 10, 10);
        edtText.setHint(getLabel());
        edtText.setOnFocusChangeListener(this);
        if (textSize > -1) {
            edtText.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
        }
        if (appearance > -1) {
            edtText.setTextAppearance(mContext, appearance);
        }
        edtText.setTextColor(textColor);
        addView(edtText);
    } else {
        txvText = new TextView(mContext);
        txvText.setTypeface(OControlHelper.lightFont());
        txvText.setLayoutParams(params);
        txvText.setBackgroundColor(Color.TRANSPARENT);
        txvText.setPadding(0, 10, 10, 10);
        if (textSize > -1) {
            txvText.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
        }
        if (appearance > -1) {
            txvText.setTextAppearance(mContext, appearance);
        }
        txvText.setTextColor(textColor);
        addView(txvText);
    }
}
 
Example 15
Source File: EditBindingAdapter.java    From Fairy with Apache License 2.0 5 votes vote down vote up
@BindingAdapter("judgehint")
public static void setHint(EditText view, CharSequence hint) {
    switch (view.getId()) {
        case R.id.edit_options_logcat:
            String options = "[options]";
            if (!hint.equals("")) {
                options = hint.toString();
            }
            view.setHint(options);
            break;
        case R.id.edit_filter_logcat:
            String filter = "[filterspecs]";
            if (!hint.equals("")) {
                filter = hint.toString();
            }
            view.setHint(filter);
            break;
        case R.id.edit_grep_logcat:
            String grep = "[grep]";
            if (!hint.equals("")) {
                grep = hint.toString();
            }
            view.setHint(grep);
            break;
        default:
            ZLog.e("no match");
            break;
    }
}
 
Example 16
Source File: AboutActivity.java    From Studio with Apache License 2.0 5 votes vote down vote up
private void addCode() {
    final EditText editText = new EditText(this);
    editText.setHint(R.string.add_code);
    new AlertDialog.Builder(this)
            .setTitle(R.string.add_code)
            .setView(editText)
            .setPositiveButton(R.string.confirm, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    addCodeToServer(editText.getText().toString());
                }
            })
            .create()
            .show();
}
 
Example 17
Source File: PolicyManagementFragment.java    From android-testdpc with Apache License 2.0 5 votes vote down vote up
/**
 * Shows a dialog that asks the user for a screen off timeout value, then sets this value as
 * screen off timeout.
 */
@TargetApi(VERSION_CODES.P)
private void showSetScreenOffTimeoutDialog() {
    if (getActivity() == null || getActivity().isFinishing()) {
        return;
    }

    final View dialogView = getActivity().getLayoutInflater().inflate(
            R.layout.simple_edittext, null);
    final EditText timeoutEditText = (EditText) dialogView.findViewById(
            R.id.input);
    final String oldTimeout = Settings.System.getString(
            getActivity().getContentResolver(), Settings.System.SCREEN_OFF_TIMEOUT);
    final int oldTimeoutValue = Integer.parseInt(oldTimeout);
    timeoutEditText.setHint(R.string.set_screen_off_timeout_hint);
    if (!TextUtils.isEmpty(oldTimeout)) {
        timeoutEditText.setText(Integer.toString(oldTimeoutValue / 1000));
    }

    new AlertDialog.Builder(getActivity())
            .setTitle(R.string.set_screen_off_timeout)
            .setView(dialogView)
            .setPositiveButton(android.R.string.ok, (dialogInterface, i) -> {
                final String screenTimeout = timeoutEditText.getText().toString();
                if (screenTimeout.isEmpty()) {
                    showToast(R.string.no_screen_off_timeout);
                    return;
                }
                final int screenTimeoutVaue = Integer.parseInt(screenTimeout);
                if (screenTimeoutVaue < 0) {
                    showToast(R.string.invalid_screen_off_timeout);
                    return;
                }
                mDevicePolicyManager.setSystemSetting(mAdminComponentName,
                        Settings.System.SCREEN_OFF_TIMEOUT,
                        Integer.toString(screenTimeoutVaue * 1000));
            })
            .setNegativeButton(android.R.string.cancel, null)
            .show();
}
 
Example 18
Source File: EasyEditDialog.java    From NIM_Android_UIKit with MIT License 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(mResourceId);

    try {
        LinearLayout root = (LinearLayout) findViewById(R.id.easy_edit_dialog_root);
        ViewGroup.LayoutParams params = root.getLayoutParams();
        params.width = (int) ScreenUtil.getDialogWidth();
        root.setLayoutParams(params);

        if (mTitle != null) {
            mTitleTextView = (TextView) findViewById(R.id.easy_dialog_title_text_view);
            mTitleTextView.setText(mTitle);
        }

        if (mMessage != null) {
            mMessageTextView = (TextView) findViewById(R.id.easy_dialog_message_text_view);
            mMessageTextView.setText(mMessage);
            mMessageTextView.setVisibility(View.VISIBLE);
        }

        mEdit = (EditText) findViewById(R.id.easy_alert_dialog_edit_text);
        mLengthTextView = (TextView) findViewById(R.id.edit_text_length);
        // mEdit.setFilters(new InputFilter[] { new InputFilter.LengthFilter(mMaxEditTextLength) });
        mLengthTextView.setVisibility(mShowEditTextLength ? View.VISIBLE : View.GONE);
        if (inputType != -1) {
            mEdit.setInputType(inputType);
        }
        mEdit.addTextChangedListener(new EditTextWatcher(mEdit, mLengthTextView, mMaxEditTextLength,
                mShowEditTextLength));

        if (!TextUtils.isEmpty(mEditHint)) {
            mEdit.setHint(mEditHint);
        }
        if (mMaxLines > 0) {
            mEdit.setMaxLines(mMaxLines);
        }
        if (mSingleLine) {
            mEdit.setSingleLine();
        }

        mPositiveBtn = (Button) findViewById(R.id.easy_dialog_positive_btn);
        if (mPositiveBtnStrResId != 0) {
            mPositiveBtn.setText(mPositiveBtnStrResId);
        }
        mPositiveBtn.setOnClickListener(mPositiveBtnListener);

        mNegativeBtn = (Button) findViewById(R.id.easy_dialog_negative_btn);
        if (mNegativeBtnStrResId != 0) {
            mNegativeBtn.setText(mNegativeBtnStrResId);
        }
        mNegativeBtn.setOnClickListener(mNegativeBtnListener);
        mNegativeBtn.setVisibility(View.VISIBLE);
        findViewById(R.id.easy_dialog_btn_divide_view).setVisibility(View.VISIBLE);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
Example 19
Source File: IRActuator.java    From puck-central-android with Apache License 2.0 4 votes vote down vote up
@Override
public AlertDialog getActuatorDialog(Activity activity, final Action action, final Rule rule, final ActuatorDialogFinishListener listener) {
    LayoutInflater layoutInflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

    View view = layoutInflater.inflate(R.layout.dialog_actuator_single_select_single_textinput, null);
    final EditText editText1 = (EditText) view.findViewById(R.id.etDialogActuatorEditText1);
    editText1.setHint(CODE);

    final List<Puck> irPucks = mPuckManager.withServiceUUID(GattServices.IR_SERVICE_UUID);

    final Spinner spinner = (Spinner) view.findViewById(R.id.spinner1);
    List<String> irPuckNames = new ArrayList<>();
    for (Puck irPuck : irPucks) {
        irPuckNames.add(irPuck.getName());
    }

    ArrayAdapter<String> spinnerAdapter = new ArrayAdapter<>(activity,
            android.R.layout.simple_spinner_item, irPuckNames);
    spinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    spinner.setAdapter(spinnerAdapter);

    AlertDialog.Builder builder = new AlertDialog.Builder(activity)
            .setView(view)
            .setTitle(describeActuator())
            .setPositiveButton(activity.getString(R.string.accept), new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    int idx = spinner.getSelectedItemPosition();
                    Puck puck = irPucks.get(idx);

                    String arguments = Action.jsonStringBuilder(
                            IRActuator.ARGUMENT_UUID, puck.getProximityUUID(),
                            IRActuator.ARGUMENT_MAJOR, puck.getMajor(),
                            IRActuator.ARGUMENT_MINOR, puck.getMinor(),
                            IRActuator.ARGUMENT_CODE, editText1.getText().toString());

                    action.setArguments(arguments);
                    rule.addAction(action);
                    listener.onActuatorDialogFinish(action, rule);
                }
            })
            .setNegativeButton(activity.getString(R.string.reject), null);
    return builder.create();
}
 
Example 20
Source File: DialogFactory.java    From Tok-Android with GNU General Public License v3.0 4 votes vote down vote up
public static DialogView addFriendDialog(Activity activity, final String friendId,
    final String alias, boolean showFriendId, String msg, View.OnClickListener leftListener,
    final View.OnClickListener rightListener) {
    View view = ViewUtil.inflateViewById(activity, R.layout.dialog_layout_input);
    //
    TextView promptTv = view.findViewById(R.id.id_prompt_tv);
    TextView idTv = view.findViewById(R.id.id_tok_id_tv);
    if (showFriendId) {
        promptTv.setVisibility(View.VISIBLE);
        idTv.setVisibility(View.VISIBLE);
        idTv.setText(friendId);
    } else {
        promptTv.setVisibility(View.GONE);
        idTv.setVisibility(View.GONE);
    }
    final EditText inputEt = view.findViewById(R.id.id_input_et);
    inputEt.setHint(R.string.add_friend_msg_hint);
    if (StringUtils.isEmpty(msg)) {
        msg = StringUtils.formatTxFromResId(R.string.add_friend_default_message,
            new String(State.userRepo().getActiveUserDetails().getNickname().value));
    }
    inputEt.setText(msg);
    inputEt.setSelection(msg.length());
    DialogView dialogView = new DialogView(activity, view, false);
    dialogView.setLeftOnClickListener(leftListener);
    dialogView.setRightOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            AddFriendsModel model = new AddFriendsModel();
            boolean success =
                model.addFriendById(friendId, alias, inputEt.getText().toString());
            if (success) {
                if (rightListener != null) {
                    rightListener.onClick(v);
                }
            } else {
                ToastUtils.show(R.string.tok_id_invalid);
            }
        }
    });
    dialogView.setTitle_(R.string.confirm_add_friends);
    if (showFriendId) {
        dialogView.setTitleCenter();
    }
    dialogView.setCanCancel(false);
    dialogView.show();
    return dialogView;
}