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

The following are Jave code examples for showing how to use setBackgroundDrawable() 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: SlidingTabView.java   View Source Code Vote up 6 votes
public void addTextTab(final int position, String title) {
    TextView tab = new TextView(getContext());
    tab.setText(title);
    tab.setFocusable(true);
    tab.setGravity(Gravity.CENTER);
    tab.setSingleLine();
    tab.setTextColor(0xffffffff);
    tab.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
    tab.setTypeface(Typeface.DEFAULT_BOLD);
    tab.setBackgroundDrawable(Theme.createBarSelectorDrawable(Theme.ACTION_BAR_PICKER_SELECTOR_COLOR, false));

    tab.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            didSelectTab(position);
        }
    });
    addView(tab);
    LayoutParams layoutParams = (LayoutParams)tab.getLayoutParams();
    layoutParams.height = LayoutHelper.MATCH_PARENT;
    layoutParams.width = 0;
    layoutParams.weight = 50;
    tab.setLayoutParams(layoutParams);

    tabCount++;
}
 
Example 2
Project: Bailan   File: SubTabNavigator.java   View Source Code Vote up 6 votes
public void setCurrentItemSelect(View view) {

        drawBackground();
        TextView tv = (TextView) view;
        tv.setTextColor(tabSelectTextColor);
        int tag = (int) tv.getTag();
        switch (tag) {
            case TAG_LEFT_VIEW:
                tv.setBackgroundDrawable(mLeftSelectDrawable);
                break;
            case TAG_NONE_VIEW:
                tv.setBackgroundDrawable(mSimpleSelectDrawable);
                break;
            case TAG_RIGHT_VIEW:
                tv.setBackgroundDrawable(mRightSelectDrawable);
                break;
        }

        switchViewPager(tag);

    }
 
Example 3
Project: EasyAndroid   File: NewAuthEditText.java   View Source Code Vote up 6 votes
/**
 * 创建 TextView 并返回
 *
 * @return {@link TextView}
 */
private TextView createTextView()
{
    TextView tv = new TextView(context);
    tv.setGravity(Gravity.CENTER);
    tv.setTextColor(textColor);
    tv.setTextSize(textSize);
    tv.setMaxLines(1);
    tv.setEllipsize(TextUtils.TruncateAt.END);
    tv.setBackgroundDrawable(createFrameDrawableBg());
    return tv;
}
 
Example 4
Project: AndroidBasicLibs   File: DrawerToast.java   View Source Code Vote up 6 votes
/**
 * 获得一个设置好属性的TextView
 *
 * @param msg
 * @return
 */
public TextView getTextView(String msg) {
    TextView tv = new TextView(mContext);
    tv.setLayoutParams(lp_WW);
    tv.setText(msg);
    tv.setTextColor(defaultTextColor);
    Drawable background = null;
    if (defaultBackgroundResid != null) {
        background = mContext.getResources().getDrawable(defaultBackgroundResid);
    } else {
        background = defaultBackgroundColor;
    }
    if (currentapiVersion > 10) tv.setBackground(background);
    else tv.setBackgroundDrawable(background);
    tv.setPadding(5, 5, 5, 5);
    tv.setGravity(Gravity.CENTER);
    return tv;
}
 
Example 5
Project: GracefulMovies   File: TagGroup.java   View Source Code Vote up 6 votes
private void createTag(String s, @ColorInt int tintColor) {
    TextView textView = new TextView(getContext());
    LayoutParams lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    lp.rightMargin = dp2px(4);
    textView.setLayoutParams(lp);
    textView.setTextSize(9);
    Drawable drawable = ContextCompat.getDrawable(getContext(), R.drawable.shape_round_stroke_bg_tag);
    DrawableCompat.setTint(drawable, tintColor);
    if (Build.VERSION.SDK_INT > 15)
        textView.setBackground(drawable);
    else
        textView.setBackgroundDrawable(drawable);
    textView.setPadding(dp2px(2), 0, dp2px(2), 0);
    textView.setText(s);

    addView(textView);
}
 
