@android.support.annotation.ColorRes

Here are the examples of the java api @android.support.annotation.ColorRes taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

61 Examples 7

19 Source : ZxingConfig.java
with MIT License
from yuzhiqiang1993

/**
 * @author: yzq
 * @date: 2017/10/27 14:48
 * @declare :zxing配置类
 */
public clreplaced ZxingConfig implements Serializable {

    /*是否播放声音*/
    private boolean isPlayBeep = true;

    /*是否震动*/
    private boolean isShake = true;

    /*是否显示下方的其他功能布局*/
    private boolean isShowbottomLayout = true;

    /*是否显示闪光灯按钮*/
    private boolean isShowFlashLight = true;

    /*是否显示相册按钮*/
    private boolean isShowAlbum = true;

    /*是否解析条形码*/
    private boolean isDecodeBarCode = true;

    /*是否全屏扫描*/
    private boolean isFullScreenScan = true;

    /*四个角的颜色*/
    @ColorRes
    private int reactColor = R.color.react;

    /*扫描框颜色*/
    @ColorRes
    private int frameLineColor = -1;

    /*扫描线颜色*/
    @ColorRes
    private int scanLineColor = R.color.scanLineColor;

    public int getFrameLineColor() {
        return frameLineColor;
    }

    public void setFrameLineColor(@ColorRes int frameLineColor) {
        this.frameLineColor = frameLineColor;
    }

    public int getScanLineColor() {
        return scanLineColor;
    }

    public void setScanLineColor(@ColorRes int scanLineColor) {
        this.scanLineColor = scanLineColor;
    }

    public int getReactColor() {
        return reactColor;
    }

    public void setReactColor(@ColorRes int reactColor) {
        this.reactColor = reactColor;
    }

    public boolean isFullScreenScan() {
        return isFullScreenScan;
    }

    public void setFullScreenScan(boolean fullScreenScan) {
        isFullScreenScan = fullScreenScan;
    }

    public boolean isDecodeBarCode() {
        return isDecodeBarCode;
    }

    public void setDecodeBarCode(boolean decodeBarCode) {
        isDecodeBarCode = decodeBarCode;
    }

    public boolean isPlayBeep() {
        return isPlayBeep;
    }

    public void setPlayBeep(boolean playBeep) {
        isPlayBeep = playBeep;
    }

    public boolean isShake() {
        return isShake;
    }

    public void setShake(boolean shake) {
        isShake = shake;
    }

    public boolean isShowbottomLayout() {
        return isShowbottomLayout;
    }

    public void setShowbottomLayout(boolean showbottomLayout) {
        isShowbottomLayout = showbottomLayout;
    }

    public boolean isShowFlashLight() {
        return isShowFlashLight;
    }

    public void setShowFlashLight(boolean showFlashLight) {
        isShowFlashLight = showFlashLight;
    }

    public boolean isShowAlbum() {
        return isShowAlbum;
    }

    public void setShowAlbum(boolean showAlbum) {
        isShowAlbum = showAlbum;
    }
}

19 Source : BaseActivity.java
with Apache License 2.0
from Yuphee

/**
 * [设置状态栏颜色]
 */
@ColorRes
protected int getStatusBarColor() {
    return 0;
}

19 Source : StatusBarView.java
with Apache License 2.0
from YummyLau

/**
 * 状态栏view
 * Created by yummylau on 2017/9/09.
 */
public clreplaced StatusBarView extends LinearLayout {

    @ColorRes
    private int mStatusBarColor;

    public StatusBarView(Context context) {
        this(context, null);
    }

    public StatusBarView(Context context, @Nullable AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public StatusBarView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        initView(attrs, defStyleAttr);
    }

    private void initView(AttributeSet attrs, int defStyle) {
        View view = LayoutInflater.from(getContext()).inflate(R.layout.view_status_bar_layout, this, true);
        final TypedArray typedArray = getContext().obtainStyledAttributes(attrs, R.styleable.StatusBarView, defStyle, 0);
        if (typedArray != null) {
            mStatusBarColor = typedArray.getResourceId(R.styleable.StatusBarView_status_bar_color, R.color.colorPrimary);
        } else {
            mStatusBarColor = R.color.colorPrimary;
        }
        setBackgroundColor(ContextCompat.getColor(getContext(), mStatusBarColor));
        view.findViewById(R.id.status_bar).setMinimumHeight(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT ? getStatusBarHeight(getContext()) : 0);
    }

    public void setColor(@ColorRes int statusBarColor) {
        mStatusBarColor = statusBarColor;
        setBackgroundColor(ContextCompat.getColor(getContext(), mStatusBarColor));
    }

    public static int getStatusBarHeight(Context context) {
        int sbar = 0;
        try {
            Clreplaced c = Clreplaced.forName("com.android.internal.R$dimen");
            Object obj = c.newInstance();
            Field field = c.getField("status_bar_height");
            int x = Integer.parseInt(field.get(obj).toString());
            sbar = context.getResources().getDimensionPixelSize(x);
        } catch (Exception var7) {
            var7.printStackTrace();
        }
        return sbar;
    }
}

19 Source : CommonConfig.java
with Apache License 2.0
from yibulaxi

public clreplaced CommonConfig {

    @ColorRes
    public static int iosBtnColor = R.color.ios_btntext_blue;

    @ColorRes
    public static int lvItemTxtColor = R.color.text_item_33;

    @ColorRes
    public static int mdBtnColor = R.color.btn_alert;

    @ColorRes
    public static int replacedleTxtColor = R.color.text_replacedle_11;

    @ColorRes
    public static int msgTxtColor = R.color.text_replacedle_11;

    @ColorRes
    public static int inputTxtColor = R.color.text_input_44;

    public static CharSequence dialogui_btnTxt1 = "确定";

    public static CharSequence dialogui_btnTxt2 = "取消";

    public static CharSequence dialogui_bottomTxt = "取消";

    public static final int TYPE_LOADING_HORIZONTAL = 1;

    public static final int TYPE_LOADING_VERTICAL = 2;

    public static final int TYPE_MD_ALERT = 3;

    public static final int TYPE_MD_MULTI_CHOOSE = 4;

    public static final int TYPE_SINGLE_CHOOSE = 5;

    public static final int TYPE_ALERT = 6;

    public static final int TYPE_CENTER_SHEET = 10;

    public static final int TYPE_BOTTOM_SHEET = 14;

    public static final int TYPE_CUSTOM_ALERT = 15;

    public static final int TYPE_CUSTOM_BOTTOM_ALERT = 16;

    public static final int TYPE_MD_LOADING_HORIZONTAL = 17;

    public static final int TYPE_MD_LOADING_VERTICAL = 18;

    public static final int TYPE_DATEPICK = 19;
}

19 Source : BaseActivity.java
with GNU General Public License v2.0
from wuxiaosu

/**
 * 状态栏默认颜色,不支持动态修改
 *
 * @return 状态栏颜色
 */
@ColorRes
protected int getStatusBarColor() {
    return R.color.status_bar;
}

19 Source : ColorNamePrimitive.java
with Apache License 2.0
from tumblr

/**
 * Created by ericleong on 3/13/16.
 */
public clreplaced ColorNamePrimitive implements Primitive.Color, Primitive.Text {

    @ColorRes
    private int color;

    private final String string;

    public ColorNamePrimitive(final int color, final String string) {
        this.color = color;
        this.string = string;
    }

    public void setColor(@ColorRes final int color) {
        this.color = color;
    }

    @ColorRes
    public int getColor() {
        return color;
    }

    public String getString() {
        return string;
    }
}

19 Source : ColorNamePrimitive.java
with Apache License 2.0
from tumblr

@ColorRes
public int getColor() {
    return color;
}

19 Source : ColorPalette.java
with Apache License 2.0
from Tenor-Inc

public clreplaced ColorPalette {

    private final int mCount;

    private final int[] mColorPalette;

    private int[] mRandomizedPalette;

    public ColorPalette(@ColorRes int[] colorResIds) {
        mCount = colorResIds.length;
        if (mCount <= 0) {
            throw new IllegalArgumentException("length of input color resource ids cannot be less than 1");
        }
        mColorPalette = colorResIds;
        shuffle();
    }

    public void shuffle() {
        mRandomizedPalette = SdkListUtils.shuffle(mColorPalette);
    }

    /**
     * Get a {@link ColorRes} from the given color resource ids
     *
     * @param index the index of the randomized {@link ColorRes}
     * @return a {@link ColorRes}
     */
    @ColorRes
    public int get(@IntRange(from = 0, to = Integer.MAX_VALUE) int index) {
        if (index < 0) {
            index = Math.abs(index);
        }
        return mColorPalette[index % mCount];
    }

    /**
     * Get a random {@link ColorRes} from the given color resource ids
     *
     * @param index the index of the randomized {@link ColorRes}
     * @return a random {@link ColorRes}
     */
    @ColorRes
    public int random(@IntRange(from = 0, to = Integer.MAX_VALUE) int index) {
        if (index < 0) {
            index = Math.abs(index);
        }
        return mRandomizedPalette[index % mCount];
    }

    /*
     * ==============
     * Static Methods
     * ==============
     */
    @ColorRes
    private static final int[] COLOR_RESOURCE_IDS = new int[] { R.color.color_palette_green, R.color.color_palette_light_blue, R.color.color_palette_yellow, R.color.color_palette_deep_purple, R.color.color_palette_red };

    private static final ColorPalette COLOR_PALETTE = new ColorPalette(COLOR_RESOURCE_IDS);

    /**
     * Get a random {@link ColorRes} from the randomized {@link #COLOR_RESOURCE_IDS}
     *
     * @param index the index of the randomized {@link ColorRes}
     * @return a random {@link ColorRes}
     */
    @ColorRes
    public static int getRandomColorResId(@IntRange(from = 0, to = Integer.MAX_VALUE) int index) {
        return COLOR_PALETTE.random(index);
    }
}

19 Source : ColorPalette.java
with Apache License 2.0
from Tenor-Inc

/**
 * Get a random {@link ColorRes} from the given color resource ids
 *
 * @param index the index of the randomized {@link ColorRes}
 * @return a random {@link ColorRes}
 */
@ColorRes
public int random(@IntRange(from = 0, to = Integer.MAX_VALUE) int index) {
    if (index < 0) {
        index = Math.abs(index);
    }
    return mRandomizedPalette[index % mCount];
}

19 Source : ColorPalette.java
with Apache License 2.0
from Tenor-Inc

/**
 * Get a {@link ColorRes} from the given color resource ids
 *
 * @param index the index of the randomized {@link ColorRes}
 * @return a {@link ColorRes}
 */
@ColorRes
public int get(@IntRange(from = 0, to = Integer.MAX_VALUE) int index) {
    if (index < 0) {
        index = Math.abs(index);
    }
    return mColorPalette[index % mCount];
}

