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


Java R类代码示例

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


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

示例1: init

import net.qiujuer.genius.ui.R; //导入依赖的package包/类
private void init(AttributeSet attrs, int defStyleAttr, int defStyleRes) {
    if (attrs == null)
        return;

    final Context context = getContext();
    final float density = getResources().getDisplayMetrics().density;

    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.TextView);
    int border = a.getInt(R.styleable.TextView_gBorder, -1);
    int borderSize = a.getDimensionPixelOffset(R.styleable.TextView_gBorderSize, (int) density);
    int borderColor = a.getColor(R.styleable.TextView_gBorderColor, Resource.Color.GREY);
    String fontFile = a.getString(R.styleable.TextView_gFont);
    a.recycle();

    setBorder(border, borderSize, borderColor);

    // Check for IDE preview render
    if (!this.isInEditMode() && fontFile != null && fontFile.length() > 0) {
        Typeface typeface = Ui.getFont(getContext(), fontFile);
        if (typeface != null) setTypeface(typeface);
    }
}
 
开发者ID:gentxq,项目名称:Genius-Android,代码行数:23,代码来源:TextView.java

示例2: initBackground

import net.qiujuer.genius.ui.R; //导入依赖的package包/类
private void initBackground() {
    final int lineSize = getLineSize();
    Drawable background;
    if (lineSize == 0) {
        background = null;
    } else {
        int increment = getResources().getDimensionPixelSize(R.dimen.genius_editText_lineSize_active_increment);
        int lineActive = lineSize + increment;
        int lineHalf = lineSize >> 1;

        // Creating normal state drawable
        ShapeDrawable normal = new ShapeDrawable(new BorderShape(new RectF(0, 0, 0, lineSize)));
        normal.getPaint().setColor(getLineColor(new int[]{android.R.attr.state_enabled}));

        // Creating pressed state drawable
        ShapeDrawable pressed = new ShapeDrawable(new BorderShape(new RectF(0, 0, 0, lineActive)));
        pressed.getPaint().setColor(getLineColor(new int[]{android.R.attr.state_pressed, android.R.attr.state_enabled}));

        // Creating focused state drawable
        ShapeDrawable focused = new ShapeDrawable(new BorderShape(new RectF(0, 0, 0, lineActive)));
        focused.getPaint().setColor(getLineColor(new int[]{android.R.attr.state_focused, android.R.attr.state_enabled}));

        // Creating disabled state drawable
        ShapeDrawable disabled = new ShapeDrawable(new BorderShape(new RectF(0, 0, 0, lineHalf), lineHalf, lineSize));
        disabled.getPaint().setColor(getLineColor(new int[]{-android.R.attr.state_enabled}));
        // disabled.getPaint().setAlpha(0xA0);

        Drawable[] drawable = new Drawable[]{pressed, focused, normal, disabled};
        background = Ui.createStateListDrawable(drawable);

    }

    // Set Background
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN)
        //noinspection deprecation
        setBackgroundDrawable(background);
    else
        setBackground(background);

}
 
开发者ID:gentxq,项目名称:Genius-Android,代码行数:41,代码来源:EditText.java

示例3: TextView

import net.qiujuer.genius.ui.R; //导入依赖的package包/类
public TextView(Context context, AttributeSet attrs) {
    super(context, attrs);
    init(attrs, R.attr.gTextViewStyle, R.style.Genius_Widget_TextView);
}
 
开发者ID:gentxq,项目名称:Genius-Android,代码行数:5,代码来源:TextView.java

示例4: EditText

import net.qiujuer.genius.ui.R; //导入依赖的package包/类
public EditText(Context context, AttributeSet attrs) {
    super(context, attrs);
    init(attrs, R.attr.gEditTextStyle, R.style.Genius_Widget_EditText);
}
 
开发者ID:gentxq,项目名称:Genius-Android,代码行数:5,代码来源:EditText.java

示例5: init