Example 6
Project: boohee_v5.6   File: WeekView.java   View Source Code Vote up 6 votes
public void select(int dayOfOrder) {
    this.selected = dayOfOrder;
    resetSelect();
    if (this.mSelectListener != null) {
        this.mSelectListener.onSelect(dayOfOrder);
    }
    TextView tv = (TextView) this.tvList.get(dayOfOrder);
    tv.setTextColor(getResources().getColor(R.color.ju));
    ShapeDrawable oval = new ShapeDrawable(new OvalShape());
    if (dayOfOrder == this.orderOfToday) {
        oval.getPaint().setColor(getResources().getColor(R.color.he));
    } else {
        oval.getPaint().setColor(getResources().getColor(R.color.hb));
    }
    tv.setBackgroundDrawable(oval);
}
 
Example 7
Project: PWEditText-SafeKeyboard   File: SafetyKeyboard.java   View Source Code Vote up 5 votes
private void setDefaultNumKey(TextView view, int key) {
    view.setText(String.valueOf(key));
    if (null != mNumBgDrawSelector) {
        Drawable tempNumBg = mNumBgDrawSelector.getConstantState()
                .newDrawable();
        view.setBackgroundDrawable(tempNumBg);
    } else {
        ColorDrawable normal = new ColorDrawable(Color.WHITE);
        ColorDrawable press = new ColorDrawable(Color.GRAY);
        view.setBackgroundDrawable(getDrawableSeletor(normal, press));
    }
}
 
Example 8
Project: EasyAndroid   File: NewAuthEditText.java   View Source Code Vote up 5 votes
/**
 * 设置 TextView边框颜色
 *
 * @param frameColor 边框颜色
 */
public void setFrameColor(@ColorInt int frameColor)
{
    this.frameColor = frameColor;
    for(TextView tv : textViewList)
    {
        tv.setBackgroundDrawable(createFrameDrawableBg());
    }
}
 
Example 9
Project: fuckView   File: FullScreenPopupWindow.java   View Source Code Vote up 5 votes
private void init(final Context context) {


        for (ViewDumper.ViewItem item : list) {
            TextView tv = new TextView(context);
            tv.setTag(item);
            //红框
            GradientDrawable redBounds = new GradientDrawable();
            redBounds.setStroke(2, Color.RED);
            redBounds.setColor(Color.TRANSPARENT);
            tv.setBackgroundDrawable(redBounds);
            AbsoluteLayout.LayoutParams layoutParams = new AbsoluteLayout.LayoutParams(item.wh.x, item.wh.y, item.bounds.x, item.bounds.y - getStatusBarHeight());
            absoluteLayout.addView(tv, layoutParams);
        }
    }
 
Example 10
Project: GitHub   File: TextBadgeItem.java   View Source Code Vote up 5 votes
/**
 * refresh's background drawable
 */
private void refreshDrawable() {
    if (isWeakReferenceValid()) {
        TextView textView = getTextView().get();
        textView.setBackgroundDrawable(getBadgeDrawable(textView.getContext()));
    }
}
 
Example 11
Project: EasyAndroid   File: AuthEditText.java   View Source Code Vote up 5 votes
/**
 * 获取返回默认的 TextView
 */
public TextView getDefaultTextView()
{
    TextView tv = new TextView(context);
    tv.setGravity(Gravity.CENTER);
    tv.setTextSize(textSize);
    tv.setTextColor(textColor);
    tv.setBackgroundDrawable(frameDrawable);

    return tv;
}
 
Example 12
Project: EasyAndroid   File: NewAuthEditText.java   View Source Code Vote up 5 votes
/**
 * 设置 TextView边框宽度,单位为像素
 *
 * @param frameWidth 边框宽度
 */
public void setFrameWidth(int frameWidth)
{
    this.frameWidth = frameWidth;
    for(int i = 1; i < textViewList.size(); i++)
    {
        LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) textViewList.get(i).getLayoutParams();
        lp.leftMargin = -frameWidth;
    }
    for(TextView tv : textViewList)
    {
        tv.setBackgroundDrawable(createFrameDrawableBg());
    }
}
 