19 Source : ColorPalette.java
with Apache License 2.0
from Tenor-Inc

/**
 * Get a random {@link ColorRes} from the randomized {@link #COLOR_RESOURCE_IDS}
 *
 * @param index the index of the randomized {@link ColorRes}
 * @return a random {@link ColorRes}
 */
@ColorRes
public static int getRandomColorResId(@IntRange(from = 0, to = Integer.MAX_VALUE) int index) {
    return COLOR_PALETTE.random(index);
}

19 Source : SearchSuggestionRVItem.java
with Apache License 2.0
from Tenor-Inc

@ColorRes
public int getPlaceholder() {
    return mPlaceholder;
}

19 Source : bilibili.java
with MIT License
from stytooldex

/**
 * Set Ripple color, default is #FFFFFF
 *
 * @param rippleColor New color resource
 */
@ColorRes
public void setRippleColor(int rippleColor) {
    this.rippleColor = getResources().getColor(rippleColor);
}

19 Source : RippleView.java
with MIT License
from Rairmmd

/**
 * Set Ripple color, default is #FFFFFF
 *
 * @param rippleColor New color resource
 */
@SuppressLint("SupportAnnotationUsage")
@ColorRes
public void setRippleColor(int rippleColor) {
    this.rippleColor = getResources().getColor(rippleColor);
}

19 Source : Slide.java
with MIT License
from PuffOpenSource

@ColorRes
public int getBackgroundDark() {
    return android.R.color.black;
}

19 Source : SecureSlide.java
with MIT License
from PuffOpenSource

/**
 * Created by bob.sun on 16/4/21.
 */
public clreplaced SecureSlide extends Slide {

    private final android.support.v4.app.Fragment fragment;

    @ColorRes
    private final int background;

    @ColorRes
    private final int backgroundDark;

    private final boolean canGoForward;

    private final boolean canGoBackward;

    private SecureSlide(SecureSlide.Builder builder) {
        this.fragment = builder.fragment;
        this.background = builder.background;
        this.backgroundDark = builder.backgroundDark;
        this.canGoForward = builder.canGoForward;
        this.canGoBackward = builder.canGoBackward;
    }

    public android.support.v4.app.Fragment getFragment() {
        return this.fragment;
    }

    public int getBackground() {
        return this.background;
    }

    public int getBackgroundDark() {
        return this.backgroundDark;
    }

    public boolean canGoForward() {
        return this.fragment instanceof SlideFragment ? ((SlideFragment) this.fragment).canGoForward() : this.canGoForward;
    }

    public boolean canGoBackward() {
        return this.fragment instanceof SlideFragment ? ((SlideFragment) this.fragment).canGoBackward() : this.canGoBackward;
    }

    public static clreplaced Fragment extends android.support.v4.app.Fragment {

        private static final String ARGUMENT_LAYOUT_RES = "com.heinrichreimersoftware.materialintro.SimpleFragment.ARGUMENT_LAYOUT_RES";

        private static final String ARGUMENT_THEME_RES = "com.heinrichreimersoftware.materialintro.SimpleFragment.ARGUMENT_THEME_RES";

        public Fragment() {
        }

        public static SecureSlide.Fragment newInstance(@LayoutRes int layoutRes, @StyleRes int themeRes) {
            SecureSlide.Fragment fragment = new SecureSlide.Fragment();
            Bundle arguments = new Bundle();
            arguments.putInt("com.heinrichreimersoftware.materialintro.SimpleFragment.ARGUMENT_LAYOUT_RES", layoutRes);
            arguments.putInt("com.heinrichreimersoftware.materialintro.SimpleFragment.ARGUMENT_THEME_RES", themeRes);
            fragment.setArguments(arguments);
            return fragment;
        }

        public static SecureSlide.Fragment newInstance(@LayoutRes int layoutRes) {
            return newInstance(layoutRes, -1);
        }

        public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
            ContextThemeWrapper contextThemeWrapper = new ContextThemeWrapper(this.getActivity(), this.getArguments().getInt("com.heinrichreimersoftware.materialintro.SimpleFragment.ARGUMENT_THEME_RES"));
            LayoutInflater localInflater = inflater.cloneInContext(contextThemeWrapper);
            return localInflater.inflate(this.getArguments().getInt("com.heinrichreimersoftware.materialintro.SimpleFragment.ARGUMENT_LAYOUT_RES"), container, false);
        }
    }

    public static clreplaced Builder {

        private android.support.v4.app.Fragment fragment;

        @ColorRes
        private int background;

        @ColorRes
        private int backgroundDark = 0;

        private boolean canGoForward = true;

        private boolean canGoBackward = true;

        public Builder() {
        }

        public SecureSlide.Builder fragment(android.support.v4.app.Fragment fragment) {
            this.fragment = fragment;
            return this;
        }

        public SecureSlide.Builder fragment(@LayoutRes int layoutRes, @StyleRes int themeRes) {
            this.fragment = SecureSlide.Fragment.newInstance(layoutRes, themeRes);
            return this;
        }

        public SecureSlide.Builder fragment(@LayoutRes int layoutRes) {
            this.fragment = SecureSlide.Fragment.newInstance(layoutRes);
            return this;
        }

        public SecureSlide.Builder fragment(FragmentSlide.FragmentSlideFragment fragment) {
            this.fragment = fragment;
            return this;
        }

        public SecureSlide.Builder background(@ColorRes int background) {
            this.background = background;
            return this;
        }

        public SecureSlide.Builder backgroundDark(@ColorRes int backgroundDark) {
            this.backgroundDark = backgroundDark;
            return this;
        }

        public SecureSlide.Builder canGoForward(boolean canGoForward) {
            this.canGoForward = canGoForward;
            return this;
        }

        public SecureSlide.Builder canGoBackward(boolean canGoBackward) {
            this.canGoBackward = canGoBackward;
            return this;
        }

        public SecureSlide build() {
            if (this.background != 0 && this.fragment != null) {
                return new SecureSlide(this);
            } else {
                throw new IllegalArgumentException("You must set at least a fragment and background.");
            }
        }
    }
}

19 Source : ColorPreference.java
with GNU General Public License v3.0
from PowerExplorer

/**
 * Get the color resource preference for the given {@link ColorUsage}
 *
 * @param usage The {@link ColorUsage}
 * @return The color resource id.
 */
@ColorRes
private int getRes(ColorUsage usage) {
    @ColorRes
    Integer color = colors.get(usage);
    return color == null ? usage.getDefaultColor() : color.intValue();
}

19 Source : TuSdkMovieColorRectView.java
with Apache License 2.0
from pili-engineering

/**
 * 颜色矩形控件
 * @author MirsFang
 */
public clreplaced TuSdkMovieColorRectView extends View {

    private static final String TAG = "ColorRectView";

    /**
     * 当前色块 *
     */
    @ColorRes
    private int mColorId = R.color.lsq_color_api_gray;

    /**
     * 方向 0 从左到右  1 从右到左 *
     */
    private int mDrawDirection;

    /**
     * 开始的位置 *
     */
    private float mStartPercent;

    /**
     * 结束的位置 *
     */
    private float mEndPercent;

    /**
     * 当前添加的下标 *
     */
    private int index;

    public TuSdkMovieColorRectView(Context context) {
        super(context);
    }

    public TuSdkMovieColorRectView(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }

    /**
     * 设置当前画块的颜色 *
     */
    public void setColorId(@ColorRes int colorId) {
        this.mColorId = colorId;
        setBackgroundColor(colorId);
    }

    /**
     * 设置输出的方向
     */
    public void setDrawDirection(int direction) {
        this.mDrawDirection = direction;
    }

    /**
     * 获取绘制的方向 *
     */
    public int getDrawDirection() {
        return mDrawDirection;
    }

    /**
     * 设置开始的进度 *
     */
    public void setStartPercent(float startPercent) {
        this.mStartPercent = startPercent;
    }

    /**
     * 获取开始的进度 *
     */
    public float getStartPercent() {
        return mStartPercent;
    }

    public float getEndPercent() {
        return mEndPercent;
    }

    public void setEndPercent(float mEndPercent) {
        this.mEndPercent = mEndPercent;
    }

    /**
     * 设置宽度 *
     */
    public void setWidth(int width) {
        ViewGroup.LayoutParams layoutParams = new FrameLayout.LayoutParams(width, ViewGroup.LayoutParams.MATCH_PARENT);
        setLayoutParams(layoutParams);
    }
}

19 Source : DashboardAdapter.java
with Apache License 2.0
from nongdenchet

@ColorRes
private int getBackgroundColor(int code) {
    int color = R.color.network_proxy_green;
    if (code < 400 && code >= 300) {
        color = R.color.network_proxy_blue;
    } else if (code < 500 && code >= 400) {
        color = R.color.network_proxy_yellow;
    } else if (code >= 500) {
        color = R.color.network_proxy_red;
    }
    return color;
}

19 Source : Utils.java
with Apache License 2.0
from maoruibin

/**
 * AQI 顏色等級
 * @param aqiIndex
 * @return
 */
@ColorRes
public static int getIndexColor(int aqiIndex) {
    switch(aqiIndex) {
        case LEVEL_AQI_1:
            return R.color.aqi_main_best;
        case LEVEL_AQI_2:
            return R.color.aqi_main_good;
        case LEVEL_AQI_3:
            return R.color.aqi_main_mild;
        case LEVEL_AQI_4:
            return R.color.aqi_main_moderate;
        case LEVEL_AQI_5:
            return R.color.aqi_main_severe;
        case LEVEL_AQI_6:
            return R.color.aqi_main_bad;
        default:
            return R.color.aqi_main_other;
    }
}

19 Source : FilterItem.java
with Apache License 2.0
from javierpe

/**
 * Created by usuario on 20/02/17.
 */
public clreplaced FilterItem {

    private String replacedle;

    @ColorRes
    private int replacedleColor;

    private Object tag;

    public String getreplacedle() {
        return replacedle;
    }

    public void setreplacedle(String replacedle) {
        this.replacedle = replacedle;
    }

    public int getreplacedleColor() {
        return replacedleColor;
    }

    public void setreplacedleColor(@ColorRes int replacedleColor) {
        this.replacedleColor = replacedleColor;
    }

    public Object getTag() {
        return tag;
    }

    public void setTag(Object tag) {
        this.tag = tag;
    }

    public FilterItem() {
    }

    public FilterItem(String replacedle) {
        this.replacedle = replacedle;
    }

    public FilterItem(Object tag) {
        this.tag = tag;
    }

    public FilterItem(int replacedleColor) {
        this.replacedleColor = replacedleColor;
    }

    public FilterItem(String replacedle, Object tag) {
        this.replacedle = replacedle;
        this.tag = tag;
    }

    public FilterItem(String replacedle, @ColorRes int replacedleColor, Object tag) {
        this.replacedle = replacedle;
        this.replacedleColor = replacedleColor;
        this.tag = tag;
    }

    public FilterItem(String replacedle, @ColorRes int replacedleColor) {
        this.replacedle = replacedle;
        this.replacedleColor = replacedleColor;
    }
}

