List of usage examples for android.widget FrameLayout addView
public void addView(View child)
Adds a child view.
From source file:com.taobao.weex.ui.component.WXSlider.java
public void addIndicator(WXIndicator indicator) { FrameLayout root = getHostView(); if (root == null) { return;// www .j a v a2 s . c o m } mIndicator = indicator; WXCircleIndicator indicatorView = indicator.getHostView(); if (indicatorView != null) { indicatorView.setCircleViewPager(mViewPager); // indicatorView.setOnPageChangeListener(mPageChangeListener); // commented for twice onChange() called when do slide. root.addView(indicatorView); } }
From source file:com.eugene.fithealthmaingit.UI.NavFragments.FragmentJournalMainHome.java
/** * Display Calorie Goal Indicator Information *//*from w w w . ja va 2 s .c o m*/ private void calorieInfoDialog(String s) { double calMin = mCalorieGoalMeal - 100; double calMax = mCalorieGoalMeal + 100; AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setTitle(s + " Calorie Goal") .setMessage("Goal: " + df.format(calMin) + " - " + df.format(calMax) + " Calories") .setPositiveButton("Done", null); LayoutInflater inflater = getActivity().getLayoutInflater(); FrameLayout f1 = new FrameLayout(getActivity()); f1.addView(inflater.inflate(R.layout.dialog_calorie_info, f1, false)); builder.setView(f1); AlertDialog alert = builder.create(); alert.show(); }
From source file:com.github.michalbednarski.intentslab.AppComponentsFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { FragmentActivity activity = getActivity(); FrameLayout frameLayout = new FrameLayout(activity); FrameLayout.LayoutParams stretch = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT); FrameLayout.LayoutParams center = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT, Gravity.CENTER); final ExpandableListView expandableListView = new ExpandableListView(activity); expandableListView.setAdapter(this); expandableListView.setOnChildClickListener(this); expandableListView.setLayoutParams(stretch); frameLayout.addView(expandableListView); final TextView emptyView = new TextView(activity); emptyView.setText(activity.getString(R.string.no_components)); emptyView.setLayoutParams(center);//from w w w .j av a2s. co m frameLayout.addView(emptyView); expandableListView.setEmptyView(emptyView); return frameLayout; }
From source file:com.pdftron.pdf.controls.ReflowPagerAdapter.java
@Override public Object instantiateItem(final ViewGroup container, final int position) { int availIndex = mWebViewRepository.pop(); ReflowWebView webView = mWebViewRepository.getWebView(availIndex); if (webView == null) { AnalyticsHandlerAdapter.getInstance() .sendException(new Exception("Reflow: there is no available WebView in repository")); Log.e(TAG, "there is no available WebView in repository"); return null; }/*from ww w . j a va 2 s .c o m*/ webView.loadUrl("about:blank"); int pagePosition = mIsRtlMode ? mPageCount - 1 - position : position; boolean need_load_flag = true; String filename = mReflowFiles.get(pagePosition); if (filename != null) { File file = new File(filename); if (file.exists()) { need_load_flag = false; if (DEBUG) Log.d(TAG, "the file at page #" + (position + 1) + " already received"); webView.loadUrl("file:///" + filename); setTextZoom(webView); } } if (need_load_flag) { webView.loadUrl(mLoadingFile); try { // request for reflow output if (DEBUG) Log.d(TAG, "request for page #" + (pagePosition + 1)); Page page = mDoc.getPage(pagePosition + 1); ReflowProcessor.getReflow(page, mRequestHandler, position); } catch (Exception e) { e.printStackTrace(); } } FrameLayout layout = new FrameLayout(mContext); FrameLayout parent = (FrameLayout) webView.getParent(); if (parent != null) { // note that we share WebViews, // so before adding a WebView make sure it's not a child of any layout parent.removeAllViews(); } layout.addView(webView); mViewHolders.put(position, layout); mViewIndexes.put(position, new Integer(availIndex)); container.addView(layout); return layout; }
From source file:com.google.android.apps.dashclock.configuration.ConfigureAppearanceFragment.java
private void configureStylePager(final ViewPager pager, final PagerPositionStrip positionStrip, final String[] styleNames, final String styleComponent, final int gravity, final String preference) { String currentStyleName = mCurrentStyleNames.get(preference); final LayoutInflater inflater = getActivity().getLayoutInflater(); pager.setAdapter(new PagerAdapter() { @Override//from w w w. j a v a2s. c om public int getCount() { return styleNames.length; } @Override public boolean isViewFromObject(View view, Object o) { return view == o; } @Override public Object instantiateItem(ViewGroup container, int position) { FrameLayout wrapper = new FrameLayout(getActivity()); ViewPager.LayoutParams wrapperLp = new ViewPager.LayoutParams(); wrapper.setLayoutParams(wrapperLp); String styleName = styleNames[position]; if (styleName.contains("analog")) { styleName += "_white"; } View v = inflater.inflate( AppearanceConfig.getLayoutByStyleName(getActivity(), styleComponent, styleName), container, false); FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); lp.gravity = gravity; v.setLayoutParams(lp); wrapper.addView(v); container.addView(wrapper); return wrapper; } @Override public void destroyItem(ViewGroup container, int position, Object object) { container.removeView((View) object); } }); pager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @Override public void onPageSelected(int position) { mCurrentStyleNames.put(preference, styleNames[position]); } @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { positionStrip.setPosition(position + positionOffset); } }); positionStrip.setPageCount(styleNames.length); pager.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View view, MotionEvent motionEvent) { switch (motionEvent.getActionMasked()) { case MotionEvent.ACTION_DOWN: showPositionStrips(true, -1); break; case MotionEvent.ACTION_UP: showPositionStrips(false, AUTO_HIDE_DELAY_MILLIS); break; } return false; } }); for (int i = 0; i < styleNames.length; i++) { if (currentStyleName.equals(styleNames[i])) { pager.setCurrentItem(i); positionStrip.setPosition(i); break; } } }
From source file:com.taobao.weex.ui.component.WXSlider.java
@Override protected FrameLayout initComponentHostView(@NonNull Context context) { FrameLayout view = new FrameLayout(context); // init view pager FrameLayout.LayoutParams pagerParams = new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);//from w w w . j a va 2s . c o m mViewPager = new WXCircleViewPager(context); mViewPager.setLayoutParams(pagerParams); // init adapter mAdapter = new WXCirclePageAdapter(); mViewPager.setAdapter(mAdapter); // add to parent view.addView(mViewPager); mViewPager.addOnPageChangeListener(mPageChangeListener); registerActivityStateListener(); return view; }
From source file:net.nanocosmos.bintu.demo.encoder.activities.StreamActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Window window = getWindow();//from www . j av a2 s. co m window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.activity_streamer); ViewGroup.LayoutParams param = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); surface = new StreamPreview(this); surface.setLayoutParams(param); MultiSurfaceTextureListenerImpl multiSurfaceTextureListener = new MultiSurfaceTextureListenerImpl(); multiSurfaceTextureListener.addListener(this); surface.setSurfaceTextureListener(multiSurfaceTextureListener); FrameLayout frameLayout = (FrameLayout) findViewById(R.id.surfaceFrame); frameLayout.addView(surface); isDefaultOrientationLandscape = (RotationHelper .getDeviceDefaultOrientation(this) == android.content.res.Configuration.ORIENTATION_LANDSCAPE); String[] lic_exp = Configuration.NANOSTREAM_LICENSE.split(":adr:"); if (lic_exp.length > 1) { lic_exp = lic_exp[1].split(":"); if (lic_exp.length > 1) { lic_exp = lic_exp[0].split(","); if (lic_exp.length > 1) { String year = lic_exp[1].substring(0, 4); String month = lic_exp[1].substring(4, 6); String day = lic_exp[1].substring(6, 8); Toast.makeText(getApplicationContext(), "Licence expires on: " + month + "/" + day + "/" + year, Toast.LENGTH_LONG).show(); } } } Intent intent = getIntent(); serverUrl = intent.getStringExtra(Constants.KEY_SERVER_URL); streamName = intent.getStringExtra(Constants.KEY_STREAM_NAME); webPlayoutUrl = intent.getStringExtra(Constants.KEY_WEB_PLAYOUT); videoBitrate = intent.getIntExtra(Constants.KEY_BITRATE, videoBitrate); streamVideo = intent.getBooleanExtra(Constants.KEY_VIDEO_ENABLED, true); streamAudio = intent.getBooleanExtra(Constants.KEY_AUDIO_ENABLED, true); logEnabled = intent.getBooleanExtra(Constants.KEY_LOG_ENABLED, true); if (null == webPlayoutUrl || webPlayoutUrl.isEmpty()) { webPlayoutUrl = "http://www.nanocosmos.net/nanostream/live.html?id=" + serverUrl + "/" + streamName; } qualityView = (LinearLayout) findViewById(R.id.qualityView); outputBitrate = (TextView) findViewById(R.id.outputBitrateText); bufferFillness = (TextView) findViewById(R.id.bufferfillnessText); bitrate = (TextView) findViewById(R.id.bitrateText); framerate = (TextView) findViewById(R.id.framerateText); streamToggle = (ImageButton) findViewById(R.id.btnToogleStream); orientation = new CustomOrientationEventListener(this, SensorManager.SENSOR_DELAY_UI); orientation.enable(); mHandler = new Handler(); sendStreamOrientationHandler = new Handler(); }
From source file:com.taobao.weex.ui.component.WXSliderNeighbor.java
@Override protected FrameLayout initComponentHostView(@NonNull Context context) { FrameLayout view = new FrameLayout(context); // init view pager FrameLayout.LayoutParams pagerParams = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT); pagerParams.gravity = Gravity.CENTER; mViewPager = new WXCircleViewPager(getContext()); mViewPager.setLayoutParams(pagerParams); // init adapter mAdapter = new WXCirclePageAdapter(); mViewPager.setAdapter(mAdapter);//from w w w. j a va 2s . co m // add to parent view.addView(mViewPager); mViewPager.addOnPageChangeListener(mPageChangeListener); mViewPager.setOverScrollMode(View.OVER_SCROLL_NEVER); registerActivityStateListener(); mViewPager.setPageTransformer(false, createTransformer()); return view; }
From source file:org.telegram.ui.PrivacyControlActivity.java
@Override public View createView(Context context) { actionBar.setBackButtonImage(R.drawable.ic_ab_back); actionBar.setAllowOverlayTitle(true); if (isGroup) { actionBar.setTitle(LocaleController.getString("GroupsAndChannels", R.string.GroupsAndChannels)); } else {/*from w w w . j a v a2 s. c o m*/ actionBar.setTitle(LocaleController.getString("PrivacyLastSeen", R.string.PrivacyLastSeen)); } actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() { @Override public void onItemClick(int id) { if (id == -1) { finishFragment(); } else if (id == done_button) { if (getParentActivity() == null) { return; } if (currentType != 0 && !isGroup) { final SharedPreferences preferences = ApplicationLoader.applicationContext .getSharedPreferences("mainconfig", Activity.MODE_PRIVATE); boolean showed = preferences.getBoolean("privacyAlertShowed", false); if (!showed) { AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); if (isGroup) { builder.setMessage( LocaleController.getString("WhoCanAddMeInfo", R.string.WhoCanAddMeInfo)); } else { builder.setMessage(LocaleController.getString("CustomHelp", R.string.CustomHelp)); } builder.setTitle(LocaleController.getString("AppName", R.string.AppName)); builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { applyCurrentPrivacySettings(); preferences.edit().putBoolean("privacyAlertShowed", true).commit(); } }); builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null); showDialog(builder.create()); return; } } applyCurrentPrivacySettings(); } } }); ActionBarMenu menu = actionBar.createMenu(); doneButton = menu.addItemWithWidth(done_button, R.drawable.ic_done, AndroidUtilities.dp(56)); doneButton.setVisibility(View.GONE); listAdapter = new ListAdapter(context); fragmentView = new FrameLayout(context); FrameLayout frameLayout = (FrameLayout) fragmentView; frameLayout.setBackgroundColor(ContextCompat.getColor(context, R.color.settings_background)); ListView listView = new ListView(context); listView.setDivider(null); listView.setDividerHeight(0); listView.setVerticalScrollBarEnabled(false); listView.setDrawSelectorOnTop(true); frameLayout.addView(listView); FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) listView.getLayoutParams(); layoutParams.width = LayoutHelper.MATCH_PARENT; layoutParams.height = LayoutHelper.MATCH_PARENT; layoutParams.gravity = Gravity.TOP; listView.setLayoutParams(layoutParams); listView.setAdapter(listAdapter); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, final int i, long l) { if (i == nobodyRow || i == everybodyRow || i == myContactsRow) { int newType = currentType; if (i == nobodyRow) { newType = 1; } else if (i == everybodyRow) { newType = 0; } else if (i == myContactsRow) { newType = 2; } if (newType == currentType) { return; } enableAnimation = true; doneButton.setVisibility(View.VISIBLE); lastCheckedType = currentType; currentType = newType; updateRows(); } else if (i == neverShareRow || i == alwaysShareRow) { ArrayList<Integer> createFromArray; if (i == neverShareRow) { createFromArray = currentMinus; } else { createFromArray = currentPlus; } if (createFromArray.isEmpty()) { Bundle args = new Bundle(); args.putBoolean(i == neverShareRow ? "isNeverShare" : "isAlwaysShare", true); args.putBoolean("isGroup", isGroup); GroupCreateActivity fragment = new GroupCreateActivity(args); fragment.setDelegate(new GroupCreateActivity.GroupCreateActivityDelegate() { @Override public void didSelectUsers(ArrayList<Integer> ids) { if (i == neverShareRow) { currentMinus = ids; for (int a = 0; a < currentMinus.size(); a++) { currentPlus.remove(currentMinus.get(a)); } } else { currentPlus = ids; for (int a = 0; a < currentPlus.size(); a++) { currentMinus.remove(currentPlus.get(a)); } } doneButton.setVisibility(View.VISIBLE); lastCheckedType = -1; listAdapter.notifyDataSetChanged(); } }); presentFragment(fragment); } else { PrivacyUsersActivity fragment = new PrivacyUsersActivity(createFromArray, isGroup, i == alwaysShareRow); fragment.setDelegate(new PrivacyUsersActivity.PrivacyActivityDelegate() { @Override public void didUpdatedUserList(ArrayList<Integer> ids, boolean added) { if (i == neverShareRow) { currentMinus = ids; if (added) { for (int a = 0; a < currentMinus.size(); a++) { currentPlus.remove(currentMinus.get(a)); } } } else { currentPlus = ids; if (added) { for (int a = 0; a < currentPlus.size(); a++) { currentMinus.remove(currentPlus.get(a)); } } } doneButton.setVisibility(View.VISIBLE); listAdapter.notifyDataSetChanged(); } }); presentFragment(fragment); } } } }); return fragmentView; }
From source file:org.telegram.ui.ContactAddActivity.java
@Override public View createView(Context context) { actionBar.setBackButtonImage(R.drawable.ic_ab_back); actionBar.setAllowOverlayTitle(true); if (addContact) { actionBar.setTitle(LocaleController.getString("AddContactTitle", R.string.AddContactTitle)); } else {/* ww w. j a va2s . c o m*/ actionBar.setTitle(LocaleController.getString("EditName", R.string.EditName)); } actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() { @Override public void onItemClick(int id) { if (id == -1) { finishFragment(); } else if (id == done_button) { if (firstNameField.getText().length() != 0) { TLRPC.User user = MessagesController.getInstance().getUser(user_id); user.first_name = firstNameField.getText().toString(); user.last_name = lastNameField.getText().toString(); ContactsController.getInstance().addContact(user); finishFragment(); SharedPreferences preferences = ApplicationLoader.applicationContext .getSharedPreferences("Notifications", Activity.MODE_PRIVATE); preferences.edit().putInt("spam3_" + user_id, 1).commit(); NotificationCenter.getInstance().postNotificationName(NotificationCenter.updateInterfaces, MessagesController.UPDATE_MASK_NAME); } } } }); ActionBarMenu menu = actionBar.createMenu(); doneButton = menu.addItemWithWidth(done_button, R.drawable.ic_done, AndroidUtilities.dp(56)); fragmentView = new ScrollView(context); LinearLayout linearLayout = new LinearLayout(context); linearLayout.setOrientation(LinearLayout.VERTICAL); ((ScrollView) fragmentView).addView(linearLayout); ScrollView.LayoutParams layoutParams2 = (ScrollView.LayoutParams) linearLayout.getLayoutParams(); layoutParams2.width = ScrollView.LayoutParams.MATCH_PARENT; layoutParams2.height = ScrollView.LayoutParams.WRAP_CONTENT; linearLayout.setLayoutParams(layoutParams2); linearLayout.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { return true; } }); FrameLayout frameLayout = new FrameLayout(context); linearLayout.addView(frameLayout); LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) frameLayout.getLayoutParams(); layoutParams.topMargin = AndroidUtilities.dp(24); layoutParams.leftMargin = AndroidUtilities.dp(24); layoutParams.rightMargin = AndroidUtilities.dp(24); layoutParams.width = LayoutHelper.MATCH_PARENT; layoutParams.height = LayoutHelper.WRAP_CONTENT; frameLayout.setLayoutParams(layoutParams); avatarImage = new BackupImageView(context); avatarImage.setRoundRadius(AndroidUtilities.dp(30)); frameLayout.addView(avatarImage); FrameLayout.LayoutParams layoutParams3 = (FrameLayout.LayoutParams) avatarImage.getLayoutParams(); layoutParams3.gravity = (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP; layoutParams3.width = AndroidUtilities.dp(60); layoutParams3.height = AndroidUtilities.dp(60); avatarImage.setLayoutParams(layoutParams3); nameTextView = new TextView(context); nameTextView.setTextColor(ContextCompat.getColor(context, R.color.primary_text)); nameTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 20); nameTextView.setLines(1); nameTextView.setMaxLines(1); nameTextView.setSingleLine(true); nameTextView.setEllipsize(TextUtils.TruncateAt.END); nameTextView.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT)); nameTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf")); frameLayout.addView(nameTextView); layoutParams3 = (FrameLayout.LayoutParams) nameTextView.getLayoutParams(); layoutParams3.width = LayoutHelper.WRAP_CONTENT; layoutParams3.height = LayoutHelper.WRAP_CONTENT; layoutParams3.leftMargin = AndroidUtilities.dp(LocaleController.isRTL ? 0 : 80); layoutParams3.rightMargin = AndroidUtilities.dp(LocaleController.isRTL ? 80 : 0); layoutParams3.topMargin = AndroidUtilities.dp(3); layoutParams3.gravity = (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP; nameTextView.setLayoutParams(layoutParams3); onlineTextView = new TextView(context); onlineTextView.setTextColor(0xff999999); onlineTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); onlineTextView.setLines(1); onlineTextView.setMaxLines(1); onlineTextView.setSingleLine(true); onlineTextView.setEllipsize(TextUtils.TruncateAt.END); onlineTextView.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT)); frameLayout.addView(onlineTextView); layoutParams3 = (FrameLayout.LayoutParams) onlineTextView.getLayoutParams(); layoutParams3.width = LayoutHelper.WRAP_CONTENT; layoutParams3.height = LayoutHelper.WRAP_CONTENT; layoutParams3.leftMargin = AndroidUtilities.dp(LocaleController.isRTL ? 0 : 80); layoutParams3.rightMargin = AndroidUtilities.dp(LocaleController.isRTL ? 80 : 0); layoutParams3.topMargin = AndroidUtilities.dp(32); layoutParams3.gravity = (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP; onlineTextView.setLayoutParams(layoutParams3); firstNameField = new EditText(context); firstNameField.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18); //firstNameField.setHintTextColor(0xff979797); firstNameField.setTextColor(ContextCompat.getColor(context, R.color.primary_text)); firstNameField.setMaxLines(1); firstNameField.setLines(1); firstNameField.setSingleLine(true); firstNameField.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT); firstNameField.setInputType(InputType.TYPE_TEXT_FLAG_CAP_SENTENCES | InputType.TYPE_TEXT_FLAG_AUTO_CORRECT); firstNameField.setImeOptions(EditorInfo.IME_ACTION_NEXT); firstNameField.setHint(LocaleController.getString("FirstName", R.string.FirstName)); AndroidUtilities.clearCursorDrawable(firstNameField); linearLayout.addView(firstNameField); layoutParams = (LinearLayout.LayoutParams) firstNameField.getLayoutParams(); layoutParams.topMargin = AndroidUtilities.dp(24); layoutParams.height = AndroidUtilities.dp(36); layoutParams.leftMargin = AndroidUtilities.dp(24); layoutParams.rightMargin = AndroidUtilities.dp(24); layoutParams.width = LayoutHelper.MATCH_PARENT; firstNameField.setLayoutParams(layoutParams); firstNameField.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) { if (i == EditorInfo.IME_ACTION_NEXT) { lastNameField.requestFocus(); lastNameField.setSelection(lastNameField.length()); return true; } return false; } }); lastNameField = new EditText(context); lastNameField.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18); //lastNameField.setHintTextColor(0xff979797); lastNameField.setTextColor(ContextCompat.getColor(context, R.color.primary_text)); lastNameField.setMaxLines(1); lastNameField.setLines(1); lastNameField.setSingleLine(true); lastNameField.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT); lastNameField.setInputType(InputType.TYPE_TEXT_FLAG_CAP_SENTENCES | InputType.TYPE_TEXT_FLAG_AUTO_CORRECT); lastNameField.setImeOptions(EditorInfo.IME_ACTION_DONE); lastNameField.setHint(LocaleController.getString("LastName", R.string.LastName)); AndroidUtilities.clearCursorDrawable(lastNameField); linearLayout.addView(lastNameField); layoutParams = (LinearLayout.LayoutParams) lastNameField.getLayoutParams(); layoutParams.topMargin = AndroidUtilities.dp(16); layoutParams.height = AndroidUtilities.dp(36); layoutParams.leftMargin = AndroidUtilities.dp(24); layoutParams.rightMargin = AndroidUtilities.dp(24); layoutParams.width = LayoutHelper.MATCH_PARENT; lastNameField.setLayoutParams(layoutParams); lastNameField.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) { if (i == EditorInfo.IME_ACTION_DONE) { doneButton.performClick(); return true; } return false; } }); TLRPC.User user = MessagesController.getInstance().getUser(user_id); if (user != null) { if (user.phone == null) { if (phone != null) { user.phone = PhoneFormat.stripExceptNumbers(phone); } } firstNameField.setText(user.first_name); firstNameField.setSelection(firstNameField.length()); lastNameField.setText(user.last_name); } return fragmentView; }