android.support.v7.content.res.AppCompatResources Java Examples

The following examples show how to use android.support.v7.content.res.AppCompatResources. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AutofillPaymentInstrument.java    From 365browser with Apache License 2.0 6 votes vote down vote up
/**
 * Builds a payment instrument for the given credit card.
 *
 * @param webContents    The web contents where PaymentRequest was invoked.
 * @param card           The autofill card that can be used for payment.
 * @param billingAddress The billing address for the card.
 * @param methodName     The payment method name, e.g., "basic-card", "visa", amex", or null.
 */
public AutofillPaymentInstrument(WebContents webContents, CreditCard card,
        @Nullable AutofillProfile billingAddress, @Nullable String methodName) {
    super(card.getGUID(), card.getObfuscatedNumber(), card.getName(), null);
    mWebContents = webContents;
    mCard = card;
    mBillingAddress = billingAddress;
    mIsEditable = true;
    mMethodName = methodName;

    Context context = ChromeActivity.fromWebContents(mWebContents);
    if (context == null) return;

    if (card.getIssuerIconDrawableId() != 0) {
        updateDrawableIcon(
                AppCompatResources.getDrawable(context, card.getIssuerIconDrawableId()));
    }

    checkAndUpateCardCompleteness(context);
}
 
Example #2
Source File: AboutActivity.java    From Capstone-Project with MIT License 6 votes vote down vote up
/**
 * Add left drawables on buttons. This is done programmatically because on pre lollipop devices
 * vector drawables cannot be directly accessed in buttons(xml).
 */
private void addIconsToButtons() {
    boolean isLightTheme = PredatorSharedPreferences.getCurrentTheme(getApplicationContext()) ==
            PredatorSharedPreferences.THEME_TYPE.LIGHT;

    Drawable githubDrawable = AppCompatResources.getDrawable(getApplicationContext(),
            isLightTheme ? R.drawable.ic_github_24dp : R.drawable.ic_github_inverse_24dp);
    btnGithub.setCompoundDrawablesWithIntrinsicBounds(githubDrawable, null, null, null);

    Drawable googlePlusDrawable = AppCompatResources.getDrawable(getApplicationContext(),
            isLightTheme ? R.drawable.ic_google_plus_24dp : R.drawable.ic_google_plus_inverse_24dp);
    btnGooglePlus.setCompoundDrawablesWithIntrinsicBounds(googlePlusDrawable, null, null, null);

    Drawable mailDrawable = AppCompatResources.getDrawable(getApplicationContext(),
            isLightTheme ? R.drawable.ic_mail_24dp : R.drawable.ic_mail_inverse_24dp);
    btnMail.setCompoundDrawablesWithIntrinsicBounds(mailDrawable, null, null, null);
}
 
Example #3
Source File: AttrTypeImageSrcCompat.java    From NightModel with Apache License 2.0 6 votes vote down vote up
@Override
public void apply(View view, String resName) {
    if (TextUtils.isEmpty(resName)) return;
    if (view instanceof ImageView) {
        Drawable drawable;
        if (((ImageView) view).getDrawable() != null
                && ((ImageView) view).getDrawable().getClass().getName().toLowerCase().contains("vector")) {
            int resId = view.getResources().getIdentifier(resName, DEFTYPE_DRAWABLE, view.getContext().getPackageName());
            drawable = AppCompatResources.getDrawable(view.getContext(), resId);
        } else {
            drawable = getDrawable(view.getContext(), resName);
        }
        if (drawable == null) return;
        ((ImageView) view).setImageDrawable(drawable);
    }
}
 