19 Source : RecyclerOnClickListener.java
with MIT License
from IdeaTrackerPlus

@ColorRes
private int getPriorityColorResource() {
    switch(mPriority) {
        case 1:
            return R.color.priority1;
        case 2:
            return R.color.priority2;
        case 3:
            return R.color.priority3;
    }
    return R.color.white;
}

19 Source : StatusbarUtil.java
with Apache License 2.0
from hss01248

/**
 * 当UI图上状态栏背景为淡色时,适配时实际应设置的颜色是什么.
 * 只是提供一个颜色计算功能,没有实际去改变任何东西
 *
 * 适用于多tab切换时计算,然后就可以动态变更状态栏颜色
 * @param activity
 */
@ColorRes
public static int getBgColorIfLight(Activity activity, @ColorRes int colorLight, @ColorRes int colorDeep) {
    int color = colorLight;
    if (isXiaomi()) {
    } else if (isMeizu()) {
    } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
    } else {
        color = colorDeep;
    }
    return color;
}

19 Source : OtherStyleConfig.java
with Apache License 2.0
from hss01248

/**
 * Created by Administrator on 2017/12/7.
 */
public clreplaced OtherStyleConfig {

    public CharSequence replacedle;

    public CharSequence msg;

    @ColorRes
    public int replacedleTxtColor = DefaultConfig.replacedleTxtColor;

    @ColorRes
    public int msgTxtColor = DefaultConfig.msgTxtColor;
}

19 Source : DefaultConfig.java
with Apache License 2.0
from hss01248

/**
 * Created by Administrator on 2016/10/9.
 */
public clreplaced DefaultConfig {

    @ColorRes
    public static int iosBtnColor = R.color.dialogutil_ios_btntext_blue;

    @ColorRes
    public static int lvItemTxtColor = R.color.dialogutil_text_item_33;

    @ColorRes
    public static int mdBtnColor = R.color.dialogutil_ios_btntext_blue;

    @ColorRes
    public static int mdBtnCancelColor = R.color.dialogutil_text_gray_light;

    @ColorRes
    public static int replacedleTxtColor = R.color.dialogutil_text_replacedle_11;

    @ColorRes
    public static int msgTxtColor = R.color.dialogutil_text_replacedle_11;

    @ColorRes
    public static int inputTxtColor = R.color.dialogutil_text_input_44;

    // 默认可以点击后退键来dismiss对话框
    public static boolean cancelable = true;

    // 默认外部半透明处点击消失
    public static boolean outsideTouchable = false;

    /**
     * 是否在点击按钮后自动消失
     * 针对有的情况下点击按钮/item拿到回调后,需要dialog不消失
     */
    public static boolean dismissAfterResultCallback = true;

    /**
     * 半透明遮罩
     */
    public static boolean dimBehind = true;

    /**
     * 是否使用带阴影的背景(以防有的手机无法显示后面的半透明遮罩,而与下方界面黏连)
     */
    public static boolean useTheShadowBg = true;

    /* <dimen name="btn_txt_size">14sp</dimen>
    <dimen name="replacedle_txt_size">17sp</dimen>
    <dimen name="msg_txt_size">14sp</dimen>
    <dimen name="item_txt_size">14sp</dimen>*/
    // in sp
    public static int btnTxtSize = 14;

    public static int replacedleTxtSize = 17;

    public static int msgTxtSize = 14;

    public static int itemTxtSize = 14;

    public static int inputTxtSize = 14;

    public static CharSequence btnTxt1;

    public static CharSequence btnTxt2;

    public static CharSequence bottomTxt;

    public static CharSequence loadingTxt;

    public static CharSequence uploadingTxt;

    public static CharSequence downloadingTxt;

    public static final int TYPE_MD_LOADING = 1;

    public static final int TYPE_MD_ALERT = 2;

    public static final int TYPE_MD_SINGLE_CHOOSE = 3;

    public static final int TYPE_MD_MULTI_CHOOSE = 4;

    public static final int TYPE_IOS_HORIZONTAL = 5;

    public static final int TYPE_IOS_VERTICAL = 6;

    public static final int TYPE_IOS_BOTTOM = 7;

    public static final int TYPE_IOS_CENTER_LIST = 8;

    public static final int TYPE_IOS_INPUT = 9;

    public static final int TYPE_CUSTOM_VIEW = 10;

    public static final int TYPE_BOTTOM_SHEET_CUSTOM = 11;

    public static final int TYPE_BOTTOM_SHEET_LIST = 12;

    public static final int TYPE_BOTTOM_SHEET_GRID = 13;

    public static final int TYPE_IOS_LOADING = 14;

    public static final int TYPE_PROGRESS = 15;

    public static final int TYPE_MD_INPUT = 16;

    public static void initBtnTxt(Context context) {
        btnTxt1 = context.getResources().getString(R.string.dialogutil_btn_sure);
        btnTxt2 = context.getResources().getString(R.string.dialogutil_btn_cancel);
        bottomTxt = context.getResources().getString(R.string.dialogutil_btn_cancel);
        loadingTxt = context.getResources().getString(R.string.dialogutil_loading);
        uploadingTxt = context.getResources().getString(R.string.dialogutil_uploading);
        downloadingTxt = context.getResources().getString(R.string.dialogutil_downloading);
    }
}

19 Source : BottomSheetStyle.java
with Apache License 2.0
from hss01248

/**
 * Created by huangshuisheng on 2017/11/13.
 */
public clreplaced BottomSheetStyle {

    public int txtSizeSp;

    @ColorRes
    public int txtColor;

    public int txtMarginTopDp;

    public int iconSizeDp;

    public int bottomTxtSizeSp;

    @ColorRes
    public int bottomTxtColor;

    public int bottomTxtHeightDp;

    public int gvMarginTopDp;

    public int gvMarginBottomDp;

    public int gcMarginLRDp;

    public int gvItemMargin_H;

    public int gvItemMargin_V;

    public int getTxtSizeSp() {
        return txtSizeSp;
    }

    public int getTxtColor() {
        return txtColor;
    }

    public int getTxtMarginTopDp() {
        return txtMarginTopDp;
    }

    public int getIconSizeDp() {
        return iconSizeDp;
    }

    public int getBottomTxtSizeSp() {
        return bottomTxtSizeSp;
    }

    public int getBottomTxtColor() {
        return bottomTxtColor;
    }

    public int getBottomTxtHeightDp() {
        return bottomTxtHeightDp;
    }

    public int getGvMarginTopDp() {
        return gvMarginTopDp;
    }

    public int getGvMarginBottomDp() {
        return gvMarginBottomDp;
    }

    public int getGcMarginLRDp() {
        return gcMarginLRDp;
    }

    public int getGvItemMargin_H() {
        return gvItemMargin_H;
    }

    public int getGvItemMargin_V() {
        return gvItemMargin_V;
    }

    private BottomSheetStyle(Builder builder) {
        txtSizeSp = builder.txtSizeSp;
        txtColor = builder.txtColor;
        txtMarginTopDp = builder.txtMarginTopDp;
        iconSizeDp = builder.iconSizeDp;
        bottomTxtSizeSp = builder.bottomTxtSizeSp;
        bottomTxtColor = builder.bottomTxtColor;
        bottomTxtHeightDp = builder.bottomTxtHeightDp;
        gvMarginTopDp = builder.gvMarginTopDp;
        gvMarginBottomDp = builder.gvMarginBottomDp;
        gcMarginLRDp = builder.gcMarginLRDp;
        gvItemMargin_H = builder.gvItemMargin_H;
        gvItemMargin_V = builder.gvItemMargin_V;
    }

    public static Builder newBuilder() {
        return new Builder();
    }

    public static Builder newBuilder(BottomSheetStyle copy) {
        Builder builder = new Builder();
        builder.txtSizeSp = copy.getTxtSizeSp();
        builder.txtColor = copy.getTxtColor();
        builder.txtMarginTopDp = copy.getTxtMarginTopDp();
        builder.iconSizeDp = copy.getIconSizeDp();
        builder.bottomTxtSizeSp = copy.getBottomTxtSizeSp();
        builder.bottomTxtColor = copy.getBottomTxtColor();
        builder.bottomTxtHeightDp = copy.getBottomTxtHeightDp();
        builder.gvMarginTopDp = copy.getGvMarginTopDp();
        builder.gvMarginBottomDp = copy.getGvMarginBottomDp();
        builder.gcMarginLRDp = copy.getGcMarginLRDp();
        builder.gvItemMargin_H = copy.getGvItemMargin_H();
        builder.gvItemMargin_V = copy.getGvItemMargin_V();
        return builder;
    }

    public static final clreplaced Builder {

        private int txtSizeSp = 12;

        @ColorRes
        private int txtColor = R.color.dialogutil_text_black;

        private int txtMarginTopDp = 4;

        private int iconSizeDp = 60;

        private int bottomTxtSizeSp = 16;

        @ColorRes
        private int bottomTxtColor = R.color.dialogutil_text_black_lighter;

        private int bottomTxtHeightDp = 49;

        private int gvMarginTopDp = 25;

        private int gvMarginBottomDp = 22;

        private int gcMarginLRDp = 20;

        private int gvItemMargin_H = 15;

        private int gvItemMargin_V = 15;

        private Builder() {
        }

        public Builder txtSizeSp(int val) {
            txtSizeSp = val;
            return this;
        }

        public Builder txtColor(int val) {
            txtColor = val;
            return this;
        }

        public Builder txtMarginTopDp(int val) {
            txtMarginTopDp = val;
            return this;
        }

        public Builder iconSizeDp(int val) {
            iconSizeDp = val;
            return this;
        }

        public Builder bottomTxtSizeSp(int val) {
            bottomTxtSizeSp = val;
            return this;
        }

        public Builder bottomTxtColor(int val) {
            bottomTxtColor = val;
            return this;
        }

        public Builder bottomTxtHeightDp(int val) {
            bottomTxtHeightDp = val;
            return this;
        }

        public Builder gvMarginTopDp(int val) {
            gvMarginTopDp = val;
            return this;
        }

        public Builder gvMarginBottomDp(int val) {
            gvMarginBottomDp = val;
            return this;
        }

        public Builder gcMarginLRDp(int val) {
            gcMarginLRDp = val;
            return this;
        }

        public Builder gvItemMargin_H(int val) {
            gvItemMargin_H = val;
            return this;
        }

        public Builder gvItemMargin_V(int val) {
            gvItemMargin_V = val;
            return this;
        }

        public BottomSheetStyle build() {
            return new BottomSheetStyle(this);
        }
    }
}

19 Source : SmallCinemaListAdapter.java
with Apache License 2.0
from Devit951

