当前位置: 首页>>代码示例>>Java>>正文


Java FontLoader类代码示例

本文整理汇总了Java中org.holoeverywhere.FontLoader的典型用法代码示例。如果您正苦于以下问题:Java FontLoader类的具体用法?Java FontLoader怎么用?Java FontLoader使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


FontLoader类属于org.holoeverywhere包,在下文中一共展示了FontLoader类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: parseFontStyle

import org.holoeverywhere.FontLoader; //导入依赖的package包/类
private static Object[] parseFontStyle(TypedArray a) {
    boolean force = true;
    int fontStyle = FontLoader.TEXT_STYLE_NORMAL;
    String fontFamily = null;
    TypedValue value = new TypedValue();
    a.getValue(R.styleable.TextAppearance_android_fontFamily, value);
    if (value.string == null) {
        a.getValue(R.styleable.TextAppearance_android_typeface, value);
    }
    if (value.string == null) {
        force = false;
    } else {
        Object[] z = FontLoader.parseFontStyle(value.string.toString());
        fontStyle = (Integer) z[0];
        fontFamily = (String) z[1];
    }
    final int defaultStyle = fontStyle & (FontLoader.TEXT_STYLE_BOLD | FontLoader.TEXT_STYLE_ITALIC);
    fontStyle &= ~defaultStyle;
    fontStyle |= a.getInt(R.styleable.TextAppearance_android_textStyle, defaultStyle);
    return new Object[]{
            force, fontStyle, fontFamily
    };
}
 
开发者ID:restorer,项目名称:gloomy-dungeons-2,代码行数:24,代码来源:TextView.java

示例2: initialize

import org.holoeverywhere.FontLoader; //导入依赖的package包/类
public void initialize(int amOrPm) {
    if (mIsInitialized) {
        Log.e(TAG, "AmPmCirclesView may only be initialized once.");
        return;
    }

    Resources res = getContext().getResources();
    mPaint.setTypeface(FontLoader.ROBOTO_REGULAR.getTypeface(getContext()));
    mPaint.setAntiAlias(true);
    mPaint.setTextAlign(Align.CENTER);

    mCircleRadiusMultiplier =
            Float.parseFloat(res.getString(R.string.time_circle_radius_multiplier));
    mAmPmCircleRadiusMultiplier =
            Float.parseFloat(res.getString(R.string.time_ampm_circle_radius_multiplier));
    String[] amPmTexts = new DateFormatSymbols().getAmPmStrings();
    mAmText = amPmTexts[0];
    mPmText = amPmTexts[1];

    setAmOrPm(amOrPm);
    mAmOrPmPressed = -1;

    mIsInitialized = true;
}
 
开发者ID:restorer,项目名称:gloomy-dungeons-2,代码行数:25,代码来源:AmPmCirclesView.java

示例3: parseFontStyle

import org.holoeverywhere.FontLoader; //导入依赖的package包/类
private static Object[] parseFontStyle(TypedArray a) {
    boolean force = true;
    int fontStyle = FontLoader.TEXT_STYLE_NORMAL;
    String fontFamily = null;
    TypedValue value = new TypedValue();
    a.getValue(R.styleable.TextAppearance_android_fontFamily, value);
    if (value.string == null) {
        a.getValue(R.styleable.TextAppearance_android_typeface, value);
    }
    if (value.string == null) {
        force = false;
    } else {
        Object[] z = FontLoader.parseFontStyle(value.string.toString());
        fontStyle = (Integer) z[0];
        fontFamily = (String) z[1];
    }
    fontStyle |= a.getInt(R.styleable.TextAppearance_android_textStyle,
            FontLoader.TEXT_STYLE_NORMAL);
    return new Object[] {
            force, fontStyle, fontFamily
    };
}
 
开发者ID:WassimBenltaief,项目名称:laposte-android,代码行数:23,代码来源:TextView.java

示例4: initView

import org.holoeverywhere.FontLoader; //导入依赖的package包/类
/**
 * Sets up the text and style properties for painting. Override this if you
 * want to use a different paint.
 */