Example #4
Source File: ScatterChart2Model.java    From JZAndroidChart with Apache License 2.0 6 votes vote down vote up
@Override protected void setDataBindingVariables(ViewDataBinding binding) {

    if (binding instanceof LayoutScatterChartBinding) {

      Drawable drawable = AppCompatResources.getDrawable(binding.getRoot().getContext(),
                                                         R.drawable.shape_circle);
      scatterDataSet.setShape(drawable);

      LayoutScatterChartBinding bd = (LayoutScatterChartBinding) binding;

      bd.combineChart.getAxisBottom().setGridCount(1);
      bd.combineChart.getAxisLeft().setGridCount(1);
      bd.combineChart.addDataSet(scatterDataSet);

      bd.combineChart.setOnEntryClickListener(new OnEntryClickListener() {
        @Override public void onEntryClick(Chart chart, int position) {
          if (position >= 0) {
            Toast.makeText(chart.getContext(), textList.get(position), Toast.LENGTH_SHORT).show();
          }
        }
      });
    }

  }
 
Example #5
Source File: AnimationHelper.java    From ListItemView with Apache License 2.0 6 votes vote down vote up
public void setupRadioButton(ListItemView listItemView) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        AnimatedStateListDrawable asl = new AnimatedStateListDrawable();
        asl.addState(
                new int[]{android.R.attr.state_checked},
                AppCompatResources.getDrawable(mContext, R.drawable.vd_radiobutton_checked),
                R.id.checked);
        asl.addState(
                new int[0],
                AppCompatResources.getDrawable(mContext, R.drawable.vd_radiobutton_unchecked),
                R.id.unchecked);
        asl.addTransition(
                R.id.unchecked,
                R.id.checked,
                AnimatedVectorDrawableCompat.create(mContext, R.drawable.avd_radiobutton_unchecked_to_checked),
                false);
        asl.addTransition(
                R.id.checked,
                R.id.unchecked,
                AnimatedVectorDrawableCompat.create(mContext, R.drawable.avd_radiobutton_checked_to_unchecked),
                false);
        listItemView.setIconDrawable(asl);
    } else {
        listItemView.setIconResId(R.drawable.selector_ic_radio);
    }
}
 
Example #6
Source File: AnimationHelper.java    From ListItemView with Apache License 2.0 6 votes vote down vote up
public void setupCheckBox(ListItemView listItemView) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        AnimatedStateListDrawable asl = new AnimatedStateListDrawable();
        asl.addState(
                new int[]{android.R.attr.state_checked},
                AppCompatResources.getDrawable(mContext, R.drawable.vd_checkbox_checked),
                R.id.checked);
        asl.addState(
                new int[0],
                AppCompatResources.getDrawable(mContext, R.drawable.vd_checkbox_unchecked),
                R.id.unchecked);
        asl.addTransition(
                R.id.unchecked,
                R.id.checked,
                AnimatedVectorDrawableCompat.create(mContext, R.drawable.avd_checkbox_unchecked_to_checked),
                false);
        asl.addTransition(
                R.id.checked,
                R.id.unchecked,
                AnimatedVectorDrawableCompat.create(mContext, R.drawable.avd_checkbox_checked_to_unchecked),
                false);
        listItemView.setIconDrawable(asl);
    } else {
        listItemView.setIconResId(R.drawable.selector_ic_check);
    }
}
 
Example #7
Source File: ResUtils.java    From Android-utils with Apache License 2.0 5 votes vote down vote up
public static Drawable getAttrDrawable(Context context, TypedArray typedArray, int index){
    TypedValue value = typedArray.peekValue(index);
    if (value != null) {
        if (value.type != TypedValue.TYPE_ATTRIBUTE && value.resourceId != 0) {
            return AppCompatResources.getDrawable(context, value.resourceId);
        }
    }
    return null;
}
 
