本文整理汇总了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);
}
}
示例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;
}
}
示例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;
}
}
示例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;
}
}