List of usage examples for android.text InputType TYPE_CLASS_PHONE
int TYPE_CLASS_PHONE
To view the source code for android.text InputType TYPE_CLASS_PHONE.
Click Source Link
From source file:org.linphone.ContactEditorFragment.java
@SuppressLint("InflateParams") private void addEmptyRowToAllowNewNumberOrAddress(final LinearLayout controls, final boolean isSip) { final View view = inflater.inflate(R.layout.contact_edit_row, null); final NewOrUpdatedNumberOrAddress nounoa = new NewOrUpdatedNumberOrAddress(isSip); final EditText noa = (EditText) view.findViewById(R.id.numoraddr); numbersAndAddresses.add(nounoa);//from www .j a v a 2s. c o m noa.setHint(isSip ? getString(R.string.sip_address) : getString(R.string.phone_number)); noa.setInputType(isSip ? InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS : InputType.TYPE_CLASS_PHONE); noa.requestFocus(); noa.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { nounoa.setNewNumberOrAddress(noa.getText().toString()); } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void afterTextChanged(Editable s) { } }); final ImageView delete = (ImageView) view.findViewById(R.id.delete_field); delete.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { nounoa.delete(); numbersAndAddresses.remove(nounoa); view.setVisibility(View.GONE); } }); controls.addView(view); }
From source file:com.example.android.contactslist.ui.eventEntry.EventEntryFragment.java
private void editAddressTextDialog() { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); // Set up the input final EditText input = new EditText(getActivity()); input.setText(mAddressViewButton.getText()); input.setMinHeight(50);//w ww.j ava 2 s . co m // Specify the type of input expected for each of the communications classes switch (mEventClass) { case EventInfo.EMAIL_CLASS: builder.setTitle(R.string.event_address_title); input.setInputType(InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS); break; case EventInfo.PHONE_CLASS: case EventInfo.SMS_CLASS: builder.setTitle(R.string.event_address_title_alt_phone); input.setInputType(InputType.TYPE_CLASS_PHONE); break; case EventInfo.MEETING_CLASS: builder.setTitle(R.string.event_address_title); input.setInputType(InputType.TYPE_TEXT_VARIATION_POSTAL_ADDRESS); break; case EventInfo.SKYPE: case EventInfo.GOOGLE_HANGOUTS: case EventInfo.FACEBOOK: default: input.setInputType(InputType.TYPE_CLASS_TEXT); builder.setTitle(R.string.event_address_title_alt_handle); } builder.setView(input); // Set up the buttons builder.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { mAddressViewButton.setText(input.getText().toString()); } }); builder.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }); builder.show(); }
From source file:com.ccxt.whl.activity.SettingsFragment.java
/** * /*from w w w .j a va 2s. co m*/ */ public void change_age(String age) { final EditText texta = new EditText(getActivity()); texta.setText(age); //EditText texta.setKeyListener(new NumberKeyListener() { public int getInputType() { return InputType.TYPE_CLASS_PHONE; } @Override protected char[] getAcceptedChars() { // TODO Auto-generated method stub char[] numbers = new char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' }; return numbers; } }); new AlertDialog.Builder(getActivity()).setTitle("") .setIcon(android.R.drawable.ic_dialog_info).setView(texta) .setPositiveButton("", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { String age = texta.getEditableText().toString(); RequestParams params = new RequestParams(); params.add("user", DemoApplication.getInstance().getUser()); params.add("age", age); params.add("param", "age"); params.add("uid", uid); HttpRestClient.get(Constant.UPDATE_USER_URL, params, responseHandler); pd.show(); dialog.dismiss(); //? } }).setNegativeButton("?", null).show(); //return true; }
From source file:org.telegram.ui.TwoStepVerificationActivity.java
private void setPasswordSetState(int state) { if (passwordEditText == null) { return;//from w w w. ja v a 2s. co m } passwordSetState = state; if (passwordSetState == 0) { actionBar.setTitle(LocaleController.getString("YourPassword", R.string.YourPassword)); if (currentPassword instanceof TLRPC.TL_account_noPassword) { titleTextView.setText( LocaleController.getString("PleaseEnterFirstPassword", R.string.PleaseEnterFirstPassword)); } else { titleTextView .setText(LocaleController.getString("PleaseEnterPassword", R.string.PleaseEnterPassword)); } passwordEditText.setImeOptions(EditorInfo.IME_ACTION_NEXT); passwordEditText.setTransformationMethod(PasswordTransformationMethod.getInstance()); bottomTextView.setVisibility(View.INVISIBLE); bottomButton.setVisibility(View.INVISIBLE); } else if (passwordSetState == 1) { actionBar.setTitle(LocaleController.getString("YourPassword", R.string.YourPassword)); titleTextView .setText(LocaleController.getString("PleaseReEnterPassword", R.string.PleaseReEnterPassword)); passwordEditText.setImeOptions(EditorInfo.IME_ACTION_NEXT); passwordEditText.setTransformationMethod(PasswordTransformationMethod.getInstance()); bottomTextView.setVisibility(View.INVISIBLE); bottomButton.setVisibility(View.INVISIBLE); } else if (passwordSetState == 2) { actionBar.setTitle(LocaleController.getString("PasswordHint", R.string.PasswordHint)); titleTextView.setText(LocaleController.getString("PasswordHintText", R.string.PasswordHintText)); passwordEditText.setImeOptions(EditorInfo.IME_ACTION_NEXT); passwordEditText.setTransformationMethod(null); bottomTextView.setVisibility(View.INVISIBLE); bottomButton.setVisibility(View.INVISIBLE); } else if (passwordSetState == 3) { actionBar.setTitle(LocaleController.getString("RecoveryEmail", R.string.RecoveryEmail)); titleTextView.setText(LocaleController.getString("YourEmail", R.string.YourEmail)); passwordEditText.setImeOptions(EditorInfo.IME_ACTION_DONE); passwordEditText.setTransformationMethod(null); passwordEditText .setInputType(EditorInfo.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_VARIATION_EMAIL_ADDRESS); bottomTextView.setVisibility(View.VISIBLE); bottomButton.setVisibility(emailOnly ? View.INVISIBLE : View.VISIBLE); } else if (passwordSetState == 4) { actionBar.setTitle(LocaleController.getString("PasswordRecovery", R.string.PasswordRecovery)); titleTextView.setText(LocaleController.getString("PasswordCode", R.string.PasswordCode)); bottomTextView .setText(LocaleController.getString("RestoreEmailSentInfo", R.string.RestoreEmailSentInfo)); bottomButton.setText(LocaleController.formatString("RestoreEmailTrouble", R.string.RestoreEmailTrouble, currentPassword.email_unconfirmed_pattern)); passwordEditText.setImeOptions(EditorInfo.IME_ACTION_DONE); passwordEditText.setTransformationMethod(null); passwordEditText.setInputType(InputType.TYPE_CLASS_PHONE); bottomTextView.setVisibility(View.VISIBLE); bottomButton.setVisibility(View.VISIBLE); } passwordEditText.setText(""); }
From source file:com.nickandjerry.dynamiclayoutinflator.DynamicLayoutInflator.java
public static void createViewRunnables() { viewRunnables = new HashMap<>(30); viewRunnables.put("scaleType", new ViewParamRunnable() { @Override/*w w w . ja va2 s . c o m*/ public void apply(View view, String value, ViewGroup parent, Map<String, String> attrs) { if (view instanceof ImageView) { ImageView.ScaleType scaleType = ((ImageView) view).getScaleType(); switch (value.toLowerCase()) { case "center": scaleType = ImageView.ScaleType.CENTER; break; case "center_crop": scaleType = ImageView.ScaleType.CENTER_CROP; break; case "center_inside": scaleType = ImageView.ScaleType.CENTER_INSIDE; break; case "fit_center": scaleType = ImageView.ScaleType.FIT_CENTER; break; case "fit_end": scaleType = ImageView.ScaleType.FIT_END; break; case "fit_start": scaleType = ImageView.ScaleType.FIT_START; break; case "fit_xy": scaleType = ImageView.ScaleType.FIT_XY; break; case "matrix": scaleType = ImageView.ScaleType.MATRIX; break; } ((ImageView) view).setScaleType(scaleType); } } }); viewRunnables.put("orientation", new ViewParamRunnable() { @Override public void apply(View view, String value, ViewGroup parent, Map<String, String> attrs) { if (view instanceof LinearLayout) { ((LinearLayout) view).setOrientation( value.equals("vertical") ? LinearLayout.VERTICAL : LinearLayout.HORIZONTAL); } } }); viewRunnables.put("text", new ViewParamRunnable() { @Override public void apply(View view, String value, ViewGroup parent, Map<String, String> attrs) { if (view instanceof TextView) { ((TextView) view).setText(value); } } }); viewRunnables.put("textSize", new ViewParamRunnable() { @Override public void apply(View view, String value, ViewGroup parent, Map<String, String> attrs) { if (view instanceof TextView) { ((TextView) view).setTextSize(TypedValue.COMPLEX_UNIT_PX, DimensionConverter.stringToDimension(value, view.getResources().getDisplayMetrics())); } } }); viewRunnables.put("textColor", new ViewParamRunnable() { @Override public void apply(View view, String value, ViewGroup parent, Map<String, String> attrs) { if (view instanceof TextView) { ((TextView) view).setTextColor(parseColor(view, value)); } } }); viewRunnables.put("textStyle", new ViewParamRunnable() { @Override public void apply(View view, String value, ViewGroup parent, Map<String, String> attrs) { if (view instanceof TextView) { int typeFace = Typeface.NORMAL; if (value.contains("bold")) typeFace |= Typeface.BOLD; else if (value.contains("italic")) typeFace |= Typeface.ITALIC; ((TextView) view).setTypeface(null, typeFace); } } }); viewRunnables.put("textAlignment", new ViewParamRunnable() { @Override public void apply(View view, String value, ViewGroup parent, Map<String, String> attrs) { if (Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT) { int alignment = View.TEXT_ALIGNMENT_TEXT_START; switch (value) { case "center": alignment = View.TEXT_ALIGNMENT_CENTER; break; case "left": case "textStart": break; case "right": case "textEnd": alignment = View.TEXT_ALIGNMENT_TEXT_END; break; } view.setTextAlignment(alignment); } else { int gravity = Gravity.LEFT; switch (value) { case "center": gravity = Gravity.CENTER; break; case "left": case "textStart": break; case "right": case "textEnd": gravity = Gravity.RIGHT; break; } ((TextView) view).setGravity(gravity); } } }); viewRunnables.put("ellipsize", new ViewParamRunnable() { @Override public void apply(View view, String value, ViewGroup parent, Map<String, String> attrs) { if (view instanceof TextView) { TextUtils.TruncateAt where = TextUtils.TruncateAt.END; switch (value) { case "start": where = TextUtils.TruncateAt.START; break; case "middle": where = TextUtils.TruncateAt.MIDDLE; break; case "marquee": where = TextUtils.TruncateAt.MARQUEE; break; case "end": break; } ((TextView) view).setEllipsize(where); } } }); viewRunnables.put("singleLine", new ViewParamRunnable() { @Override public void apply(View view, String value, ViewGroup parent, Map<String, String> attrs) { if (view instanceof TextView) { ((TextView) view).setSingleLine(); } } }); viewRunnables.put("hint", new ViewParamRunnable() { @Override public void apply(View view, String value, ViewGroup parent, Map<String, String> attrs) { if (view instanceof EditText) { ((EditText) view).setHint(value); } } }); viewRunnables.put("inputType", new ViewParamRunnable() { @Override public void apply(View view, String value, ViewGroup parent, Map<String, String> attrs) { if (view instanceof TextView) { int inputType = 0; switch (value) { case "textEmailAddress": inputType |= InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS; break; case "number": inputType |= InputType.TYPE_CLASS_NUMBER; break; case "phone": inputType |= InputType.TYPE_CLASS_PHONE; break; } if (inputType > 0) ((TextView) view).setInputType(inputType); } } }); viewRunnables.put("gravity", new ViewParamRunnable() { @Override public void apply(View view, String value, ViewGroup parent, Map<String, String> attrs) { int gravity = parseGravity(value); if (view instanceof TextView) { ((TextView) view).setGravity(gravity); } else if (view instanceof LinearLayout) { ((LinearLayout) view).setGravity(gravity); } else if (view instanceof RelativeLayout) { ((RelativeLayout) view).setGravity(gravity); } } }); viewRunnables.put("src", new ViewParamRunnable() { @Override public void apply(View view, String value, ViewGroup parent, Map<String, String> attrs) { if (view instanceof ImageView) { String imageName = value; if (imageName.startsWith("//")) imageName = "http:" + imageName; if (imageName.startsWith("http")) { if (imageLoader != null) { if (attrs.containsKey("cornerRadius")) { int radius = DimensionConverter.stringToDimensionPixelSize( attrs.get("cornerRadius"), view.getResources().getDisplayMetrics()); imageLoader.loadRoundedImage((ImageView) view, imageName, radius); } else { imageLoader.loadImage((ImageView) view, imageName); } } } else if (imageName.startsWith("@drawable/")) { imageName = imageName.substring("@drawable/".length()); ((ImageView) view).setImageDrawable(getDrawableByName(view, imageName)); } } } }); viewRunnables.put("visibility", new ViewParamRunnable() { @Override public void apply(View view, String value, ViewGroup parent, Map<String, String> attrs) { int visibility = View.VISIBLE; String visValue = value.toLowerCase(); if (visValue.equals("gone")) visibility = View.GONE; else if (visValue.equals("invisible")) visibility = View.INVISIBLE; view.setVisibility(visibility); } }); viewRunnables.put("clickable", new ViewParamRunnable() { @Override public void apply(View view, String value, ViewGroup parent, Map<String, String> attrs) { view.setClickable(value.equals("true")); } }); viewRunnables.put("tag", new ViewParamRunnable() { @Override public void apply(View view, String value, ViewGroup parent, Map<String, String> attrs) { // Sigh, this is dangerous because we use tags for other purposes if (view.getTag() == null) view.setTag(value); } }); viewRunnables.put("onClick", new ViewParamRunnable() { @Override public void apply(View view, String value, ViewGroup parent, Map<String, String> attrs) { view.setOnClickListener(getClickListener(parent, value)); } }); }
From source file:fiskinfoo.no.sintef.fiskinfoo.Implementation.UtilityOnClickListeners.java
public OnClickListener getToolEntryEditDialogOnClickListener(final Activity activity, final FragmentManager fragmentManager, final GpsLocationTracker locationTracker, final ToolEntry toolEntry, final User user) { return new OnClickListener() { @Override//from w w w . j av a2 s . co m public void onClick(final View editButton) { final DialogInterface dialogInterface = new UtilityDialogs(); final Dialog dialog = dialogInterface.getDialog(editButton.getContext(), R.layout.dialog_register_new_tool, R.string.edit_tool); ((Button) dialog.findViewById(R.id.dialog_register_tool_create_tool_button)) .setText(editButton.getContext().getString(R.string.save)); final Button updateButton = (Button) dialog .findViewById(R.id.dialog_register_tool_create_tool_button); final Button cancelButton = (Button) dialog.findViewById(R.id.dialog_register_tool_cancel_button); final LinearLayout fieldContainer = (LinearLayout) dialog .findViewById(R.id.dialog_register_tool_main_container); final DatePickerRow setupDateRow = new DatePickerRow(editButton.getContext(), editButton.getContext().getString(R.string.tool_set_date_colon), fragmentManager); final TimePickerRow setupTimeRow = new TimePickerRow(editButton.getContext(), editButton.getContext().getString(R.string.tool_set_time_colon), fragmentManager, false); final CoordinatesRow coordinatesRow = new CoordinatesRow(activity, locationTracker); final SpinnerRow toolRow = new SpinnerRow(editButton.getContext(), editButton.getContext().getString(R.string.tool_type), ToolType.getValues()); final CheckBoxRow toolRemovedRow = new CheckBoxRow(editButton.getContext(), editButton.getContext().getString(R.string.tool_removed_row_text), true); final EditTextRow commentRow = new EditTextRow(editButton.getContext(), editButton.getContext().getString(R.string.comment_field_header), editButton.getContext().getString(R.string.comment_field_hint)); final EditTextRow contactPersonNameRow = new EditTextRow(editButton.getContext(), editButton.getContext().getString(R.string.contact_person_name), editButton.getContext().getString(R.string.contact_person_name)); final EditTextRow contactPersonPhoneRow = new EditTextRow(editButton.getContext(), editButton.getContext().getString(R.string.contact_person_phone), editButton.getContext().getString(R.string.contact_person_phone)); final EditTextRow contactPersonEmailRow = new EditTextRow(editButton.getContext(), editButton.getContext().getString(R.string.contact_person_email), editButton.getContext().getString(R.string.contact_person_email)); final EditTextRow vesselNameRow = new EditTextRow(editButton.getContext(), editButton.getContext().getString(R.string.vessel_name), editButton.getContext().getString(R.string.vessel_name)); final EditTextRow vesselPhoneNumberRow = new EditTextRow(editButton.getContext(), editButton.getContext().getString(R.string.vessel_phone_number), editButton.getContext().getString(R.string.vessel_phone_number)); final EditTextRow vesselIrcsNumberRow = new EditTextRow(editButton.getContext(), editButton.getContext().getString(R.string.ircs_number), editButton.getContext().getString(R.string.ircs_number)); final EditTextRow vesselMmsiNumberRow = new EditTextRow(editButton.getContext(), editButton.getContext().getString(R.string.mmsi_number), editButton.getContext().getString(R.string.mmsi_number)); final EditTextRow vesselImoNumberRow = new EditTextRow(editButton.getContext(), editButton.getContext().getString(R.string.imo_number), editButton.getContext().getString(R.string.imo_number)); final EditTextRow vesselRegistrationNumberRow = new EditTextRow(editButton.getContext(), editButton.getContext().getString(R.string.registration_number), editButton.getContext().getString(R.string.registration_number)); final ErrorRow errorRow = new ErrorRow(editButton.getContext(), editButton.getContext().getString(R.string.error_minimum_identification_factors_not_met), false); final SimpleDateFormat sdfMilliSeconds = new SimpleDateFormat( editButton.getContext().getString(R.string.datetime_format_yyyy_mm_dd_t_hh_mm_ss_sss), Locale.getDefault()); final SimpleDateFormat sdf = new SimpleDateFormat( editButton.getContext().getString(R.string.datetime_format_yyyy_mm_dd_t_hh_mm_ss), Locale.getDefault()); View.OnClickListener deleteButtonRowOnClickListener = new OnClickListener() { @Override public void onClick(View v) { String confirmationText; switch (toolEntry.getToolStatus()) { case STATUS_RECEIVED: case STATUS_SENT_UNCONFIRMED: confirmationText = v.getContext() .getString(R.string.confirm_registered_tool_deletion_text); break; case STATUS_UNSENT: case STATUS_UNREPORTED: confirmationText = v.getContext().getString(R.string.confirm_tool_deletion_text); break; case STATUS_REMOVED_UNCONFIRMED: confirmationText = v.getContext() .getString(R.string.confirm_registered_tool_with_local_changes_deletion_text); break; default: confirmationText = v.getContext() .getString(R.string.confirm_tool_deletion_text_general); break; } final Dialog deleteToolDialog = dialogInterface.getConfirmationDialog(v.getContext(), v.getContext().getString(R.string.delete_tool), confirmationText, v.getContext().getString(R.string.delete)); Button confirmToolDeletionButton = (Button) deleteToolDialog .findViewById(R.id.dialog_bottom_confirm_bottom); confirmToolDeletionButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { View parentView = (View) ((editButton.getParent()).getParent()); ((LinearLayout) parentView).removeView(((View) (editButton.getParent()))); Toast.makeText(v.getContext(), v.getContext().getString(R.string.tool_deleted), Toast.LENGTH_LONG).show(); user.getToolLog().removeTool(toolEntry.getSetupDate(), toolEntry.getToolLogId()); user.writeToSharedPref(v.getContext()); deleteToolDialog.dismiss(); dialog.dismiss(); } }); deleteToolDialog.show(); } }; View.OnClickListener archiveToolOnClickListener = new OnClickListener() { @Override public void onClick(View v) { String confirmationText; switch (toolEntry.getToolStatus()) { case STATUS_RECEIVED: confirmationText = v.getContext().getString(R.string.confirm_registered_tool_archiving); break; case STATUS_UNSENT: if (!toolEntry.getId().isEmpty()) { confirmationText = v.getContext().getString(R.string.confirm_tool_archiving_text); } else { confirmationText = v.getContext().getString( R.string.confirm_registered_tool_with_local_changes_archiving_text); } break; default: confirmationText = v.getContext() .getString(R.string.confirm_tool_archiving_text_general); break; } final Dialog archiveDialog = dialogInterface.getConfirmationDialog(v.getContext(), v.getContext().getString(R.string.archive_tool), confirmationText, v.getContext().getString(R.string.archive)); Button confirmToolArchiveButton = (Button) archiveDialog .findViewById(R.id.dialog_bottom_confirm_bottom); confirmToolArchiveButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { View parentView = (View) ((editButton.getParent()).getParent()).getParent(); ((LinearLayout) parentView) .removeView(((View) (editButton.getParent()).getParent())); Toast.makeText(v.getContext(), v.getContext().getString(R.string.tool_archived), Toast.LENGTH_LONG).show(); toolEntry.setToolStatus(ToolEntryStatus.STATUS_REMOVED); user.writeToSharedPref(v.getContext()); archiveDialog.dismiss(); dialog.dismiss(); } }); archiveDialog.show(); } }; ActionRow archiveRow = new ActionRow(editButton.getContext(), editButton.getContext().getString(R.string.archive_tool), R.drawable.ic_archive_black_24dp, archiveToolOnClickListener); ActionRow deleteRow = new ActionRow(editButton.getContext(), editButton.getContext().getString(R.string.delete_tool), R.drawable.ic_delete_black_24dp, deleteButtonRowOnClickListener); commentRow.setInputType(InputType.TYPE_CLASS_TEXT); commentRow.setHelpText(editButton.getContext().getString(R.string.comment_help_description)); vesselNameRow.setInputType(InputType.TYPE_CLASS_TEXT); contactPersonPhoneRow .setHelpText(editButton.getContext().getString(R.string.vessel_name_help_description)); vesselPhoneNumberRow.setInputType(InputType.TYPE_CLASS_PHONE); vesselIrcsNumberRow.setInputType(InputType.TYPE_CLASS_TEXT); vesselIrcsNumberRow.setInputFilters(new InputFilter[] { new InputFilter.LengthFilter( editButton.getContext().getResources().getInteger(R.integer.input_length_ircs)), new InputFilter.AllCaps() }); vesselIrcsNumberRow.setHelpText(editButton.getContext().getString(R.string.ircs_help_description)); vesselMmsiNumberRow.setInputType(InputType.TYPE_CLASS_NUMBER); vesselMmsiNumberRow.setInputFilters(new InputFilter[] { new InputFilter.LengthFilter( editButton.getContext().getResources().getInteger(R.integer.input_length_mmsi)) }); vesselMmsiNumberRow.setHelpText(editButton.getContext().getString(R.string.mmsi_help_description)); vesselImoNumberRow.setInputType(InputType.TYPE_CLASS_NUMBER); vesselImoNumberRow.setInputFilters(new InputFilter[] { new InputFilter.LengthFilter( editButton.getContext().getResources().getInteger(R.integer.input_length_imo)) }); vesselImoNumberRow.setHelpText(editButton.getContext().getString(R.string.imo_help_description)); vesselRegistrationNumberRow.setInputType(InputType.TYPE_CLASS_TEXT); vesselRegistrationNumberRow.setInputFilters(new InputFilter[] { new InputFilter.LengthFilter(editButton.getContext().getResources() .getInteger(R.integer.input_length_registration_number)), new InputFilter.AllCaps() }); vesselRegistrationNumberRow.setHelpText( editButton.getContext().getString(R.string.registration_number_help_description)); contactPersonNameRow.setInputType(InputType.TYPE_TEXT_VARIATION_PERSON_NAME); contactPersonPhoneRow.setInputType(InputType.TYPE_CLASS_PHONE); contactPersonEmailRow.setInputType(InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS); contactPersonNameRow.setHelpText( editButton.getContext().getString(R.string.contact_person_name_help_description)); contactPersonPhoneRow.setHelpText( editButton.getContext().getString(R.string.contact_person_phone_help_description)); contactPersonEmailRow.setHelpText( editButton.getContext().getString(R.string.contact_person_email_help_description)); coordinatesRow.setCoordinates(activity, toolEntry.getCoordinates()); setupDateRow.setEnabled(false); /* Should these fields be editable after tools are reported? */ // vesselRegistrationNumberRow.setEnabled(toolEntry.getToolStatus() == ToolEntryStatus.STATUS_UNREPORTED); // vesselImoNumberRow.setEnabled(toolEntry.getToolStatus() == ToolEntryStatus.STATUS_UNREPORTED); // vesselMmsiNumberRow.setEnabled(toolEntry.getToolStatus() == ToolEntryStatus.STATUS_UNREPORTED); // vesselNameRow.setEnabled(toolEntry.getToolStatus() == ToolEntryStatus.STATUS_UNREPORTED); // vesselIrcsNumberRow.setEnabled(toolEntry.getToolStatus() == ToolEntryStatus.STATUS_UNREPORTED); ArrayAdapter<String> currentAdapter = toolRow.getAdapter(); toolRow.setSelectedSpinnerItem(currentAdapter.getPosition(toolEntry.getToolType().toString())); toolRemovedRow.setChecked(!toolEntry.getRemovedTime().isEmpty()); commentRow.setText(toolEntry.getComment()); contactPersonNameRow.setText(toolEntry.getContactPersonName()); contactPersonPhoneRow .setText(!toolEntry.getContactPersonPhone().equals("") ? toolEntry.getContactPersonPhone() : toolEntry.getVesselPhone()); contactPersonEmailRow .setText(!toolEntry.getContactPersonEmail().equals("") ? toolEntry.getContactPersonEmail() : toolEntry.getVesselEmail()); vesselNameRow.setText(toolEntry.getVesselName()); vesselPhoneNumberRow.setText(toolEntry.getVesselPhone()); vesselIrcsNumberRow.setText(toolEntry.getIRCS()); vesselMmsiNumberRow.setText(toolEntry.getMMSI()); vesselImoNumberRow.setText(toolEntry.getIMO()); vesselRegistrationNumberRow.setText(toolEntry.getRegNum()); sdf.setTimeZone(TimeZone.getTimeZone("UTC")); Date setupDate = null; String toolSetupDateTime; try { setupDate = sdf.parse(toolEntry.getSetupDateTime()); } catch (ParseException e) { e.printStackTrace(); } sdfMilliSeconds.setTimeZone(TimeZone.getDefault()); toolSetupDateTime = sdfMilliSeconds.format(setupDate); setupDateRow.setDate(toolSetupDateTime.substring(0, 10)); setupTimeRow.setTime(toolSetupDateTime.substring(toolEntry.getSetupDateTime().indexOf('T') + 1, toolEntry.getSetupDateTime().indexOf('T') + 6)); fieldContainer.addView(coordinatesRow.getView()); fieldContainer.addView(setupDateRow.getView()); fieldContainer.addView(setupTimeRow.getView()); fieldContainer.addView(toolRow.getView()); fieldContainer.addView(toolRemovedRow.getView()); fieldContainer.addView(commentRow.getView()); fieldContainer.addView(contactPersonNameRow.getView()); fieldContainer.addView(contactPersonPhoneRow.getView()); fieldContainer.addView(contactPersonEmailRow.getView()); fieldContainer.addView(vesselNameRow.getView()); fieldContainer.addView(vesselPhoneNumberRow.getView()); fieldContainer.addView(vesselIrcsNumberRow.getView()); fieldContainer.addView(vesselMmsiNumberRow.getView()); fieldContainer.addView(vesselImoNumberRow.getView()); fieldContainer.addView(vesselRegistrationNumberRow.getView()); fieldContainer.addView(errorRow.getView()); if (toolEntry.getToolStatus() != ToolEntryStatus.STATUS_UNREPORTED) { fieldContainer.addView(archiveRow.getView()); } fieldContainer.addView(deleteRow.getView()); updateButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View updateButton) { List<Point> coordinates = coordinatesRow.getCoordinates(); ToolType toolType = ToolType.createFromValue(toolRow.getCurrentSpinnerItem()); boolean toolRemoved = toolRemovedRow.isChecked(); String vesselName = vesselNameRow.getFieldText(); String vesselPhoneNumber = vesselPhoneNumberRow.getFieldText(); String toolSetupDate = setupDateRow.getDate(); String toolSetupTime = setupTimeRow.getTime(); String toolSetupDateTime; String commentString = commentRow.getFieldText(); String vesselIrcsNumber = vesselIrcsNumberRow.getFieldText(); String vesselMmsiNumber = vesselMmsiNumberRow.getFieldText(); String vesselImoNumber = vesselImoNumberRow.getFieldText(); String registrationNumber = vesselRegistrationNumberRow.getFieldText(); String contactPersonName = contactPersonNameRow.getFieldText(); String contactPersonPhone = contactPersonPhoneRow.getFieldText(); String contactPersonEmail = contactPersonEmailRow.getFieldText(); FiskInfoUtility utility = new FiskInfoUtility(); boolean validated; boolean edited = false; boolean ircsValidated; boolean mmsiValidated; boolean imoValidated; boolean regNumValidated; boolean minimumIdentificationFactorsMet; validated = coordinates != null; if (!validated) { return; } validated = utility.validateName(contactPersonNameRow.getFieldText().trim()); contactPersonNameRow.setError(validated ? null : updateButton.getContext().getString(R.string.error_invalid_name)); if (!validated) { ((ScrollView) fieldContainer.getParent()).post(new Runnable() { @Override public void run() { ((ScrollView) fieldContainer.getParent()).scrollTo(0, contactPersonNameRow.getView().getBottom()); contactPersonNameRow.requestFocus(); } }); return; } validated = utility.validatePhoneNumber(contactPersonPhoneRow.getFieldText().trim()); contactPersonPhoneRow.setError(validated ? null : updateButton.getContext().getString(R.string.error_invalid_phone_number)); if (!validated) { ((ScrollView) fieldContainer.getParent()).post(new Runnable() { @Override public void run() { ((ScrollView) fieldContainer.getParent()).scrollTo(0, contactPersonPhoneRow.getView().getBottom()); contactPersonPhoneRow.requestFocus(); } }); return; } validated = utility.isEmailValid(contactPersonEmailRow.getFieldText().trim()); contactPersonEmailRow.setError(validated ? null : updateButton.getContext().getString(R.string.error_invalid_email)); if (!validated) { ((ScrollView) fieldContainer.getParent()).post(new Runnable() { @Override public void run() { ((ScrollView) fieldContainer.getParent()).scrollTo(0, contactPersonEmailRow.getView().getBottom()); contactPersonEmailRow.requestFocus(); } }); return; } validated = vesselNameRow.getFieldText().trim() != null && !vesselNameRow.getFieldText().isEmpty(); vesselNameRow.setError(validated ? null : updateButton.getContext().getString(R.string.error_invalid_vessel_name)); if (!validated) { ((ScrollView) fieldContainer.getParent()).post(new Runnable() { @Override public void run() { ((ScrollView) fieldContainer.getParent()).scrollTo(0, vesselNameRow.getView().getBottom()); vesselNameRow.requestFocus(); } }); return; } validated = vesselPhoneNumberRow.getFieldText().trim() != null && !vesselPhoneNumberRow.getFieldText().isEmpty(); vesselPhoneNumberRow.setError(validated ? null : updateButton.getContext().getString(R.string.error_invalid_phone_number)); if (!validated) { ((ScrollView) fieldContainer.getParent()).post(new Runnable() { @Override public void run() { ((ScrollView) fieldContainer.getParent()).scrollTo(0, vesselPhoneNumberRow.getView().getBottom()); vesselPhoneNumberRow.requestFocus(); } }); return; } validated = (ircsValidated = utility.validateIRCS(vesselIrcsNumber)) || vesselIrcsNumber.isEmpty(); vesselIrcsNumberRow.setError(validated ? null : updateButton.getContext().getString(R.string.error_invalid_ircs)); if (!validated) { ((ScrollView) fieldContainer.getParent()).post(new Runnable() { @Override public void run() { ((ScrollView) fieldContainer.getParent()).scrollTo(0, vesselIrcsNumberRow.getView().getBottom()); vesselIrcsNumberRow.requestFocus(); } }); return; } validated = (mmsiValidated = utility.validateMMSI(vesselMmsiNumber)) || vesselMmsiNumber.isEmpty(); vesselMmsiNumberRow.setError(validated ? null : updateButton.getContext().getString(R.string.error_invalid_mmsi)); if (!validated) { ((ScrollView) fieldContainer.getParent()).post(new Runnable() { @Override public void run() { ((ScrollView) fieldContainer.getParent()).scrollTo(0, vesselMmsiNumberRow.getView().getBottom()); vesselMmsiNumberRow.requestFocus(); } }); return; } validated = (imoValidated = utility.validateIMO(vesselImoNumber)) || vesselImoNumber.isEmpty(); vesselImoNumberRow.setError( validated ? null : updateButton.getContext().getString(R.string.error_invalid_imo)); if (!validated) { ((ScrollView) fieldContainer.getParent()).post(new Runnable() { @Override public void run() { ((ScrollView) fieldContainer.getParent()).scrollTo(0, vesselImoNumberRow.getView().getBottom()); vesselImoNumberRow.requestFocus(); } }); return; } validated = (regNumValidated = utility.validateRegistrationNumber(registrationNumber)) || registrationNumber.isEmpty(); vesselRegistrationNumberRow.setError(validated ? null : editButton.getContext().getString(R.string.error_invalid_registration_number)); if (!validated) { ((ScrollView) fieldContainer.getParent().getParent()).post(new Runnable() { @Override public void run() { ((ScrollView) fieldContainer.getParent().getParent()).scrollTo(0, vesselRegistrationNumberRow.getView().getBottom()); vesselRegistrationNumberRow.requestFocus(); } }); return; } sdf.setTimeZone(TimeZone.getDefault()); Date setupDate = null; String setupDateString = toolSetupDate + "T" + toolSetupTime + ":00Z"; try { setupDate = sdf.parse(setupDateString); } catch (ParseException e) { e.printStackTrace(); } sdfMilliSeconds.setTimeZone(TimeZone.getTimeZone("UTC")); setupDateString = sdfMilliSeconds.format(setupDate); toolSetupDateTime = setupDateString.substring(0, setupDateString.indexOf('.')).concat("Z"); minimumIdentificationFactorsMet = !vesselName.isEmpty() && (ircsValidated || mmsiValidated || imoValidated || regNumValidated); if ((coordinates != null && coordinates.size() != toolEntry.getCoordinates().size()) || toolType != toolEntry.getToolType() || (toolRemoved) == (toolEntry.getRemovedTime().isEmpty()) || (vesselName != null && !vesselName.equals(toolEntry.getVesselName())) || (vesselPhoneNumber != null && !vesselPhoneNumber.equals(toolEntry.getVesselPhone())) || (toolSetupDateTime != null && !toolSetupDateTime.equals(toolEntry.getSetupDateTime())) || (vesselIrcsNumber != null && !vesselIrcsNumber.equals(toolEntry.getIRCS())) || (vesselMmsiNumber != null && !vesselMmsiNumber.equals(toolEntry.getMMSI())) || (vesselImoNumber != null && !vesselImoNumber.equals(toolEntry.getIMO())) || (registrationNumber != null && !registrationNumber.equals(toolEntry.getRegNum())) || (contactPersonName != null && !contactPersonName.equals(toolEntry.getContactPersonName())) || (contactPersonPhone != null && !contactPersonPhone.equals(toolEntry.getContactPersonPhone())) || (contactPersonEmail != null && !contactPersonEmail.equals(toolEntry.getContactPersonEmail())) || (commentString != null && !commentString.equals(toolEntry.getComment()))) { edited = true; } else { List<Point> points = toolEntry.getCoordinates(); for (int i = 0; i < coordinates.size(); i++) { if (coordinates.get(i).getLatitude() != points.get(i).getLatitude() || coordinates.get(i).getLongitude() != points.get(i).getLongitude()) { edited = true; break; } } } if (edited) { if (!minimumIdentificationFactorsMet) { errorRow.setVisibility(!minimumIdentificationFactorsMet); return; } Date lastChangedDate = new Date(); Date previousSetupDate = null; SimpleDateFormat sdfSetupCompare = new SimpleDateFormat("yyyyMMdd", Locale.getDefault()); String lastChangedDateString = sdfMilliSeconds.format(lastChangedDate).concat("Z"); sdfSetupCompare.setTimeZone(TimeZone.getTimeZone("UTC")); try { previousSetupDate = sdf.parse(toolEntry.getSetupDateTime() .substring(0, toolEntry.getSetupDateTime().length() - 1).concat(".000")); } catch (ParseException e) { e.printStackTrace(); } if (!sdfSetupCompare.format(previousSetupDate) .equals(sdfSetupCompare.format(setupDate))) { // TODO: setup date is changed, tool needs to be moved in log so the app does not crash when trying to delete tool. // user.getToolLog().removeTool(toolEntry.getSetupDate(), toolEntry.getToolLogId()); // user.getToolLog().addTool(toolEntry, toolEntry.getSetupDateTime().substring(0, 10)); // user.writeToSharedPref(editButton.getContext()); } ToolEntryStatus toolStatus = (toolRemoved ? ToolEntryStatus.STATUS_REMOVED_UNCONFIRMED : (toolEntry.getToolStatus() == ToolEntryStatus.STATUS_UNREPORTED ? ToolEntryStatus.STATUS_UNREPORTED : ToolEntryStatus.STATUS_UNSENT)); toolEntry.setToolStatus(toolStatus); toolEntry.setCoordinates(coordinates); toolEntry.setToolType(toolType); toolEntry.setVesselName(vesselName); toolEntry.setVesselPhone(vesselPhoneNumber); toolEntry.setSetupDateTime(toolSetupDateTime); toolEntry.setRemovedTime(toolRemoved ? lastChangedDateString : null); toolEntry.setComment(commentString); toolEntry.setIRCS(vesselIrcsNumber); toolEntry.setMMSI(vesselMmsiNumber); toolEntry.setIMO(vesselImoNumber); toolEntry.setRegNum(registrationNumber); toolEntry.setLastChangedDateTime(lastChangedDateString); toolEntry.setLastChangedBySource(lastChangedDateString); toolEntry.setContactPersonName(contactPersonName); toolEntry.setContactPersonPhone(contactPersonPhone); toolEntry.setContactPersonEmail(contactPersonEmail); try { ImageView notificationView = (ImageView) ((View) editButton.getParent()) .findViewById(R.id.tool_log_row_reported_image_view); if (notificationView != null) { notificationView.setVisibility(View.VISIBLE); notificationView.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Toast.makeText(v.getContext(), R.string.notification_tool_unreported_changes, Toast.LENGTH_LONG).show(); } }); } TextView dateTimeTextView = (TextView) ((View) editButton.getParent()) .findViewById(R.id.tool_log_row_latest_date_text_view); TextView toolTypeTextView = (TextView) ((View) editButton.getParent()) .findViewById(R.id.tool_log_row_tool_type_text_view); TextView positionTextView = (TextView) ((View) editButton.getParent()) .findViewById(R.id.tool_log_row_tool_position_text_view); StringBuilder sb = new StringBuilder(); sb.append(FiskInfoUtility .decimalToDMS((toolEntry.getCoordinates().get(0).getLatitude()))); sb.append(", "); sb.append(FiskInfoUtility .decimalToDMS((toolEntry.getCoordinates().get(0).getLongitude()))); String coordinateString = sb.toString(); coordinateString = toolEntry.getCoordinates().size() < 2 ? coordinateString : coordinateString + "\n.."; sdfMilliSeconds.setTimeZone(TimeZone.getTimeZone("GMT+1")); setupDateString = sdfMilliSeconds.format(setupDate); dateTimeTextView.setText(setupDateString.substring(0, 16).replace("T", " ")); toolTypeTextView.setText(toolEntry.getToolType().toString()); positionTextView.setText(coordinateString); Date toolDate; Date currentDate = new Date(); try { toolDate = sdf.parse(toolEntry.getSetupDateTime() .substring(0, toolEntry.getSetupDateTime().length() - 1) .concat(".000")); long diff = currentDate.getTime() - toolDate.getTime(); double days = diff / updateButton.getContext().getResources() .getInteger(R.integer.milliseconds_in_a_day); if (days > 14) { dateTimeTextView.setTextColor(ContextCompat .getColor(updateButton.getContext(), (R.color.error_red))); } else { dateTimeTextView.setTextColor(toolTypeTextView.getCurrentTextColor()); } } catch (ParseException e) { e.printStackTrace(); return; } } catch (ClassCastException e) { e.printStackTrace(); } user.writeToSharedPref(updateButton.getContext()); } else { Toast.makeText(editButton.getContext(), R.string.no_changes_made, Toast.LENGTH_LONG) .show(); } dialog.dismiss(); } }); cancelButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); dialog.show(); } }; }
From source file:com.example.android.contactslist.ui.eventEntry.EventEntryFragment.java
private void addItemsToClassSpinner() { //set the adapter to the string-array in the strings resource ArrayAdapter<String> feedSelectionAdapter = new ArrayAdapter<String>(getActivity(), android.R.layout.simple_spinner_item, getResources().getStringArray(R.array.array_of_event_classes)); //choose the style of the list. feedSelectionAdapter.setDropDownViewResource(android.R.layout.simple_list_item_activated_1); mClassSelectionSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override// w w w . j ava 2 s .c o m public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) { mEventClass = pos + 1; // set the event class for this java class switch (mEventClass) { case EventInfo.PHONE_CLASS: mAddressViewButton.setText(mVoiceNumber); mAddressViewButton.setInputType(InputType.TYPE_CLASS_PHONE); mEventDurationLayout.setVisibility(View.VISIBLE); mEventWordCountLayout.setVisibility(View.GONE); mIncomingButton.setText(R.string.incoming_title); mOutgoingButton.setText(R.string.outgoing_title); mAddressTitle.setText(R.string.event_address_title_alt_phone); break; case EventInfo.EMAIL_CLASS: mAddressViewButton.setText(mEmailAddress); mAddressViewButton.setInputType(InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS); mEventDurationLayout.setVisibility(View.GONE); mEventWordCountLayout.setVisibility(View.VISIBLE); mIncomingButton.setText(R.string.incoming_title); mOutgoingButton.setText(R.string.outgoing_title); mAddressTitle.setText(R.string.event_address_title); break; case EventInfo.SMS_CLASS: mAddressViewButton.setText(mVoiceNumber); mAddressViewButton.setInputType(InputType.TYPE_CLASS_PHONE); mEventDurationLayout.setVisibility(View.GONE); mEventWordCountLayout.setVisibility(View.VISIBLE); mIncomingButton.setText(R.string.incoming_title); mOutgoingButton.setText(R.string.outgoing_title); mAddressTitle.setText(R.string.event_address_title_alt_phone); break; case EventInfo.MEETING_CLASS: mAddressViewButton.setText(mStreetAddress); mAddressViewButton.setInputType(InputType.TYPE_TEXT_VARIATION_POSTAL_ADDRESS); mEventDurationLayout.setVisibility(View.VISIBLE); mEventWordCountLayout.setVisibility(View.GONE); mIncomingButton.setText(R.string.incoming_title_alt); mOutgoingButton.setText(R.string.outgoing_title_alt); mAddressTitle.setText(R.string.event_address_title); break; case EventInfo.SKYPE: mEventDurationLayout.setVisibility(View.VISIBLE); mEventWordCountLayout.setVisibility(View.GONE); mIncomingButton.setText(R.string.incoming_title); mOutgoingButton.setText(R.string.outgoing_title); mAddressTitle.setText(R.string.event_address_title_alt_handle); break; case EventInfo.GOOGLE_HANGOUTS: mAddressViewButton.setText(mEmailAddress); mAddressViewButton.setInputType(InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS); mEventDurationLayout.setVisibility(View.VISIBLE); mEventWordCountLayout.setVisibility(View.GONE); mIncomingButton.setText(R.string.incoming_title); mOutgoingButton.setText(R.string.outgoing_title); mAddressTitle.setText(R.string.event_address_title_alt_handle); break; case EventInfo.FACEBOOK: mAddressViewButton.setText(mEmailAddress); mAddressViewButton.setInputType(InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS); mEventDurationLayout.setVisibility(View.GONE); mEventWordCountLayout.setVisibility(View.VISIBLE); mIncomingButton.setText(R.string.incoming_title); mOutgoingButton.setText(R.string.outgoing_title); mAddressTitle.setText(R.string.event_address_title_alt_handle); break; default: } } @Override public void onNothingSelected(AdapterView<?> arg0) { // TODO Auto-generated method stub } }); mClassSelectionSpinner.setAdapter(feedSelectionAdapter); }
From source file:org.telegram.ui.PassportActivity.java
private void createEmailVerificationInterface(Context context) { actionBar.setTitle(LocaleController.getString("PassportEmail", R.string.PassportEmail)); inputFields = new EditTextBoldCursor[1]; for (int a = 0; a < 1; a++) { ViewGroup container = new FrameLayout(context); linearLayout2.addView(container, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 50)); container.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite)); inputFields[a] = new EditTextBoldCursor(context); inputFields[a].setTag(a);// w ww . jav a 2s. co m inputFields[a].setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16); inputFields[a].setHintTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteHintText)); inputFields[a].setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText)); inputFields[a].setBackgroundDrawable(null); inputFields[a].setCursorColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText)); inputFields[a].setCursorSize(AndroidUtilities.dp(20)); inputFields[a].setCursorWidth(1.5f); inputFields[a].setInputType(InputType.TYPE_CLASS_PHONE); inputFields[a].setImeOptions(EditorInfo.IME_ACTION_DONE | EditorInfo.IME_FLAG_NO_EXTRACT_UI); switch (a) { case FIELD_EMAIL: inputFields[a].setHint(LocaleController.getString("PassportEmailCode", R.string.PassportEmailCode)); break; } inputFields[a].setSelection(inputFields[a].length()); inputFields[a].setPadding(0, 0, 0, AndroidUtilities.dp(6)); inputFields[a].setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT); container.addView(inputFields[a], LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.TOP, 21, 12, 21, 6)); inputFields[a].setOnEditorActionListener((textView, i, keyEvent) -> { if (i == EditorInfo.IME_ACTION_DONE || i == EditorInfo.IME_ACTION_NEXT) { doneItem.callOnClick(); return true; } return false; }); inputFields[a].addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void afterTextChanged(Editable s) { if (ignoreOnTextChange) { return; } if (emailCodeLength != 0 && inputFields[FIELD_EMAIL].length() == emailCodeLength) { doneItem.callOnClick(); } } }); } bottomCell = new TextInfoPrivacyCell(context); bottomCell.setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); bottomCell.setText(LocaleController.formatString("PassportEmailVerifyInfo", R.string.PassportEmailVerifyInfo, currentValues.get("email"))); linearLayout2.addView(bottomCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); }