com.devspark.robototextview.RobotoTypefaces Java Examples

The following examples show how to use com.devspark.robototextview.RobotoTypefaces. 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: RoundedBackgroundSpan.java    From Slide with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void draw(Canvas canvas, CharSequence oldText, int start, int end, float x, int top, int y, int bottom, Paint paint) {
    int offset = 0;
    if (half) {
        offset = (bottom - top) / 6;
    }

    paint.setTypeface(RobotoTypefaces.obtainTypeface(c, RobotoTypefaces.TYPEFACE_ROBOTO_CONDENSED_BOLD));

    if (half) {
        paint.setTextSize(paint.getTextSize() / 2);
    }

    final RectF rect = new RectF(x, top + offset, x + measureText(paint, oldText, start, end), bottom - offset);
    paint.setColor(backgroundColor);
    final int CORNER_RADIUS = 8;
    canvas.drawRoundRect(rect, CORNER_RADIUS, CORNER_RADIUS, paint);
    paint.setColor(textColor);

    final float baseLine = paint.descent();
    canvas.drawText(oldText, start, end, x, rect.bottom - ((rect.bottom - rect.top) / 2) + (baseLine * 1.5f), paint); //center the text in the parent span
}
 
Example #2
Source File: RobotoTextAppearanceSpan.java    From Android-RobotoTextView with Apache License 2.0 6 votes vote down vote up
/**
 * Uses the specified TextAppearance resource to determine the
 * text appearance, and the specified text color resource
 * to determine the color.  The <code>appearance</code> should be,
 * for example, <code>android.R.style.TextAppearance_Small</code>,
 * and the <code>colorList</code> should be, for example,
 * <code>android.R.styleable.Theme_textColorPrimary</code>.
 */
public RobotoTextAppearanceSpan(Context context, int appearance, int colorList) {
    TypedArray a = context.obtainStyledAttributes(appearance, R.styleable.RobotoTextView);
    typeface = RobotoTypefaces.obtainTypeface(context, a);
    a.recycle();

    ColorStateList textColor;

    a = context.obtainStyledAttributes(appearance, TEXT_ATTRS);
    SparseIntArray attrsIndexes = textAttrsIndexes();

    textColor = a.getColorStateList(attrsIndexes.get(android.R.attr.textColor));
    this.textColorLink = a.getColorStateList(attrsIndexes.get(android.R.attr.textColorLink));
    this.textSize = a.getDimensionPixelSize(attrsIndexes.get(android.R.attr.textSize), -1);

    a.recycle();

    if (colorList >= 0) {
        a = context.obtainStyledAttributes(themeResId(context), TEXT_ATTRS);
        textColor = a.getColorStateList(colorList);
        a.recycle();
    }

    this.textColor = textColor;
}
 
Example #3
Source File: RobotoInflater.java    From Android-RobotoTextView with Apache License 2.0 6 votes vote down vote up
@Override
public View onCreateView(View parent, String name, Context context, AttributeSet attrs) {
    try {
        View view = mAppCompatDelegate.createView(parent, name, context, attrs);
        if (view == null) {
            final boolean isPre21 = Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP;
            final boolean inheritContext = isPre21 && shouldInheritContext((ViewParent) parent);
            view = mCompatInflater.createView(parent, name, context, attrs, inheritContext, isPre21, VectorEnabledTintResources.shouldBeUsed());
        }

        if (view instanceof TextView) {
            RobotoTypefaces.setUpTypeface((TextView) view, context, attrs);
        }
        return view;
    } catch (Exception e) {
        //if some thing went wrong
        return null;
    }
}
 
Example #4
Source File: SearchView.java    From Material-SearchView with Apache License 2.0 5 votes vote down vote up
public void setTypeface(int typefaceValue) {
    setupTypeface(typefaceValue);

    Typeface typeface = RobotoTypefaces.obtainTypeface(
            getActivity().getApplicationContext(),
            typefaceValue);

    if (mSearchEditText != null) {
        RobotoTypefaces.setUpTypeface(mSearchEditText, typeface);
    }
}
 
Example #5
Source File: RobotoTextAppearanceSpan.java    From Android-RobotoTextView with Apache License 2.0 5 votes vote down vote up
@Override
public void updateMeasureState(TextPaint tp) {
    RobotoTypefaces.setUpTypeface(tp, typeface);
    if (textSize > 0) {
        tp.setTextSize(textSize);
    }
}
 