Example 13
Project: boohee_v5.6   File: WeightDetailAdapter.java   View Source Code Vote up 5 votes
public View getView(int position, View convertView, ViewGroup parent) {
    if (convertView == null) {
        convertView = LayoutInflater.from(this.context).inflate(R.layout.jm, parent, false);
    }
    final ScaleIndex itemData = (ScaleIndex) getItem(position);
    TextView amount = (TextView) convertView.findViewById(R.id.tv_amount);
    TextView level = (TextView) convertView.findViewById(R.id.tv_level);
    ((TextView) convertView.findViewById(R.id.tv_name)).setText(itemData.getName());
    amount.setText(itemData.getValueWithUnit());
    GradientDrawable drawable = new GradientDrawable();
    drawable.setColor(ViewCompat.MEASURED_SIZE_MASK);
    drawable.setCornerRadius(this.outerR[0]);
    drawable.setStroke(1, itemData.getColor());
    level.setBackgroundDrawable(drawable);
    level.setTextColor(itemData.getColor());
    level.setText(itemData.getLevelName());
    if (itemData instanceof FakeIndex) {
        convertView.setOnClickListener(null);
    } else {
        convertView.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
                WeightDetailAdapter.this.mFragment.getDialog().getWindow()
                        .setWindowAnimations(R.style.df);
                ScaleIndexActivity.startActivity(WeightDetailAdapter.this.context,
                        WeightDetailAdapter.this.mRecord, itemData.getName());
            }
        });
    }
    return convertView;
}
 
Example 14
Project: CXJPadProject   File: VersionUtils.java   View Source Code Vote up 5 votes
@SuppressWarnings("deprecation")
@SuppressLint("NewApi")
public static void setBackground(Drawable imagebakground,TextView view){
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
    	view.setBackground(imagebakground);
    } else {
    	view.setBackgroundDrawable(imagebakground);
    }
}
 
Example 15
Project: PlusGram   File: DialogsActivity.java   View Source Code Vote up 5 votes
private void addMenuView(Context context, ImageView iv, TextView tv, boolean show) {
        //SharedPreferences themePrefs = ApplicationLoader.applicationContext.getSharedPreferences(AndroidUtilities.THEME_PREFS, AndroidUtilities.THEME_PREFS_MODE);
        //int cColor = themePrefs.getInt("chatsHeaderTabCounterColor", 0xffffffff);
        //int bgColor = themePrefs.getInt("chatsHeaderTabCounterBGColor", 0xffff0000);

        iv.setScaleType(ImageView.ScaleType.CENTER);
        //int size = themePrefs.getInt("chatsHeaderTabCounterSize", 11);
        //tv.setTextSize(TypedValue.COMPLEX_UNIT_DIP, size);
        tv.setGravity(Gravity.RIGHT);
        //tv.setTextColor(cColor);

        GradientDrawable shape = new GradientDrawable();
        shape.setShape(GradientDrawable.RECTANGLE);
        shape.setCornerRadius(AndroidUtilities.dp(32));
        //shape.setColor(bgColor);

        tv.setBackgroundDrawable(shape);
        //tv.setPadding(AndroidUtilities.dp(size > 10 ? size - 7 : 4), 0, AndroidUtilities.dp(size > 10 ? size - 7 : 4), 0);
        RelativeLayout layout = new RelativeLayout(context);
        layout.addView(iv, LayoutHelper.createRelative(50, LayoutHelper.MATCH_PARENT));
        layout.addView(tv, LayoutHelper.createRelative(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, 0, 10, 5, 0, RelativeLayout.ALIGN_PARENT_RIGHT));
        RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) tv.getLayoutParams();
        params.addRule(RelativeLayout.ALIGN_PARENT_TOP);
        tv.setLayoutParams(params);
        if (show) {
            menu.addView(layout, LayoutHelper.createLinear(50, LayoutHelper.MATCH_PARENT, 0));
        }

//        MenuCount(notifsCounter);

    }
 