Example #8
Source File: TintVtDrTextView.java    From EosCommander with MIT License 5 votes vote down vote up
private void init(Context context, AttributeSet attrs) {
    if ( null == attrs ) {
        return;
    }

    TypedArray attributeArray = context.obtainStyledAttributes( attrs, R.styleable.TintVtDrTextView);
    Drawable[] drawables = new Drawable[4];
    int[] styleableIds = { R.styleable.TintVtDrTextView_vectorLeft, R.styleable.TintVtDrTextView_vectorTop,
            R.styleable.TintVtDrTextView_vectorRight, R.styleable.TintVtDrTextView_vectorBottom} ;

    int colorId = attributeArray.getResourceId(R.styleable.TintVtDrTextView_vectorTint, -1);
    int tintColor = Color.BLACK;
    if ( -1 != colorId ) {
        tintColor = context.getResources().getColor( colorId );
    }


    for ( int i = 0; i < drawables.length ;i++ ) {
        int rscId = attributeArray.getResourceId(styleableIds[i], -1);
        if ( -1 != rscId ){
            drawables[i] = AppCompatResources.getDrawable(context, rscId) ;

            if ( -1 != tintColor ) {
                DrawableCompat.setTint( drawables[i], tintColor);
            }
        }
    }

    // left, top, right, bottom
    setCompoundDrawablesWithIntrinsicBounds(drawables[0], drawables[1], drawables[2], drawables[3]);
    attributeArray.recycle();
}
 
Example #9
Source File: Util.java    From Camera-Roll-Android-App with Apache License 2.0 5 votes vote down vote up
public static Drawable getAlbumItemSelectorOverlay(Context context) {
    Drawable selectorOverlay = AppCompatResources.getDrawable(context,
            R.drawable.album_item_selected_indicator);

    if (selectorOverlay == null) {
        return null;
    }
    return tintDrawableWithAccentColor(context, selectorOverlay);
}
 
Example #10
Source File: Util.java    From Camera-Roll-Android-App with Apache License 2.0 5 votes vote down vote up
public static Drawable getErrorPlaceholder(Context context) {
    Drawable errorPlaceholder = AppCompatResources.getDrawable(context,
            R.drawable.error_placeholder);

    if (errorPlaceholder == null) {
        return null;
    }
    return tintDrawableWithAccentColor(context, errorPlaceholder);
}
 
Example #11
Source File: BookDetailActivity.java    From ReadMark with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    //Log.e("onCreate", "调用了");
    //initTheme();

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_book_detail);
    ButterKnife.bind(this);
    initEvents();
    mToolbar.setNavigationIcon(AppCompatResources.getDrawable(this, R.drawable.ic_action_clear));
}
 
Example #12
Source File: VectorCompatHelper.java    From pandroid with Apache License 2.0 5 votes vote down vote up
private static Drawable getDrawableInternal(Context context, @DrawableRes int drawableRes, Integer tintColor) {
    if (drawableRes == 0) {
        return null;
    }
    Drawable drawable = AppCompatResources.getDrawable(context, drawableRes);
    if (drawable != null && tintColor != null) {
        Drawable tintDrawable = DrawableCompat.wrap(drawable);
        DrawableCompat.setTint(tintDrawable, tintColor);
        return tintDrawable;
    }
    return drawable;
}
 
Example #13
Source File: App.java    From ForPDA with GNU General Public License v3.0 5 votes vote down vote up
public static Drawable getVecDrawable(Context context, @DrawableRes int id) {
    Drawable drawable = AppCompatResources.getDrawable(context, id);
    if (!(drawable instanceof VectorDrawableCompat || drawable instanceof VectorDrawable)) {
        throw new RuntimeException();
    }
    return drawable;
}
 
Example #14
Source File: BitmapLoader.java    From xDrip with GNU General Public License v3.0 5 votes vote down vote up
private static Bitmap getBitmapFromVectorDrawable(int drawableId) {
    Drawable drawable = AppCompatResources.getDrawable(xdrip.getAppContext(), drawableId);
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
        drawable = (DrawableCompat.wrap(drawable)).mutate();
    }
    final Bitmap bitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(),
            drawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
    final Canvas canvas = new Canvas(bitmap);
    drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
    drawable.draw(canvas);

    return bitmap;
}
 