public clreplaced SmallCinemaListAdapter extends AbstractCinemaListAdapter<SmallCinemaViewHolder, RecyclerView.ViewHolder> {

    private final int HEADER_TYPE = 0;

    private final int CONTENT_TYPE = 1;

    private final boolean withOutHeader;

    private final boolean withOutBackground;

    @ColorRes
    private int viewHolderForegroundColor;

    public SmallCinemaListAdapter(Context context, OnCinemaClickListener onCinemaClickListener) {
        this(context, onCinemaClickListener, true, true);
    }

    public SmallCinemaListAdapter(Context context, OnCinemaClickListener onCinemaClickListener, boolean withOutHeader, boolean withOutBackground) {
        super(onCinemaClickListener);
        this.withOutHeader = withOutHeader;
        this.withOutBackground = withOutBackground;
        TypedValue typedValue = new TypedValue();
        context.getTheme().resolveAttribute(R.attr.selectableItemBackground, typedValue, true);
        viewHolderForegroundColor = typedValue.resourceId;
    }

    public SmallCinemaListAdapter(Context context, OnCinemaClickListener onCinemaClickListener, boolean withOutHeader, @ColorRes int viewHolderForegroundColor, boolean withOutBackground) {
        this(context, onCinemaClickListener, withOutHeader, withOutBackground);
        this.viewHolderForegroundColor = viewHolderForegroundColor;
    }

    @Override
    @NonNull
    public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        LayoutInflater inflater = LayoutInflater.from(parent.getContext());
        View view;
        if (withOutHeader) {
            view = inflater.inflate(R.layout.item_small_cinema, parent, false);
            return new SmallCinemaViewHolder(view, onCinemaClickListener, viewHolderForegroundColor, withOutBackground);
        }
        if (viewType == HEADER_TYPE) {
            view = inflater.inflate(R.layout.item_small_cinema_header, parent, false);
            return new SmallCinemaHeaderViewHolder(view);
        } else {
            view = inflater.inflate(R.layout.item_small_cinema, parent, false);
            return new SmallCinemaViewHolder(view, onCinemaClickListener);
        }
    }

    @Override
    public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
        switch(gereplacedemViewType(position)) {
            case HEADER_TYPE:
                {
                    ((SmallCinemaHeaderViewHolder) holder).render(cinemas.size());
                    break;
                }
            case CONTENT_TYPE:
                {
                    if (withOutHeader) {
                        Cinema cinema = cinemas.get(position);
                        ((SmallCinemaViewHolder) holder).render(cinema, holder.getAdapterPosition());
                    } else {
                        Cinema cinema = cinemas.get(position - 1);
                        ((SmallCinemaViewHolder) holder).render(cinema, holder.getAdapterPosition());
                    }
                    break;
                }
        }
    }

    @Override
    public int gereplacedemCount() {
        if (withOutHeader) {
            return cinemas.size();
        }
        return cinemas.size() + 1;
    }

    @Override
    public int gereplacedemViewType(int position) {
        if (withOutHeader) {
            return CONTENT_TYPE;
        }
        return position == 0 ? HEADER_TYPE : CONTENT_TYPE;
    }

    public void removeCinema(int position) {
        cinemas.remove(position);
        notifyItemRemoved(position);
    }

    public void restoreCinema(Cinema cinema, int position) {
        cinemas.add(position, cinema);
        notifyItemInserted(position);
    }

    public void clear() {
        cinemas.clear();
        notifyDataSetChanged();
    }
}

19 Source : MovieDetailsViewModel.java
with Apache License 2.0
from ArturVasilov

@ColorRes
@Bindable
public int getExpandedreplacedleColor() {
    return android.R.color.transparent;
}

18 Source : TimeCatApp.java
with Apache License 2.0
from triline3

@ColorRes
private int getThemeColor(Context context, int color, String theme) {
    switch(color) {
        case 0xd20000:
            return context.getResources().getIdentifier(theme, "color", getPackageName());
    }
    return -1;
}

18 Source : TimeCatApp.java
with Apache License 2.0
from triline3

@ColorRes
private int getThemeColorId(Context context, int colorId, String theme) {
    switch(colorId) {
        case R.color.theme_color_primary:
            return context.getResources().getIdentifier(theme, "color", getPackageName());
        case R.color.theme_color_primary_dark:
            return context.getResources().getIdentifier(theme + "_dark", "color", getPackageName());
        case R.color.playbarProgressColor:
            return context.getResources().getIdentifier(theme + "_trans", "color", getPackageName());
    }
    return colorId;
}

18 Source : SearchSuggestionRVItem.java
with Apache License 2.0
from Tenor-Inc

public clreplaced SearchSuggestionRVItem extends AbstractRVItem {

    @ColorRes
    private final int mPlaceholder;

    @NonNull
    private final String mQuery;

    public SearchSuggestionRVItem(int type, @NonNull final String query, @ColorRes int placeholder, @NonNull final String suggestion) {
        super(type, suggestion);
        mQuery = query;
        mPlaceholder = placeholder;
    }

    @NonNull
    public String getQuery() {
        return StringConstant.getOrEmpty(mQuery);
    }

    @ColorRes
    public int getPlaceholder() {
        return mPlaceholder;
    }

    @NonNull
    public String getSuggestion() {
        return getId();
    }
}

18 Source : Themes.java
with Apache License 2.0
from saket

@ColorRes
public static int voteColor(VoteDirection voteDirection) {
    switch(voteDirection) {
        case UP:
            return R.color.vote_direction_upvote;
        case DOWN:
            return R.color.vote_direction_downvote;
        default:
        case NONE:
            return R.color.vote_direction_none;
    }
}

18 Source : SlideAdapter.java
with MIT License
from PuffOpenSource

@ColorRes
public int getBackground(int position) {
    return data.get(position).getBackground();
}

18 Source : SlideAdapter.java
with MIT License
from PuffOpenSource

@ColorRes
public int getBackgroundDark(int position) {
    return data.get(position).getBackgroundDark();
}

18 Source : SimpleSlide.java
with MIT License
from PuffOpenSource