Example 16
Project: PlusGram   File: DialogsActivity.java   View Source Code Vote up 5 votes
private void addTabView(Context context, ImageView iv, TextView tv, boolean show) {
    //SharedPreferences themePrefs = ApplicationLoader.applicationContext.getSharedPreferences(AndroidUtilities.THEME_PREFS, AndroidUtilities.THEME_PREFS_MODE);
    //int cColor = themePrefs.getInt("chatsHeaderTabCounterColor", 0xffffffff);
    //int bgColor = themePrefs.getInt("chatsHeaderTabCounterBGColor", 0xffff0000);

    iv.setScaleType(ImageView.ScaleType.CENTER);
    //int size = themePrefs.getInt("chatsHeaderTabCounterSize", 11);
    //tv.setTextSize(TypedValue.COMPLEX_UNIT_DIP, size);
    tv.setGravity(Gravity.CENTER);
    //tv.setTextColor(cColor);

    GradientDrawable shape = new GradientDrawable();
    shape.setShape(GradientDrawable.RECTANGLE);
    shape.setCornerRadius(AndroidUtilities.dp(32));
    //shape.setColor(bgColor);

    tv.setBackgroundDrawable(shape);
    //tv.setPadding(AndroidUtilities.dp(size > 10 ? size - 7 : 4), 0, AndroidUtilities.dp(size > 10 ? size - 7 : 4), 0);
    RelativeLayout layout = new RelativeLayout(context);
    layout.addView(iv, LayoutHelper.createRelative(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
    layout.addView(tv, LayoutHelper.createRelative(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, 0, 0, 3, 6, RelativeLayout.ALIGN_PARENT_RIGHT));
    RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) tv.getLayoutParams();
    params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
    tv.setLayoutParams(params);
    if (show) {
        tabsLayout.addView(layout, LayoutHelper.createLinear(0, LayoutHelper.MATCH_PARENT, 1.0f));
    }

}
 
Example 17
Project: JD-Test   File: BadgeItem.java   View Source Code Vote up 4 votes
private void refreshDrawable() {
    if (isWeakReferenceValid()) {
        TextView textView = mTextViewRef.get();
        textView.setBackgroundDrawable(BottomNavigationHelper.getBadgeDrawable(this, textView.getContext()));
    }
}
 
Example 18
Project: PlusGram   File: PickerBottomLayout.java   View Source Code Vote up 4 votes
public PickerBottomLayout(Context context, boolean darkTheme) {
    super(context);
    isDarkTheme = darkTheme;

    setBackgroundColor(isDarkTheme ? 0xff1a1a1a : 0xffffffff);

    cancelButton = new TextView(context);
    cancelButton.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
    cancelButton.setTextColor(isDarkTheme ? 0xffffffff : 0xff19a7e8);
    cancelButton.setGravity(Gravity.CENTER);
    cancelButton.setBackgroundDrawable(Theme.createBarSelectorDrawable(isDarkTheme ? Theme.ACTION_BAR_PICKER_SELECTOR_COLOR : Theme.ACTION_BAR_AUDIO_SELECTOR_COLOR, false));
    cancelButton.setPadding(AndroidUtilities.dp(29), 0, AndroidUtilities.dp(29), 0);
    cancelButton.setText(LocaleController.getString("Cancel", R.string.Cancel).toUpperCase());
    cancelButton.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
    addView(cancelButton, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.LEFT));

    doneButton = new LinearLayout(context);
    doneButton.setOrientation(LinearLayout.HORIZONTAL);
    doneButton.setBackgroundDrawable(Theme.createBarSelectorDrawable(isDarkTheme ? Theme.ACTION_BAR_PICKER_SELECTOR_COLOR : Theme.ACTION_BAR_AUDIO_SELECTOR_COLOR, false));
    doneButton.setPadding(AndroidUtilities.dp(29), 0, AndroidUtilities.dp(29), 0);
    addView(doneButton, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.RIGHT));

    doneButtonBadgeTextView = new TextView(context);
    doneButtonBadgeTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
    doneButtonBadgeTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13);
    doneButtonBadgeTextView.setTextColor(0xffffffff);
    doneButtonBadgeTextView.setGravity(Gravity.CENTER);
    doneButtonBadgeTextView.setBackgroundResource(isDarkTheme ? R.drawable.photobadge : R.drawable.bluecounter);
    doneButtonBadgeTextView.setMinWidth(AndroidUtilities.dp(23));
    doneButtonBadgeTextView.setPadding(AndroidUtilities.dp(8), 0, AndroidUtilities.dp(8), AndroidUtilities.dp(1));
    doneButton.addView(doneButtonBadgeTextView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, 23, Gravity.CENTER_VERTICAL, 0, 0, 10, 0));

    doneButtonTextView = new TextView(context);
    doneButtonTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
    doneButtonTextView.setTextColor(isDarkTheme ? 0xffffffff : 0xff19a7e8);
    doneButtonTextView.setGravity(Gravity.CENTER);
    doneButtonTextView.setCompoundDrawablePadding(AndroidUtilities.dp(8));
    doneButtonTextView.setText(LocaleController.getString("Send", R.string.Send).toUpperCase());
    doneButtonTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
    doneButton.addView(doneButtonTextView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER_VERTICAL));
}
 