Example #15
Source File: BitmapLoader.java    From xDrip-plus with GNU General Public License v3.0 5 votes vote down vote up
private static Bitmap getBitmapFromVectorDrawable(int drawableId) {
    Drawable drawable = AppCompatResources.getDrawable(xdrip.getAppContext(), drawableId);
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
        drawable = (DrawableCompat.wrap(drawable)).mutate();
    }
    final Bitmap bitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(),
            drawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
    final Canvas canvas = new Canvas(bitmap);
    drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
    drawable.draw(canvas);

    return bitmap;
}
 
Example #16
Source File: DemoCodeFragment.java    From FABRevealMenu-master with Apache License 2.0 5 votes vote down vote up
private void initItems(boolean toShowDoubleItems) {
    items = new ArrayList<>();
    items.add(new FABMenuItem("Attachments", AppCompatResources.getDrawable(getActivity(), R.drawable.ic_attachment)));
    items.add(new FABMenuItem("Images", AppCompatResources.getDrawable(getActivity(), R.drawable.ic_image)));
    items.add(new FABMenuItem("Places", AppCompatResources.getDrawable(getActivity(), R.drawable.ic_place)));
    items.add(new FABMenuItem("Emoticons", AppCompatResources.getDrawable(getActivity(), R.drawable.ic_emoticon)));
    if (toShowDoubleItems) {
        items.add(new FABMenuItem("Attachments", AppCompatResources.getDrawable(getActivity(), R.drawable.ic_attachment)));
        items.add(new FABMenuItem("Images", AppCompatResources.getDrawable(getActivity(), R.drawable.ic_image)));
        items.add(new FABMenuItem("Places", AppCompatResources.getDrawable(getActivity(), R.drawable.ic_place)));
        items.add(new FABMenuItem("Emoticons", AppCompatResources.getDrawable(getActivity(), R.drawable.ic_emoticon)));
    }
}
 
Example #17
Source File: BookDetailActivity.java    From MaterialHome with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    setContentView(R.layout.activity_book_detail);
    ButterKnife.bind(this);
    super.onCreate(savedInstanceState);
    mToolbar.setNavigationIcon(AppCompatResources.getDrawable(this, R.drawable.ic_action_clear));
}
 
Example #18
Source File: EBookDetailActivity.java    From MaterialHome with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    setContentView(R.layout.activity_ebook_detail);
    ButterKnife.bind(this);
    super.onCreate(savedInstanceState);
    mToolbar.setNavigationIcon(AppCompatResources.getDrawable(this, R.drawable.ic_action_clear));
}
 
Example #19
Source File: BookDetailActivity.java    From ReadMark with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    //Log.e("onCreate", "调用了");
    //initTheme();

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_book_detail);
    ButterKnife.bind(this);
    initEvents();
    mToolbar.setNavigationIcon(AppCompatResources.getDrawable(this, R.drawable.ic_action_clear));
}
 
Example #20
Source File: RoundedImageViewWithBorder.java    From ImageLetterIcon with Apache License 2.0 5 votes vote down vote up
private Drawable resolveResource() {
    Drawable d = null;
    if (mResource != 0) {
        try {
            d = AppCompatResources.getDrawable(getContext(), mResource);
        } catch (Exception e) {
            mResource = 0;
        }
    }
    return RoundedDrawable.fromDrawable(d);
}
 
Example #21
Source File: EditorTextField.java    From 365browser with Apache License 2.0 5 votes vote down vote up
private void updateFieldValueIcon(boolean force) {
    if (mValueIcon == null) return;

    int iconId = mEditorFieldModel.getValueIconGenerator().getIconResourceId(mInput.getText());
    if (mValueIconId == iconId && !force) return;
    mValueIconId = iconId;
    if (mValueIconId == 0) {
        mValueIcon.setVisibility(GONE);
    } else {
        mValueIcon.setImageDrawable(AppCompatResources.getDrawable(getContext(), mValueIconId));
        mValueIcon.setVisibility(VISIBLE);
    }
}
 