public clreplaced SimpleSlide extends RestorableSlide {

    // Random number
    private static final int DEFAULT_PERMISSIONS_REQUEST_CODE = 34;

    private Fragment fragment;

    @ColorRes
    private final int background;

    @ColorRes
    private final int backgroundDark;

    private final boolean canGoForward;

    private final boolean canGoBackward;

    private SimpleSlide(Builder builder) {
        fragment = SimpleSlideFragment.newInstance(builder.replacedle, builder.replacedleRes, builder.description, builder.descriptionRes, builder.imageRes, builder.backgroundRes, builder.backgroundDarkRes, builder.layoutRes, builder.permissions, builder.permissionsRequestCode);
        background = builder.backgroundRes;
        backgroundDark = builder.backgroundDarkRes;
        canGoForward = builder.canGoForward;
        canGoBackward = builder.canGoBackward;
    }

    @Override
    public Fragment getFragment() {
        return fragment;
    }

    @Override
    public void setFragment(Fragment fragment) {
        this.fragment = fragment;
    }

    @Override
    public int getBackground() {
        return background;
    }

    @Override
    public int getBackgroundDark() {
        return backgroundDark;
    }

    @Override
    public boolean canGoForward() {
        if (fragment instanceof SlideFragment) {
            return canGoForward && ((SlideFragment) fragment).canGoForward();
        }
        return canGoForward;
    }

    @Override
    public boolean canGoBackward() {
        return canGoBackward;
    }

    public static clreplaced Builder {

        @ColorRes
        private int backgroundRes = 0;

        @ColorRes
        private int backgroundDarkRes = 0;

        private CharSequence replacedle = null;

        @StringRes
        private int replacedleRes = 0;

        private CharSequence description = null;

        @StringRes
        private int descriptionRes = 0;

        @DrawableRes
        private int imageRes = 0;

        @LayoutRes
        private int layoutRes = R.layout.fragment_simple_slide;

        private boolean canGoForward = true;

        private boolean canGoBackward = true;

        private String[] permissions = null;

        private int permissionsRequestCode = DEFAULT_PERMISSIONS_REQUEST_CODE;

        public Builder background(@ColorRes int backgroundRes) {
            this.backgroundRes = backgroundRes;
            return this;
        }

        public Builder backgroundDark(@ColorRes int backgroundDarkRes) {
            this.backgroundDarkRes = backgroundDarkRes;
            return this;
        }

        public Builder replacedle(CharSequence replacedle) {
            this.replacedle = replacedle;
            this.replacedleRes = 0;
            return this;
        }

        public Builder replacedleHtml(String replacedleHtml) {
            this.replacedle = Html.fromHtml(replacedleHtml);
            this.replacedleRes = 0;
            return this;
        }

        public Builder replacedle(@StringRes int replacedleRes) {
            this.replacedleRes = replacedleRes;
            this.replacedle = null;
            return this;
        }

        public Builder description(CharSequence description) {
            this.description = description;
            this.descriptionRes = 0;
            return this;
        }

        public Builder descriptionHtml(String descriptionHtml) {
            this.description = Html.fromHtml(descriptionHtml);
            this.descriptionRes = 0;
            return this;
        }

        public Builder description(@StringRes int descriptionRes) {
            this.descriptionRes = descriptionRes;
            this.description = null;
            return this;
        }

        public Builder image(@DrawableRes int imageRes) {
            this.imageRes = imageRes;
            return this;
        }

        public Builder layout(@LayoutRes int layoutRes) {
            this.layoutRes = layoutRes;
            return this;
        }

        public Builder scrollable(boolean scrollable) {
            this.layoutRes = scrollable ? R.layout.fragment_simple_slide_scrollable : R.layout.fragment_simple_slide;
            return this;
        }

        public Builder canGoForward(boolean canGoForward) {
            this.canGoForward = canGoForward;
            return this;
        }

        public Builder canGoBackward(boolean canGoBackward) {
            this.canGoBackward = canGoBackward;
            return this;
        }

        public Builder permissions(String[] permissions) {
            this.permissions = permissions;
            return this;
        }

        public Builder permission(String permission) {
            this.permissions = new String[] { permission };
            return this;
        }

        public Builder permissionsRequestCode(int permissionsRequestCode) {
            this.permissionsRequestCode = permissionsRequestCode;
            return this;
        }

        public SimpleSlide build() {
            return new SimpleSlide(this);
        }
    }

    public static clreplaced SimpleSlideFragment extends SlideFragment {

        private static final String ARGUMENT_replacedLE = "com.heinrichreimersoftware.materialintro.SimpleFragment.ARGUMENT_replacedLE";

        private static final String ARGUMENT_replacedLE_RES = "com.heinrichreimersoftware.materialintro.SimpleFragment.ARGUMENT_replacedLE_RES";

        private static final String ARGUMENT_DESCRIPTION = "com.heinrichreimersoftware.materialintro.SimpleFragment.ARGUMENT_DESCRIPTION";

        private static final String ARGUMENT_DESCRIPTION_RES = "com.heinrichreimersoftware.materialintro.SimpleFragment.ARGUMENT_DESCRIPTION_RES";

        private static final String ARGUMENT_IMAGE_RES = "com.heinrichreimersoftware.materialintro.SimpleFragment.ARGUMENT_IMAGE_RES";

        private static final String ARGUMENT_BACKGROUND_RES = "com.heinrichreimersoftware.materialintro.SimpleFragment.ARGUMENT_BACKGROUND_RES";

        private static final String ARGUMENT_BACKGROUND_DARK_RES = "com.heinrichreimersoftware.materialintro.SimpleFragment.ARGUMENT_BACKGROUND_DARK_RES";

        private static final String ARGUMENT_LAYOUT_RES = "com.heinrichreimersoftware.materialintro.SimpleFragment.ARGUMENT_LAYOUT_RES";

        private static final String ARGUMENT_PERMISSIONS = "com.heinrichreimersoftware.materialintro.SimpleFragment.ARGUMENT_PERMISSIONS";

        private static final String ARGUMENT_PERMISSIONS_REQUEST_CODE = "com.heinrichreimersoftware.materialintro.SimpleFragment.ARGUMENT_PERMISSIONS_REQUEST_CODE";

        private Button buttonGrantPermissions;

        private String[] permissions = null;

        public SimpleSlideFragment() {
        }

        public static SimpleSlideFragment newInstance(CharSequence replacedle, @StringRes int replacedleRes, CharSequence description, @StringRes int descriptionRes, @DrawableRes int imageRes, @ColorRes int background, @ColorRes int backgroundDark, @LayoutRes int layout, String[] permissions, int permissionsRequestCode) {
            SimpleSlideFragment fragment = new SimpleSlideFragment();
            Bundle arguments = new Bundle();
            arguments.putCharSequence(ARGUMENT_replacedLE, replacedle);
            arguments.putInt(ARGUMENT_replacedLE_RES, replacedleRes);
            arguments.putCharSequence(ARGUMENT_DESCRIPTION, description);
            arguments.putInt(ARGUMENT_DESCRIPTION_RES, descriptionRes);
            arguments.putInt(ARGUMENT_IMAGE_RES, imageRes);
            arguments.putInt(ARGUMENT_BACKGROUND_RES, background);
            arguments.putInt(ARGUMENT_BACKGROUND_DARK_RES, backgroundDark);
            arguments.putInt(ARGUMENT_LAYOUT_RES, layout);
            arguments.putStringArray(ARGUMENT_PERMISSIONS, permissions);
            arguments.putInt(ARGUMENT_PERMISSIONS_REQUEST_CODE, permissionsRequestCode);
            fragment.setArguments(arguments);
            return fragment;
        }

        @Override
        public void onAttach(Context context) {
            super.onAttach(context);
            Bundle arguments = getArguments();
            String[] newPermissions = arguments.getStringArray(ARGUMENT_PERMISSIONS);
            updatePermissions(newPermissions != null ? newPermissions : permissions);
        }

        @Override
        public void onCreate(@Nullable Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setRetainInstance(true);
        }

        @Override
        public void onResume() {
            super.onResume();
            // Lock scroll for the case that users revoke accepted permission settings while in the intro
            updatePermissions();
            updateNavigation();
        }

        @Override
        public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
            Bundle arguments = getArguments();
            View fragment = inflater.inflate(arguments.getInt(ARGUMENT_LAYOUT_RES, R.layout.fragment_simple_slide), container, false);
            TextView replacedleView = (TextView) fragment.findViewById(R.id.mi_replacedle);
            TextView descriptionView = (TextView) fragment.findViewById(R.id.mi_description);
            buttonGrantPermissions = (Button) fragment.findViewById(R.id.mi_button_grant_permissions);
            ImageView imageView = (ImageView) fragment.findViewById(R.id.mi_image);
            CharSequence replacedle = arguments.getCharSequence(ARGUMENT_replacedLE);
            int replacedleRes = arguments.getInt(ARGUMENT_replacedLE_RES);
            CharSequence description = arguments.getCharSequence(ARGUMENT_DESCRIPTION);
            int descriptionRes = arguments.getInt(ARGUMENT_DESCRIPTION_RES);
            int imageRes = arguments.getInt(ARGUMENT_IMAGE_RES);
            int backgroundRes = arguments.getInt(ARGUMENT_BACKGROUND_RES);
            int backgroundDarkRes = arguments.getInt(ARGUMENT_BACKGROUND_DARK_RES);
            // replacedle
            if (replacedleView != null) {
                if (replacedle != null) {
                    replacedleView.setText(replacedle);
                    replacedleView.setVisibility(View.VISIBLE);
                } else if (replacedleRes != 0) {
                    replacedleView.setText(replacedleRes);
                    replacedleView.setVisibility(View.VISIBLE);
                } else {
                    replacedleView.setVisibility(View.GONE);
                }
            }
            // Description
            if (descriptionView != null) {
                if (description != null) {
                    descriptionView.setText(description);
                    descriptionView.setVisibility(View.VISIBLE);
                } else if (descriptionRes != 0) {
                    descriptionView.setText(descriptionRes);
                    descriptionView.setVisibility(View.VISIBLE);
                } else {
                    descriptionView.setVisibility(View.GONE);
                }
            }
            // Image
            if (imageView != null) {
                if (imageRes != 0) {
                    imageView.setImageResource(imageRes);
                    imageView.setVisibility(View.VISIBLE);
                } else {
                    imageView.setVisibility(View.GONE);
                }
            }
            if (backgroundDarkRes != 0 && buttonGrantPermissions != null) {
                ViewCompat.setBackgroundTintList(buttonGrantPermissions, ColorStateList.valueOf(ContextCompat.getColor(getContext(), backgroundDarkRes)));
            }
            @ColorInt
            int textColorPrimary;
            @ColorInt
            int textColorSecondary;
            if (backgroundRes != 0 && ColorUtils.calculateLuminance(ContextCompat.getColor(getContext(), backgroundRes)) < 0.6) {
                // Use light text color
                textColorPrimary = ContextCompat.getColor(getContext(), R.color.mi_text_color_primary_dark);
                textColorSecondary = ContextCompat.getColor(getContext(), R.color.mi_text_color_secondary_dark);
            } else {
                // Use dark text color
                textColorPrimary = ContextCompat.getColor(getContext(), R.color.mi_text_color_primary_light);
                textColorSecondary = ContextCompat.getColor(getContext(), R.color.mi_text_color_secondary_light);
            }
            if (replacedleView != null) {
                replacedleView.setTextColor(textColorPrimary);
            }
            if (descriptionView != null) {
                descriptionView.setTextColor(textColorSecondary);
            }
            if (buttonGrantPermissions != null) {
                buttonGrantPermissions.setTextColor(textColorPrimary);
            }
            return fragment;
        }

        private void updatePermissions() {
            updatePermissions(permissions);
        }

        private synchronized void updatePermissions(@Nullable String[] newPermissions) {
            if (newPermissions != null) {
                final List<String> permissionsNotGranted = new ArrayList<>();
                for (String permission : newPermissions) {
                    if (ContextCompat.checkSelfPermission(getActivity(), permission) != PackageManager.PERMISSION_GRANTED) {
                        permissionsNotGranted.add(permission);
                    }
                }
                if (permissionsNotGranted.size() > 0) {
                    this.permissions = permissionsNotGranted.toArray(new String[permissionsNotGranted.size()]);
                    if (buttonGrantPermissions != null) {
                        buttonGrantPermissions.setVisibility(View.VISIBLE);
                        buttonGrantPermissions.setText(getResources().getQuanreplacedyText(R.plurals.mi_label_grant_permission, permissionsNotGranted.size()));
                        buttonGrantPermissions.setOnClickListener(new View.OnClickListener() {

                            @Override
                            public void onClick(View v) {
                                int permissionsRequestCode = getArguments() == null ? DEFAULT_PERMISSIONS_REQUEST_CODE : getArguments().getInt(ARGUMENT_PERMISSIONS_REQUEST_CODE, DEFAULT_PERMISSIONS_REQUEST_CODE);
                                ActivityCompat.requestPermissions(getActivity(), permissions, permissionsRequestCode);
                            }
                        });
                    }
                } else {
                    this.permissions = null;
                    if (buttonGrantPermissions != null) {
                        buttonGrantPermissions.setVisibility(View.GONE);
                    }
                }
            } else {
                this.permissions = null;
                if (buttonGrantPermissions != null) {
                    buttonGrantPermissions.setVisibility(View.GONE);
                }
            }
        }

        @Override
        public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
            int permissionsRequestCode = getArguments() == null ? DEFAULT_PERMISSIONS_REQUEST_CODE : getArguments().getInt(ARGUMENT_PERMISSIONS_REQUEST_CODE, DEFAULT_PERMISSIONS_REQUEST_CODE);
            if (requestCode == permissionsRequestCode) {
                updatePermissions();
                updateNavigation();
            }
        }

        @Override
        public synchronized boolean canGoForward() {
            final List<String> permissionsNotGranted = new ArrayList<>();
            if (permissions != null) {
                for (String permission : permissions) {
                    if (getActivity() == null || ContextCompat.checkSelfPermission(getActivity(), permission) != PackageManager.PERMISSION_GRANTED) {
                        permissionsNotGranted.add(permission);
                    }
                }
            }
            return permissionsNotGranted.size() <= 0;
        }
    }
}

18 Source : FragmentSlide.java
with MIT License
from PuffOpenSource

