Java Code Examples for android.widget.TextView.setLines()

The following are Jave code examples for showing how to use setLines() of the android.widget.TextView class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: PlusGram   File: JoinSheetUserCell.java   View Source Code Vote up 6 votes
public JoinSheetUserCell(Context context) {
    super(context);

    imageView = new BackupImageView(context);
    imageView.setRoundRadius(AndroidUtilities.dp(27));
    addView(imageView, LayoutHelper.createFrame(54, 54, Gravity.TOP | Gravity.CENTER_HORIZONTAL, 0, 7, 0, 0));

    nameTextView = new TextView(context);
    nameTextView.setTextColor(0xff212121);
    nameTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 12);
    nameTextView.setMaxLines(1);
    nameTextView.setGravity(Gravity.TOP | Gravity.CENTER_HORIZONTAL);
    nameTextView.setLines(1);
    nameTextView.setSingleLine(true);
    nameTextView.setEllipsize(TextUtils.TruncateAt.END);
    addView(nameTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.TOP, 6, 64, 6, 0));
}
 
Example 2
Project: airgram   File: ShareDialogCell.java   View Source Code Vote up 6 votes
public ShareDialogCell(Context context) {
    super(context);
    setBackgroundResource(R.drawable.list_selector);

    imageView = new BackupImageView(context);
    imageView.setRoundRadius(AndroidUtilities.dp(27));
    addView(imageView, LayoutHelper.createFrame(54, 54, Gravity.TOP | Gravity.CENTER_HORIZONTAL, 0, 7, 0, 0));

    nameTextView = new TextView(context);
    nameTextView.setTypeface(FontManager.instance().getTypeface());
    nameTextView.setTextColor(0xff212121);
    nameTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 12);
    nameTextView.setMaxLines(2);
    nameTextView.setGravity(Gravity.TOP | Gravity.CENTER_HORIZONTAL);
    nameTextView.setLines(2);
    nameTextView.setEllipsize(TextUtils.TruncateAt.END);
    addView(nameTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.TOP, 6, 64, 6, 0));

    checkBox = new CheckBox(context, R.drawable.round_check2);
    checkBox.setSize(24);
    checkBox.setCheckOffset(AndroidUtilities.dp(1));
    checkBox.setVisibility(VISIBLE);
    checkBox.setColor(0xff3ec1f9);
    addView(checkBox, LayoutHelper.createFrame(24, 24, Gravity.CENTER_HORIZONTAL | Gravity.TOP, 17, 39, 0, 0));
}
 
Example 3
Project: airgram   File: ChatAttachAlert.java   View Source Code Vote up 6 votes
public AttachButton(Context context) {
    super(context);

    imageView = new ImageView(context);
    imageView.setScaleType(ImageView.ScaleType.CENTER);
    addView(imageView, LayoutHelper.createFrame(64, 64, Gravity.CENTER_HORIZONTAL | Gravity.TOP));

    textView = new TextView(context);
    textView.setTypeface(FontManager.instance().getTypeface());
    textView.setLines(1);
    textView.setSingleLine(true);
    textView.setGravity(Gravity.CENTER_HORIZONTAL);
    textView.setEllipsize(TextUtils.TruncateAt.END);
    textView.setTextColor(Theme.ATTACH_SHEET_TEXT_COLOR);
    textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 12);
    addView(textView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.TOP, 0, 64, 0, 0));
}
 
Example 4
Project: PlusGram   File: ChatAttachView.java   View Source Code Vote up 6 votes
public AttachButton(Context context) {
    super(context);

    imageView = new ImageView(context);
    imageView.setScaleType(ImageView.ScaleType.CENTER);
    addView(imageView, LayoutHelper.createFrame(64, 64, Gravity.CENTER_HORIZONTAL | Gravity.TOP));

    textView = new TextView(context);
    textView.setLines(1);
    textView.setSingleLine(true);
    textView.setGravity(Gravity.CENTER_HORIZONTAL);
    textView.setEllipsize(TextUtils.TruncateAt.END);
    //textView.setTextColor(0xff757575);
    SharedPreferences themePrefs = ApplicationLoader.applicationContext.getSharedPreferences(AndroidUtilities.THEME_PREFS, AndroidUtilities.THEME_PREFS_MODE);
    textView.setTextColor(themePrefs.getInt("chatAttachTextColor", 0xff757575));
    textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 12);
    addView(textView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.TOP, 0, 64, 0, 0));
}
 