Example #6
Source File: RobotoTextAppearanceSpan.java    From Android-RobotoTextView with Apache License 2.0 5 votes vote down vote up
/**
 * Makes text be drawn with the specified typeface, size and colors.
 */
public RobotoTextAppearanceSpan(Context context, @RobotoTypeface int typeface,
        int size, @Nullable ColorStateList color, @Nullable ColorStateList linkColor) {
    this.typeface = RobotoTypefaces.obtainTypeface(context, typeface);
    this.textSize = size;
    this.textColor = color;
    this.textColorLink = linkColor;
}
 
Example #7
Source File: SearchView.java    From Material-SearchView with Apache License 2.0 5 votes vote down vote up
private void initViews(@NonNull final View layout) {
    mRoot = (RelativeLayout) layout.findViewById(R.id.root);
    mSearchOverlay = (CardView) layout.findViewById(R.id.search_overlay);
    mNavBackBtn = (ImageButton) layout.findViewById(R.id.ibtn_navigation_back);
    mCloseVoiceBtn = (ImageButton) layout.findViewById(R.id.ibtn_voice_close);
    mSearchEditText = (SearchEditText) layout.findViewById(R.id.et_search_text);
    mSearchRegion = (RelativeLayout) layout.findViewById(R.id.search_region);
    mSuggestionsRegion = (LinearLayout) layout.findViewById(R.id.suggestions_region);
    mSuggestionsView = (RecyclerView) layout.findViewById(R.id.suggestion_list);
    if (mAdapter != null) {
        mSuggestionsView.setAdapter(mAdapter);
    }
    mSuggestionsView.setLayoutManager(new VerticalLinearLayoutManager(getActivity()));

    if (mDecoration != null) {
        mSuggestionsView.removeItemDecoration(mDecoration);
        mSuggestionsView.addItemDecoration(mDecoration);
    }

    Typeface typeface = RobotoTypefaces.obtainTypeface(
            getActivity().getApplicationContext(),
            this.mTypefaceValue);
    RobotoTypefaces.setUpTypeface(mSearchEditText, typeface);

    mSearchEditText.setText(mQuery);
    mSearchEditText.setHint(mHint);
    if (mSelection == -1) {
        if (mQuery != null) {
            mSearchEditText.setSelection(mQuery.length());
        }
    } else {
        mSearchEditText.setSelection(mSelection);
    }
}
 
Example #8
Source File: TitleTextView.java    From Slide with GNU General Public License v3.0 5 votes vote down vote up
public TitleTextView(Context c, AttributeSet attrs) {
    super(c, attrs);
    if (!isInEditMode()) {
        int type = new FontPreferences(getContext()).getFontTypeTitle().getTypeface();
        Typeface typeface;
        if (type >= 0) {
            typeface = RobotoTypefaces.obtainTypeface(c, type);
        } else {
            typeface = Typeface.DEFAULT;
        }
        setTypeface(typeface);
    }
}
 
Example #9
Source File: TitleTextView.java    From Slide with GNU General Public License v3.0 5 votes vote down vote up
public TitleTextView(Context c) {
    super(c);
    if (!isInEditMode()) {
        int type = new FontPreferences(getContext()).getFontTypeTitle().getTypeface();
        Typeface typeface;
        if (type >= 0) {
            typeface = RobotoTypefaces.obtainTypeface(c, type);
        } else {
            typeface = Typeface.DEFAULT;
        }
        setTypeface(typeface);

    }
}
 
Example #10
Source File: TitleTextView.java    From Slide with GNU General Public License v3.0 5 votes vote down vote up
public TitleTextView(Context c, AttributeSet attrs, int defStyle) {
    super(c, attrs, defStyle);
    if (!isInEditMode()) {
        int type = new FontPreferences(getContext()).getFontTypeTitle().getTypeface();
        Typeface typeface;
        if (type >= 0) {
            typeface = RobotoTypefaces.obtainTypeface(c, type);
        } else {
            typeface = Typeface.DEFAULT;
        }
        setTypeface(typeface);
    }
}
 