public clreplaced FragmentSlide extends RestorableSlide {

    private Fragment fragment;

    @ColorRes
    private final int background;

    @ColorRes
    private final int backgroundDark;

    private final boolean canGoForward;

    private final boolean canGoBackward;

    private FragmentSlide(Builder builder) {
        fragment = builder.fragment;
        background = builder.background;
        backgroundDark = builder.backgroundDark;
        canGoForward = builder.canGoForward;
        canGoBackward = builder.canGoBackward;
    }

    @Override
    public Fragment getFragment() {
        return fragment;
    }

    @Override
    public void setFragment(Fragment fragment) {
        this.fragment = fragment;
    }

    @Override
    public int getBackground() {
        return background;
    }

    @Override
    public int getBackgroundDark() {
        return backgroundDark;
    }

    @Override
    public boolean canGoForward() {
        if (getFragment() instanceof SlideFragment) {
            return ((SlideFragment) getFragment()).canGoForward();
        }
        return canGoForward;
    }

    @Override
    public boolean canGoBackward() {
        if (getFragment() instanceof SlideFragment) {
            return ((SlideFragment) getFragment()).canGoBackward();
        }
        return canGoBackward;
    }

    public static clreplaced Builder {

        private Fragment fragment;

        @ColorRes
        private int background;

        @ColorRes
        private int backgroundDark = 0;

        private boolean canGoForward = true;

        private boolean canGoBackward = true;

        public Builder fragment(Fragment fragment) {
            this.fragment = fragment;
            return this;
        }

        public Builder fragment(@LayoutRes int layoutRes, @StyleRes int themeRes) {
            this.fragment = FragmentSlideFragment.newInstance(layoutRes, themeRes);
            return this;
        }

        public Builder fragment(@LayoutRes int layoutRes) {
            this.fragment = FragmentSlideFragment.newInstance(layoutRes);
            return this;
        }

        public Builder background(@ColorRes int background) {
            this.background = background;
            return this;
        }

        public Builder backgroundDark(@ColorRes int backgroundDark) {
            this.backgroundDark = backgroundDark;
            return this;
        }

        public Builder canGoForward(boolean canGoForward) {
            this.canGoForward = canGoForward;
            return this;
        }

        public Builder canGoBackward(boolean canGoBackward) {
            this.canGoBackward = canGoBackward;
            return this;
        }

        public FragmentSlide build() {
            if (background == 0 || fragment == null)
                throw new IllegalArgumentException("You must set at least a fragment and background.");
            return new FragmentSlide(this);
        }
    }

    public static clreplaced FragmentSlideFragment extends Fragment {

        private static final String ARGUMENT_LAYOUT_RES = "com.heinrichreimersoftware.materialintro.SimpleFragment.ARGUMENT_LAYOUT_RES";

        private static final String ARGUMENT_THEME_RES = "com.heinrichreimersoftware.materialintro.SimpleFragment.ARGUMENT_THEME_RES";

        public FragmentSlideFragment() {
        }

        public static FragmentSlideFragment newInstance(@LayoutRes int layoutRes, @StyleRes int themeRes) {
            FragmentSlideFragment fragment = new FragmentSlideFragment();
            Bundle arguments = new Bundle();
            arguments.putInt(ARGUMENT_LAYOUT_RES, layoutRes);
            arguments.putInt(ARGUMENT_THEME_RES, themeRes);
            fragment.setArguments(arguments);
            return fragment;
        }

        public static FragmentSlideFragment newInstance(@LayoutRes int layoutRes) {
            return newInstance(layoutRes, 0);
        }

        @Override
        public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
            int themeRes = getArguments().getInt(ARGUMENT_THEME_RES);
            Context contextThemeWrapper;
            if (themeRes != 0) {
                contextThemeWrapper = new ContextThemeWrapper(getActivity(), themeRes);
            } else {
                contextThemeWrapper = getActivity();
            }
            LayoutInflater localInflater = inflater.cloneInContext(contextThemeWrapper);
            return localInflater.inflate(getArguments().getInt(ARGUMENT_LAYOUT_RES), container, false);
        }
    }
}

18 Source : IntroActivity.java
with MIT License
from PuffOpenSource

@ColorRes
protected int getBackground(int position) {
    return adapter.getBackground(position);
}

18 Source : IntroActivity.java
with MIT License
from PuffOpenSource

@ColorRes
protected int getBackgroundDark(int position) {
    return adapter.getBackgroundDark(position);
}

18 Source : ColorPreference.java
with GNU General Public License v3.0
from PowerExplorer

/**
 * Compatibility code for use zith legacy. Retrieves a ColorResource given its index in the availableColors array.
 * Used to load color preferences from the {@link SharedPreferences} object.
 *
 * @param colorIndex An index
 * @return The color with the given index.
 */
@Deprecated
@ColorRes
private static int getColorByIndex(int colorIndex) {
    return availableColors.get(colorIndex).intValue();
}

18 Source : MyApplication.java
with Apache License 2.0
from Kanghanbin

@ColorRes
private int getThemeColor(Context context, int color, String theme) {
    switch(color) {
        case 0xff2196F3:
            return context.getResources().getIdentifier(theme, "color", getPackageName());
        case 0xff1565C0:
            return context.getResources().getIdentifier(theme + "_dark", "color", getPackageName());
        case 0x99f0486c:
            return context.getResources().getIdentifier(theme + "_trans", "color", getPackageName());
    }
    return -1;
}

18 Source : ButtonsStyleConfig.java
with Apache License 2.0
from hss01248

/**
 * Created by Administrator on 2017/12/7.
 */
public clreplaced ButtonsStyleConfig {

    @StringRes
    public int btn1Text;

    @StringRes
    public int btn2Text;

    @StringRes
    public int btn3Text;

    @ColorRes
    public int btn1Color = DefaultConfig.iosBtnColor;

    @ColorRes
    public int btn2Color = DefaultConfig.mdBtnCancelColor;

    @ColorRes
    public int btn3Color = DefaultConfig.iosBtnColor;

    // in sp
    public int btnTxtSize = DefaultConfig.btnTxtSize;

    public boolean isTxtBold = false;

    public int getBtn1Text() {
        return btn1Text;
    }

    public int getBtn2Text() {
        return btn2Text;
    }

    public int getBtn3Text() {
        return btn3Text;
    }

    public int getBtn1Color() {
        return btn1Color;
    }

    public int getBtn2Color() {
        return btn2Color;
    }

    public int getBtn3Color() {
        return btn3Color;
    }

    public int getBtnTxtSize() {
        return btnTxtSize;
    }

    public boolean isTxtBold() {
        return isTxtBold;
    }

    private ButtonsStyleConfig(Builder builder) {
        btn1Text = builder.btn1Text;
        btn2Text = builder.btn2Text;
        btn3Text = builder.btn3Text;
        btn1Color = builder.btn1Color;
        btn2Color = builder.btn2Color;
        btn3Color = builder.btn3Color;
        btnTxtSize = builder.btnTxtSize;
        isTxtBold = builder.isTxtBold;
    }

    public static Builder newBuilder() {
        return new Builder();
    }

    public static Builder newBuilder(ButtonsStyleConfig copy) {
        Builder builder = new Builder();
        builder.btn1Text = copy.getBtn1Text();
        builder.btn2Text = copy.getBtn2Text();
        builder.btn3Text = copy.getBtn3Text();
        builder.btn1Color = copy.getBtn1Color();
        builder.btn2Color = copy.getBtn2Color();
        builder.btn3Color = copy.getBtn3Color();
        builder.btnTxtSize = copy.getBtnTxtSize();
        builder.isTxtBold = copy.isTxtBold();
        return builder;
    }

    public static final clreplaced Builder {

        private int btn1Text;

        private int btn2Text;

        private int btn3Text;

        private int btn1Color;

        private int btn2Color;

        private int btn3Color;

        private int btnTxtSize;

        private boolean isTxtBold;

        private Builder() {
        }

        public Builder btn1Text(int val) {
            btn1Text = val;
            return this;
        }

        public Builder btn2Text(int val) {
            btn2Text = val;
            return this;
        }

        public Builder btn3Text(int val) {
            btn3Text = val;
            return this;
        }

        public Builder btn1Color(int val) {
            btn1Color = val;
            return this;
        }

        public Builder btn2Color(int val) {
            btn2Color = val;
            return this;
        }

        public Builder btn3Color(int val) {
            btn3Color = val;
            return this;
        }

        public Builder btnTxtSize(int val) {
            btnTxtSize = val;
            return this;
        }

        public Builder isTxtBold(boolean val) {
            isTxtBold = val;
            return this;
        }

        public ButtonsStyleConfig build() {
            return new ButtonsStyleConfig(this);
        }
    }
}

18 Source : ListFragment.java
with Apache License 2.0
from gejiaheng

@Override
@ColorRes
public int toolbarBackground() {
    return R.color.protein_white;
}

18 Source : ClockDrawable.java
with Apache License 2.0
from evelyne24

/**
 * Created by evelina on 15/07/2016.
 */