import net.qiujuer.genius.ui.R; //导入依赖的package包/类
private void init(AttributeSet attrs, int defStyleAttr, int defStyleRes) {
    if (attrs == null)
        return;

    // Get the super padding top
    mTruePaddingTop = super.getPaddingTop();

    final Context context = getContext();
    final Resources resources = getResources();

    TypedArray a = context.obtainStyledAttributes(
            attrs, R.styleable.EditText, defStyleAttr, defStyleRes);

    String fontFile = a.getString(R.styleable.EditText_gFont);
    int lineSize = a.getDimensionPixelSize(R.styleable.EditText_gLineSize, resources.getDimensionPixelSize(R.dimen.genius_editText_lineSize));
    ColorStateList lineColor = a.getColorStateList(R.styleable.EditText_gLineColor);

    // Set HintProperty
    int titleModel = a.getInt(R.styleable.EditText_gHintTitle, 1);
    int titleTextSize = a.getDimensionPixelSize(R.styleable.EditText_gHintTitleTextSize, resources.getDimensionPixelSize(R.dimen.genius_editText_hintTitleTextSize));
    int titlePaddingTop = a.getDimensionPixelSize(R.styleable.EditText_gHintTitlePaddingTop, 0);
    int titlePaddingBottom = a.getDimensionPixelSize(R.styleable.EditText_gHintTitlePaddingBottom, 0);
    int titlePaddingLeft = a.getDimensionPixelSize(R.styleable.EditText_gHintTitlePaddingLeft, 0);
    int titlePaddingRight = a.getDimensionPixelSize(R.styleable.EditText_gHintTitlePaddingRight, 0);

    a.recycle();

    // Init color
    if (lineColor == null)
        lineColor = resources.getColorStateList(R.color.g_default_edit_view_line);

    if (attrs.getAttributeValue(Ui.androidStyleNameSpace, "textColorHint") == null || getHintTextColors() == null) {
        ColorStateList hintColor = resources.getColorStateList(R.color.g_default_edit_view_hint);
        setHintTextColor(hintColor);
    }

    // Set same values
    setLineSize(lineSize);
    setLineColor(lineColor);

    setHintTitleModel(titleModel);
    setHintTitleTextSize(titleTextSize);

    // check for IDE preview render
    if (!this.isInEditMode()) {
        // Set Font
        if (fontFile != null && fontFile.length() > 0) {
            Typeface typeface = Ui.getFont(context, fontFile);
            if (typeface != null) setTypeface(typeface);
        }
    }

    // Init background and title
    initBackground();
    initHintTitleText();

    // SetHintPadding
    setHintTitlePadding(titlePaddingLeft, titlePaddingTop, titlePaddingRight, titlePaddingBottom);
}
 
开发者ID:gentxq,项目名称:Genius-Android,代码行数:60,代码来源:EditText.java

示例6: Button

import net.qiujuer.genius.ui.R; //导入依赖的package包/类
public Button(Context context, AttributeSet attrs) {
    super(context, attrs);
    init(attrs, R.attr.gButtonStyle, R.style.Genius_Widget_Button);
}
 
开发者ID:gentxq,项目名称:Genius-Android,代码行数:5,代码来源:Button.java

示例7: FloatActionButton

import net.qiujuer.genius.ui.R; //导入依赖的package包/类
public FloatActionButton(Context context, AttributeSet attrs) {
    super(context, attrs);
    init(attrs, R.attr.gFloatActionButtonStyle, R.style.Genius_Widget_FloatActionButton);
}
 
开发者ID:gentxq,项目名称:Genius-Android,代码行数:5,代码来源:FloatActionButton.java

示例8: init

import net.qiujuer.genius.ui.R; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void init(AttributeSet attrs, int defStyleAttr, int defStyleRes) {
    if (attrs == null)
        return;

    final Context context = getContext();
    final Resources resource = getResources();

    // Load attributes
    final TypedArray a = context.obtainStyledAttributes(
            attrs, R.styleable.FloatActionButton, defStyleAttr, defStyleRes);

    ColorStateList bgColor = a.getColorStateList(R.styleable.FloatActionButton_gBackgroundColor);
    int touchColor = a.getColor(R.styleable.FloatActionButton_gTouchColor, Ui.TOUCH_PRESS_COLOR);

    a.recycle();

    // Enable
    boolean enable = Ui.isEnableAttr(context, attrs);
    setEnabled(enable);

    // BackgroundColor
    if (bgColor == null) {
        bgColor = resource.getColorStateList(R.color.g_default_float_action_bg);
    }

    // Background drawable
    final float density = resource.getDisplayMetrics().density;
    final int shadowYOffset = (int) (density * Ui.Y_OFFSET);
    final int shadowXOffset = (int) (density * Ui.X_OFFSET);
    final int maxShadowOffset = Math.max(shadowXOffset, shadowYOffset);

    mShadowRadius = (int) (density * Ui.SHADOW_RADIUS);
    mShadowRadius += maxShadowOffset;

    ShapeDrawable background;
    if (Ui.SUPPER_LOLLIPOP) {
        background = new ShapeDrawable(new OvalShape());
        //ViewCompat.setElevation(this, Ui.SHADOW_ELEVATION * density);
        setElevation(Ui.SHADOW_ELEVATION * density);
    } else {
        OvalShape oval = new OvalShadowShape(mShadowRadius);
        background = new ShapeDrawable(oval);

        // We want set this LayerType type on Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB
        setLayerType(LAYER_TYPE_SOFTWARE, background.getPaint());

        background.getPaint().setShadowLayer(mShadowRadius - maxShadowOffset, shadowXOffset, shadowYOffset,
                Ui.KEY_SHADOW_COLOR);
        final int padding = mShadowRadius;
        // set padding so the inner image sits correctly within the shadow.
        setPadding(Math.max(padding, getPaddingLeft()),
                Math.max(padding, getPaddingTop()),
                Math.max(padding, getPaddingRight()),
                Math.max(padding, getPaddingBottom()));
    }
    setBackgroundDrawable(background);
    setBackgroundColor(bgColor);

    // TouchDrawable
    mTouchDrawable = new TouchEffectDrawable(new FloatEffect(), ColorStateList.valueOf(touchColor));
    mTouchDrawable.setCallback(this);
    mTouchDrawable.setPerformClicker(this);
}
 