Example #11
Source File: RoundedBackgroundSpan.java    From Slide with GNU General Public License v3.0 5 votes vote down vote up
@Override
public int getSize(Paint paint, CharSequence text, int start, int end, Paint.FontMetricsInt fm) {
    paint.setTypeface(RobotoTypefaces.obtainTypeface(c, RobotoTypefaces.TYPEFACE_ROBOTO_CONDENSED_BOLD));
    final int size = Math.round(paint.measureText(text, start, end));

    if (half) {
        return size / 2;
    } else {
        return size;
    }
}
 
Example #12
Source File: BaseRestoreInstanceFragment.java    From Material-SearchView with Apache License 2.0 5 votes vote down vote up
@Override
public void onDismiss(DialogInterface dialog) {
    super.onDismiss(dialog);
    this.mVisible = false;
    this.mCloseRequested = false;
    this.mQuery = null;
    this.mHint = null;
    this.mSelection = -1;
    this.mTypefaceValue = RobotoTypefaces.TYPEFACE_ROBOTO_REGULAR;
}
 
Example #13
Source File: RobotoTypefaceSpan.java    From Android-RobotoTextView with Apache License 2.0 4 votes vote down vote up
@Override
public void updateMeasureState(TextPaint tp) {
    RobotoTypefaces.setUpTypeface(tp, typeface);
}
 
Example #14
Source File: RobotoChronometer.java    From Android-RobotoTextView with Apache License 2.0 3 votes vote down vote up
/**
 * Perform inflation from XML and apply a class-specific base style. This
 * constructor of View allows subclasses to use their own base style when
 * they are inflating.
 *
 * @param context  The Context the widget is running in, through which it can
 *                 access the current theme, resources, etc.
 * @param attrs    The attributes of the XML tag that is inflating the widget.
 * @param defStyle The default style to apply to this widget. If 0, no style
 *                 will be applied (beyond what is included in the theme). This may
 *                 either be an attribute resource, whose value will be retrieved
 *                 from the current theme, or an explicit style resource.
 * @see #RobotoChronometer(Context, AttributeSet)
 */
public RobotoChronometer(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    if (!isInEditMode()) {
        RobotoTypefaces.setUpTypeface(this, context, attrs);
    }
}
 
Example #15
Source File: RobotoButton.java    From Android-RobotoTextView with Apache License 2.0 3 votes vote down vote up
/**
 * Constructor that is called when inflating a widget from XML. This is called
 * when a widget is being constructed from an XML file, supplying attributes
 * that were specified in the XML file. This version uses a default style of
 * 0, so the only attribute values applied are those in the Context's Theme
 * and the given AttributeSet.
 * <p>
 * <p>
 * The method onFinishInflate() will be called after all children have been
 * added.
 *
 * @param context The Context the widget is running in, through which it can
 *                access the current theme, resources, etc.
 * @param attrs   The attributes of the XML tag that is inflating the widget.
 * @see #RobotoButton(Context, AttributeSet, int)
 */
public RobotoButton(Context context, AttributeSet attrs) {
    super(context, attrs);

    if (!isInEditMode()) {
        RobotoTypefaces.setUpTypeface(this, context, attrs);
    }
}
 
Example #16
Source File: RobotoButton.java    From Android-RobotoTextView with Apache License 2.0 3 votes vote down vote up
/**
 * Perform inflation from XML and apply a class-specific base style. This
 * constructor of View allows subclasses to use their own base style when
 * they are inflating.
 *
 * @param context  The Context the widget is running in, through which it can
 *                 access the current theme, resources, etc.
 * @param attrs    The attributes of the XML tag that is inflating the widget.
 * @param defStyle The default style to apply to this widget. If 0, no style
 *                 will be applied (beyond what is included in the theme). This may
 *                 either be an attribute resource, whose value will be retrieved
 *                 from the current theme, or an explicit style resource.
 * @see #RobotoButton(Context, AttributeSet)
 */
public RobotoButton(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    if (!isInEditMode()) {
        RobotoTypefaces.setUpTypeface(this, context, attrs);
    }
}
 
Example #17
Source File: RobotoCompoundButton.java    From Android-RobotoTextView with Apache License 2.0 3 votes vote down vote up
/**
 * Constructor that is called when inflating a widget from XML. This is called
 * when a widget is being constructed from an XML file, supplying attributes
 * that were specified in the XML file. This version uses a default style of
 * 0, so the only attribute values applied are those in the Context's Theme
 * and the given AttributeSet.
 * <p>
 * <p>
 * The method onFinishInflate() will be called after all children have been
 * added.
 *
 * @param context The Context the widget is running in, through which it can
 *                access the current theme, resources, etc.
 * @param attrs   The attributes of the XML tag that is inflating the widget.
 * @see #RobotoCompoundButton(Context, android.util.AttributeSet, int)
 */
