Example usage for android.graphics.drawable GradientDrawable setColor

List of usage examples for android.graphics.drawable GradientDrawable setColor

Introduction

In this page you can find the example usage for android.graphics.drawable GradientDrawable setColor.

Prototype

public void setColor(@Nullable ColorStateList colorStateList) 

Source Link

Document

Changes this drawable to use a single color state list instead of a gradient.

Usage

From source file:com.skydoves.elasticviewsexample.ElasticVIews.ElasticCheckButton.java

private void setTypeArray(TypedArray typedArray) {
    GradientDrawable bgShape = (GradientDrawable) view.getBackground();

    round = typedArray.getInt(R.styleable.ElasticCheckButton_checkbutton_round, round);
    bgShape.setCornerRadius(round);/*from w  w  w  .  j a  v  a 2s.  c  om*/

    color = typedArray.getInt(R.styleable.ElasticCheckButton_checkbutton_backgroundColor, color);
    bgShape.setColor(color);

    scale = typedArray.getFloat(R.styleable.ElasticCheckButton_checkbutton_scale, scale);

    duration = typedArray.getInt(R.styleable.ElasticCheckButton_checkbutton_duration, duration);

    labelText = typedArray.getString(R.styleable.ElasticCheckButton_checkbutton_labelText);
    view.setText(labelText);

    labelColor = typedArray.getInt(R.styleable.ElasticCheckButton_checkbutton_labelColor, labelColor);
    view.setTextColor(labelColor);

    labelSize = typedArray.getInt(R.styleable.ElasticCheckButton_checkbutton_labelSize, labelSize);
    view.setTextSize(labelSize);

    labelStyle = typedArray.getInt(R.styleable.ElasticCheckButton_checkbutton_labelStyle, labelStyle);

    if (labelStyle == 0)
        view.setTypeface(null, Typeface.NORMAL);
    else if (labelStyle == 1)
        view.setTypeface(null, Typeface.BOLD);
    else if (labelStyle == 2)
        view.setTypeface(null, Typeface.ITALIC);

    alpha = typedArray.getFloat(R.styleable.ElasticCheckButton_checkbutton_alpha, alpha);

    checked = typedArray.getBoolean(R.styleable.ElasticCheckButton_checkbutton_ischecked, checked);
    if (checked)
        view.setAlpha(alpha);
}

From source file:com.auth0.android.lock.views.CountryCodeSelectorView.java

private void setupBackground() {
    Drawable leftBackground = ViewUtils.getRoundedBackground(getResources(),
            ContextCompat.getColor(getContext(), R.color.com_auth0_lock_input_field_border_normal),
            ViewUtils.Corners.ONLY_LEFT);
    Drawable rightBackground = ViewUtils.getRoundedBackground(getResources(),
            ContextCompat.getColor(getContext(), R.color.com_auth0_lock_input_country_code_background),
            ViewUtils.Corners.ONLY_RIGHT);
    ViewUtils.setBackground(icon, leftBackground);
    ViewUtils.setBackground(chevron, rightBackground);
    ViewGroup parent = ((ViewGroup) countryNameTextView.getParent());
    Drawable bg = parent.getBackground();
    GradientDrawable gd = bg == null ? new GradientDrawable() : (GradientDrawable) bg;
    gd.setCornerRadius(getResources().getDimensionPixelSize(R.dimen.com_auth0_lock_widget_corner_radius));
    gd.setStroke(getResources().getDimensionPixelSize(R.dimen.com_auth0_lock_input_field_stroke_width),
            ContextCompat.getColor(getContext(), R.color.com_auth0_lock_input_field_border_normal));
    gd.setColor(ContextCompat.getColor(getContext(), R.color.com_auth0_lock_input_field_border_normal));
    ViewUtils.setBackground(parent, gd);
}

From source file:com.sonymobile.androidapp.gridcomputing.fragments.ReportChartFragment.java

