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


Java FlatUI类代码示例

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


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

示例1: onCreate

import com.cengalabs.flatui.FlatUI; //导入依赖的package包/类
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        FlatUI.initDefaultValues(this);
//        FlatUI.setDefaultTheme(FlatUI.SEA);

        ActionBar actionBar = getSupportActionBar();
        actionBar.setBackgroundDrawable(FlatUI.getActionBarDrawable(this, FlatUI.GRASS, false));

        setContentView(R.layout.day29_activity_flatui);

        FlatToggleButton toggleButton = (FlatToggleButton) findViewById(R.id.toggle_button);
        toggleButton.getAttributes().setTheme(FlatUI.BLOSSOM, getResources());
    }
 
开发者ID:Phonbopit,项目名称:30-android-libraries-in-30-days,代码行数:16,代码来源:FlatUIActivity.java

示例2: init

import com.cengalabs.flatui.FlatUI; //导入依赖的package包/类
private void init(AttributeSet attrs) {

        if (attributes == null)
            attributes = new Attributes(this, getResources());

        if (attrs != null) {

            // getting android default tags for textColor and textColorHint
            String textColorAttribute = attrs.getAttributeValue(FlatUI.androidStyleNameSpace, "textColor");
            int styleId = attrs.getStyleAttribute();
            int[] attributesArray = new int[] { android.R.attr.textColor };
            TypedArray styleTextColorTypedArray = getContext().obtainStyledAttributes(styleId, attributesArray);
            // color might have values from the entire integer range, so to find out if there is any color set,
            // checking if default value is returned is not enough. Thus we get color with two different 
            // default values - if returned value is the same, it means color is set
            int styleTextColor1 = styleTextColorTypedArray.getColor(0, -1);
            int styleTextColor2 = styleTextColorTypedArray.getColor(0, 1);
            hasOwnTextColor = textColorAttribute != null || styleTextColor1 == styleTextColor2;
            styleTextColorTypedArray.recycle();

            TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.fl_FlatTextView);

            // getting common attributes
            int customTheme = a.getResourceId(R.styleable.fl_FlatTextView_fl_theme, Attributes.DEFAULT_THEME);
            attributes.setThemeSilent(customTheme, getResources());

            attributes.setFontFamily(a.getString(R.styleable.fl_FlatTextView_fl_fontFamily));
            attributes.setFontWeight(a.getString(R.styleable.fl_FlatTextView_fl_fontWeight));
            attributes.setFontExtension(a.getString(R.styleable.fl_FlatTextView_fl_fontExtension));

            attributes.setRadius(a.getDimensionPixelSize(R.styleable.fl_FlatTextView_fl_cornerRadius, Attributes.DEFAULT_RADIUS_PX));
            attributes.setBorderWidth(a.getDimensionPixelSize(R.styleable.fl_FlatTextView_fl_borderWidth, 0));

            // getting view specific attributes
            textColor = a.getInt(R.styleable.fl_FlatTextView_fl_textColor, textColor);
            backgroundColor = a.getInt(R.styleable.fl_FlatTextView_fl_backgroundColor, backgroundColor);
            customBackgroundColor = a.getInt(R.styleable.fl_FlatTextView_fl_customBackgroundColor, customBackgroundColor);

            a.recycle();
        }

        GradientDrawable gradientDrawable = new GradientDrawable();
        if (backgroundColor != Attributes.INVALID) {
            gradientDrawable.setColor(attributes.getColor(backgroundColor));
        } else if (customBackgroundColor != Attributes.INVALID) {
            gradientDrawable.setColor(customBackgroundColor);
        } else {
            gradientDrawable.setColor(Color.TRANSPARENT);
        }
        gradientDrawable.setCornerRadius(attributes.getRadius());
        gradientDrawable.setStroke(attributes.getBorderWidth(), attributes.getColor(textColor));
        setBackgroundDrawable(gradientDrawable);

        // setting the text color only if there is no android:textColor attribute used
        if (!hasOwnTextColor) setTextColor(attributes.getColor(textColor));

        // check for IDE preview render
        if(!this.isInEditMode()) {
            Typeface typeface = FlatUI.getFont(getContext(), attributes);
            if (typeface != null) setTypeface(typeface);
        }
    }
 