public RobotoCompoundButton(Context context, AttributeSet attrs) {
    super(context, attrs);

    if (!isInEditMode()) {
        RobotoTypefaces.setUpTypeface(this, context, attrs);
    }
}
 
Example #18
Source File: RobotoCompoundButton.java    From Android-RobotoTextView with Apache License 2.0 3 votes vote down vote up
/**
 * Perform inflation from XML and apply a class-specific base style. This
 * constructor of View allows subclasses to use their own base style when
 * they are inflating.
 *
 * @param context  The Context the widget is running in, through which it can
 *                 access the current theme, resources, etc.
 * @param attrs    The attributes of the XML tag that is inflating the widget.
 * @param defStyle The default style to apply to this widget. If 0, no style
 *                 will be applied (beyond what is included in the theme). This may
 *                 either be an attribute resource, whose value will be retrieved
 *                 from the current theme, or an explicit style resource.
 * @see #RobotoCompoundButton(Context, AttributeSet)
 */
public RobotoCompoundButton(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    if (!isInEditMode()) {
        RobotoTypefaces.setUpTypeface(this, context, attrs);
    }
}
 
Example #19
Source File: RobotoTextClock.java    From Android-RobotoTextView with Apache License 2.0 3 votes vote down vote up
/**
 * Constructor that is called when inflating a widget from XML. This is called
 * when a widget is being constructed from an XML file, supplying attributes
 * that were specified in the XML file. This version uses a default style of
 * 0, so the only attribute values applied are those in the Context's Theme
 * and the given AttributeSet.
 * <p>
 * <p>
 * The method onFinishInflate() will be called after all children have been
 * added.
 *
 * @param context The Context the widget is running in, through which it can
 *                access the current theme, resources, etc.
 * @param attrs   The attributes of the XML tag that is inflating the widget.
 * @see #RobotoTextClock(Context, android.util.AttributeSet, int)
 */
public RobotoTextClock(Context context, AttributeSet attrs) {
    super(context, attrs);

    if (!isInEditMode()) {
        RobotoTypefaces.setUpTypeface(this, context, attrs);
    }
}
 
Example #20
Source File: RobotoTextClock.java    From Android-RobotoTextView with Apache License 2.0 3 votes vote down vote up
/**
 * Perform inflation from XML and apply a class-specific base style. This
 * constructor of View allows subclasses to use their own base style when
 * they are inflating.
 *
 * @param context  The Context the widget is running in, through which it can
 *                 access the current theme, resources, etc.
 * @param attrs    The attributes of the XML tag that is inflating the widget.
 * @param defStyle The default style to apply to this widget. If 0, no style
 *                 will be applied (beyond what is included in the theme). This may
 *                 either be an attribute resource, whose value will be retrieved
 *                 from the current theme, or an explicit style resource.
 * @see #RobotoTextClock(Context, AttributeSet)
 */
public RobotoTextClock(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    if (!isInEditMode()) {
        RobotoTypefaces.setUpTypeface(this, context, attrs);
    }
}
 
Example #21
Source File: RobotoCheckedTextView.java    From Android-RobotoTextView with Apache License 2.0 3 votes vote down vote up
/**
 * Constructor that is called when inflating a widget from XML. This is called
 * when a widget is being constructed from an XML file, supplying attributes
 * that were specified in the XML file. This version uses a default style of
 * 0, so the only attribute values applied are those in the Context's Theme
 * and the given AttributeSet.
 * <p>
 * <p>
 * The method onFinishInflate() will be called after all children have been
 * added.
 *
 * @param context The Context the widget is running in, through which it can
 *                access the current theme, resources, etc.
 * @param attrs   The attributes of the XML tag that is inflating the widget.
 * @see #RobotoCheckedTextView(Context, android.util.AttributeSet, int)
 */
public RobotoCheckedTextView(Context context, AttributeSet attrs) {
    super(context, attrs);

    if (!isInEditMode()) {
        RobotoTypefaces.setUpTypeface(this, context, attrs);
    }
}
 