private void setLegends() {
    if (mChart.getData().getDataSets().size() > 1) {
        final Resources resources = ApplicationData.getAppContext().getResources();
        final float density = getResources().getDisplayMetrics().density;
        final float legendWidth = resources.getDimension(R.dimen.chart_legend_width) / density;
        final float legendHeight = resources.getDimension(R.dimen.chart_legend_height) / density;
        final float legendMargin = resources.getDimension(R.dimen.chart_legend_margin) / density;
        final float legendCorner = resources.getDimension(R.dimen.chart_legend_corner) / density;

        for (ILineDataSet lineDataSet : mChart.getData().getDataSets()) {
            final CheckBox checkBox = new CheckBox(mLegendLayout.getContext());
            checkBox.setChecked(true);//from www .ja  va2s  . co  m
            checkBox.setText(lineDataSet.getLabel());
            checkBox.setTag(lineDataSet);
            checkBox.setOnCheckedChangeListener(mLegendCheckedChangeListener);

            GradientDrawable drawable = new GradientDrawable();
            drawable.setShape(GradientDrawable.RECTANGLE);
            drawable.setColor(lineDataSet.getColor());
            drawable.setSize((int) legendWidth, (int) legendHeight);
            drawable.setCornerRadius(legendCorner);

            checkBox.setCompoundDrawablesWithIntrinsicBounds(null, null, drawable, null);
            checkBox.setCompoundDrawablePadding((int) legendMargin);

            final GridLayout.Spec titleTxtSpecColumn = GridLayout.spec(GridLayout.UNDEFINED);
            final GridLayout.Spec titleRowSpec = GridLayout.spec(GridLayout.UNDEFINED);
            final GridLayout.LayoutParams layoutParams = new GridLayout.LayoutParams(titleRowSpec,
                    titleTxtSpecColumn);
            layoutParams.setMargins((int) legendWidth, 0, (int) legendWidth, 0);
            mLegendLayout.addView(checkBox, layoutParams);
        }
    }
}

From source file:com.example.mcervantes.quakereport.EarthquakeAdapter.java

/**
 * Returns a list item view that displays information about the earthquake at the given position
 * in the list of earthquakes./*from  ww w  . j  a v a2s.com*/
 */
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    // Check if there is an existing list item view (called convertView) that we can reuse,
    // otherwise, if convertView is null, then inflate a new list item layout.
    View listItemView = convertView;
    if (listItemView == null) {
        listItemView = LayoutInflater.from(getContext()).inflate(R.layout.earthquake_list_item, parent, false);
    }

    // Find the earthquake at the given position in the list of earthquakes
    Earthquake currentEarthquake = getItem(position);

    // Find the TextView with view ID magnitude
    TextView magnitudeView = (TextView) listItemView.findViewById(R.id.magnitude);
    // Format the magnitude to show 1 decimal place
    String formattedMagnitude = formatMagnitude(currentEarthquake.getMagnitude());
    // Display the magnitude of the current earthquake in that TextView
    magnitudeView.setText(formattedMagnitude);

    // Set the proper background color on the magnitude circle.
    // Fetch the background from the TextView, which is a GradientDrawable.
    GradientDrawable magnitudeCircle = (GradientDrawable) magnitudeView.getBackground();
    // Get the appropriate background color based on the current earthquake magnitude
    int magnitudeColor = getMagnitudeColor(currentEarthquake.getMagnitude());
    // Set the color on the magnitude circle
    magnitudeCircle.setColor(magnitudeColor);

    // Get the original location string from the Earthquake object,
    // which can be in the format of "5km N of Cairo, Egypt" or "Pacific-Antarctic Ridge".
    String originalLocation = currentEarthquake.getLocation();

    // If the original location string (i.e. "5km N of Cairo, Egypt") contains
    // a primary location (Cairo, Egypt) and a location offset (5km N of that city)
    // then store the primary location separately from the location offset in 2 Strings,
    // so they can be displayed in 2 TextViews.
    String primaryLocation;
    String locationOffset;

    // Check whether the originalLocation string contains the " of " text
    if (originalLocation.contains(LOCATION_SEPARATOR)) {
        // Split the string into different parts (as an array of Strings)
        // based on the " of " text. We expect an array of 2 Strings, where
        // the first String will be "5km N" and the second String will be "Cairo, Egypt".
        String[] parts = originalLocation.split(LOCATION_SEPARATOR);
        // Location offset should be "5km N " + " of " --> "5km N of"
        locationOffset = parts[0] + LOCATION_SEPARATOR;
        // Primary location should be "Cairo, Egypt"
        primaryLocation = parts[1];
    } else {
        // Otherwise, there is no " of " text in the originalLocation string.
        // Hence, set the default location offset to say "Near the".
        locationOffset = getContext().getString(R.string.near_the);
        // The primary location will be the full location string "Pacific-Antarctic Ridge".
        primaryLocation = originalLocation;
    }

    // Find the TextView with view ID location
    TextView primaryLocationView = (TextView) listItemView.findViewById(R.id.primary_location);
    // Display the location of the current earthquake in that TextView
    primaryLocationView.setText(primaryLocation);

    // Find the TextView with view ID location offset
    TextView locationOffsetView = (TextView) listItemView.findViewById(R.id.location_offset);
    // Display the location offset of the current earthquake in that TextView
    locationOffsetView.setText(locationOffset);

    // Create a new Date object from the time in milliseconds of the earthquake
    Date dateObject = new Date(currentEarthquake.getTimeInMilliseconds());

    // Find the TextView with view ID date
    TextView dateView = (TextView) listItemView.findViewById(R.id.date);
    // Format the date string (i.e. "Mar 3, 1984")
    String formattedDate = formatDate(dateObject);
    // Display the date of the current earthquake in that TextView
    dateView.setText(formattedDate);

    // Find the TextView with view ID time
    TextView timeView = (TextView) listItemView.findViewById(R.id.time);
    // Format the time string (i.e. "4:30PM")
    String formattedTime = formatTime(dateObject);
    // Display the time of the current earthquake in that TextView
    timeView.setText(formattedTime);

    // Return the list item view that is now showing the appropriate data
    return listItemView;
}