开发者ID:htooaunghlaing,项目名称:NyaungUConverter,代码行数:63,代码来源:FlatTextView.java

示例3: init

import com.cengalabs.flatui.FlatUI; //导入依赖的package包/类
private void init(AttributeSet attrs) {

        if (attributes == null)
            attributes = new Attributes(this, getResources());

        if (attrs != null) {

            // getting android default tags for textColor and textColorHint
            hasOwnTextColor = attrs.getAttributeValue(FlatUI.androidStyleNameSpace, "textColor") != null;
            hasOwnHintColor = attrs.getAttributeValue(FlatUI.androidStyleNameSpace, "textColorHint") != null;

            TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.fl_FlatEditText);

            // getting common attributes
            int customTheme = a.getResourceId(R.styleable.fl_FlatEditText_fl_theme, Attributes.DEFAULT_THEME);
            attributes.setThemeSilent(customTheme, getResources());

            attributes.setFontFamily(a.getString(R.styleable.fl_FlatEditText_fl_fontFamily));
            attributes.setFontWeight(a.getString(R.styleable.fl_FlatEditText_fl_fontWeight));
            attributes.setFontExtension(a.getString(R.styleable.fl_FlatEditText_fl_fontExtension));

            attributes.setTextAppearance(a.getInt(R.styleable.fl_FlatEditText_fl_textAppearance, Attributes.DEFAULT_TEXT_APPEARANCE));
            attributes.setRadius(a.getDimensionPixelSize(R.styleable.fl_FlatEditText_fl_cornerRadius, Attributes.DEFAULT_RADIUS_PX));
            attributes.setBorderWidth(a.getDimensionPixelSize(R.styleable.fl_FlatEditText_fl_borderWidth, Attributes.DEFAULT_BORDER_WIDTH_PX));

            // getting view specific attributes
            style = a.getInt(R.styleable.fl_FlatEditText_fl_fieldStyle, 0);

            a.recycle();
        }

        GradientDrawable backgroundDrawable = new GradientDrawable();
        backgroundDrawable.setCornerRadius(attributes.getRadius());

        if (style == 0) {             // flat
            if (!hasOwnTextColor) setTextColor(attributes.getColor(3));
            backgroundDrawable.setColor(attributes.getColor(2));
            backgroundDrawable.setStroke(0, attributes.getColor(2));

        } else if (style == 1) {      // box
            if (!hasOwnTextColor) setTextColor(attributes.getColor(2));
            backgroundDrawable.setColor(Color.WHITE);
            backgroundDrawable.setStroke(attributes.getBorderWidth(), attributes.getColor(2));

        } else if (style == 2) {      // transparent
            if (!hasOwnTextColor) setTextColor(attributes.getColor(1));
            backgroundDrawable.setColor(Color.TRANSPARENT);
            backgroundDrawable.setStroke(attributes.getBorderWidth(), attributes.getColor(2));
        }

        setBackgroundDrawable(backgroundDrawable);

        if (!hasOwnHintColor) setHintTextColor(attributes.getColor(3));

        if (attributes.getTextAppearance() == 1) setTextColor(attributes.getColor(0));
        else if (attributes.getTextAppearance() == 2) setTextColor(attributes.getColor(3));

        // check for IDE preview render
        if(!this.isInEditMode()) {
            Typeface typeface = FlatUI.getFont(getContext(), attributes);
            if (typeface != null) setTypeface(typeface);
        }
    }
 
开发者ID:htooaunghlaing,项目名称:NyaungUConverter,代码行数:64,代码来源:FlatEditText.java

示例4: init