Example #22
Source File: RobotoCheckedTextView.java    From Android-RobotoTextView with Apache License 2.0 3 votes vote down vote up
/**
 * Perform inflation from XML and apply a class-specific base style. This
 * constructor of View allows subclasses to use their own base style when
 * they are inflating.
 *
 * @param context  The Context the widget is running in, through which it can
 *                 access the current theme, resources, etc.
 * @param attrs    The attributes of the XML tag that is inflating the widget.
 * @param defStyle The default style to apply to this widget. If 0, no style
 *                 will be applied (beyond what is included in the theme). This may
 *                 either be an attribute resource, whose value will be retrieved
 *                 from the current theme, or an explicit style resource.
 * @see #RobotoCheckedTextView(Context, AttributeSet)
 */
public RobotoCheckedTextView(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    if (!isInEditMode()) {
        RobotoTypefaces.setUpTypeface(this, context, attrs);
    }
}
 
Example #23
Source File: RobotoTextView.java    From Android-RobotoTextView with Apache License 2.0 3 votes vote down vote up
/**
 * Constructor that is called when inflating a widget from XML. This is called
 * when a widget is being constructed from an XML file, supplying attributes
 * that were specified in the XML file. This version uses a default style of
 * 0, so the only attribute values applied are those in the Context's Theme
 * and the given AttributeSet.
 * <p>
 * <p>
 * The method onFinishInflate() will be called after all children have been
 * added.
 *
 * @param context The Context the widget is running in, through which it can
 *                access the current theme, resources, etc.
 * @param attrs   The attributes of the XML tag that is inflating the widget.
 * @see #RobotoTextView(Context, AttributeSet, int)
 */
public RobotoTextView(Context context, AttributeSet attrs) {
    super(context, attrs);

    if (!isInEditMode()) {
        RobotoTypefaces.setUpTypeface(this, context, attrs);
    }
}
 
Example #24
Source File: RobotoTextView.java    From Android-RobotoTextView with Apache License 2.0 3 votes vote down vote up
/**
 * Perform inflation from XML and apply a class-specific base style. This
 * constructor of View allows subclasses to use their own base style when
 * they are inflating.
 *
 * @param context  The Context the widget is running in, through which it can
 *                 access the current theme, resources, etc.
 * @param attrs    The attributes of the XML tag that is inflating the widget.
 * @param defStyle The default style to apply to this widget. If 0, no style
 *                 will be applied (beyond what is included in the theme). This may
 *                 either be an attribute resource, whose value will be retrieved
 *                 from the current theme, or an explicit style resource.
 * @see #RobotoTextView(Context, AttributeSet)
 */
public RobotoTextView(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    if (!isInEditMode()) {
        RobotoTypefaces.setUpTypeface(this, context, attrs);
    }
}
 
Example #25
Source File: RobotoMultiAutoCompleteTextView.java    From Android-RobotoTextView with Apache License 2.0 3 votes vote down vote up
/**
 * Constructor that is called when inflating a widget from XML. This is called
 * when a widget is being constructed from an XML file, supplying attributes
 * that were specified in the XML file. This version uses a default style of
 * 0, so the only attribute values applied are those in the Context's Theme
 * and the given AttributeSet.
 * <p>
 * <p>
 * The method onFinishInflate() will be called after all children have been
 * added.
 *
 * @param context The Context the widget is running in, through which it can
 *                access the current theme, resources, etc.
 * @param attrs   The attributes of the XML tag that is inflating the widget.
 * @see #RobotoMultiAutoCompleteTextView(Context, android.util.AttributeSet, int)
 */
public RobotoMultiAutoCompleteTextView(Context context, AttributeSet attrs) {
    super(context, attrs);

    if (!isInEditMode()) {
        RobotoTypefaces.setUpTypeface(this, context, attrs);
    }
}
 
Example #26
Source File: RobotoMultiAutoCompleteTextView.java    From Android-RobotoTextView with Apache License 2.0 3 votes vote down vote up
/**
 * Perform inflation from XML and apply a class-specific base style. This
 * constructor of View allows subclasses to use their own base style when
 * they are inflating.
 *
 * @param context  The Context the widget is running in, through which it can
 *                 access the current theme, resources, etc.
 * @param attrs    The attributes of the XML tag that is inflating the widget.
 * @param defStyle The default style to apply to this widget. If 0, no style
 *                 will be applied (beyond what is included in the theme). This may
 *                 either be an attribute resource, whose value will be retrieved
 *                 from the current theme, or an explicit style resource.
 * @see #RobotoMultiAutoCompleteTextView(Context, AttributeSet)
 */