From source file:io.imoji.sdk.grid.ui.ResultView.java

private Drawable getPlaceholder(int placeholderRandomizer, int position) {
    int[] colorArray = context.getResources().getIntArray(R.array.search_widget_placeholder_colors);
    int color = colorArray[(placeholderRandomizer + position) % colorArray.length];

    GradientDrawable placeholder = new GradientDrawable(GradientDrawable.Orientation.TOP_BOTTOM,
            new int[] { ColorUtils.setAlphaComponent(Color.WHITE, GRADIENT_START_ALPHA),
                    ColorUtils.setAlphaComponent(Color.WHITE, GRADIENT_END_ALPHA) });
    placeholder.setColor(color);
    placeholder.setShape(GradientDrawable.OVAL);
    return placeholder;
}

From source file:org.onebusaway.android.ui.ArrivalsListAdapterStyleB.java

@Override
protected void initView(final View view, CombinedArrivalInfoStyleB combinedArrivalInfoStyleB) {
    final ArrivalInfo stopInfo = combinedArrivalInfoStyleB.getArrivalInfoList().get(0);
    final ObaArrivalInfo arrivalInfo = stopInfo.getInfo();
    final Context context = getContext();

    LayoutInflater inflater = LayoutInflater.from(context);

    TextView routeName = (TextView) view.findViewById(R.id.routeName);
    TextView destination = (TextView) view.findViewById(R.id.routeDestination);

    // TableLayout that we will fill with TableRows of arrival times
    TableLayout arrivalTimesLayout = (TableLayout) view.findViewById(R.id.arrivalTimeLayout);
    arrivalTimesLayout.removeAllViews();

    Resources r = view.getResources();

    ImageButton starBtn = (ImageButton) view.findViewById(R.id.route_star);
    starBtn.setColorFilter(r.getColor(R.color.theme_primary));

    ImageButton mapImageBtn = (ImageButton) view.findViewById(R.id.mapImageBtn);
    mapImageBtn.setColorFilter(r.getColor(R.color.theme_primary));

    ImageButton routeMoreInfo = (ImageButton) view.findViewById(R.id.route_more_info);
    routeMoreInfo.setColorFilter(r.getColor(R.color.switch_thumb_normal_material_dark));

    starBtn.setImageResource(/*  w ww  .  ja  v a  2  s  . c om*/
            stopInfo.isRouteAndHeadsignFavorite() ? R.drawable.focus_star_on : R.drawable.focus_star_off);

    starBtn.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            // Show dialog for setting route favorite
            RouteFavoriteDialogFragment dialog = new RouteFavoriteDialogFragment.Builder(
                    stopInfo.getInfo().getRouteId(), stopInfo.getInfo().getHeadsign())
                            .setRouteShortName(stopInfo.getInfo().getShortName())
                            .setRouteLongName(stopInfo.getInfo().getRouteLongName())
                            .setStopId(stopInfo.getInfo().getStopId())
                            .setFavorite(!stopInfo.isRouteAndHeadsignFavorite()).build();

            dialog.setCallback(new RouteFavoriteDialogFragment.Callback() {
                @Override
                public void onSelectionComplete(boolean savedFavorite) {
                    if (savedFavorite) {
                        mFragment.refreshLocal();
                    }
                }
            });
            dialog.show(mFragment.getFragmentManager(), RouteFavoriteDialogFragment.TAG);
        }
    });

    // Setup map
    mapImageBtn.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            mFragment.showRouteOnMap(stopInfo);
        }
    });

    // Setup more
    routeMoreInfo.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            mFragment.showListItemMenu(view, stopInfo);
        }
    });

    routeName.setText(arrivalInfo.getShortName());
    destination.setText(MyTextUtils.toTitleCase(arrivalInfo.getHeadsign()));

    // Loop through the arrival times and create the TableRows that contains the data
    for (int i = 0; i < combinedArrivalInfoStyleB.getArrivalInfoList().size(); i++) {
        final ArrivalInfo arrivalRow = combinedArrivalInfoStyleB.getArrivalInfoList().get(i);
        final ObaArrivalInfo tempArrivalInfo = arrivalRow.getInfo();
        long scheduledTime = tempArrivalInfo.getScheduledArrivalTime();

        // Create a new row to be added
        final TableRow tr = (TableRow) inflater.inflate(R.layout.arrivals_list_tr_template_style_b, null);

        // Layout and views to inflate from XML templates
        RelativeLayout layout;
        TextView scheduleView, estimatedView, statusView;
        View divider;

        if (i == 0) {
            // Use larger styled layout/view for next arrival time
            layout = (RelativeLayout) inflater.inflate(R.layout.arrivals_list_rl_template_style_b_large, null);
            scheduleView = (TextView) inflater
                    .inflate(R.layout.arrivals_list_tv_template_style_b_schedule_large, null);
            estimatedView = (TextView) inflater
                    .inflate(R.layout.arrivals_list_tv_template_style_b_estimated_large, null);
            statusView = (TextView) inflater.inflate(R.layout.arrivals_list_tv_template_style_b_status_large,
                    null);
        } else {
            // Use smaller styled layout/view for further out times
            layout = (RelativeLayout) inflater.inflate(R.layout.arrivals_list_rl_template_style_b_small, null);
            scheduleView = (TextView) inflater
                    .inflate(R.layout.arrivals_list_tv_template_style_b_schedule_small, null);
            estimatedView = (TextView) inflater
                    .inflate(R.layout.arrivals_list_tv_template_style_b_estimated_small, null);
            statusView = (TextView) inflater.inflate(R.layout.arrivals_list_tv_template_style_b_status_small,
                    null);
        }

        // Set arrival times and status in views
        scheduleView.setText(DateUtils.formatDateTime(context, scheduledTime,
                DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_NO_NOON | DateUtils.FORMAT_NO_MIDNIGHT));
        if (arrivalRow.getPredicted()) {
            long eta = arrivalRow.getEta();
            if (eta == 0) {
                estimatedView.setText(R.string.stop_info_eta_now);
            } else {
                estimatedView.setText(eta + " min");
            }
        } else {
            estimatedView.setText(R.string.stop_info_eta_unknown);
        }
        statusView.setText(arrivalRow.getStatusText());
        int colorCode = arrivalRow.getColor();
        statusView.setBackgroundResource(R.drawable.round_corners_style_b_status);
        GradientDrawable d = (GradientDrawable) statusView.getBackground();
        d.setColor(context.getResources().getColor(colorCode));

        int alpha;
        if (i == 0) {
            // Set next arrival
            alpha = (int) (1.0f * 255); // X percent transparency
        } else {
            // Set smaller rows
            alpha = (int) (.35f * 255); // X percent transparency
        }
        d.setAlpha(alpha);

        // Set padding on status view
        int pSides = UIUtils.dpToPixels(context, 5);
        int pTopBottom = UIUtils.dpToPixels(context, 2);
        statusView.setPadding(pSides, pTopBottom, pSides, pTopBottom);

        // Add TextViews to layout
        layout.addView(scheduleView);
        layout.addView(statusView);
        layout.addView(estimatedView);

        // Make sure the TextViews align left/center/right of parent relative layout
        RelativeLayout.LayoutParams params1 = (RelativeLayout.LayoutParams) scheduleView.getLayoutParams();
        params1.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
        params1.addRule(RelativeLayout.CENTER_VERTICAL);
        scheduleView.setLayoutParams(params1);

        RelativeLayout.LayoutParams params2 = (RelativeLayout.LayoutParams) statusView.getLayoutParams();
        params2.addRule(RelativeLayout.CENTER_IN_PARENT);
        // Give status view a little extra margin
        int p = UIUtils.dpToPixels(context, 3);
        params2.setMargins(p, p, p, p);
        statusView.setLayoutParams(params2);

        RelativeLayout.LayoutParams params3 = (RelativeLayout.LayoutParams) estimatedView.getLayoutParams();
        params3.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
        params3.addRule(RelativeLayout.CENTER_VERTICAL);
        estimatedView.setLayoutParams(params3);

        // Add layout to TableRow
        tr.addView(layout);

        // Add the divider, if its not the first row
        if (i != 0) {
            int dividerHeight = UIUtils.dpToPixels(context, 1);
            divider = inflater.inflate(R.layout.arrivals_list_divider_template_style_b, null);
            divider.setLayoutParams(
                    new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, dividerHeight));
            arrivalTimesLayout.addView(divider);
        }

        // Add click listener
        tr.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mFragment.showListItemMenu(tr, arrivalRow);
            }
        });

        // Add TableRow to container layout
        arrivalTimesLayout.addView(tr, new TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT,
                TableLayout.LayoutParams.MATCH_PARENT));
    }

    // Show or hide reminder for this trip
    ContentValues values = null;
    if (mTripsForStop != null) {
        values = mTripsForStop.getValues(arrivalInfo.getTripId());
    }
    if (values != null) {
        String reminderName = values.getAsString(ObaContract.Trips.NAME);

        TextView reminder = (TextView) view.findViewById(R.id.reminder);
        if (reminderName.length() == 0) {
            reminderName = context.getString(R.string.trip_info_noname);
        }
        reminder.setText(reminderName);
        Drawable d = reminder.getCompoundDrawables()[0];
        d = DrawableCompat.wrap(d);
        DrawableCompat.setTint(d.mutate(), view.getResources().getColor(R.color.theme_primary));
        reminder.setCompoundDrawables(d, null, null, null);
        reminder.setVisibility(View.VISIBLE);
    } else {
        // Explicitly set reminder to invisible because we might be reusing
        // this view.
        View reminder = view.findViewById(R.id.reminder);
        reminder.setVisibility(View.GONE);
    }
}