开发者ID:gentxq,项目名称:Genius-Android,代码行数:65,代码来源:FloatActionButton.java

示例9: CheckBox

import net.qiujuer.genius.ui.R; //导入依赖的package包/类
public CheckBox(Context context, AttributeSet attrs) {
    super(context, attrs);
    init(attrs, R.attr.gCheckBoxStyle, R.style.Genius_Widget_CompoundButton_CheckBox);
}
 
开发者ID:gentxq,项目名称:Genius-Android,代码行数:5,代码来源:CheckBox.java

示例10: init

import net.qiujuer.genius.ui.R; //导入依赖的package包/类
private void init(AttributeSet attrs, int defStyleAttr, int defStyleRes) {
    if (attrs == null)
        return;

    final Context context = getContext();
    final Resources resource = getResources();
    final float density = resource.getDisplayMetrics().density;

    int baseSize = (int) (density * 2);

    // Load attributes
    final TypedArray a = context.obtainStyledAttributes(
            attrs, R.styleable.CheckBox, defStyleAttr, defStyleRes);

    int borderSize = a.getDimensionPixelOffset(R.styleable.CheckBox_gBorderSize, baseSize);
    int intervalSize = a.getDimensionPixelOffset(R.styleable.CheckBox_gIntervalSize, baseSize);
    int markSize = a.getDimensionPixelOffset(R.styleable.CheckBox_gMarkSize, -1);
    ColorStateList color = a.getColorStateList(R.styleable.CheckBox_gMarkColor);
    String fontFile = a.getString(R.styleable.CheckBox_gFont);

    a.recycle();

    if (color == null)
        color = resource.getColorStateList(R.color.g_default_check_box);

    boolean isCustom = true;

    if (markSize < 0) {
        markSize = (int) (density * 22);
        isCustom = false;
    }

    mMarkDrawable = new CircleCheckDrawable(color);
    mMarkDrawable.setBorderSize(borderSize);
    mMarkDrawable.setIntervalSize(intervalSize);
    mMarkDrawable.setMarkSize(markSize, isCustom);
    setButtonDrawable(mMarkDrawable);

    // Check for IDE preview render
    if (!this.isInEditMode()) {
        // Font
        if (fontFile != null && fontFile.length() > 0) {
            Typeface typeface = Ui.getFont(getContext(), fontFile);
            if (typeface != null) setTypeface(typeface);
        }
    }
}
 
开发者ID:gentxq,项目名称:Genius-Android,代码行数:48,代码来源:CheckBox.java

示例11: AbsSeekBar

import net.qiujuer.genius.ui.R; //导入依赖的package包/类
public AbsSeekBar(Context context, AttributeSet attrs) {
    super(context, attrs);
    init(attrs, R.attr.gSeekBarStyle, R.style.Genius_Widget_SeekBar);
}
 
开发者ID:gentxq,项目名称:Genius-Android,代码行数:5,代码来源:AbsSeekBar.java

示例12: init