Example #22
Source File: PlacesAutocompleteTextView.java    From android-PlacesAutocompleteTextView with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void enableClearButton(boolean value){
    if(!value) {
        this.setCompoundDrawables(null, null, null, null);
        return;
    }
    if(imgClearButton == null) {
        imgClearButton = AppCompatResources.getDrawable(getContext(), R.drawable.ic_clear_black_24dp);
    }
    // Set the bounds of the clear button
    this.setCompoundDrawablesWithIntrinsicBounds(null, null, imgClearButton, null);

    // if the clear button is pressed fire up the handler Otherwise do nothing
    final Drawable finalImgClearButton = imgClearButton;
    this.setOnTouchListener(new OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            PlacesAutocompleteTextView et = PlacesAutocompleteTextView.this;
            if (et.getCompoundDrawables()[2] == null)
                return false;
            if (event.getAction() != MotionEvent.ACTION_UP)
                return false;
            if (event.getX() > et.getWidth() - et.getPaddingRight() - finalImgClearButton.getIntrinsicWidth()) {
                onClearListener.onClear();
            }
            return false;
        }
    });
}
 
Example #23
Source File: MaskableFrameLayout.java    From android_maskable_layout with Apache License 2.0 5 votes vote down vote up
@Nullable
private Drawable loadMask(@NonNull TypedArray a) {
    final int drawableResId = a.getResourceId(R.styleable.MaskableLayout_mask, -1);
    if (drawableResId == -1) {
        return null;
    }
    return AppCompatResources.getDrawable(getContext(), drawableResId);
}
 
Example #24
Source File: App.java    From StateViews with MIT License 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();

    StateViewsBuilder
            .init(this)
            .setIconColor(Color.parseColor("#D2D5DA"))
            .addState("error",
                    "No Connection",
                    "Error retrieving information from server.",
                    AppCompatResources.getDrawable(this, R.drawable.ic_server_error),
                    "Retry"
            )

            .addState(
                    "archive",
                    "Clear the clutter",
                    "Archived items will be kept here. They'll still show in albums " +
                            "& search results.",
                    AppCompatResources.getDrawable(this, R.drawable.photos_archive),
                    "LEARN MORE"
            )

            .addState("search",
                    "No Results Found",
                    "Unfortunately I could not find any results matching your search",
                    AppCompatResources.getDrawable(this, R.drawable.search), null)

            .addState("custom",
                    "Custom State",
                    "This is a custom state, made in 5 seconds",
                    AppCompatResources.getDrawable(this, R.drawable.fingerprint),
                    "Cool")
            .setButtonBackgroundColor(Color.parseColor("#317DED"))
            .setButtonTextColor(Color.parseColor("#FFFFFF"))
            .setIconSize(getResources().getDimensionPixelSize(R.dimen.state_views_icon_size));
}
 
Example #25
Source File: NavigationMapRoute.java    From graphhopper-navigation-android with MIT License 5 votes vote down vote up
private void addDirectionWaypoints() {
  MapUtils.updateMapSourceFromFeatureCollection(
    mapboxMap, featureCollections.get(featureCollections.size() - 1), WAYPOINT_SOURCE_ID);
  drawWaypointMarkers(mapboxMap,
    AppCompatResources.getDrawable(mapView.getContext(), originWaypointIcon),
    AppCompatResources.getDrawable(mapView.getContext(), destinationWaypointIcon)
  );
}
 
Example #26
Source File: EmoticonSpan.java    From EmoticonGIFKeyboard with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("ConstantConditions")
@Override
public Drawable getDrawable() {
    if (mDeferredDrawable == null) {
        mDeferredDrawable = AppCompatResources.getDrawable(mContext, mEmoticonIcon);
        mDeferredDrawable.setBounds(0, 0, (int) mEmoticonSize, (int) mEmoticonSize);
    }
    return mDeferredDrawable;
}
 