From source file:io.imoji.sdk.editor.fragment.TagImojiFragment.java

public Drawable createTagDrawable() {

    GradientDrawable d = new GradientDrawable();
    TypedArray a = getActivity().getTheme().obtainStyledAttributes(new int[] { R.attr.colorAccent });
    final int accentColor = a.getColor(0, Color.WHITE);
    a.recycle();// w  ww .  jav  a2 s  .c  om
    d.setColor(0xB3FFFFFF & accentColor);
    d.setCornerRadius(getResources().getDimension(R.dimen.dim_8dp));
    d.setShape(GradientDrawable.RECTANGLE);

    GradientDrawable d1 = new GradientDrawable();
    d1.setCornerRadius(getResources().getDimension(R.dimen.dim_8dp));
    d1.setStroke((int) getResources().getDimension(R.dimen.dim_0_5dp), 0x66FFFFFF & Color.BLACK);

    GradientDrawable d2 = new GradientDrawable();
    d2.setStroke((int) getResources().getDimension(R.dimen.dim_1dp), accentColor);
    d2.setCornerRadius(getResources().getDimension(R.dimen.dim_8dp));

    LayerDrawable layer = new LayerDrawable(new Drawable[] { d, d2, d1 });

    int halfDp = (int) getResources().getDimension(R.dimen.dim_0_5dp);
    int oneDp = (int) getResources().getDimension(R.dimen.dim_1dp);
    int oneAndHalf = halfDp + oneDp;

    layer.setLayerInset(2, 0, 0, 0, 0);
    layer.setLayerInset(1, halfDp, halfDp, halfDp, halfDp);
    layer.setLayerInset(0, oneAndHalf, oneAndHalf, oneAndHalf, oneAndHalf);

    return layer;
}