protected void initView() {

    mMonthTitlePaint = new Paint();
    mMonthTitlePaint.setFakeBoldText(true);
    mMonthTitlePaint.setAntiAlias(true);
    mMonthTitlePaint.setTextSize(MONTH_LABEL_TEXT_SIZE);
    mMonthTitlePaint.setTypeface(FontLoader.ROBOTO_BOLD.getTypeface(getContext()));
    mMonthTitlePaint.setColor(mMonthTitleColor);
    mMonthTitlePaint.setTextAlign(Align.CENTER);
    mMonthTitlePaint.setStyle(Style.FILL);

    mSelectedCirclePaint = new Paint();
    mSelectedCirclePaint.setFakeBoldText(true);
    mSelectedCirclePaint.setAntiAlias(true);
    mSelectedCirclePaint.setColor(mSelectedCircleColor);
    mSelectedCirclePaint.setTextAlign(Align.CENTER);
    mSelectedCirclePaint.setStyle(Style.FILL);
    mSelectedCirclePaint.setAlpha(SELECTED_CIRCLE_ALPHA);

    mMonthDayLabelPaint = new Paint();
    mMonthDayLabelPaint.setAntiAlias(true);
    mMonthDayLabelPaint.setTextSize(MONTH_DAY_LABEL_TEXT_SIZE);
    mMonthDayLabelPaint.setColor(mDayTextColor);
    mMonthDayLabelPaint.setTypeface(FontLoader.ROBOTO_REGULAR.getTypeface(getContext()));
    mMonthDayLabelPaint.setStyle(Style.FILL);
    mMonthDayLabelPaint.setTextAlign(Align.CENTER);
    mMonthDayLabelPaint.setFakeBoldText(true);

    mMonthNumPaint = new Paint();
    mMonthNumPaint.setAntiAlias(true);
    mMonthNumPaint.setTextSize(MINI_DAY_NUMBER_TEXT_SIZE);
    mMonthNumPaint.setStyle(Style.FILL);
    mMonthNumPaint.setTextAlign(Align.CENTER);
    mMonthNumPaint.setFakeBoldText(false);
}
 
开发者ID:restorer,项目名称:gloomy-dungeons-2,代码行数:40,代码来源:SimpleMonthView.java

示例5: getTypeface

import org.holoeverywhere.FontLoader; //导入依赖的package包/类
@Override
public Typeface getTypeface(String fontFamily, int fontStyle) {
	if ("gloomy".equals(getContext().getString(R.string.typeface_interface))
		|| (fontFamily != null && fontFamily.equals(getFontFamily()))
	) {
		return super.getTypeface(fontFamily, fontStyle);
	} else {
		// FontLoader.Font.setContext() - моя кастомная функа
		FontLoader.ROBOTO.setContext(getContext());
		return FontLoader.ROBOTO.getTypeface(fontFamily, fontStyle);
	}
}
 
开发者ID:restorer,项目名称:gloomy-dungeons-2,代码行数:13,代码来源:GloomyFont.java

示例6: onContentChanged

import org.holoeverywhere.FontLoader; //导入依赖的package包/类
@Override
public void onContentChanged() {
    super.onContentChanged();
    performAddonAction(new AddonCallback<IAddonActivity>() {
        @Override
        public void justAction(IAddonActivity addon) {
            addon.onContentChanged();
        }
    });
    FontLoader.apply(getWindow().getDecorView());
}
 
开发者ID:antonyt,项目名称:TflTravelAlerts,代码行数:12,代码来源:Activity.java

示例7: createViewFromResource

import org.holoeverywhere.FontLoader; //导入依赖的package包/类
private View createViewFromResource(int position, View convertView,
        ViewGroup parent, int resource) {
    View view;
    TextView text = null;
    if (convertView == null) {
        view = FontLoader.apply(mInflater.inflate(resource, parent, false));
    } else {
        view = convertView;
    }
    try {
        if (view != null) {
            if (mFieldId > 0) {
                text = (TextView) view.findViewById(mFieldId);
            } else {
                text = (TextView) view.findViewById(android.R.id.text1);
            }
            if (text == null && view instanceof TextView) {
                text = (TextView) view;
            }
        }
        if (text == null) {
            throw new NullPointerException();
        }
    } catch (RuntimeException e) {
        Log.e("ArrayAdapter",
                "You must supply a resource ID for a TextView");
        throw new IllegalStateException(
                "ArrayAdapter requires the resource ID to be a TextView", e);
    }
    T item = getItem(position);
    if (item instanceof CharSequence) {
        text.setText((CharSequence) item);
    } else {
        text.setText(item.toString());
    }
    return view;
}
 