Example 5
Project: GitHub   File: AbstractWheelTextAdapter.java   View Source Code Vote up 5 votes
/**
 * Configures text view. Is called for the TEXT_VIEW_ITEM_RESOURCE views.
 * @param view the text view to be configured
 */
protected void configureTextView(TextView view) {
    view.setTextColor(textColor);
    view.setGravity(Gravity.CENTER);
    view.setPadding(0, padding, 0, padding);
    view.setTextSize(textSize);
    view.setEllipsize(TextUtils.TruncateAt.END);
    view.setLines(1);
    //        view.setCompoundDrawablePadding(20);
    //        view.setTypeface(Typeface.SANS_SERIF, Typeface.BOLD);
}
 
Example 6
Project: AssistantBySDK   File: AbstractWheelTextAdapter.java   View Source Code Vote up 5 votes
/**
 * Configures text view. Is called for the TEXT_VIEW_ITEM_RESOURCE views.
 * @param view the text view to be configured
 */
protected void configureTextView(TextView view) {
    view.setTextColor(textColor);
    view.setGravity(Gravity.CENTER);
    view.setTextSize(textSize);
    view.setLines(1);
    view.setTypeface(Typeface.SANS_SERIF, Typeface.BOLD);
}
 
Example 7
Project: airgram   File: TextDetailCell.java   View Source Code Vote up 5 votes
public TextDetailCell(Context context) {
    super(context);

    textView = new TextView(context);
    textView.setTypeface(FontManager.instance().getTypeface());
    textView.setTextColor(0xff212121);
    textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
    textView.setLines(1);
    textView.setMaxLines(1);
    textView.setSingleLine(true);
    textView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
    addView(textView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT, LocaleController.isRTL ? 16 : 71, 10, LocaleController.isRTL ? 71 : 16, 0));

    valueTextView = new TextView(context);
    valueTextView.setTypeface(FontManager.instance().getTypeface());
    valueTextView.setTextColor(0xff8a8a8a);
    valueTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13);
    valueTextView.setLines(1);
    valueTextView.setMaxLines(1);
    valueTextView.setSingleLine(true);
    valueTextView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
    addView(valueTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT, LocaleController.isRTL ? 16 : 71, 35, LocaleController.isRTL ? 71 : 16, 0));

    imageView = new ImageView(context);
    imageView.setScaleType(ImageView.ScaleType.CENTER);
    addView(imageView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL, LocaleController.isRTL ? 0 : 16, 0, LocaleController.isRTL ? 16 : 0, 0));
}
 
Example 8
Project: airgram   File: HintDialogCell.java   View Source Code Vote up 5 votes
public HintDialogCell(Context context) {
    super(context);
    setBackgroundResource(R.drawable.list_selector);

    imageView = new BackupImageView(context);
    imageView.setRoundRadius(AndroidUtilities.dp(27));
    addView(imageView, LayoutHelper.createFrame(54, 54, Gravity.TOP | Gravity.CENTER_HORIZONTAL, 0, 7, 0, 0));

    nameTextView = new TextView(context);
    nameTextView.setTypeface(FontManager.instance().getTypeface());
    nameTextView.setTextColor(0xff212121);
    nameTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 12);
    nameTextView.setMaxLines(2);
    nameTextView.setGravity(Gravity.TOP | Gravity.CENTER_HORIZONTAL);
    nameTextView.setLines(2);
    nameTextView.setEllipsize(TextUtils.TruncateAt.END);
    addView(nameTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.TOP, 6, 64, 6, 0));

    if (countDrawable == null) {
        countDrawable = getResources().getDrawable(R.drawable.dialogs_badge);
        countDrawableGrey = getResources().getDrawable(R.drawable.dialogs_badge2);

        countPaint = new TextPaint(TextPaint.ANTI_ALIAS_FLAG);
        countPaint.setTextSize(AndroidUtilities.dp(13));
        countPaint.setColor(0xffffffff);
        countPaint.setTypeface(FontManager.instance().getTypeface());
    }
}
 
Example 9
Project: decoy   File: AbstractWheelTextAdapter.java   View Source Code Vote up 5 votes
/**
     * Configures text view. Is called for the TEXT_VIEW_ITEM_RESOURCE views.
     * @param view the text view to be configured
     */
    protected void configureTextView(TextView view) {
        view.setTextColor(textColor);
        view.setGravity(Gravity.CENTER);
        view.setTextSize(textSize);
        view.setEllipsize(TextUtils.TruncateAt.END);
        view.setLines(1);
//        view.setCompoundDrawablePadding(20);
//        view.setTypeface(Typeface.SANS_SERIF, Typeface.BOLD);
    }
 