From source file:com.adithyaupadhya.uimodule.roundcornerprogressbar.BaseRoundCornerProgressBar.java

GradientDrawable createGradientDrawable(int color) {
    GradientDrawable gradientDrawable = new GradientDrawable();
    gradientDrawable.setShape(GradientDrawable.RECTANGLE);
    gradientDrawable.setColor(color);
    return gradientDrawable;
}

From source file:com.hctrom.romcontrol.MainViewActivity.java

public void showHideRebootMenu() {

    for (int i = 0; i < rebootFabs.length; i++) {
        if (rebootFabs[i].isShown()) {
            overlay.setVisibility(View.GONE);
            rebootFabs[i].hide();//from   w  w w.  j a  v a 2 s.c o  m
            rebootFabs_text[i].setVisibility(View.GONE);
        } else {
            overlay.setVisibility(View.VISIBLE);
            rebootFabs[i].show();
            rebootFabs_text[i].setVisibility(View.VISIBLE);
            GradientDrawable gd = new GradientDrawable();
            gd.setColor(getResources().getColor(R.color.button_material_dark)); // Changes this drawbale to use a single color instead of a gradient
            gd.setCornerRadius(20);
            gd.setStroke(1, 0xFF000000);
            rebootFabs_text[i].setBackgroundDrawable(gd);
        }
    }

    if (!overlay.isShown()) {
        Blurry.delete((ViewGroup) findViewById(R.id.content));
    } else {
        Blurry.with(MainViewActivity.this).radius(25).sampling(2).async().animate(200)
                .onto((ViewGroup) findViewById(R.id.content));
    }
}