开发者ID:antonyt,项目名称:TflTravelAlerts,代码行数:38,代码来源:ArrayAdapter.java

示例8: setFontStyle

import org.holoeverywhere.FontLoader; //导入依赖的package包/类
public static <T extends android.widget.TextView & FontStyleProvider> void setFontStyle(
        T textView, String fontFamily, int fontStyle) {
    FontLoader.applyDefaultFont(textView);
}
 
开发者ID:restorer,项目名称:gloomy-dungeons-2,代码行数:5,代码来源:TextView.java

示例9: initialize

import org.holoeverywhere.FontLoader; //导入依赖的package包/类
public void initialize(Resources res, String[] texts, String[] innerTexts,
                       boolean is24HourMode, boolean disappearsOut) {
    if (mIsInitialized) {
        Log.e(TAG, "This RadialTextsView may only be initialized once.");
        return;
    }

    // Set up the paint.
    mPaint.setColor(mNumberTextColor);
    mTypeface = FontLoader.ROBOTO_REGULAR.getTypeface(getContext());
    mPaint.setAntiAlias(true);
    mPaint.setTextAlign(Align.CENTER);

    mTexts = texts;
    mInnerTexts = innerTexts;
    mIs24HourMode = is24HourMode;
    mHasInnerCircle = (innerTexts != null);

    // Calculate the radius for the main circle.
    if (is24HourMode) {
        mCircleRadiusMultiplier = Float.parseFloat(
                res.getString(R.string.time_circle_radius_multiplier_24HourMode));
    } else {
        mCircleRadiusMultiplier = Float.parseFloat(
                res.getString(R.string.time_circle_radius_multiplier));
        mAmPmCircleRadiusMultiplier =
                Float.parseFloat(res.getString(R.string.time_ampm_circle_radius_multiplier));
    }

    // Initialize the widths and heights of the grid, and calculate the values for the numbers.
    mTextGridHeights = new float[7];
    mTextGridWidths = new float[7];
    if (mHasInnerCircle) {
        mNumbersRadiusMultiplier = Float.parseFloat(
                res.getString(R.string.time_numbers_radius_multiplier_outer));
        mTextSizeMultiplier = Float.parseFloat(
                res.getString(R.string.time_text_size_multiplier_outer));
        mInnerNumbersRadiusMultiplier = Float.parseFloat(
                res.getString(R.string.time_numbers_radius_multiplier_inner));
        mInnerTextSizeMultiplier = Float.parseFloat(
                res.getString(R.string.time_text_size_multiplier_inner));

        mInnerTextGridHeights = new float[7];
        mInnerTextGridWidths = new float[7];
    } else {
        mNumbersRadiusMultiplier = Float.parseFloat(
                res.getString(R.string.time_time_numbers_radius_multiplier_normal));
        mTextSizeMultiplier = Float.parseFloat(
                res.getString(R.string.time_time_text_size_multiplier_normal));
    }

    mAnimationRadiusMultiplier = 1;
    mInvalidateUpdateListener = new InvalidateUpdateListener();

    mTextGridValuesDirty = true;
    mIsInitialized = true;
}
 
开发者ID:restorer,项目名称:gloomy-dungeons-2,代码行数:58,代码来源:RadialTextsView.java

示例10: GloomyFont

import org.holoeverywhere.FontLoader; //导入依赖的package包/类
public GloomyFont(FontLoader.Font font) {
	super(font);
	setFontFamily("gloomy");
}
 
开发者ID:restorer,项目名称:gloomy-dungeons-2,代码行数:5,代码来源:GloomyFont.java

示例11: initFonts

import org.holoeverywhere.FontLoader; //导入依赖的package包/类
protected void initFonts() {
	gloomyFont = new GloomyFont();
	FontLoader.setDefaultFont(gloomyFont);
}
 
开发者ID:restorer,项目名称:gloomy-dungeons-2,代码行数:5,代码来源:MyApplication.java


注:本文中的org.holoeverywhere.FontLoader类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。