Example #27
Source File: AnimationHelper.java    From ListItemView with Apache License 2.0 5 votes vote down vote up
public void setupCheckBoxMenu(ListItemView listItemView) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        AnimatedStateListDrawable asl = new AnimatedStateListDrawable();
        asl.addState(
                new int[]{android.R.attr.state_checked},
                AppCompatResources.getDrawable(mContext, R.drawable.vd_checkbox_checked),
                R.id.checked);
        asl.addState(
                new int[0],
                AppCompatResources.getDrawable(mContext, R.drawable.vd_checkbox_unchecked),
                R.id.unchecked);
        asl.addTransition(
                R.id.unchecked,
                R.id.checked,
                AnimatedVectorDrawableCompat.create(mContext, R.drawable.avd_checkbox_unchecked_to_checked),
                false);
        asl.addTransition(
                R.id.checked,
                R.id.unchecked,
                AnimatedVectorDrawableCompat.create(mContext, R.drawable.avd_checkbox_checked_to_unchecked),
                false);

        listItemView.inflateMenu(R.menu.checkable_action_menu);
        ImageView imageView = (ImageView) listItemView.findMenuItem(R.id.action_checkable).getActionView();
        imageView.setImageDrawable(asl);
        asl.jumpToCurrentState();
    } else {
        listItemView.inflateMenu(R.menu.checkable_action_menu);
    }
}
 
Example #28
Source File: NavigationMapRoute.java    From graphhopper-navigation-android with MIT License 5 votes vote down vote up
private void addArrowHeadIconCasing() {
  Drawable headCasing = DrawableCompat.wrap(AppCompatResources.getDrawable(mapView.getContext(),
    R.drawable.ic_arrow_head_casing));
  DrawableCompat.setTint(headCasing.mutate(), arrowBorderColor);
  Bitmap icon = MapImageUtils.getBitmapFromDrawable(headCasing);
  mapboxMap.addImage(ARROW_HEAD_ICON_CASING, icon);
}
 
Example #29
Source File: ListItemView.java    From ListItemView with Apache License 2.0 4 votes vote down vote up
/**
 * Set an icon on left side.
 *
 * @param iconResId an icon resource id
 */
public void setIconResId(@DrawableRes final int iconResId) {
    mIconResId = iconResId;
    setIconDrawableInternal(
            mIconResId != NULL ? AppCompatResources.getDrawable(getContext(), mIconResId) : null);
}
 
Example #30
Source File: RecyclerTabLayout.java    From RecyclerTabLayout with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("deprecation")
@Override
public DefaultAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    TabTextView tabTextView = new TabTextView(parent.getContext());

    if (mTabSelectedTextColorSet) {
        tabTextView.setTextColor(tabTextView.createColorStateList(
                tabTextView.getCurrentTextColor(), mTabSelectedTextColor));
    }

    ViewCompat.setPaddingRelative(tabTextView, mTabPaddingStart, mTabPaddingTop,
            mTabPaddingEnd, mTabPaddingBottom);
    tabTextView.setTextAppearance(parent.getContext(), mTabTextAppearance);
    tabTextView.setGravity(Gravity.CENTER);
    tabTextView.setMaxLines(MAX_TAB_TEXT_LINES);
    tabTextView.setEllipsize(TextUtils.TruncateAt.END);

    if (mTabOnScreenLimit > 0) {
        int width = parent.getMeasuredWidth() / mTabOnScreenLimit;
        tabTextView.setMaxWidth(width);
        tabTextView.setMinWidth(width);

    } else {
        if (mTabMaxWidth > 0) {
            tabTextView.setMaxWidth(mTabMaxWidth);
        }
        tabTextView.setMinWidth(mTabMinWidth);
    }

    tabTextView.setTextAppearance(tabTextView.getContext(), mTabTextAppearance);
    if (mTabSelectedTextColorSet) {
        tabTextView.setTextColor(tabTextView.createColorStateList(
                tabTextView.getCurrentTextColor(), mTabSelectedTextColor));
    }
    if (mTabBackgroundResId != 0) {
        tabTextView.setBackgroundDrawable(
                AppCompatResources.getDrawable(tabTextView.getContext(), mTabBackgroundResId));
    }
    tabTextView.setLayoutParams(createLayoutParamsForTabs());
    return new ViewHolder(tabTextView);
}