From source file:org.noise_planet.noisecapture.CommentActivity.java

private void addTag(String tagName, int id, ViewGroup column, int color) {
    ToggleButton tagButton = new ToggleButton(this);
    if (color != -1) {
        LinearLayout colorBox = new LinearLayout(this);
        // Convert the dps to pixels, based on density scale
        final int tagPaddingPx = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 1,
                getResources().getDisplayMetrics());
        final int tagPaddingPxBottom = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 3,
                getResources().getDisplayMetrics());
        //use a GradientDrawable with only one color set, to make it a solid color
        colorBox.setBackgroundResource(R.drawable.tag_round_corner);
        GradientDrawable gradientDrawable = (GradientDrawable) colorBox.getBackground();
        gradientDrawable.setColor(color);
        LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.WRAP_CONTENT);
        params.setMargins(tagPaddingPx, tagPaddingPx, tagPaddingPx, tagPaddingPxBottom);
        colorBox.setLayoutParams(params);
        colorBox.addView(tagButton);//from  w w  w  .  j av  a 2s  .c o m
        column.addView(colorBox);
    } else {
        column.addView(tagButton);
    }
    tagButton.setTextOff(tagName);
    tagButton.setTextOn(tagName);
    boolean isChecked = checkedTags.contains(id);
    tagButton.setChecked(isChecked);
    if (isChecked) {
        tagButton.setTextColor(selectedColor);
    }
    tagButton.setOnCheckedChangeListener(new TagStateListener(id, checkedTags));
    tagButton.setMinHeight(0);
    tagButton.setMinimumHeight(0);
    tagButton.setTextSize(Dimension.SP, 12);
    tagButton.setEnabled(record == null || record.getUploadId().isEmpty());
    tagButton.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.WRAP_CONTENT));
    tagButton.invalidate();
}