Example 10
Project: GCSApp   File: AbstractWheelTextAdapter.java   View Source Code Vote up 5 votes
/**
     * Configures text view. Is called for the TEXT_VIEW_ITEM_RESOURCE views.
     * @param view the text view to be configured
     */
    protected void configureTextView(TextView view) {
        view.setTextColor(textColor);
        view.setGravity(Gravity.CENTER);
        view.setTextSize(textSize);
        view.setEllipsize(TextUtils.TruncateAt.END);
        view.setLines(1);
//        view.setCompoundDrawablePadding(20);
//        view.setTypeface(Typeface.SANS_SERIF, Typeface.BOLD);
    }
 
Example 11
Project: PlusGram   File: BottomSheet.java   View Source Code Vote up 5 votes
public BottomSheetCell(Context context, int type) {
    super(context);

    setBackgroundResource(R.drawable.list_selector);
    setPadding(AndroidUtilities.dp(16), 0, AndroidUtilities.dp(16), 0);

    imageView = new ImageView(context);
    imageView.setScaleType(ImageView.ScaleType.CENTER);
    addView(imageView, LayoutHelper.createFrame(24, 24, Gravity.CENTER_VERTICAL | (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT)));

    textView = new TextView(context);
    textView.setLines(1);
    textView.setSingleLine(true);
    textView.setGravity(Gravity.CENTER_HORIZONTAL);
    textView.setEllipsize(TextUtils.TruncateAt.END);
    if (type == 0) {
        textView.setTextColor(0xff212121);
        textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
        addView(textView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL));
    } else if (type == 1) {
        textView.setGravity(Gravity.CENTER);
        textView.setTextColor(0xff212121);
        textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
        textView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
        addView(textView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
    }
}
 
Example 12
Project: Customerly-Android-SDK   File: IE_Attachment.java   View Source Code Vote up 5 votes
void addAttachmentToInput(@NonNull IAct_AInput pA_Customerly_Activity) {
    pA_Customerly_Activity._Attachments.add(this);
    TextView tv = new TextView(pA_Customerly_Activity);
    tv.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT));
    tv.setCompoundDrawablesWithIntrinsicBounds(R.drawable.io_customerly__ld_chat_attachment, 0, 0, 0);
    int _5dp = IU_Utils.px(5);
    tv.setCompoundDrawablePadding(_5dp);
    tv.setPadding(_5dp, 0, 0, 0);
    tv.setTextColor(IU_Utils.getColorStateListFromResource(pA_Customerly_Activity.getResources(), R.color.io_customerly__textcolor_malibu_grey));
    tv.setLines(1);
    tv.setSingleLine();
    tv.setEllipsize(TextUtils.TruncateAt.MIDDLE);
    tv.setTypeface(Typeface.SANS_SERIF, Typeface.NORMAL);
    tv.setText(this.name);
    tv.setOnClickListener(textView -> new AlertDialog.Builder(pA_Customerly_Activity)
            .setTitle(R.string.io_customerly__choose_a_file_to_attach)
            .setMessage(pA_Customerly_Activity.getString(R.string.io_customerly__cancel_attachment, tv.getText()))
            .setNegativeButton(R.string.io_customerly__cancel, null)
            .setPositiveButton(R.string.io_customerly__remove, (dlg, which) -> {
                ViewGroup vg = (ViewGroup)tv.getParent();
                if(vg != null) {
                    vg.removeView(tv);
                }
                pA_Customerly_Activity._Attachments.remove(this);
            })
            .setCancelable(true)
            .show());
    pA_Customerly_Activity.input_attachments.addView(tv);
}
 
Example 13
Project: PlusGram   File: HintDialogCell.java   View Source Code Vote up 5 votes
public HintDialogCell(Context context) {
    super(context);
    setBackgroundResource(R.drawable.list_selector);

    imageView = new BackupImageView(context);
    imageView.setRoundRadius(AndroidUtilities.dp(27));
    addView(imageView, LayoutHelper.createFrame(54, 54, Gravity.TOP | Gravity.CENTER_HORIZONTAL, 0, 7, 0, 0));

    nameTextView = new TextView(context);
    nameTextView.setTextColor(0xff212121);
    nameTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 12);
    nameTextView.setMaxLines(2);
    nameTextView.setGravity(Gravity.TOP | Gravity.CENTER_HORIZONTAL);
    nameTextView.setLines(2);
    nameTextView.setEllipsize(TextUtils.TruncateAt.END);
    addView(nameTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.TOP, 6, 64, 6, 0));

    if (countDrawable == null) {
        countDrawable = getResources().getDrawable(R.drawable.dialogs_badge);
        countDrawableGrey = getResources().getDrawable(R.drawable.dialogs_badge2);

        countPaint = new TextPaint(TextPaint.ANTI_ALIAS_FLAG);
        countPaint.setColor(0xffffffff);
        countPaint.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
    }
    countPaint.setTextSize(AndroidUtilities.dp(13));
}
 