import net.qiujuer.genius.ui.R; //导入依赖的package包/类
private void init(AttributeSet attrs, int defStyleAttr, int defStyleRes) {
    final Context context = getContext();
    final Resources resources = getResources();
    final boolean notEdit = !isInEditMode();

    setFocusable(true);
    setWillNotDraw(false);

    mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();


    mRipple = new AlmostRippleDrawable(resources.getColorStateList(R.color.g_default_seek_bar_ripple));
    mRipple.setCallback(this);

    mSeekBarDrawable = new SeekBarDrawable(resources.getColorStateList(R.color.g_default_seek_bar_track),
            resources.getColorStateList(R.color.g_default_seek_bar_scrubber),
            resources.getColorStateList(R.color.g_default_seek_bar_thumb));
    mSeekBarDrawable.setCallback(this);

    // Init
    if (attrs == null) {
        mSeekBarDrawable.setTrackStroke(resources.getDimensionPixelSize(R.dimen.genius_seekBar_trackStroke));
        mSeekBarDrawable.setScrubberStroke(resources.getDimensionPixelSize(R.dimen.genius_seekBar_scrubberStroke));
        mSeekBarDrawable.setTouchRadius(resources.getDimensionPixelSize(R.dimen.genius_seekBar_touchSize));
        mSeekBarDrawable.setTickRadius(resources.getDimensionPixelSize(R.dimen.genius_seekBar_tickSize));
        mSeekBarDrawable.setThumbRadius(resources.getDimensionPixelSize(R.dimen.genius_seekBar_thumbSize));

        if (notEdit) {
            mIndicator = new PopupIndicator(context);
            mIndicator.setListener(mFloaterListener);
            mIndicator.setIndicatorColor(resources.getColorStateList(R.color.g_default_seek_bar_indicator));
            mIndicator.setIndicatorClosedSize(mSeekBarDrawable.getThumbRadius() * 2);
        }

    } else {
        initAttrs(context, resources, notEdit, attrs, defStyleAttr, defStyleRes);
    }

    // Set Values
    mSeekBarDrawable.setNumSegments(mMax - mMin);
    updateKeyboardRange();

    // End
    setNumericTransformer(new DefaultNumericTransformer());
    isRtl();
}
 
开发者ID:gentxq,项目名称:Genius-Android,代码行数:47,代码来源:AbsSeekBar.java

示例13: initAttrs

import net.qiujuer.genius.ui.R; //导入依赖的package包/类
private void initAttrs(Context context, Resources resources, boolean notEdit, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.AbsSeekBar,
            defStyleAttr, defStyleRes);

    // Values
    int max = a.getInteger(R.styleable.AbsSeekBar_gMax, mMax);
    int min = a.getInteger(R.styleable.AbsSeekBar_gMin, mMin);
    int value = a.getInteger(R.styleable.AbsSeekBar_gValue, mValue);

    mMin = min;
    mMax = Math.max(min + 1, max);
    mValue = Math.max(min, Math.min(max, value));

    // Colors
    ColorStateList trackColor = a.getColorStateList(R.styleable.AbsSeekBar_gTrackColor);
    ColorStateList thumbColor = a.getColorStateList(R.styleable.AbsSeekBar_gThumbColor);
    ColorStateList scrubberColor = a.getColorStateList(R.styleable.AbsSeekBar_gScrubberColor);
    ColorStateList rippleColor = a.getColorStateList(R.styleable.AbsSeekBar_gRippleColor);
    ColorStateList indicatorColor = a.getColorStateList(R.styleable.AbsSeekBar_gIndicatorBackgroundColor);

    // Size
    int tickSize = a.getDimensionPixelSize(R.styleable.AbsSeekBar_gTickSize,
            resources.getDimensionPixelSize(R.dimen.genius_seekBar_tickSize));
    int thumbSize = a.getDimensionPixelSize(R.styleable.AbsSeekBar_gThumbSize,
            resources.getDimensionPixelSize(R.dimen.genius_seekBar_thumbSize));
    int touchSize = a.getDimensionPixelSize(R.styleable.AbsSeekBar_gTouchSize,
            resources.getDimensionPixelSize(R.dimen.genius_seekBar_touchSize));
    int trackStroke = a.getDimensionPixelSize(R.styleable.AbsSeekBar_gTrackStroke,
            resources.getDimensionPixelSize(R.dimen.genius_seekBar_trackStroke));
    int scrubberStroke = a.getDimensionPixelSize(R.styleable.AbsSeekBar_gScrubberStroke,
            resources.getDimensionPixelSize(R.dimen.genius_seekBar_scrubberStroke));

    // Other
    int indicator = a.getInt(R.styleable.AbsSeekBar_gIndicator, 1);

    mMirrorForRtl = a.getBoolean(R.styleable.AbsSeekBar_gMirrorForRtl, mMirrorForRtl);
    mAllowTrackClick = a.getBoolean(R.styleable.AbsSeekBar_gAllowTrackClickToDrag, mAllowTrackClick);
    mIndicatorFormatter = a.getString(R.styleable.AbsSeekBar_gIndicatorFormatter);

    // Indicator TextAppearance
    int textAppearanceId = a.getResourceId(R.styleable.AbsSeekBar_gIndicatorTextAppearance, R.style.Genius_Widget_BalloonMarker_TextAppearance);
    String fontFile = a.getString(R.styleable.AbsSeekBar_gFont);

    a.recycle();

    // Set Size
    mSeekBarDrawable.setTrackStroke(trackStroke);
    mSeekBarDrawable.setScrubberStroke(scrubberStroke);
    mSeekBarDrawable.setTouchRadius(touchSize);
    mSeekBarDrawable.setTickRadius(tickSize);
    mSeekBarDrawable.setThumbRadius(thumbSize);

    // Set Colors
    if (rippleColor != null)
        mRipple.setColorStateList(rippleColor);
    if (trackColor != null)
        mSeekBarDrawable.setTrackColor(trackColor);
    if (thumbColor != null)
        mSeekBarDrawable.setThumbColor(thumbColor);
    if (scrubberColor != null)
        mSeekBarDrawable.setScrubberColor(scrubberColor);

    if (notEdit && indicator != 0) {
        mIndicator = new PopupIndicator(context);
        mIndicator.setListener(mFloaterListener);
        if (indicatorColor != null)
            mIndicator.setIndicatorColor(indicatorColor);
        mIndicator.setIndicatorTextAppearance(textAppearanceId);
        mIndicator.setIndicatorClosedSize(thumbSize * 2);

        // Font
        if (fontFile != null && fontFile.length() > 0) {
            Typeface typeface = Ui.getFont(getContext(), fontFile);
            if (typeface != null) mIndicator.setTypeface(typeface);
        }
    }

    // Enabled
    setEnabled(attrs.getAttributeBooleanValue(Ui.androidStyleNameSpace, "enabled", isEnabled()));
}
 