public RobotoMultiAutoCompleteTextView(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    if (!isInEditMode()) {
        RobotoTypefaces.setUpTypeface(this, context, attrs);
    }
}
 
Example #27
Source File: RobotoEditText.java    From Android-RobotoTextView with Apache License 2.0 3 votes vote down vote up
/**
 * Perform inflation from XML and apply a class-specific base style. This
 * constructor of View allows subclasses to use their own base style when
 * they are inflating.
 *
 * @param context  The Context the widget is running in, through which it can
 *                 access the current theme, resources, etc.
 * @param attrs    The attributes of the XML tag that is inflating the widget.
 * @param defStyle The default style to apply to this widget. If 0, no style
 *                 will be applied (beyond what is included in the theme). This may
 *                 either be an attribute resource, whose value will be retrieved
 *                 from the current theme, or an explicit style resource.
 * @see #RobotoEditText(Context, AttributeSet)
 */
public RobotoEditText(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    if (!isInEditMode()) {
        RobotoTypefaces.setUpTypeface(this, context, attrs);
    }
}
 
Example #28
Source File: RobotoEditText.java    From Android-RobotoTextView with Apache License 2.0 3 votes vote down vote up
/**
 * Constructor that is called when inflating a widget from XML. This is called
 * when a widget is being constructed from an XML file, supplying attributes
 * that were specified in the XML file. This version uses a default style of
 * 0, so the only attribute values applied are those in the Context's Theme
 * and the given AttributeSet.
 * <p>
 * <p>
 * The method onFinishInflate() will be called after all children have been
 * added.
 *
 * @param context The Context the widget is running in, through which it can
 *                access the current theme, resources, etc.
 * @param attrs   The attributes of the XML tag that is inflating the widget.
 * @see #RobotoEditText(Context, android.util.AttributeSet, int)
 */
public RobotoEditText(Context context, AttributeSet attrs) {
    super(context, attrs);

    if (!isInEditMode()) {
        RobotoTypefaces.setUpTypeface(this, context, attrs);
    }
}
 
Example #29
Source File: RobotoChronometer.java    From Android-RobotoTextView with Apache License 2.0 3 votes vote down vote up
/**
 * Constructor that is called when inflating a widget from XML. This is called
 * when a widget is being constructed from an XML file, supplying attributes
 * that were specified in the XML file. This version uses a default style of
 * 0, so the only attribute values applied are those in the Context's Theme
 * and the given AttributeSet.
 * <p>
 * <p>
 * The method onFinishInflate() will be called after all children have been
 * added.
 *
 * @param context The Context the widget is running in, through which it can
 *                access the current theme, resources, etc.
 * @param attrs   The attributes of the XML tag that is inflating the widget.
 * @see #RobotoChronometer(Context, android.util.AttributeSet, int)
 */
public RobotoChronometer(Context context, AttributeSet attrs) {
    super(context, attrs);

    if (!isInEditMode()) {
        RobotoTypefaces.setUpTypeface(this, context, attrs);
    }
}
 
Example #30
Source File: RobotoAutoCompleteTextView.java    From Android-RobotoTextView with Apache License 2.0 3 votes vote down vote up
/**
 * Perform inflation from XML and apply a class-specific base style. This
 * constructor of View allows subclasses to use their own base style when
 * they are inflating.
 *
 * @param context  The Context the widget is running in, through which it can
 *                 access the current theme, resources, etc.
 * @param attrs    The attributes of the XML tag that is inflating the widget.
 * @param defStyle The default style to apply to this widget. If 0, no style
 *                 will be applied (beyond what is included in the theme). This may
 *                 either be an attribute resource, whose value will be retrieved
 *                 from the current theme, or an explicit style resource.
 * @see #RobotoAutoCompleteTextView(Context, AttributeSet)
 */
public RobotoAutoCompleteTextView(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    if (!isInEditMode()) {
        RobotoTypefaces.setUpTypeface(this, context, attrs);
    }
}