Example 14
Project: Bailan   File: FoldingTextView.java   View Source Code Vote up 5 votes
/**
 * Title的高度(更新 应用介绍 权限 这几个字) 宽度是固定的MeasureSpec.EXACTLY
 *
 * @return
 */
public int getTileHeight() {
    int measuredWidth = titleTextView.getMeasuredWidth();
    TextView copyTextView = new TextView(getContext());
    copyTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15);
    int widthMeasureSpec = MeasureSpec.makeMeasureSpec(measuredWidth, MeasureSpec.EXACTLY);
    copyTextView.setMaxLines(1);
    copyTextView.setLines(1);
    int heightMeasureSpec = MeasureSpec.makeMeasureSpec(2000, MeasureSpec.AT_MOST);//MeasureSpec.AT_MOST情况下前一个参数设置多少无所谓
    copyTextView.measure(widthMeasureSpec, heightMeasureSpec);
    return copyTextView.getMeasuredHeight();
}
 
Example 15
Project: PlusGram   File: DrawerActionCell.java   View Source Code Vote up 5 votes
public DrawerActionCell(Context context) {
    super(context);

    textView = new TextView(context);
    textView.setTextColor(0xff444444);
    textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15);
    textView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
    textView.setLines(1);
    textView.setMaxLines(1);
    textView.setSingleLine(true);
    textView.setGravity(Gravity.LEFT | Gravity.CENTER_VERTICAL);
    textView.setCompoundDrawablePadding(AndroidUtilities.dp(34));
    addView(textView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.LEFT | Gravity.TOP, 14, 0, 16, 0));
}
 
Example 16
Project: PlusGram   File: TextDetailCell.java   View Source Code Vote up 5 votes
public TextDetailCell(Context context) {
    super(context);

    textView = new TextView(context);
    textView.setTextColor(0xff212121);
    textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
    textView.setLines(1);
    textView.setMaxLines(1);
    textView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
    textView.setSingleLine(true);
    textView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
    addView(textView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT, LocaleController.isRTL ? 16 : 71, 10, LocaleController.isRTL ? 71 : 16, 0));

    valueTextView = new TextView(context);
    valueTextView.setTextColor(0xff8a8a8a);
    valueTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13);
    valueTextView.setLines(1);
    valueTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
    valueTextView.setMaxLines(1);
    valueTextView.setSingleLine(true);
    valueTextView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
    addView(valueTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT, LocaleController.isRTL ? 16 : 71, 35, LocaleController.isRTL ? 71 : 16, 0));

    imageView = new ImageView(context);
    imageView.setScaleType(ImageView.ScaleType.CENTER);
    addView(imageView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL, LocaleController.isRTL ? 0 : 16, 0, LocaleController.isRTL ? 16 : 0, 0));
}
 
Example 17
Project: Hotspot-master-devp   File: AbstractWheelTextAdapter.java   View Source Code Vote up 5 votes
/**
 * Configures text view. Is called for the TEXT_VIEW_ITEM_RESOURCE views.
 * 
 * @param view
 *            the text view to be configured
 */
protected void configureTextView(TextView view) {
	view.setTextColor(textColor);
	view.setGravity(Gravity.CENTER);
	view.setTextSize(textSize);
	view.setLines(1);
	view.setTypeface(Typeface.SANS_SERIF, Typeface.BOLD);
}
 
Example 18
Project: CoolClock   File: AbstractWheelTextAdapter.java   View Source Code Vote up 5 votes
/**
 * Configures text view. Is called for the TEXT_VIEW_ITEM_RESOURCE views.
 * @param view the text view to be configured
 */
protected void configureTextView(TextView view) {
    view.setTextColor(textColor);
    view.setGravity(Gravity.CENTER);
    view.setTextSize(textSize);
    view.setLines(1);
    view.setTypeface(Typeface.SANS_SERIF, Typeface.NORMAL);
}
 