开发者ID:gentxq,项目名称:Genius-Android,代码行数:81,代码来源:AbsSeekBar.java

示例14: BalloonMarker

import net.qiujuer.genius.ui.R; //导入依赖的package包/类
public BalloonMarker(Context context, AttributeSet attrs) {
    this(context, attrs, R.attr.gBalloonMarkerStyle);
}
 
开发者ID:gentxq,项目名称:Genius-Android,代码行数:4,代码来源:BalloonMarker.java

示例15: init

import net.qiujuer.genius.ui.R; //导入依赖的package包/类
public void init(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes, String maxValue) {
    DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
    int padding = (int) (PADDING_DP * displayMetrics.density) * 2;
    mNumber = new TextView(context);
    //Add some padding to this textView so the bubble has some space to breath
    mNumber.setPadding(padding, 0, padding, 0);
    mNumber.setGravity(Gravity.CENTER);
    mNumber.setText(maxValue);
    mNumber.setMaxLines(1);
    mNumber.setSingleLine(true);
    UiCompat.setTextDirection(mNumber, TEXT_DIRECTION_LOCALE);
    mNumber.setVisibility(View.INVISIBLE);

    //add some padding for the elevation shadow not to be clipped
    //I'm sure there are better ways of doing this...
    setPadding(padding, padding, padding, padding);

    resetSizes(maxValue);

    mSeparation = (int) (SEPARATION_DP * displayMetrics.density);

    mBalloonMarkerDrawable = new BalloonMarkerDrawable(ColorStateList.valueOf(Color.TRANSPARENT), 0);
    mBalloonMarkerDrawable.setCallback(this);
    mBalloonMarkerDrawable.setMarkerListener(this);
    mBalloonMarkerDrawable.setExternalOffset(padding);

    UiCompat.setOutlineProvider(this, mBalloonMarkerDrawable);


    if (attrs != null) {

        TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.BalloonMarker,
                defStyleAttr, defStyleRes);
        int textAppearanceId = a.getResourceId(R.styleable.BalloonMarker_gMarkerTextAppearance,
                R.style.Genius_Widget_BalloonMarker_TextAppearance);
        ColorStateList color = a.getColorStateList(R.styleable.BalloonMarker_gMarkerBackgroundColor);
        String fontFile = a.getString(R.styleable.BalloonMarker_gFont);
        a.recycle();

        setTextAppearance(textAppearanceId);
        setBackgroundColor(color);

        //Elevation for android 5+
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            float elevation = a.getDimension(R.styleable.BalloonMarker_gMarkerElevation, ELEVATION_DP * displayMetrics.density);
            this.setElevation(elevation);
        }

        // Check for IDE preview render
        if (!this.isInEditMode()) {
            // Font
            if (fontFile != null && fontFile.length() > 0) {
                Typeface typeface = Ui.getFont(getContext(), fontFile);
                if (typeface != null) setTypeface(typeface);
            }
        }
    }
}
 
开发者ID:gentxq,项目名称:Genius-Android,代码行数:59,代码来源:BalloonMarker.java


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