public clreplaced ClockDrawable extends Drawable implements Animatable {

    private final static int ANIMATION_DURATION = 500;

    @ColorRes
    private static final int FACE_COLOR = android.R.color.white;

    @ColorRes
    private static final int RIM_COLOR = R.color.colorAccent;

    private final Paint facePaint;

    private final Paint rimPaint;

    private final ValueAnimator minAnimator;

    private final ValueAnimator hourAnimator;

    private float rimRadius;

    private float faceRadius;

    private float screwRadius;

    private final Path hourHandPath;

    private final Path minuteHandPath;

    private float remainingHourRotation = 0f;

    private float remainingMinRotation = 0f;

    private float targetHourRotation = 0f;

    private float targetMinRotation = 0f;

    private float currentHourRotation = 0f;

    private float currentMinRotation;

    private boolean hourAnimInterrupted;

    private boolean minAnimInterrupted;

    private LocalDateTime previousTime;

    private boolean animateDays = true;

    public ClockDrawable(Resources resources) {
        facePaint = new Paint(ANTI_ALIAS_FLAG);
        facePaint.setColor(resources.getColor(FACE_COLOR));
        facePaint.setStyle(FILL);
        rimPaint = new Paint(ANTI_ALIAS_FLAG);
        rimPaint.setColor(resources.getColor(RIM_COLOR));
        rimPaint.setStyle(STROKE);
        rimPaint.setStrokeCap(ROUND);
        rimPaint.setStrokeWidth(resources.getDimension(R.dimen.clock_stroke_width));
        hourHandPath = new Path();
        minuteHandPath = new Path();
        hourAnimator = ValueAnimator.ofFloat(0, 0);
        hourAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
        hourAnimator.setDuration(ANIMATION_DURATION);
        hourAnimator.addUpdateListener(new AnimatorUpdateListener() {

            @Override
            public void onAnimationUpdate(ValueAnimator valueAnimator) {
                float fraction = (float) valueAnimator.getAnimatedValue();
                // d("ANIM", "Hfraction = " + fraction + ", remaining hour rotation = " + remainingHourRotation);
                remainingHourRotation = targetHourRotation - fraction;
                currentHourRotation = fraction;
                invalidateSelf();
            }
        });
        hourAnimator.addListener(new AnimatorListenerAdapter() {

            @Override
            public void onAnimationEnd(Animator animation) {
                if (!hourAnimInterrupted) {
                    remainingHourRotation = 0f;
                }
            // i("ANIM", "END! remaining hour rotation = " + remainingHourRotation);
            }
        });
        minAnimator = ValueAnimator.ofFloat(0, 0);
        minAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
        minAnimator.setDuration(ANIMATION_DURATION);
        minAnimator.addUpdateListener(new AnimatorUpdateListener() {

            @Override
            public void onAnimationUpdate(ValueAnimator valueAnimator) {
                float fraction = (float) valueAnimator.getAnimatedValue();
                // d("ANIM", "Mfraction = " + fraction + ", remaining minute rotation = " + remainingMinRotation);
                remainingMinRotation = targetMinRotation - fraction;
                currentMinRotation = fraction;
                invalidateSelf();
            }
        });
        minAnimator.addListener(new AnimatorListenerAdapter() {

            @Override
            public void onAnimationEnd(Animator animation) {
                if (!minAnimInterrupted) {
                    remainingMinRotation = 0f;
                }
            // i("ANIM", "END! remaining minute rotation = " + remainingMinRotation);
            }
        });
        previousTime = LocalDateTime.now().withTime(0, 0, 0, 0);
    }

    @Override
    protected void onBoundsChange(Rect bounds) {
        super.onBoundsChange(bounds);
        rimRadius = Math.min(bounds.width(), bounds.height()) / 2f - rimPaint.getStrokeWidth();
        faceRadius = rimRadius - rimPaint.getStrokeWidth();
        screwRadius = rimPaint.getStrokeWidth() * 2;
        float hourHandLength = (float) (0.5 * faceRadius);
        float minuteHandLength = (float) (0.7 * faceRadius);
        float top = bounds.centerY() - screwRadius;
        hourHandPath.reset();
        hourHandPath.moveTo(bounds.centerX(), bounds.centerY());
        hourHandPath.addRect(bounds.centerX(), top, bounds.centerX(), top - hourHandLength, Direction.CCW);
        hourHandPath.close();
        minuteHandPath.reset();
        minuteHandPath.moveTo(bounds.centerX(), bounds.centerY());
        minuteHandPath.addRect(bounds.centerX(), top, bounds.centerX(), top - minuteHandLength, Direction.CCW);
        minuteHandPath.close();
    }

    @Override
    public void draw(Canvas canvas) {
        Rect bounds = getBounds();
        // draw the outer rim of the clock
        canvas.drawCircle(bounds.centerX(), bounds.centerY(), rimRadius, rimPaint);
        // draw the face of the clock
        canvas.drawCircle(bounds.centerX(), bounds.centerY(), faceRadius, facePaint);
        // draw the little rim in the middle of the clock
        canvas.drawCircle(bounds.centerX(), bounds.centerY(), screwRadius, rimPaint);
        int saveCount = canvas.save();
        canvas.rotate(currentHourRotation, bounds.centerX(), bounds.centerY());
        // draw hour hand
        canvas.drawPath(hourHandPath, rimPaint);
        canvas.restoreToCount(saveCount);
        saveCount = canvas.save();
        canvas.rotate(currentMinRotation, bounds.centerX(), bounds.centerY());
        // draw minute hand
        canvas.drawPath(minuteHandPath, rimPaint);
        canvas.restoreToCount(saveCount);
    }

    @Override
    public void setAlpha(int alpha) {
        rimPaint.setAlpha(alpha);
        facePaint.setAlpha(alpha);
        invalidateSelf();
    }

    @Override
    public void setColorFilter(ColorFilter colorFilter) {
        rimPaint.setColorFilter(colorFilter);
        invalidateSelf();
    }

    @Override
    public int getOpacity() {
        return PixelFormat.OPAQUE;
    }

    @Override
    public void start() {
        hourAnimInterrupted = false;
        minAnimInterrupted = false;
        hourAnimator.start();
        minAnimator.start();
    }

    public void setAnimateDays(boolean animateDays) {
        this.animateDays = animateDays;
    }

    public void start(LocalDateTime newTime) {
        int minDiff = getMinsBetween(previousTime, newTime);
        // 60min ... 360grade
        // minDif .. minDelta
        float minDeltaRotation = ((float) minDiff * 360f) / 60f;
        // 720min ... 360grade = 12h ... 360grade
        // minDif ... hourDelta
        float hourDeltaRotation = ((float) minDiff * 360f) / 720f;
        remainingMinRotation += minDeltaRotation;
        remainingHourRotation += hourDeltaRotation;
        d("ANIM", "current hour rotation = " + currentHourRotation + ", current min rotation = " + currentMinRotation);
        if (isRunning()) {
            stop();
        }
        targetHourRotation = currentHourRotation + remainingHourRotation;
        hourAnimator.setFloatValues(currentHourRotation, targetHourRotation);
        targetMinRotation = currentMinRotation + remainingMinRotation;
        minAnimator.setFloatValues(currentMinRotation, targetMinRotation);
        start();
        previousTime = newTime;
    }

    @Override
    public void stop() {
        hourAnimInterrupted = true;
        minAnimInterrupted = true;
        hourAnimator.cancel();
        minAnimator.cancel();
    }

    @Override
    public boolean isRunning() {
        return hourAnimator.isRunning() || minAnimator.isRunning();
    }

    private int getMinsBetween(LocalDateTime t1, LocalDateTime t2) {
        if (animateDays) {
            return minutesBetween(t1, t2).getMinutes();
        }
        return minutesBetween(t1, t2.withDate(t1.getYear(), t1.getMonthOfYear(), t1.getDayOfMonth())).getMinutes();
    }
}

18 Source : ShowCaseStep.java
with Apache License 2.0
from dimorinny

public clreplaced ShowCaseStep {

    private ShowCasePosition position;

    private ShowCaseRadius radius;

    private String message;

    @ColorRes
    private int color;

    public ShowCasePosition getPosition() {
        return position;
    }

    public ShowCaseRadius getRadius() {
        return radius;
    }

    public String getMessage() {
        return message;
    }

    @ColorRes
    public int getColor() {
        return color;
    }

    public static clreplaced Builder {

        private final static int DEFAULT_RADIUS_DP = 70;

        private ShowCaseRadius radius;

        private ShowCasePosition position;

        private String message;

        @ColorRes
        private int color = R.color.black20;

        public ShowCaseStep.Builder withTypedRadius(ShowCaseRadius radius) {
            this.radius = radius;
            return this;
        }

        public ShowCaseStep.Builder withTypedPosition(ShowCasePosition position) {
            this.position = position;
            return this;
        }

        public ShowCaseStep.Builder withMessage(String message) {
            this.message = message;
            return this;
        }

        public ShowCaseStep.Builder withColor(@ColorRes int overlayColor) {
            color = overlayColor;
            return this;
        }

        public ShowCaseStep build(Context context) {
            checkRequiredFields();
            ShowCaseStep step = new ShowCaseStep();
            if (radius == null) {
                radius = new Radius(ViewUtils.convertDpToPx(context, DEFAULT_RADIUS_DP));
            }
            step.position = position;
            step.radius = radius;
            step.message = message;
            step.color = color;
            return step;
        }

        private void checkRequiredFields() {
            if (position == null) {
                throw new IllegalArgumentException("position is required field for ShowCaseStep builder");
            }
            if (message == null) {
                throw new IllegalArgumentException("message is required field for ShowCaseStep builder");
            }
        }
    }
}

17 Source : HeroVideoApp.java
with Apache License 2.0
from WeDevelopTeam

@ColorRes
private int getThemeColor(Context context, int color, String theme) {
    switch(color) {
        case 0xfffb7299:
            return context.getResources().getIdentifier(theme, "color", getPackageName());
        case 0xffb85671:
            return context.getResources().getIdentifier(theme + "_dark", "color", getPackageName());
        case 0x99f0486c:
            return context.getResources().getIdentifier(theme + "_trans", "color", getPackageName());
    }
    return -1;
}

17 Source : HeroVideoApp.java
with Apache License 2.0
from WeDevelopTeam

@ColorRes
private int getThemeColorId(Context context, int colorId, String theme) {
    switch(colorId) {
        case R.color.theme_color_primary:
            return context.getResources().getIdentifier(theme, "color", getPackageName());
        case R.color.theme_color_primary_dark:
            return context.getResources().getIdentifier(theme + "_dark", "color", getPackageName());
        case R.color.theme_color_primary_trans:
            return context.getResources().getIdentifier(theme + "_trans", "color", getPackageName());
    }
    return colorId;
}

17 Source : FancyWalkthroughCard.java
with Apache License 2.0
from Shashank02051997

public clreplaced FancyWalkthroughCard {

    public String replacedle;

    public String description;

    public Drawable imageResource;

    @StringRes
    public int replacedleResourceId;

    @StringRes
    public int descriptionResourceId;

    @DrawableRes
    public int imageResourceId;

    @ColorRes
    public int replacedleColor;

    @ColorRes
    public int descriptionColor;

    @ColorRes
    public int backgroundColor;

    public float replacedleTextSize;

    public float descriptionTextSize;

    public int iconWidth, iconHeight, marginTop, marginLeft, marginRight, marginBottom;

    public FancyWalkthroughCard(String replacedle, String description) {
        this.replacedle = replacedle;
        this.description = description;
    }

    public FancyWalkthroughCard(int replacedle, int description) {
        this.replacedleResourceId = replacedle;
        this.descriptionResourceId = description;
    }

    public FancyWalkthroughCard(String replacedle, String description, int imageResourceId) {
        this.replacedle = replacedle;
        this.description = description;
        this.imageResourceId = imageResourceId;
    }

    public FancyWalkthroughCard(String replacedle, String description, Drawable imageResource) {
        this.replacedle = replacedle;
        this.description = description;
        this.imageResource = imageResource;
    }

    public FancyWalkthroughCard(int replacedle, int description, int imageResourceId) {
        this.replacedleResourceId = replacedle;
        this.descriptionResourceId = description;
        this.imageResourceId = imageResourceId;
    }

    public FancyWalkthroughCard(int replacedle, int description, Drawable imageResource) {
        this.replacedleResourceId = replacedle;
        this.descriptionResourceId = description;
        this.imageResource = imageResource;
    }

    public String getreplacedle() {
        return replacedle;
    }

    public int getreplacedleResourceId() {
        return replacedleResourceId;
    }

    public String getDescription() {
        return description;
    }

    public int getDescriptionResourceId() {
        return descriptionResourceId;
    }

    public int getreplacedleColor() {
        return replacedleColor;
    }

    public int getDescriptionColor() {
        return descriptionColor;
    }

    public void setreplacedleColor(int color) {
        this.replacedleColor = color;
    }

    public void setDescriptionColor(int color) {
        this.descriptionColor = color;
    }

    public void setImageResourceId(int imageResourceId) {
        this.imageResourceId = imageResourceId;
    }

    public int getImageResourceId() {
        return imageResourceId;
    }

    public float getreplacedleTextSize() {
        return replacedleTextSize;
    }

    public void setreplacedleTextSize(float replacedleTextSize) {
        this.replacedleTextSize = replacedleTextSize;
    }

    public float getDescriptionTextSize() {
        return descriptionTextSize;
    }

    public void setDescriptionTextSize(float descriptionTextSize) {
        this.descriptionTextSize = descriptionTextSize;
    }

    public int getBackgroundColor() {
        return backgroundColor;
    }

    public void setBackgroundColor(int backgroundColor) {
        this.backgroundColor = backgroundColor;
    }

    public int getIconWidth() {
        return iconWidth;
    }

    public void setIconLayoutParams(int iconWidth, int iconHeight, int marginTop, int marginLeft, int marginRight, int marginBottom) {
        this.iconWidth = iconWidth;
        this.iconHeight = iconHeight;
        this.marginLeft = marginLeft;
        this.marginRight = marginRight;
        this.marginTop = marginTop;
        this.marginBottom = marginBottom;
    }

    public int getIconHeight() {
        return iconHeight;
    }

    public int getMarginTop() {
        return marginTop;
    }

    public int getMarginLeft() {
        return marginLeft;
    }

    public int getMarginRight() {
        return marginRight;
    }

    public int getMarginBottom() {
        return marginBottom;
    }
}