Example 19
Project: NeiHanDuanZiTV   File: BGABanner.java   View Source Code Vote up 4 votes
private void initView(Context context) {
    RelativeLayout pointContainerRl = new RelativeLayout(context);
    if (Build.VERSION.SDK_INT >= 16) {
        pointContainerRl.setBackground(mPointContainerBackgroundDrawable);
    } else {
        pointContainerRl.setBackgroundDrawable(mPointContainerBackgroundDrawable);
    }
    pointContainerRl.setPadding(mPointContainerLeftRightPadding, mPointTopBottomMargin, mPointContainerLeftRightPadding, mPointTopBottomMargin);
    LayoutParams pointContainerLp = new LayoutParams(RMP, RWC);
    // 处理圆点在顶部还是底部
    if ((mPointGravity & Gravity.VERTICAL_GRAVITY_MASK) == Gravity.TOP) {
        pointContainerLp.addRule(RelativeLayout.ALIGN_PARENT_TOP);
    } else {
        pointContainerLp.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
    }
    addView(pointContainerRl, pointContainerLp);


    LayoutParams indicatorLp = new LayoutParams(RWC, RWC);
    indicatorLp.addRule(CENTER_VERTICAL);
    if (mIsNumberIndicator) {
        mNumberIndicatorTv = new TextView(context);
        mNumberIndicatorTv.setId(R.id.banner_indicatorId);
        mNumberIndicatorTv.setGravity(Gravity.CENTER_VERTICAL);
        mNumberIndicatorTv.setSingleLine(true);
        mNumberIndicatorTv.setEllipsize(TextUtils.TruncateAt.END);
        mNumberIndicatorTv.setTextColor(mNumberIndicatorTextColor);
        mNumberIndicatorTv.setTextSize(TypedValue.COMPLEX_UNIT_PX, mNumberIndicatorTextSize);
        mNumberIndicatorTv.setVisibility(View.INVISIBLE);
        if (mNumberIndicatorBackground != null) {
            if (Build.VERSION.SDK_INT >= 16) {
                mNumberIndicatorTv.setBackground(mNumberIndicatorBackground);
            } else {
                mNumberIndicatorTv.setBackgroundDrawable(mNumberIndicatorBackground);
            }
        }
        pointContainerRl.addView(mNumberIndicatorTv, indicatorLp);
    } else {
        mPointRealContainerLl = new LinearLayout(context);
        mPointRealContainerLl.setId(R.id.banner_indicatorId);
        mPointRealContainerLl.setOrientation(LinearLayout.HORIZONTAL);
        mPointRealContainerLl.setGravity(Gravity.CENTER_VERTICAL);
        pointContainerRl.addView(mPointRealContainerLl, indicatorLp);
    }

    LayoutParams tipLp = new LayoutParams(RMP, RWC);
    tipLp.addRule(CENTER_VERTICAL);
    mTipTv = new TextView(context);
    mTipTv.setGravity(Gravity.CENTER_VERTICAL);
    mTipTv.setSingleLine(true);
    mTipTv.setEllipsize(TextUtils.TruncateAt.END);
    mTipTv.setTextColor(mTipTextColor);
    mTipTv.setTextSize(TypedValue.COMPLEX_UNIT_PX, mTipTextSize);
    pointContainerRl.addView(mTipTv, tipLp);

    int horizontalGravity = mPointGravity & Gravity.HORIZONTAL_GRAVITY_MASK;
    // 处理圆点在左边、右边还是水平居中
    if (horizontalGravity == Gravity.LEFT) {
        indicatorLp.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
        tipLp.addRule(RelativeLayout.RIGHT_OF, R.id.banner_indicatorId);
        mTipTv.setGravity(Gravity.CENTER_VERTICAL | Gravity.RIGHT);
    } else if (horizontalGravity == Gravity.RIGHT) {
        indicatorLp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
        tipLp.addRule(RelativeLayout.LEFT_OF, R.id.banner_indicatorId);
    } else {
        indicatorLp.addRule(RelativeLayout.CENTER_HORIZONTAL);
        tipLp.addRule(RelativeLayout.LEFT_OF, R.id.banner_indicatorId);
    }

    showPlaceholder();
}
 
