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


Java Style.FRAME_KITKAT属性代码示例

本文整理汇总了Java中com.github.johnpersano.supertoasts.library.Style.FRAME_KITKAT属性的典型用法代码示例。如果您正苦于以下问题:Java Style.FRAME_KITKAT属性的具体用法?Java Style.FRAME_KITKAT怎么用?Java Style.FRAME_KITKAT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.github.johnpersano.supertoasts.library.Style的用法示例。


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

示例1: getBackground

/**
 * Returns a {@link GradientDrawable} with the
 * desired background color. If no {@link Style.Frame}
 * is set prior to calling this method, an appropriate {@link Style.Frame}
 * will be chosen based on the device's SDK level.
 *
 * @param style The current {@link Style}
 * @param color The desired color
 *
 * @return {@link GradientDrawable}
 */
public static Drawable getBackground(Style style, int color) {

    // If a frame has been manually set, return the appropriate background
    if (style.frame > 0) {
        switch (style.frame) {
            case Style.FRAME_STANDARD: return BackgroundUtils.getStandardBackground(color);
            case Style.FRAME_KITKAT: return BackgroundUtils.getKitkatBackground(color);
            case Style.FRAME_LOLLIPOP: return BackgroundUtils.getLollipopBackground(color);
        }
    }

    // The frame has NOT been manually set so set the frame to correspond with SDK level
    final int sdkVersion = Build.VERSION.SDK_INT;

    // These statements should be ordered by highest SDK level to lowest
    if (sdkVersion >= Build.VERSION_CODES.LOLLIPOP) {
        style.frame = Style.FRAME_LOLLIPOP;
        return BackgroundUtils.getLollipopBackground(color);
    } else if (sdkVersion >= Build.VERSION_CODES.KITKAT) {
        style.frame = Style.FRAME_KITKAT;
        return BackgroundUtils.getKitkatBackground(color);
    } else {
        style.frame = Style.FRAME_STANDARD;
        return BackgroundUtils.getStandardBackground(color);
    }
}
 
开发者ID:heshshark,项目名称:ToastUI,代码行数:37,代码来源:BackgroundUtils.java

示例2: getXPFrame

public static int getXPFrame(XSharedPreferences xperf) {
    switch (xperf.getInt(Common.KEY_TOAST_FRAME,0)) {
        case 0: return Style.FRAME_LOLLIPOP;
        case 1: return Style.FRAME_STANDARD;
        case 2: return Style.FRAME_KITKAT;
        default: return Style.FRAME_LOLLIPOP;
    }
}
 
开发者ID:heshshark,项目名称:ToastUI,代码行数:8,代码来源:AttributeUtils.java

示例3: getFrame

public static int getFrame(Context context) {
    switch (PreferenceManager.getDefaultSharedPreferences(context).getInt(context
            .getResources().getString(R.string.frame_title), 0)) {
        case 0: return Style.FRAME_STANDARD;
        case 1: return Style.FRAME_KITKAT;
        case 2: return Style.FRAME_LOLLIPOP;
        default: return Style.FRAME_STANDARD;
    }
}
 
开发者ID:JohnPersano,项目名称:SuperToasts,代码行数:9,代码来源:AttributeUtils.java

示例4: getButtonBackgroundResource

/**
 * Returns a background resource for the Button in a
 * {@link com.github.johnpersano.supertoasts.library.SuperActivityToast}.
 * This Button resource will correspond to the corner radii of the
 * {@link Style.Frame}.
 *
 * @param frame The current {@link Style.Frame}
 * @return The corresponding Drawable reference
 */
public static int getButtonBackgroundResource(@Style.Frame int frame) {
    switch (frame) {
        case Style.FRAME_LOLLIPOP: return R.drawable.selector_button_lollipop;
        case Style.FRAME_KITKAT: return R.drawable.selector_button_kitkat;
        case Style.FRAME_STANDARD: return R.drawable.selector_button_standard;
        default: return R.drawable.selector_button_standard;
    }
}
 
开发者ID:heshshark,项目名称:ToastUI,代码行数:17,代码来源:BackgroundUtils.java


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