17 Source : SelectionList.java
with MIT License
from playmusicexporter

/**
 * Selection list
 */
public abstract clreplaced SelectionList<T> {

    /**
     * The selected items
     */
    private List<T> mItems = new ArrayList<>();

    /**
     * The activity
     * We need the activity to show the action mode when some items are selected
     */
    private AppCompatActivity mActivity;

    /**
     * The action mode
     */
    private ActionMode mActionMode;

    /**
     * The callback for the action mode
     */
    private ActionMode.Callback mActionModeCallback;

    /**
     * Flag to not close the activity when action mode is closing
     */
    private boolean mDoNotCloseActionMode;

    public boolean getDoNotCloseActionMode() {
        return mDoNotCloseActionMode;
    }

    public void setDoNotCloseActionMode(boolean doNotCloseActionMode) {
        mDoNotCloseActionMode = doNotCloseActionMode;
    }

    /**
     * The colors
     */
    @ColorRes
    private int mResColorNormal;

    @ColorRes
    private int mResColorSelected;

    /**
     * Gets the activity
     * @return Returns the activity
     */
    public AppCompatActivity getActivity() {
        return mActivity;
    }

    /**
     * Sets the colors of the view.
     * Use @SuppressWarnings("ResourceAsColor") to prevent Lint errors
     * @param colorNormal Normal state
     * @param colorSelected Selected state
     */
    public void setColor(@ColorRes int colorNormal, @ColorRes int colorSelected) {
        mResColorNormal = colorNormal;
        mResColorSelected = colorSelected;
    }

    /**
     * Sets up the action mode for this selection list
     * @param activity The activity
     */
    public void setupActionMode(AppCompatActivity activity) {
        mActivity = activity;
        mActionModeCallback = createActionMode(activity);
        // Updates the action mode
        updateActionModeMenu();
    }

    /**
     * Set the selection state of the item
     * @param item The item
     * @param state The selection state
     */
    public void setSelected(T item, boolean state) {
        // Adds the item to the selection list
        if (state && !mItems.contains(item))
            mItems.add(item);
        // Removes the item from the selection list
        if (!state && mItems.contains(item))
            mItems.remove(item);
        // Updates the action mode
        updateActionModeMenu();
    }

    /**
     * Set the selection state of the item and change the item background
     * @param item The item
     * @param state The selection state
     * @param view The view
     */
    public void setSelected(T item, boolean state, View view) {
        // Set the selection state
        setSelected(item, state);
        if (view != null) {
            // Change the background
            if (state)
                view.setBackgroundColor(ContextCompat.getColor(view.getContext(), mResColorSelected));
            else
                view.setBackgroundColor(ContextCompat.getColor(view.getContext(), mResColorNormal));
        }
    }

    /**
     * Toggles the item
     * @param item The selected item
     * @return Returns whether the item is now selected
     */
    public boolean toggle(T item) {
        boolean state = isSelected(item);
        setSelected(item, !state);
        return !state;
    }

    /**
     * Toggles the item
     * @param item The selected item
     * @param view The view
     * @return Returns whether the item is now selected
     */
    public boolean toggle(T item, View view) {
        boolean state = isSelected(item);
        setSelected(item, !state, view);
        return !state;
    }

    /**
     * Gets all selected items
     * @return Returns a list with all selected items
     */
    public List<T> getSelectedItems() {
        return mItems;
    }

    /**
     * Clears the selection
     */
    public void clear() {
        clear(false);
    }

    /**
     * Clears the selection
     * @param doNotCloseActionMode Close the action mode?
     */
    public void clear(boolean doNotCloseActionMode) {
        mDoNotCloseActionMode = doNotCloseActionMode;
        mItems.clear();
        // Updates the action mode
        updateActionModeMenu();
        // Reset the flag
        mDoNotCloseActionMode = false;
    }

    /**
     * Clears the action mode
     */
    public void clearActionMode() {
        mActionMode = null;
    }

    /**
     * Call this after the view was created.
     * This will change the background color.
     * @param item The selected item
     * @param view The view
     */
    public void initView(T item, View view) {
        // Change the background
        if (isSelected(item))
            view.setBackgroundColor(ContextCompat.getColor(view.getContext(), mResColorSelected));
        else
            view.setBackgroundColor(ContextCompat.getColor(view.getContext(), mResColorNormal));
    }

    /**
     * Updates the action mode menu
     */
    private void updateActionModeMenu() {
        updateActionModeMenu(false);
    }

    /**
     * Updates the action mode menu
     * @param doNotCloseActivity Prevent the closing of the activity
     */
    private void updateActionModeMenu(boolean doNotCloseActivity) {
        // Null check
        if (mActionModeCallback != null && mActivity != null && !mActivity.isFinishing()) {
            // Some items are selected, shows the action mode
            if (mItems.size() > 0 && mActionMode == null) {
                mActionMode = mActivity.startSupportActionMode(mActionModeCallback);
            }
            // Close the action mode
            if (mItems.size() == 0 && mActionMode != null) {
                // Set mActionMode to null before call finish to prevent recursion
                ActionMode actionMode = mActionMode;
                mActionMode = null;
                // Close the action mode
                actionMode.finish();
            }
            // Set the text
            if (mActionMode != null) {
                // Update the action mode
                mActionMode.invalidate();
            }
        }
    }

    /**
     * This is called every time a new activity opens.
     * This method has to create a action mode callback
     * @param activity The new activity
     * @return Returns the action mode callback
     */
    protected abstract ActionMode.Callback createActionMode(AppCompatActivity activity);

    /**
     * Gets whether the item is selected
     * @param item The selected item
     * @return Returns true if the item is selected
     */
    public boolean isSelected(T item) {
        return mItems.contains(item);
    }
}

17 Source : InputStyleConfig.java
with Apache License 2.0
from hss01248

/**
 * Created by Administrator on 2017/12/7.
 */
public clreplaced InputStyleConfig {

    @StringRes
    public int hint1;

    @StringRes
    public int hint2;

    public CharSequence inputOriginal1;

    public CharSequence inputOriginal2;

    @StringRes
    public int tagTxt1;

    @StringRes
    public int tagTxt2;

    public boolean isInput2HideAsPreplacedword = true;

    public int inputTxtSize = DefaultConfig.inputTxtSize;

    @ColorRes
    public int inputTxtColor;

    @ColorRes
    public int hintTxtColor;

    @DrawableRes
    public int cursorResId;

    @DrawableRes
    public int editTextBg;

    public int editTextPaddingTopBottomInDp;

    public int editTextPaddingLeftRightInDp;
}

17 Source : AhoyOnboarderCard.java
with Apache License 2.0
from codemybrainsout

public clreplaced AhoyOnboarderCard {

    public String replacedle;

    public String description;

    public Drawable imageResource;

    @StringRes
    public int replacedleResourceId;

    @StringRes
    public int descriptionResourceId;

    @DrawableRes
    public int imageResourceId;

    @ColorRes
    public int replacedleColor;

    @ColorRes
    public int descriptionColor;

    @ColorRes
    public int backgroundColor;

    public float replacedleTextSize;

    public float descriptionTextSize;

    public int iconWidth, iconHeight, marginTop, marginLeft, marginRight, marginBottom;

    public AhoyOnboarderCard(String replacedle, String description) {
        this.replacedle = replacedle;
        this.description = description;
    }

    public AhoyOnboarderCard(int replacedle, int description) {
        this.replacedleResourceId = replacedle;
        this.descriptionResourceId = description;
    }

    public AhoyOnboarderCard(String replacedle, String description, int imageResourceId) {
        this.replacedle = replacedle;
        this.description = description;
        this.imageResourceId = imageResourceId;
    }

    public AhoyOnboarderCard(String replacedle, String description, Drawable imageResource) {
        this.replacedle = replacedle;
        this.description = description;
        this.imageResource = imageResource;
    }

    public AhoyOnboarderCard(int replacedle, int description, int imageResourceId) {
        this.replacedleResourceId = replacedle;
        this.descriptionResourceId = description;
        this.imageResourceId = imageResourceId;
    }

    public AhoyOnboarderCard(int replacedle, int description, Drawable imageResource) {
        this.replacedleResourceId = replacedle;
        this.descriptionResourceId = description;
        this.imageResource = imageResource;
    }

    public String getreplacedle() {
        return replacedle;
    }

    public int getreplacedleResourceId() {
        return replacedleResourceId;
    }

    public String getDescription() {
        return description;
    }

    public int getDescriptionResourceId() {
        return descriptionResourceId;
    }

    public int getreplacedleColor() {
        return replacedleColor;
    }

    public int getDescriptionColor() {
        return descriptionColor;
    }

    public void setreplacedleColor(int color) {
        this.replacedleColor = color;
    }

    public void setDescriptionColor(int color) {
        this.descriptionColor = color;
    }

    public void setImageResourceId(int imageResourceId) {
        this.imageResourceId = imageResourceId;
    }

    public int getImageResourceId() {
        return imageResourceId;
    }

    public float getreplacedleTextSize() {
        return replacedleTextSize;
    }

    public void setreplacedleTextSize(float replacedleTextSize) {
        this.replacedleTextSize = replacedleTextSize;
    }

    public float getDescriptionTextSize() {
        return descriptionTextSize;
    }

    public void setDescriptionTextSize(float descriptionTextSize) {
        this.descriptionTextSize = descriptionTextSize;
    }

    public int getBackgroundColor() {
        return backgroundColor;
    }

    public void setBackgroundColor(int backgroundColor) {
        this.backgroundColor = backgroundColor;
    }

    public int getIconWidth() {
        return iconWidth;
    }

    public void setIconLayoutParams(int iconWidth, int iconHeight, int marginTop, int marginLeft, int marginRight, int marginBottom) {
        this.iconWidth = iconWidth;
        this.iconHeight = iconHeight;
        this.marginLeft = marginLeft;
        this.marginRight = marginRight;
        this.marginTop = marginTop;
        this.marginBottom = marginBottom;
    }

    public int getIconHeight() {
        return iconHeight;
    }

    public int getMarginTop() {
        return marginTop;
    }

    public int getMarginLeft() {
        return marginLeft;
    }

    public int getMarginRight() {
        return marginRight;
    }

    public int getMarginBottom() {
        return marginBottom;
    }
}

See More Examples