Example 20
Project: KrGallery   File: PickerBottomLayout.java   View Source Code Vote up 4 votes
public PickerBottomLayout(Context context, boolean darkTheme) {
    super(context);
    isDarkTheme = darkTheme;

    setBackgroundColor(isDarkTheme ? 0xff1a1a1a : 0xffffffff);

    cancelButton = new TextView(context);
    cancelButton.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18);
    cancelButton.setTextColor(isDarkTheme ? 0xffffffff : 0xff007aff);
    cancelButton.setGravity(Gravity.CENTER);
    cancelButton.setBackgroundDrawable(
            Theme.createBarSelectorDrawable(isDarkTheme ? Theme.ACTION_BAR_PICKER_SELECTOR_COLOR
                    : Theme.ACTION_BAR_AUDIO_SELECTOR_COLOR, false));
    cancelButton.setPadding(AndroidUtilities.dp(29), 0, AndroidUtilities.dp(29), 0);
    cancelButton.setText(R.string.Preview);
    // cancelButton.getPaint().setFakeBoldText(true);
    addView(cancelButton, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT,
            LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.LEFT));

    doneButton = new LinearLayout(context);
    doneButton.setOrientation(LinearLayout.HORIZONTAL);
    doneButton.setBackgroundDrawable(
            Theme.createBarSelectorDrawable(isDarkTheme ? Theme.ACTION_BAR_PICKER_SELECTOR_COLOR
                    : Theme.ACTION_BAR_AUDIO_SELECTOR_COLOR, false));
    doneButton.setPadding(AndroidUtilities.dp(29), 0, AndroidUtilities.dp(29), 0);
    addView(doneButton, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT,
            LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.RIGHT));

    doneButtonBadgeTextView = new TextView(context);
    // doneButtonBadgeTextView.getPaint().setFakeBoldText(true);
    doneButtonBadgeTextView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16);
    doneButtonBadgeTextView.setTextColor(0xffffffff);
    doneButtonBadgeTextView.setGravity(Gravity.CENTER);
    doneButtonBadgeTextView.setBackgroundResource(
            isDarkTheme ? R.drawable.photobadge_new : R.drawable.photobadge_new);
    doneButtonBadgeTextView.setPadding(AndroidUtilities.dp(8), 0, AndroidUtilities.dp(8),
            AndroidUtilities.dp(1));
    doneButton.addView(doneButtonBadgeTextView,
            LayoutHelper.createLinear(26, 26, Gravity.CENTER_VERTICAL, 0, 0, 10, 0));

    doneButtonTextView = new TextView(context);
    doneButtonTextView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18);
    doneButtonTextView.setTextColor(isDarkTheme ? 0xffffffff : 0xff007aff);
    doneButtonTextView.setGravity(Gravity.CENTER);
    doneButtonTextView.setCompoundDrawablePadding(AndroidUtilities.dp(8));
    doneButtonTextView.setText(R.string.Send);
    // doneButtonTextView.getPaint().setFakeBoldText(true);
    doneButton.addView(doneButtonTextView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT,
            LayoutHelper.WRAP_CONTENT, Gravity.CENTER_VERTICAL));
}