Example 19
Project: PlusGram   File: CustomHintDialogCell.java   View Source Code Vote up 5 votes
public CustomHintDialogCell(Context context) {
    super(context);
    setBackgroundResource(R.drawable.list_selector);

    imageView = new BackupImageView(context);
    imageView.setRoundRadius(AndroidUtilities.dp(27));
    addView(imageView, LayoutHelper.createFrame(43, 43, Gravity.TOP | Gravity.CENTER_HORIZONTAL, 0, 7, 0, 0));

    nameTextView = new TextView(context);
    nameTextView.setTextColor(0xff212121);
    nameTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 9);
    nameTextView.setMaxLines(2);
    nameTextView.setGravity(Gravity.TOP | Gravity.CENTER_HORIZONTAL);
    nameTextView.setLines(2);
    nameTextView.setEllipsize(TextUtils.TruncateAt.END);
    addView(nameTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.TOP, 6, 64, 6, 0));

    if (countDrawable == null) {
        countDrawable = getResources().getDrawable(R.drawable.dialogs_badge);
        countDrawableGrey = getResources().getDrawable(R.drawable.dialogs_badge2);

        countPaint = new TextPaint(TextPaint.ANTI_ALIAS_FLAG);
        countPaint.setColor(0xffffffff);
        countPaint.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
    }
    countPaint.setTextSize(AndroidUtilities.dp(11));
}
 
Example 20
Project: PlusGram   File: DrawerProfileCell.java   View Source Code Vote up 4 votes
public DrawerProfileCell(Context context) {
    super(context);
    setBackgroundColor(Theme.ACTION_BAR_PROFILE_COLOR);


    shadowView = new ImageView(context);
    shadowView.setVisibility(INVISIBLE);
    shadowView.setScaleType(ImageView.ScaleType.FIT_XY);
    shadowView.setImageResource(R.drawable.bottom_shadow);
    addView(shadowView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 70, Gravity.LEFT | Gravity.BOTTOM));
    SharedPreferences themePrefs = ApplicationLoader.applicationContext.getSharedPreferences(AndroidUtilities.THEME_PREFS, AndroidUtilities.THEME_PREFS_MODE);
    avatarImageView = new BackupImageView(context);
    avatarImageView.getImageReceiver().setRoundRadius(AndroidUtilities.dp(32));

    int aSize = themePrefs.getInt("drawerAvatarSize", 64);
    boolean centerAvatar = themePrefs.getBoolean("drawerCenterAvatarCheck", false);
    if(!centerAvatar){
        addView(avatarImageView, LayoutHelper.createFrame(aSize, aSize, Gravity.LEFT | Gravity.BOTTOM, 16, 0, 0, 67));
    }else{
        addView(avatarImageView, LayoutHelper.createFrame(aSize, aSize, Gravity.CENTER | Gravity.BOTTOM, 0, 0, 0, 67));
    }


    final Activity activity = (Activity) context;

    avatarImageView.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            if (activity == null) {
                return;
            }
            TLRPC.User user = MessagesController.getInstance().getUser(UserConfig.getClientUserId());
            if (user.photo != null && user.photo.photo_big != null) {
                PhotoViewer.getInstance().setParentActivity(activity);
                PhotoViewer.getInstance().openPhoto(user.photo.photo_big, DrawerProfileCell.this);
            }
        }
    });
    nameTextView = new TextView(context);
    nameTextView.setTextColor(0xffffffff);
    nameTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15);
    nameTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
    nameTextView.setLines(1);
    nameTextView.setMaxLines(1);
    nameTextView.setSingleLine(true);
    if(!centerAvatar){
        nameTextView.setGravity(Gravity.LEFT);
    nameTextView.setEllipsize(TextUtils.TruncateAt.END);
        addView(nameTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.BOTTOM, 16, 0, 16, 28));
    }else{
        nameTextView.setGravity(Gravity.CENTER);
        addView(nameTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER | Gravity.BOTTOM, 0, 0, 0, 28));
    }

    phoneTextView = new TextView(context);
    phoneTextView.setTextColor(0xffc2e5ff);
    phoneTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13);
    phoneTextView.setLines(1);
    phoneTextView.setMaxLines(1);
    phoneTextView.setSingleLine(true);
    if(!centerAvatar){
        phoneTextView.setGravity(Gravity.LEFT);
        addView(phoneTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.BOTTOM, 16, 0, 16, 9));
    }else{
        phoneTextView.setGravity(Gravity.CENTER);
        addView(phoneTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER | Gravity.BOTTOM, 0, 0, 0, 9));
    }


    cloudView = new CloudView(context);
    addView(cloudView, LayoutHelper.createFrame(61, 61, Gravity.RIGHT | Gravity.BOTTOM));
}