import com.cengalabs.flatui.FlatUI; //导入依赖的package包/类
private void init(AttributeSet attrs) {

        if (attributes == null)
            attributes = new Attributes(this, getResources());

        if (attrs != null) {

            // getting android default tags for textColor and textColorHint
            hasOwnTextColor = attrs.getAttributeValue(FlatUI.androidStyleNameSpace, "textColor") != null;
            hasOwnHintColor = attrs.getAttributeValue(FlatUI.androidStyleNameSpace, "textColorHint") != null;

            TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.fl_FlatAutoCompleteTextView);

            // getting common attributes
            int customTheme = a.getResourceId(R.styleable.fl_FlatAutoCompleteTextView_fl_theme, Attributes.DEFAULT_THEME);
            attributes.setThemeSilent(customTheme, getResources());

            attributes.setFontFamily(a.getString(R.styleable.fl_FlatAutoCompleteTextView_fl_fontFamily));
            attributes.setFontWeight(a.getString(R.styleable.fl_FlatAutoCompleteTextView_fl_fontWeight));
            attributes.setFontExtension(a.getString(R.styleable.fl_FlatAutoCompleteTextView_fl_fontExtension));

            attributes.setTextAppearance(a.getInt(R.styleable.fl_FlatAutoCompleteTextView_fl_textAppearance, Attributes.DEFAULT_TEXT_APPEARANCE));
            attributes.setRadius(a.getDimensionPixelSize(R.styleable.fl_FlatAutoCompleteTextView_fl_cornerRadius, Attributes.DEFAULT_RADIUS_PX));
            attributes.setBorderWidth(a.getDimensionPixelSize(R.styleable.fl_FlatAutoCompleteTextView_fl_borderWidth, Attributes.DEFAULT_BORDER_WIDTH_PX));

            // getting view specific attributes
            style = a.getInt(R.styleable.fl_FlatAutoCompleteTextView_fl_autoFieldStyle, 0);

            a.recycle();
        }

        GradientDrawable backgroundDrawable = new GradientDrawable();
        backgroundDrawable.setCornerRadius(attributes.getRadius());

        if (style == 0) {             // flat
            if (!hasOwnTextColor) setTextColor(attributes.getColor(3));
            backgroundDrawable.setColor(attributes.getColor(2));
            backgroundDrawable.setStroke(0, attributes.getColor(2));

        } else if (style == 1) {      // box
            if (!hasOwnTextColor) setTextColor(attributes.getColor(2));
            backgroundDrawable.setColor(Color.WHITE);
            backgroundDrawable.setStroke(attributes.getBorderWidth(), attributes.getColor(2));

        } else if (style == 2) {      // transparent
            if (!hasOwnTextColor) setTextColor(attributes.getColor(1));
            backgroundDrawable.setColor(Color.TRANSPARENT);
            backgroundDrawable.setStroke(attributes.getBorderWidth(), attributes.getColor(2));
        }

        setBackgroundDrawable(backgroundDrawable);

        if (!hasOwnHintColor) setHintTextColor(attributes.getColor(3));

        if (attributes.getTextAppearance() == 1) setTextColor(attributes.getColor(0));
        else if (attributes.getTextAppearance() == 2) setTextColor(attributes.getColor(3));

        // check for IDE preview render
        if(!this.isInEditMode()) {
            Typeface typeface = FlatUI.getFont(getContext(), attributes);
            if (typeface != null) setTypeface(typeface);
        }
    }
 
开发者ID:htooaunghlaing,项目名称:NyaungUConverter,代码行数:64,代码来源:FlatAutoCompleteTextView.java

示例5: onCreate

import com.cengalabs.flatui.FlatUI; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    FlatUI.initDefaultValues(getActivity());
    FlatUI.setDefaultTheme(R.array.candy);
}
 
开发者ID:mmublackpirate,项目名称:our_days,代码行数:7,代码来源:MyConfigFragment.java


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