项目:Ariana
文件:Ariana.java
public static Drawable drawable(final int[] colorBoxes,final float[] position,final GradientAngle gradientAngle) {
ShapeDrawable.ShaderFactory shaderFactory = new ShapeDrawable.ShaderFactory() {
@Override
public Shader resize(int width,int height) {
AngleCoordinate ac = AngleCoordinate.getAngleCoordinate(gradientAngle,width,height);
LinearGradient linearGradient = new LinearGradient(ac.x1,ac.y1,ac.x2,ac.y2,colorBoxes,position,Shader.TileMode.REPEAT);
return linearGradient;
}
};
PaintDrawable paint = new PaintDrawable();
paint.setShape(new RectShape());
paint.setShaderFactory(shaderFactory);
return paint;
}
public ActionBarButtonBackground(int accentHeight,int strokeWidth,Integer strokeColor,Integer accentColor,Integer fillColor,Integer highlightColor,ActionBarOptions.ColorLayout colorLayout) {
super(new Drawable[] {
new PaintDrawable((strokeColor == null) ? DEFAULT_stroke_COLOR : strokeColor),new PaintDrawable((accentColor == null) ? DEFAULT_ACCENT_COLOR : accentColor),new PaintDrawable((highlightColor == null) ? DEFAULT_HIGHLIGHT_COLOR : highlightColor),new PaintDrawable((fillColor == null) ? DEFAULT_FILL_COLOR : fillColor)});
if(colorLayout.equals(ColorLayout.TOP)) {
setLayerInset(1,strokeWidth,0);
setLayerInset(2,accentHeight+strokeWidth,0);
setLayerInset(3,strokeWidth);
}
else {
setLayerInset(1,strokeWidth);
setLayerInset(2,accentHeight+strokeWidth);
setLayerInset(3,accentHeight+strokeWidth);
}
}
项目:NyaungUConverter
文件:FlatUI.java
/**
* Returns a suitable drawable for ActionBar with theme colors.
*
* @param theme selected theme
* @param dark boolean for choosing dark colors or primary colors
* @param borderBottom bottom border width
* @return drawable to be used in ActionBar
*/
public static Drawable getActionBarDrawable(Activity activity,int theme,boolean dark,float borderBottom) {
int[] colors = activity.getResources().getIntArray(theme);
int color1 = colors[2];
int color2 = colors[1];
if (dark) {
color1 = colors[1];
color2 = colors[0];
}
borderBottom = dipToPx(activity,borderBottom);
PaintDrawable front = new PaintDrawable(color1);
PaintDrawable bottom = new PaintDrawable(color2);
Drawable[] d = {bottom,front};
LayerDrawable drawable = new LayerDrawable(d);
drawable.setLayerInset(1,(int) borderBottom);
return drawable;
}
项目:Genius-Android
文件:Ui.java
/**
* Returns a suitable drawable for ActionBar with theme colors.
*
* @param theme selected theme
* @param dark boolean for choosing dark colors or primary colors
* @param borderBottom bottom border width
* @return drawable to be used in ActionBar
*/
public static Drawable getActionBarDrawable(Activity activity,(int) borderBottom);
return drawable;
}
项目:Genius-Android
文件:GeniusUI.java
/**
* Returns a suitable drawable for ActionBar with theme colors.
*
* @param theme selected theme
* @param dark boolean for choosing dark colors or primary colors
* @param borderBottom bottom border width
* @return drawable to be used in ActionBar
*/
public static Drawable getActionBarDrawable(Activity activity,(int) borderBottom);
return drawable;
}
/**
* Returns a suitable drawable for ActionBar with theme colors.
*
* @param theme selected theme
* @param dark boolean for choosing dark colors or primary colors
* @param borderBottom bottom border width
* @return drawable to be used in ActionBar
*/
public static Drawable getActionBarDrawable(Activity activity,(int) borderBottom);
return drawable;
}
项目:indoorlib
文件:MapScrollView.java
/**
* @param context
* @param zoomController
*/
private void makeZoomLabel(Context context,ZoomButtonsController zoomController) {
ViewGroup container = zoomController.getContainer();
View controls = zoomController.getZoomControls();
LayoutParams p0 = controls.getLayoutParams();
container.removeView(controls);
LinearLayout layout = new LinearLayout(context);
layout.setorientation(LinearLayout.VERTICAL);
mZoomLabel = new TextView(context);
mZoomLabel.setPadding(12,12,0);
mZoomLabel.setTypeface(Typeface.DEFAULT_BOLD);
mZoomLabel.setTextColor(0xff000000);
PaintDrawable d = new PaintDrawable(0xeeffffff);
d.setCornerRadius(6);
mZoomLabel.setBackgroundDrawable(d);
mZoomLabel.setTextSize(20);
mZoomLabel.setG@R_404_6110@ty(G@R_404[email protected]_HORIZONTAL);
LinearLayout.LayoutParams p1 = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
p1.g@R_404_6110@ty = G@R_404[email protected]_HORIZONTAL;
layout.addView(mZoomLabel,p1);
layout.addView(controls);
container.addView(layout,p0);
}
项目:Demos
文件:FillBlankView.java
@Override
public void onClick(final View widget) {
View view = LayoutInflater.from(context).inflate(R.layout.layout_input,null);
final EditText etInput = (EditText) view.findViewById(R.id.et_answer);
Button btnFillBlank = (Button) view.findViewById(R.id.btn_fill_blank);
// 显示原有答案
String oldAnswer = answerList.get(position);
if (!TextUtils.isEmpty(oldAnswer)) {
etInput.setText(oldAnswer);
etInput.setSelection(oldAnswer.length());
}
final PopupWindow popupWindow = new PopupWindow(view,LayoutParams.MATCH_PARENT,dp2px(40));
// 获取焦点
popupWindow.setFocusable(true);
// 为了防止弹出菜单获取焦点之后,点击Activity的其他组件没有响应
popupWindow.setBackgroundDrawable(new PaintDrawable());
// 设置PopupWindow在软键盘的上方
popupWindow.setSoftInputMode(WindowManager.LayoutParams.soFT_INPUT_ADJUST_RESIZE);
// 弹出PopupWindow
popupWindow.showAtLocation(tvContent,G@R_404[email protected]ottOM,0);
btnFillBlank.setonClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// 填写答案
String answer = etInput.getText().toString();
fillAnswer(answer,position);
popupWindow.dismiss();
}
});
// 显示软键盘
InputMethodManager inputMethodManager =
(InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
inputMethodManager.toggleSoftInput(0,InputMethodManager.HIDE_NOT_ALWAYS);
}
项目:TreebolicLib
文件:splitpanelayout.java
/**
* Basic constructor
*
* @param context context
*/
public splitpanelayout(final Context context)
{
super(context);
this.orientation = splitpanelayout.ORIENTATION_HORIZONTAL;
this.splitterPositionPercent = 0.5f;
this.splitterPosition = Integer.MIN_VALUE;
this.splitterDrawable = new PaintDrawable(SPLITTER_COLOR);
this.splitterDraggingDrawable = new PaintDrawable(SPLITTER_DRAG_COLOR);
}
protected Drawable makeDefaultBackground() {
PaintDrawable shadow = new PaintDrawable(bottomColor);
PaintDrawable highlight = new PaintDrawable(topColor);
PaintDrawable surface = new PaintDrawable(bgColor);
LayerDrawable layers = new LayerDrawable(new Drawable[] {shadow,highlight,surface});
layers.setLayerInset(0,0);
layers.setLayerInset(1,1);
layers.setLayerInset(2,1,1);
return layers;
}
项目:BlendedBackground
文件:Gradient.java
private Drawable createDrawableFrom(ShapeDrawable.ShaderFactory sf) {
PaintDrawable p = new PaintDrawable();
p.setShape(new RectShape());
p.setShaderFactory(sf);
return p;
}
项目:DiaryMemo
文件:DrawNoteList.java
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.list_draw);
findViewById(R.id.btn_add).setonClickListener(this);
list_menu = (LinearLayout) findViewById(R.id.list_menu);
list_menu.setVisibility(View.GONE);
findViewById(R.id.btn_edit).setonClickListener(this);
findViewById(R.id.btn_share).setonClickListener(this);
findViewById(R.id.btn_setting).setonClickListener(this);
findViewById(R.id.btn_check).setonClickListener(this);
findViewById(R.id.btn_delete).setonClickListener(this);
findViewById(R.id.btn_notemain).setonClickListener(this);
mTodoList = new ArrayList<DrawNoteList_Row>();
selectedPosition = -1;
PaintDrawable d = new PaintDrawable(Color.TRANSPARENT);
getListView().setSelector(d);
//서비스 해제
AlarmManager am = (AlarmManager) this.getSystemService(Context.ALARM_SERVICE);
Intent intent = new Intent(DrawNoteList.this,DrawNoteNotification.class);
PendingIntent pi = PendingIntent.getService(DrawNoteList.this,intent,0);
am.cancel(pi);
notificationmanager nm = (notificationmanager) getSystemService(NOTIFICATION_SERVICE);
nm.cancelAll();
}
项目:igcparser
文件:FlightPreviewActivity.java
public PaintDrawable getColorScala() {
ShapeDrawable.ShaderFactory shaderFactory = new ShapeDrawable.ShaderFactory() {
@Override
public Shader resize(int width,int height) {
LinearGradient linearGradient = new LinearGradient(width,height,new int[]{
getResources().getColor(R.color.altitude_0_100),getResources().getColor(R.color.altitude_100_300),getResources().getColor(R.color.altitude_300_500),getResources().getColor(R.color.altitude_500_1000),getResources().getColor(R.color.altitude_1000_1500),getResources().getColor(R.color.altitude_1500_2000),getResources().getColor(R.color.altitude_2000_2500),getResources().getColor(R.color.altitude_more_than_2500)},new float[]{
0,0.07f,0.14f,0.28f,0.42f,0.56f,0.7f,0.84f},Shader.TileMode.REPEAT);
return linearGradient;
}
};
PaintDrawable paint = new PaintDrawable();
paint.setShape(new RectShape());
paint.setShaderFactory(shaderFactory);
return paint;
}
项目:FMTech
文件:ActionBarHelper.java
private static Drawable getBackgroundColorDrawable(int paramInt)
{
SoftReference localSoftReference = (SoftReference)sBackgroundCache.get(Integer.valueOf(paramInt));
if ((localSoftReference == null) || (localSoftReference.get() == null))
{
localSoftReference = new SoftReference(new PaintDrawable(paramInt));
sBackgroundCache.put(Integer.valueOf(paramInt),localSoftReference);
}
return (Drawable)localSoftReference.get();
}
项目:FMTech
文件:DetailsSummary.java
public void setThumbnailMode(int paramInt)
{
int i = 1;
int j;
if (this.mThumbnailMode != paramInt)
{
this.mThumbnailMode = paramInt;
j = getResources().getColor(2131689753);
if (this.mThumbnailMode != i) {
break label77;
}
if (i == 0) {
break label82;
}
setBackgroundDrawable(new InsetDrawable(new PaintDrawable(j),this.mThumbnailVerticalPeek,0));
}
for (;;)
{
ViewCompat.setPaddingrelative(this,0);
requestLayout();
return;
label77:
i = 0;
break;
label82:
setBackgroundColor(j);
}
}
项目:FMTech
文件:PlayCardViewBase.java
public void draw(Canvas paramCanvas)
{
super.draw(paramCanvas);
int i = getWidth();
int j = getHeight();
if (this.mTodisplayAsdisabled)
{
if (this.mdisabledDrawable == null) {
this.mdisabledDrawable = new PaintDrawable(getResources().getColor(R.color.play_dismissed_overlay));
}
this.mdisabledDrawable.setBounds(0,i,j);
this.mdisabledDrawable.draw(paramCanvas);
}
}
项目:kora
文件:ColorButton.java
protected void init()
{
mPaintDrawable = new PaintDrawable();
mPaintDrawable.setCornerRadius(4);
mPaintDrawable.setBounds(0,30,25);
setCompoundDrawables(mPaintDrawable,null,null);
setText(R.string.colorButtonText);
setonClickListener(listener);
}
项目:QuizUpWinner
文件:RoundDialogFrame.java
@TargetApi(16)
private void ˊ()
{
this.ᐝ = new PaintDrawable();
this.ᐝ.getPaint().setColor(this.ˊ);
this.ᐝ.setPadding(this.ˎ,this.ˋ,this.ˎ,this.ˋ);
this.ᐝ.setCornerRadius(this.ˏ);
if (Build.VERSION.SDK_INT < 16)
{
setBackgroundDrawable(this.ᐝ);
return;
}
setBackground(this.ᐝ);
}
public void init(){
drawable = new PaintDrawable();
paint = drawable.getPaint();
paint.setTextSize(30);
paint.setTextAlign(Paint.Align.CENTER);
drawable.setCornerRadius(15);
setBackground(drawable);
}
项目:music_player
文件:ScrimUtil.java
/**
* Creates an approximated cubic gradient using a multi-stop linear gradient. See
* <a href="https://plus.google.com/+RomanNurik/posts/2QvHVFWrHZf">this post</a> for more
* details.
*/
public static Drawable makeCubicGradientScrimDrawable(int baseColor,int numStops,int g@R_404_6110@ty) {
// Generate a cache key by hashing together the inputs,based on the method described in the Effective Java book
int cacheKeyHash = baseColor;
cacheKeyHash = 31 * cacheKeyHash + numStops;
cacheKeyHash = 31 * cacheKeyHash + g@R_404_6110@ty;
Drawable cachedGradient = cubicGradientScrimCache.get(cacheKeyHash);
if (cachedGradient != null) {
return cachedGradient;
}
numStops = Math.max(numStops,2);
PaintDrawable paintDrawable = new PaintDrawable();
paintDrawable.setShape(new RectShape());
final int[] stopColors = new int[numStops];
int red = Color.red(baseColor);
int green = Color.green(baseColor);
int blue = Color.blue(baseColor);
int alpha = Color.alpha(baseColor);
for (int i = 0; i < numStops; i++) {
float x = i * 1f / (numStops - 1);
float opacity = MathUtil.constrain(0,(float) Math.pow(x,3));
stopColors[i] = Color.argb((int) (alpha * opacity),red,green,blue);
}
final float x0,x1,y0,y1;
switch (g@R_404_6110@ty & G@R_404[email protected]_G@R_404_6110@TY_MASK) {
case G@R_404[email protected]: x0 = 1; x1 = 0; break;
case G@R_404[email protected]: x0 = 0; x1 = 1; break;
default: x0 = 0; x1 = 0; break;
}
switch (g@R_404_6110@ty & G@R_404[email protected]_G@R_404_6110@TY_MASK) {
case G@R_404[email protected]: y0 = 1; y1 = 0; break;
case G@R_404[email protected]ottOM: y0 = 0; y1 = 1; break;
default: y0 = 0; y1 = 0; break;
}
paintDrawable.setShaderFactory(new ShapeDrawable.ShaderFactory() {
@Override
public Shader resize(int width,int height) {
return new LinearGradient(
width * x0,height * y0,width * x1,height * y1,stopColors,Shader.TileMode.CLAMP);
}
});
cubicGradientScrimCache.put(cacheKeyHash,paintDrawable);
return paintDrawable;
}
public static PaintDrawable getPaintDrawable(int startX,int endX) {
PaintDrawable drawable = new PaintDrawable();
drawable.setShape(new RectShape());
drawable.setShaderFactory(getShaderFactory(startX,endX));
return drawable;
}
项目:buildAPKsSamples
文件:Home.java
@Override
public View getView(int position,View convertView,ViewGroup parent) {
final ApplicationInfo info = mApplications.get(position);
if (convertView == null) {
final LayoutInflater inflater = getLayoutInflater();
convertView = inflater.inflate(R.layout.application,parent,false);
}
Drawable icon = info.icon;
if (!info.filtered) {
//final Resources resources = getContext().getResources();
int width = 42;//(int) resources.getDimension(android.R.dimen.app_icon_size);
int height = 42;//(int) resources.getDimension(android.R.dimen.app_icon_size);
final int iconWidth = icon.getIntrinsicWidth();
final int iconHeight = icon.getIntrinsicHeight();
if (icon instanceof PaintDrawable) {
PaintDrawable painter = (PaintDrawable) icon;
painter.setIntrinsicWidth(width);
painter.setIntrinsicHeight(height);
}
if (width > 0 && height > 0 && (width < iconWidth || height < iconHeight)) {
final float ratio = (float) iconWidth / iconHeight;
if (iconWidth > iconHeight) {
height = (int) (width / ratio);
} else if (iconHeight > iconWidth) {
width = (int) (height * ratio);
}
final Bitmap.Config c =
icon.getopacity() != PixelFormat.OPAQUE ?
Bitmap.Config.ARGB_8888 : Bitmap.Config.RGB_565;
final Bitmap thumb = Bitmap.createBitmap(width,c);
final Canvas canvas = new Canvas(thumb);
canvas.setDrawFilter(new PaintFlagsDrawFilter(Paint.DITHER_FLAG,0));
// copy the old bounds to restore them later
// If we were to do oldBounds = icon.getBounds(),// the call to setBounds() that follows would
// change the same instance and we would lose the
// old bounds
mOldBounds.set(icon.getBounds());
icon.setBounds(0,height);
icon.draw(canvas);
icon.setBounds(mOldBounds);
icon = info.icon = new BitmapDrawable(thumb);
info.filtered = true;
}
}
final TextView textView = (TextView) convertView.findViewById(R.id.label);
textView.setCompoundDrawablesWithIntrinsicBounds(null,icon,null);
textView.setText(info.title);
return convertView;
}
项目:iosched-reader
文件:UIUtils.java
/**
* This helper method creates a 'nice' scrim or background protection for layering text over
* an image. This non-linear scrim is less noticable than a linear or constant one.
*
* Borrowed from github.com/romannurik/muzei
*
* Creates an approximated cubic gradient using a multi-stop linear gradient. See
* <a href="https://plus.google.com/+RomanNurik/posts/2QvHVFWrHZf">this post</a> for more
* details.
*/
public static Drawable makeCubicGradientScrimDrawable(int baseColor,int g@R_404_6110@ty) {
numStops = Math.max(numStops,2);
PaintDrawable paintDrawable = new PaintDrawable();
paintDrawable.setShape(new RectShape());
final int[] stopColors = new int[numStops];
int alpha = Color.alpha(baseColor);
for (int i = 0; i < numStops; i++) {
double x = i * 1f / (numStops - 1);
double opacity = Math.max(0,Math.min(1,Math.pow(x,3)));
stopColors[i] = (baseColor & 0x00ffffff) | ((int) (alpha * opacity) << 24);
}
final float x0,int height) {
LinearGradient linearGradient = new LinearGradient(
width * x0,Shader.TileMode.CLAMP);
return linearGradient;
}
});
return paintDrawable;
}
项目:TreebolicLib
文件:splitpanelayout.java
private void extractAttributes(@NonNull final Context context,@Nullable final AttributeSet attrs)
{
if (attrs != null)
{
final TypedArray array = context.obtainStyledAttributes(attrs,R.styleable.splitpanelayout);
// misc
this.orientation = array.getInt(R.styleable.splitpanelayout_orientation,0);
this.splitterSize = array.getDimensionPixelSize(R.styleable.splitpanelayout_splitterSize,context.getResources().getDimensionPixelSize(R.dimen.spl_default_splitter_size));
this.splitterMovable = array.getBoolean(R.styleable.splitpanelayout_splitterMovable,true);
// position
TypedValue value = array.peekValue(R.styleable.splitpanelayout_splitterPosition);
if (value != null)
{
if (value.type == TypedValue.TYPE_DIMENSION)
{
this.splitterPosition = array.getDimensionPixelSize(R.styleable.splitpanelayout_splitterPosition,Integer.MIN_VALUE);
this.splitterPositionPercent = -1;
}
else if (value.type == TypedValue.TYPE_FRACTION)
{
this.splitterPositionPercent = array.getFraction(R.styleable.splitpanelayout_splitterPosition,100,50) * 0.01f;
this.splitterPosition = Integer.MIN_VALUE;
}
}
else
{
this.splitterPosition = Integer.MIN_VALUE;
this.splitterPositionPercent = 0.5f;
}
// backgrounds
value = array.peekValue(R.styleable.splitpanelayout_splitterBackground);
if (value != null)
{
if (value.type == TypedValue.TYPE_REFERENCE || value.type == TypedValue.TYPE_STRING)
{
this.splitterDrawable = array.getDrawable(R.styleable.splitpanelayout_splitterBackground);
}
else if (value.type == TypedValue.TYPE_INT_COLOR_ARGB8 || value.type == TypedValue.TYPE_INT_COLOR_ARGB4 || value.type == TypedValue.TYPE_INT_COLOR_RGB8 || value.type == TypedValue.TYPE_INT_COLOR_RGB4)
{
this.splitterDrawable = new PaintDrawable(array.getColor(R.styleable.splitpanelayout_splitterBackground,0xFF000000));
}
}
value = array.peekValue(R.styleable.splitpanelayout_splitterDraggingBackground);
if (value != null)
{
if (value.type == TypedValue.TYPE_REFERENCE || value.type == TypedValue.TYPE_STRING)
{
this.splitterDraggingDrawable = array.getDrawable(R.styleable.splitpanelayout_splitterDraggingBackground);
}
else if (value.type == TypedValue.TYPE_INT_COLOR_ARGB8 || value.type == TypedValue.TYPE_INT_COLOR_ARGB4 || value.type == TypedValue.TYPE_INT_COLOR_RGB8 || value.type == TypedValue.TYPE_INT_COLOR_RGB4)
{
this.splitterDraggingDrawable = new PaintDrawable(array.getColor(R.styleable.splitpanelayout_splitterDraggingBackground,SPLITTER_DRAG_COLOR));
}
}
else
{
this.splitterDraggingDrawable = new PaintDrawable(SPLITTER_DRAG_COLOR);
}
array.recycle();
}
}
项目:smconf-android
文件:UIUtils.java
/**
* This helper method creates a 'nice' scrim or background protection for layering text over
* an image. This non-linear scrim is less noticable than a linear or constant one.
*
* Borrowed from github.com/romannurik/muzei
*
* Creates an approximated cubic gradient using a multi-stop linear gradient. See
* <a href="https://plus.google.com/+RomanNurik/posts/2QvHVFWrHZf">this post</a> for more
* details.
*/
public static Drawable makeCubicGradientScrimDrawable(int baseColor,Shader.TileMode.CLAMP);
return linearGradient;
}
});
return paintDrawable;
}
项目:xowa_android
文件:GradientUtil.java
项目:xowa_android
文件:GradientUtil.java
/**
* Create a cubic gradient by using a compound gradient composed of a series of linear
* gradients with intermediate color values.
* adapted from: https://github.com/romannurik/muzei/blob/master/main/src/main/java/com/google/android/apps/muzei/util/ScrimUtil.java
* @param baseColor The color from which the gradient starts (the ending color is transparent).
* @param g@R_404_6110@ty Where the gradient should start from. Note: when making horizontal gradients,* remember to use START/END,instead of LEFT/RIGHT.
*/
public static void setCubicGradient(PaintDrawable drawable,int baseColor,int g@R_404_6110@ty) {
final int[] stopColors = new int[GRADIENT_NUM_STOPS];
int red = Color.red(baseColor);
int green = Color.green(baseColor);
int blue = Color.blue(baseColor);
int alpha = Color.alpha(baseColor);
for (int i = 0; i < GRADIENT_NUM_STOPS; i++) {
float x = i * 1f / (GRADIENT_NUM_STOPS - 1);
float opacity = MathUtil.constrain((float) Math.pow(x,GRADIENT_POWER),0.0f,1.0f);
stopColors[i] = Color.argb((int) (alpha * opacity),y1;
switch (g@R_404_6110@ty & G@R_404[email protected]_G@R_404_6110@TY_MASK) {
case G@R_404[email protected]:
x0 = 1;
x1 = 0;
break;
case G@R_404[email protected]:
x0 = 0;
x1 = 1;
break;
default:
x0 = 0;
x1 = 0;
break;
}
switch (g@R_404_6110@ty & G@R_404[email protected]_G@R_404_6110@TY_MASK) {
case G@R_404[email protected]:
y0 = 1;
y1 = 0;
break;
case G@R_404[email protected]ottOM:
y0 = 0;
y1 = 1;
break;
default:
y0 = 0;
y1 = 0;
break;
}
drawable.setShaderFactory(new ShapeDrawable.ShaderFactory() {
@Override
public Shader resize(int width,int height) {
return new LinearGradient(width * x0,Shader.TileMode.CLAMP);
}
});
}
项目:StatusBarColorManager
文件:ScrimUtil.java
/**
* Creates an approximated cubic gradient using a multi-stop linear gradient. See
* <a href="https://plus.google.com/+RomanNurik/posts/2QvHVFWrHZf">this post</a> for more
* details.
*/
public static Drawable makeCubicGradientScrimDrawable(int baseColor,paintDrawable);
return paintDrawable;
}
项目:Amumu
文件:ScrimUtil.java
/**
* Creates an approximated cubic gradient using a multi-stop linear gradient. See
* <a href="https://plus.google.com/+RomanNurik/posts/2QvHVFWrHZf">this post</a> for more
* details.
*/
public static Drawable makeCubicGradientScrimDrawable(@ColorInt int baseColor,2);
PaintDrawable paintDrawable = new PaintDrawable();
paintDrawable.setShape(new RectShape());
final int[] stopColors = new int[numStops];
int alpha = Color.alpha(baseColor);
for (int i = 0; i < numStops; i++) {
float x = i * 1f / (numStops - 1);
float opacity = MathUtils.constrain(0,3));
stopColors[i] = ColorUtils.modifyAlpha(baseColor,(int) (alpha * opacity));
}
final float x0,y1;
switch (g@R_404_6110@ty & G@R_404[email protected]_G@R_404_6110@TY_MASK) {
case G@R_404[email protected]:
x0 = 1;
x1 = 0;
break;
case G@R_404[email protected]:
x0 = 0;
x1 = 1;
break;
default:
x0 = 0;
x1 = 0;
break;
}
switch (g@R_404_6110@ty & G@R_404[email protected]_G@R_404_6110@TY_MASK) {
case G@R_404[email protected]:
y0 = 1;
y1 = 0;
break;
case G@R_404[email protected]ottOM:
y0 = 0;
y1 = 1;
break;
default:
y0 = 0;
y1 = 0;
break;
}
paintDrawable.setShaderFactory(new ShapeDrawable.ShaderFactory() {
@Override
public Shader resize(int width,Shader.TileMode.CLAMP);
return linearGradient;
}
});
return paintDrawable;
}
项目:2015-Google-I-O-app
文件:UIUtils.java
/**
* This helper method creates a 'nice' scrim or background protection for layering text over
* an image. This non-linear scrim is less noticable than a linear or constant one.
*
* Borrowed from github.com/romannurik/muzei
*
* Creates an approximated cubic gradient using a multi-stop linear gradient. See
* <a href="https://plus.google.com/+RomanNurik/posts/2QvHVFWrHZf">this post</a> for more
* details.
*/
public static Drawable makeCubicGradientScrimDrawable(int baseColor,Shader.TileMode.CLAMP);
return linearGradient;
}
});
return paintDrawable;
}
项目:DialogUtils
文件:ScrimUtil.java
/**
* Creates an approximated cubic gradient using a multi-stop linear gradient. See
* <a href="https://plus.google.com/+RomanNurik/posts/2QvHVFWrHZf">this post</a> for more
* details.
*/
public static Drawable makeCubicGradientScrimDrawable(int baseColor,2);
PaintDrawable paintDrawable = new PaintDrawable();
paintDrawable.setShape(new RectShape());
final int[] stopColors = new int[numStops];
int red = Color.red(baseColor);
int green = Color.green(baseColor);
int blue = Color.blue(baseColor);
int alpha = Color.alpha(baseColor);
for (int i = 0; i < numStops; i++) {
float x = i * 1f / (numStops - 1);
/* float opacity = MathUtil.constrain(0,blue);*/
}
final float x0,Shader.TileMode.CLAMP);
return linearGradient;
}
});
cubicGradientScrimCache.put(cacheKeyHash,paintDrawable);
return paintDrawable;
}
项目:android-proguards
文件:ScrimUtil.java
/**
* Creates an approximated cubic gradient using a multi-stop linear gradient. See
* <a href="https://plus.google.com/+RomanNurik/posts/2QvHVFWrHZf">this post</a> for more
* details.
*/
public static Drawable makeCubicGradientScrimDrawable(@ColorInt int baseColor,Shader.TileMode.CLAMP);
return linearGradient;
}
});
return paintDrawable;
}
项目:OldDriver-master
文件:ScrimUtil.java
/**
* Creates an approximated cubic gradient using a multi-stop linear gradient. See
* <a href="https://plus.google.com/+RomanNurik/posts/2QvHVFWrHZf">this post</a> for more
* details.
*/
public static Drawable makeCubicGradientScrimDrawable(@ColorInt int baseColor,Shader.TileMode.CLAMP);
return linearGradient;
}
});
return paintDrawable;
}
项目:FMTech
文件:UIUtils.java
/**
* This helper method creates a 'nice' scrim or background protection for layering text over
* an image. This non-linear scrim is less noticable than a linear or constant one.
*
* Borrowed from github.com/romannurik/muzei
*
* Creates an approximated cubic gradient using a multi-stop linear gradient. See
* <a href="https://plus.google.com/+RomanNurik/posts/2QvHVFWrHZf">this post</a> for more
* details.
*/
public static Drawable makeCubicGradientScrimDrawable(int baseColor,Shader.TileMode.CLAMP);
return linearGradient;
}
});
return paintDrawable;
}
项目:AndroidLiveWallpaperHelloWorld
文件:ScrimUtil.java
/**
* Creates an approximated cubic gradient using a multi-stop linear gradient. See
* <a href="https://plus.google.com/+RomanNurik/posts/2QvHVFWrHZf">this post</a> for more
* details.
*/
public static Drawable makeCubicGradientScrimDrawable(int baseColor,FloatMath.pow(x,Shader.TileMode.CLAMP);
return linearGradient;
}
});
return paintDrawable;
}
项目:JJCamera
文件:UIUtils.java
/**
* This helper method creates a 'nice' scrim or background protection for layering text over
* an image. This non-linear scrim is less noticable than a linear or constant one.
*
* Borrowed from github.com/romannurik/muzei
*
* Creates an approximated cubic gradient using a multi-stop linear gradient. See
* <a href="https://plus.google.com/+RomanNurik/posts/2QvHVFWrHZf">this post</a> for more
* details.
*/
public static Drawable makeCubicGradientScrimDrawable(int baseColor,Shader.TileMode.CLAMP);
return linearGradient;
}
});
return paintDrawable;
}
项目:NyaungUConverter
文件:FlatSeekBar.java
private void init(AttributeSet attrs) {
if (attributes == null)
attributes = new Attributes(this,getResources());
if (attrs != null) {
TypedArray a = getContext().obtainStyledAttributes(attrs,com.cengalabs.flatui.R.styleable.fl_FlatSeekBar);
// getting common attributes
int customTheme = a.getResourceId(com.cengalabs.flatui.R.styleable.fl_FlatSeekBar_fl_theme,Attributes.DEFAULT_THEME);
attributes.setThemeSilent(customTheme,getResources());
attributes.setSize(a.getDimensionPixelSize(com.cengalabs.flatui.R.styleable.fl_FlatSeekBar_fl_size,Attributes.DEFAULT_SIZE_PX));
a.recycle();
}
// setting thumb
PaintDrawable thumb = new PaintDrawable(attributes.getColor(0));
thumb.setCornerRadius(attributes.getSize() * 9 / 8);
thumb.setIntrinsicWidth(attributes.getSize() * 9 / 4);
thumb.setIntrinsicHeight(attributes.getSize() * 9 / 4);
setThumb(thumb);
// progress
PaintDrawable progress = new PaintDrawable(attributes.getColor(1));
progress.setCornerRadius(attributes.getSize());
progress.setIntrinsicHeight(attributes.getSize());
progress.setIntrinsicWidth(attributes.getSize());
progress.setDither(true);
ClipDrawable progressClip = new ClipDrawable(progress,G@R_404[email protected],ClipDrawable.HORIZONTAL);
// secondary progress
PaintDrawable secondary = new PaintDrawable(attributes.getColor(2));
secondary.setCornerRadius(attributes.getSize());
secondary.setIntrinsicHeight(attributes.getSize());
ClipDrawable secondaryProgressClip = new ClipDrawable(secondary,ClipDrawable.HORIZONTAL);
// background
PaintDrawable background = new PaintDrawable(attributes.getColor(3));
background.setCornerRadius(attributes.getSize());
background.setIntrinsicHeight(attributes.getSize());
// applying drawable
LayerDrawable ld = (LayerDrawable) getProgressDrawable();
ld.setDrawableByLayerId(R.id.background,background);
ld.setDrawableByLayerId(R.id.progress,progressClip);
ld.setDrawableByLayerId(R.id.secondaryProgress,secondaryProgressClip);
}
项目:plaid
文件:ScrimUtil.java
/**
* Creates an approximated cubic gradient using a multi-stop linear gradient. See
* <a href="https://plus.google.com/+RomanNurik/posts/2QvHVFWrHZf">this post</a> for more
* details.
*/
public static Drawable makeCubicGradientScrimDrawable(@ColorInt int baseColor,Shader.TileMode.CLAMP);
return linearGradient;
}
});
return paintDrawable;
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。