java类android.graphics.drawable.GradientDrawable.Orientation的实例源码

UberColorPickerDialog.java 文件源码 项目:GitHub 阅读 27 收藏 0 点赞 0 评论 0
/**
 * Create a linear gradient shader to show variations in value.
 */
private void setVerValSlider() {
    float[] hsv = new float[3];
    hsv[0] = mHSV[0];
    hsv[1] = mHSV[1];
    hsv[2] = 1;
    int col = Color.HSVToColor(hsv);

    int colors[] = new int[2];
    colors[0] = col;
    colors[1] = 0xFF000000;
    GradientDrawable gradDraw = new GradientDrawable(Orientation.TOP_BOTTOM, colors);
    gradDraw.setDither(true);
    gradDraw.setLevel(10000);
    gradDraw.setBounds(0, 0, mSliderThicknessPx, mPaletteDimPx);
    gradDraw.draw(mVerSliderCv);
}
Coloring.java 文件源码 项目:silly-android 阅读 42 收藏 0 点赞 0 评论 0
/**
 * Creates a new drawable (implementation of the Drawable object may vary depending on the OS version).
 * The result Drawable will be colored with the given color, and clipped to match the given bounds.
 * Note that the drawable's alpha is set to 0 when argument color is {@link Color#TRANSPARENT}.
 *
 * @param color  Integer color used to color the output drawable
 * @param bounds Four-dimensional vector representing drawable bounds
 * @return Colored and clipped drawable object
 */
@NonNull
public static Drawable createColoredDrawable(@ColorInt final int color, @Nullable final Rect bounds) {
    // create the drawable depending on the OS (pre-Honeycomb couldn't use color drawables inside state lists)
    Drawable drawable;
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB || bounds != null) {
        drawable = new GradientDrawable(Orientation.BOTTOM_TOP, new int[] { color, color }).mutate();
    } else {
        drawable = new ColorDrawable(color).mutate();
    }

    // set the alpha value
    if (color == Color.TRANSPARENT) {
        drawable.setAlpha(0);
    }

    // update bounds
    if (bounds != null) {
        drawable.setBounds(bounds);
    }
    return drawable;
}
SharePanelView.java 文件源码 项目:InsanityRadio-Android 阅读 20 收藏 0 点赞 0 评论 0
protected View makeHeaderView(int headerHeight, float headerRadius) {
    LayoutParams headerParams = new LayoutParams(LayoutParams.FILL_PARENT, headerHeight);

    TextView header = new TextView(getContext());

    if(colors != null) {
        GradientDrawable headerBG = new GradientDrawable(Orientation.BOTTOM_TOP, new int[]{colors.getColor(Colors.AUTH_PANEL_BOTTOM), colors.getColor(Colors.AUTH_PANEL_TOP)});
        headerBG.setCornerRadii(new float[]{headerRadius, headerRadius, headerRadius, headerRadius, 0.0f, 0.0f, 0.0f, 0.0f});

        CompatUtils.setBackgroundDrawable(header, headerBG);
    }

    if(localizationService != null) {
        header.setText(localizationService.getString(I18NConstants.SHARE_HEADER));
    }

    header.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
    header.setTextColor(Color.WHITE);
    header.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL);
    header.setLayoutParams(headerParams);

    return header;
}
ProfilePictureEditView.java 文件源码 项目:InsanityRadio-Android 阅读 20 收藏 0 点赞 0 评论 0
@Override
protected ImageView makeImage() {
    defaultProfilePicture = drawables.getDrawable(Socialize.DEFAULT_USER_ICON);
    profilePicture = new ImageView(getContext());

    int imageSize = displayUtils.getDIP(64);
    int imagePadding = displayUtils.getDIP(4);

    LayoutParams imageLayout = new LinearLayout.LayoutParams(imageSize,imageSize);

    GradientDrawable imageBG = new GradientDrawable(Orientation.BOTTOM_TOP, new int[] {Color.WHITE, Color.WHITE});
    imageBG.setStroke(2, Color.BLACK);
    imageBG.setAlpha(64);

    profilePicture.setLayoutParams(imageLayout);
    profilePicture.setPadding(imagePadding, imagePadding, imagePadding, imagePadding);

    CompatUtils.setBackgroundDrawable(profilePicture, imageBG);

    profilePicture.setScaleType(ScaleType.CENTER_CROP);

    return profilePicture;
}
AuthPanelView.java 文件源码 项目:InsanityRadio-Android 阅读 20 收藏 0 点赞 0 评论 0
protected View makeHeaderView(int headerHeight, float headerRadius) {
    LayoutParams headerParams = new LayoutParams(LayoutParams.FILL_PARENT, headerHeight);

    TextView header = new TextView(getContext());

    if(colors != null) {
        GradientDrawable headerBG = new GradientDrawable(Orientation.BOTTOM_TOP, new int[]{colors.getColor(Colors.AUTH_PANEL_BOTTOM), colors.getColor(Colors.AUTH_PANEL_TOP)});
        headerBG.setCornerRadii(new float[]{headerRadius, headerRadius, headerRadius, headerRadius, 0.0f, 0.0f, 0.0f, 0.0f});

        CompatUtils.setBackgroundDrawable(header, headerBG);
    }

       if(localizationService != null) {
           header.setText(localizationService.getString(I18NConstants.AUTH_HEADER));
       }

    header.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
    header.setTextColor(Color.WHITE);
    header.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL);
    header.setLayoutParams(headerParams);

    return header;
}
WheelView.java 文件源码 项目:MyTravelingDiary 阅读 24 收藏 0 点赞 0 评论 0
/**
 * Initializes resources
 */
private void initResourcesIfNecessary() {
    if (centerDrawable == null) {
        centerDrawable = getContext().getResources().getDrawable(R.drawable.wheel_val);
    }

    if (topShadow == null) {
        topShadow = new GradientDrawable(Orientation.TOP_BOTTOM, SHADOWS_COLORS);
    }

    if (bottomShadow == null) {
        bottomShadow = new GradientDrawable(Orientation.BOTTOM_TOP, SHADOWS_COLORS);
    }

    setBackgroundResource(R.drawable.wheel_bg);
}
WheelView.java 文件源码 项目:ktball 阅读 26 收藏 0 点赞 0 评论 0
/**
 * Initializes resources
 */
private void initResourcesIfNecessary() {
    if (centerDrawable == null) {
        centerDrawable = getContext().getResources().getDrawable(wheelForeground);
    }

    if (topShadow == null) {
        topShadow = new GradientDrawable(Orientation.TOP_BOTTOM, SHADOWS_COLORS);
    }

    if (bottomShadow == null) {
        bottomShadow = new GradientDrawable(Orientation.BOTTOM_TOP, SHADOWS_COLORS);
    }

    setBackgroundResource(wheelBackground);
}
SearchView.java 文件源码 项目:brailleback 阅读 27 收藏 0 点赞 0 评论 0
public SearchView(Context context, StringBuilder queryText) {
    super(context);

    mContext = context;
    mQueryText = queryText;

    mPaint = new Paint();
    mPaint.setAntiAlias(true);

    final SurfaceHolder holder = getHolder();
    holder.setFormat(PixelFormat.TRANSLUCENT);
    holder.addCallback(mSurfaceCallback);

    final Resources res = context.getResources();

    int mExtremeRadius = 128;

    // Gradient colors.
    final int gradientInnerColor = res.getColor(R.color.search_overlay);
    final int gradientOuterColor = res.getColor(R.color.search_overlay);
    final int[] colors = new int[] {gradientInnerColor, gradientOuterColor};
    mGradientBackground =
            new GradientDrawable(Orientation.TOP_BOTTOM, colors);
    mGradientBackground.setGradientType(GradientDrawable.LINEAR_GRADIENT);
}
WheelView.java 文件源码 项目:myapplication 阅读 25 收藏 0 点赞 0 评论 0
/**
 * Initializes resources
 */
private void initResourcesIfNecessary() {
    if (centerDrawable == null) {
        centerDrawable = getContext().getResources().getDrawable(wheelForeground);
    }

    if (topShadow == null) {
        topShadow = new GradientDrawable(Orientation.TOP_BOTTOM, SHADOWS_COLORS);
    }

    if (bottomShadow == null) {
        bottomShadow = new GradientDrawable(Orientation.BOTTOM_TOP, SHADOWS_COLORS);
    }

    setBackgroundResource(wheelBackground);
}
WheelView.java 文件源码 项目:RxTools 阅读 26 收藏 0 点赞 0 评论 0
/**
 * Initializes resources
 */
private void initResourcesIfNecessary() {
    if (centerDrawable == null) {
        centerDrawable = getContext().getResources().getDrawable(wheelForeground);
    }

    if (topShadow == null) {
        topShadow = new GradientDrawable(Orientation.TOP_BOTTOM, SHADOWS_COLORS);
    }

    if (bottomShadow == null) {
        bottomShadow = new GradientDrawable(Orientation.BOTTOM_TOP, SHADOWS_COLORS);
    }

    setBackgroundResource(wheelBackground);
}
WheelView.java 文件源码 项目:BigApp_Discuz_Android 阅读 28 收藏 0 点赞 0 评论 0
/**
 * Initializes resources
 */
private void initResourcesIfNecessary() {
    if (centerDrawable == null) {
        centerDrawable = getContext().getResources().getDrawable(
                R.drawable.two_line);
    }

    if (topShadow == null) {
        topShadow = new GradientDrawable(Orientation.TOP_BOTTOM,
                SHADOWS_COLORS);
    }

    if (bottomShadow == null) {
        bottomShadow = new GradientDrawable(Orientation.BOTTOM_TOP,
                SHADOWS_COLORS);
    }

    setBackgroundResource(R.drawable.white);
}
WheelView.java 文件源码 项目:fast-dev-library 阅读 26 收藏 0 点赞 0 评论 0
/**
 * Initializes resources
 */
private void initResourcesIfNecessary() {
    if (centerDrawable == null) {
        centerDrawable = getContext().getResources().getDrawable(
                R.drawable.wheel_val);
    }

    if (topShadow == null) {
        topShadow = new GradientDrawable(Orientation.TOP_BOTTOM,
                SHADOWS_COLORS);
    }

    if (bottomShadow == null) {
        bottomShadow = new GradientDrawable(Orientation.BOTTOM_TOP,
                SHADOWS_COLORS);
    }

    setBackgroundResource(R.drawable.wheel_bg);
}
UberColorPickerDialog.java 文件源码 项目:connectbot 阅读 24 收藏 0 点赞 0 评论 0
/**
 * Create a linear gradient shader to show variations in value.
 */
private void setVerValSlider() {
    float[] hsv = new float[3];
    hsv[0] = mHSV[0];
    hsv[1] = mHSV[1];
    hsv[2] = 1;
    int col = Color.HSVToColor(hsv);

    int colors[] = new int[2];
    colors[0] = col;
    colors[1] = 0xFF000000;
    GradientDrawable gradDraw = new GradientDrawable(Orientation.TOP_BOTTOM, colors);
    gradDraw.setDither(true);
    gradDraw.setLevel(10000);
    gradDraw.setBounds(0, 0, SLIDER_THICKNESS, PALETTE_DIM);
    gradDraw.draw(mVerSliderCv);
}
WheelView.java 文件源码 项目:EntboostIM 阅读 28 收藏 0 点赞 0 评论 0
/**
 * Initializes resources
 */
private void initResourcesIfNecessary() {
    if (centerDrawable == null) {
        centerDrawable = getContext().getResources().getDrawable(wheelForeground);
    }

    if (topShadow == null) {
        topShadow = new GradientDrawable(Orientation.TOP_BOTTOM, SHADOWS_COLORS);
    }

    if (bottomShadow == null) {
        bottomShadow = new GradientDrawable(Orientation.BOTTOM_TOP, SHADOWS_COLORS);
    }

    setBackgroundResource(wheelBackground);
}
WheelView.java 文件源码 项目:work_sen 阅读 33 收藏 0 点赞 0 评论 0
/**
 * Initializes resources
 */
private void initResourcesIfNecessary() {
    if (centerDrawable == null) {
        centerDrawable = getContext().getResources().getDrawable(wheelForeground);
    }

    if (topShadow == null) {
        topShadow = new GradientDrawable(Orientation.TOP_BOTTOM, SHADOWS_COLORS);
    }

    if (bottomShadow == null) {
        bottomShadow = new GradientDrawable(Orientation.BOTTOM_TOP, SHADOWS_COLORS);
    }

    setBackgroundResource(wheelBackground);
}
SharePanelView.java 文件源码 项目:InsanityRadio-Android 阅读 21 收藏 0 点赞 0 评论 0
protected View makeHeaderView(int headerHeight, float headerRadius) {
    LayoutParams headerParams = new LayoutParams(LayoutParams.FILL_PARENT, headerHeight);

    TextView header = new TextView(getContext());

    if(colors != null) {
        GradientDrawable headerBG = new GradientDrawable(Orientation.BOTTOM_TOP, new int[]{colors.getColor(Colors.AUTH_PANEL_BOTTOM), colors.getColor(Colors.AUTH_PANEL_TOP)});
        headerBG.setCornerRadii(new float[]{headerRadius, headerRadius, headerRadius, headerRadius, 0.0f, 0.0f, 0.0f, 0.0f});

        CompatUtils.setBackgroundDrawable(header, headerBG);
    }

    if(localizationService != null) {
        header.setText(localizationService.getString(I18NConstants.SHARE_HEADER));
    }

    header.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
    header.setTextColor(Color.WHITE);
    header.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL);
    header.setLayoutParams(headerParams);

    return header;
}
ProfilePictureEditView.java 文件源码 项目:InsanityRadio-Android 阅读 21 收藏 0 点赞 0 评论 0
@Override
protected ImageView makeImage() {
    defaultProfilePicture = drawables.getDrawable(Socialize.DEFAULT_USER_ICON);
    profilePicture = new ImageView(getContext());

    int imageSize = displayUtils.getDIP(64);
    int imagePadding = displayUtils.getDIP(4);

    LayoutParams imageLayout = new LinearLayout.LayoutParams(imageSize,imageSize);

    GradientDrawable imageBG = new GradientDrawable(Orientation.BOTTOM_TOP, new int[] {Color.WHITE, Color.WHITE});
    imageBG.setStroke(2, Color.BLACK);
    imageBG.setAlpha(64);

    profilePicture.setLayoutParams(imageLayout);
    profilePicture.setPadding(imagePadding, imagePadding, imagePadding, imagePadding);

    CompatUtils.setBackgroundDrawable(profilePicture, imageBG);

    profilePicture.setScaleType(ScaleType.CENTER_CROP);

    return profilePicture;
}
AuthPanelView.java 文件源码 项目:InsanityRadio-Android 阅读 21 收藏 0 点赞 0 评论 0
protected View makeHeaderView(int headerHeight, float headerRadius) {
    LayoutParams headerParams = new LayoutParams(LayoutParams.FILL_PARENT, headerHeight);

    TextView header = new TextView(getContext());

    if(colors != null) {
        GradientDrawable headerBG = new GradientDrawable(Orientation.BOTTOM_TOP, new int[]{colors.getColor(Colors.AUTH_PANEL_BOTTOM), colors.getColor(Colors.AUTH_PANEL_TOP)});
        headerBG.setCornerRadii(new float[]{headerRadius, headerRadius, headerRadius, headerRadius, 0.0f, 0.0f, 0.0f, 0.0f});

        CompatUtils.setBackgroundDrawable(header, headerBG);
    }

       if(localizationService != null) {
           header.setText(localizationService.getString(I18NConstants.AUTH_HEADER));
       }

    header.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
    header.setTextColor(Color.WHITE);
    header.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL);
    header.setLayoutParams(headerParams);

    return header;
}
AbLetterFilterListView.java 文件源码 项目:eshow-android 阅读 21 收藏 0 点赞 0 评论 0
/**
 * Inits the.
 */
private void init() {
    l = new char[] {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K',
            'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
            'X', 'Y', 'Z', '#' };
    paint = new Paint();
    paint.setColor(Color.parseColor("#949494"));
    paint.setTypeface(Typeface.DEFAULT_BOLD);
    paint.setTextSize(22);
    paint.setAntiAlias(true);
    paint.setTextAlign(Paint.Align.CENTER);

    gradientDrawable = new GradientDrawable(Orientation.BOTTOM_TOP, new int []{0x99B0B0B0,0x99B0B0B0});
    gradientDrawable.setCornerRadius(30);

}
ActionBarBackgroundUpdater.java 文件源码 项目:FMTech 阅读 19 收藏 0 点赞 0 评论 0
public ActionBarBackgroundUpdater(Window paramWindow, PlayHeaderListLayout paramPlayHeaderListLayout)
{
  this.mWindow = paramWindow;
  this.mHeaderListLayout = paramPlayHeaderListLayout;
  Resources localResources = paramPlayHeaderListLayout.getResources();
  this.mTransparentBackground = new ColorDrawable(0);
  final int i = FinskySearchToolbar.getToolbarHeight(this.mHeaderListLayout.getContext());
  int[] arrayOfInt = new int[2];
  arrayOfInt[0] = this.mHeaderListLayout.getResources().getColor(2131689730);
  arrayOfInt[1] = 0;
  this.mProtectionBackground = new GradientDrawable(GradientDrawable.Orientation.TOP_BOTTOM, arrayOfInt)
  {
    protected final void onBoundsChange(Rect paramAnonymousRect)
    {
      if (paramAnonymousRect.bottom - paramAnonymousRect.top > i) {
        paramAnonymousRect.bottom = (paramAnonymousRect.top + i);
      }
      super.onBoundsChange(paramAnonymousRect);
    }
  };
  this.mBaseBackground = this.mProtectionBackground;
  this.mSearchStatusBarColor = localResources.getColor(2131689676);
  this.mWasHeaderListFloating = this.mHeaderListLayout.isHeaderFloating();
  this.mWasStatusBarUnderlayProtectingControls = this.mHeaderListLayout.isStatusBarUnderlayProtectingControls();
  updateActionBar();
}
PlayTextView.java 文件源码 项目:FMTech 阅读 17 收藏 0 点赞 0 评论 0
public void setLastLineOverdrawColor(int paramInt)
{
  if (!this.mToDrawOverLastLineIfNecessary)
  {
    this.mLastLineOverdrawPaint = new Paint();
    this.mLastLineOverdrawPaint.setStyle(Paint.Style.FILL_AND_STROKE);
    Resources localResources = getResources();
    this.mLastLineFadeOutSize = localResources.getDimensionPixelSize(R.dimen.play_text_view_fadeout);
    this.mLastLineFadeOutHintMargin = localResources.getDimensionPixelSize(R.dimen.play_text_view_fadeout_hint_margin);
  }
  this.mLastLineOverdrawPaint.setColor(paramInt);
  GradientDrawable.Orientation localOrientation = GradientDrawable.Orientation.LEFT_RIGHT;
  int[] arrayOfInt = new int[2];
  arrayOfInt[0] = (0xFFFFFF & paramInt);
  arrayOfInt[1] = paramInt;
  this.mLastLineFadeOutDrawable = new GradientDrawable(localOrientation, arrayOfInt);
  this.mToDrawOverLastLineIfNecessary = true;
}
lbt.java 文件源码 项目:FMTech 阅读 20 收藏 0 点赞 0 评论 0
public final void a(View paramView, Bundle paramBundle)
{
  super.a(paramView, paramBundle);
  this.ad = ((MediaView)paramView.findViewById(dl.ae));
  this.ae = ((ImageButton)paramView.findViewById(dl.N));
  this.af = ((ProgressBar)paramView.findViewById(dl.ag));
  this.ad.c(aaw.qd);
  this.ad.d(aaw.qd);
  this.ad.n = true;
  int[] arrayOfInt = new int[3];
  arrayOfInt[0] = g().getColor(aaw.qc);
  arrayOfInt[1] = g().getColor(aaw.qe);
  arrayOfInt[2] = g().getColor(aaw.qc);
  GradientDrawable localGradientDrawable = new GradientDrawable(GradientDrawable.Orientation.BOTTOM_TOP, arrayOfInt);
  localGradientDrawable.setGradientType(0);
  this.ad.b(localGradientDrawable);
  this.ae.setOnClickListener(this);
  w();
  if (paramBundle != null) {
    this.ad.a((ipf)paramBundle.getParcelable("current_media_ref"));
  }
}
WheelViewer.java 文件源码 项目:MUtils 阅读 20 收藏 0 点赞 0 评论 0
protected void init(Context context, AttributeSet attrs) {
    Resources res = getResources();
    this.setCenterDrawable(res.getDrawable(R.drawable.wheel_val_light));
    this.setBackgroundResource(R.drawable.wheel_bg_light);

    GradientDrawable topShadow = new GradientDrawable(Orientation.TOP_BOTTOM, new int[] { 0x00000000, 0x00000000 });
    this.setTopShadowDrawable(topShadow);

    GradientDrawable bottomShadow = new GradientDrawable(Orientation.BOTTOM_TOP,
            new int[] { 0x00000000, 0x00000000 });
    this.setBottomShadowDrawable(bottomShadow);

    mTextColorValue = 0xFF000000;
    mTextColorItems = 0xFF888888;

    TEXT_SIZE = (int) AppUtil.sp2px(getContext(), 18);
    setFakeBoldText(false);
    setCyclic(true);
}
NodeSearch.java 文件源码 项目:talkback 阅读 20 收藏 0 点赞 0 评论 0
public SearchView(Context context, StringBuilder queryText, SearchTextFormatter
        textFormatter) {
    super(context);

    mQueryText = queryText;
    mTextFormatter = textFormatter;

    final SurfaceHolder holder = getHolder();
    holder.setFormat(PixelFormat.TRANSLUCENT);
    holder.addCallback(mSurfaceCallback);

    // Gradient colors.
    final int[] colors = new int[] {GRADIENT_INNER_COLOR, GRADIENT_OUTER_COLOR};
    mGradientBackground = new GradientDrawable(Orientation.TOP_BOTTOM, colors);
    mGradientBackground.setGradientType(GradientDrawable.LINEAR_GRADIENT);
}
WheelView.java 文件源码 项目:konkeWatch 阅读 30 收藏 0 点赞 0 评论 0
/**
     * Initialize.
     * 
     * @param context
     */
    private void initialize(Context context) {
        this.setVerticalScrollBarEnabled(false);
        this.setSlotInCenter(true);
        this.setOrientation(VERTICAL);
        this.setGravity(Gravity.CENTER_HORIZONTAL);
        this.setUnselectedAlpha(1.0f);

        // This lead the onDraw() will be called.
        this.setWillNotDraw(false);

        // The selector rectangle drawable.
        this.mSelectorDrawable = getContext().getResources().getDrawable(R.drawable.wheel_val);
        this.mTopShadow = new GradientDrawable(Orientation.TOP_BOTTOM, SHADOWS_COLORS);
        this.mBottomShadow = new GradientDrawable(Orientation.BOTTOM_TOP, SHADOWS_COLORS);

        // The default background.
//        this.setBackgroundResource(R.drawable.wheel_bg);

        // Disable the sound effect default.
        this.setSoundEffectsEnabled(true);
    }
WheelView.java 文件源码 项目:MoneyRecord 阅读 37 收藏 0 点赞 0 评论 0
/**
 * Initialize.
 *
 * @param context
 */
private void initialize(Context context) {
    this.setVerticalScrollBarEnabled(false);
    this.setSlotInCenter(true);
    this.setOrientation(TosGallery.VERTICAL);
    this.setGravity(Gravity.CENTER_HORIZONTAL);
    this.setUnselectedAlpha(1.0f);

    // This lead the onDraw() will be called.
    this.setWillNotDraw(false);

    // The selector rectangle drawable.
    this.mSelectorDrawable = getContext().getResources().getDrawable(R.drawable.wheel_val);
    this.mTopShadow = new GradientDrawable(Orientation.TOP_BOTTOM, SHADOWS_COLORS);
    this.mBottomShadow = new GradientDrawable(Orientation.BOTTOM_TOP, SHADOWS_COLORS);

    // The default background.
    this.setBackgroundResource(R.drawable.wheel_bg);

    // Disable the sound effect default.
    this.setSoundEffectsEnabled(false);
}
ShapeTranslater.java 文件源码 项目:AndroidXMLToJava 阅读 18 收藏 0 点赞 0 评论 0
@Override
public String translate() {
    AX2JCodeBlock codeBlock = new AX2JCodeBlock(GradientDrawable.class, getRoot().getObjectName());
    for (AX2JNode node : getRoot().getChildren()) {
        if (node.getLabelName().equals("gradient")) {
            String orientation;
            Attribute attribute = node.findAttrByName("android:angle");
            orientation = (attribute == null)? "Orientation.TOP_BOTTOM" : translateValue(codeBlock, attribute, Integer.class);
            addImport(Orientation.class);
            codeBlock.add("GradientDrawable " + getRoot().getObjectName() + " = new GradientDrawable(" +
                    orientation + ", null);\n", AX2JCode.PRIORITY_SECOND);
        } else if(node.getLabelName().equals("solid")) {
            codeBlock.add("GradientDrawable " + getRoot().getObjectName() + " = new GradientDrawable();\n", AX2JCode.PRIORITY_SECOND);
        }
    }
    addCodeBlock(codeBlock);

    return super.translate();
}
WheelView.java 文件源码 项目:Unity 阅读 25 收藏 0 点赞 0 评论 0
/**
 * Initializes resources
 */
private void initResourcesIfNecessary() {

    if (topShadow == null) {
        topShadow = new GradientDrawable(Orientation.TOP_BOTTOM,
                SHADOWS_COLORS);
    }

    if (topBlurShadow == null) {
        topBlurShadow = new GradientDrawable(Orientation.TOP_BOTTOM,
                BLUR_SHADOWS_COLORS);
    }

    if (bottomBlurShadow == null) {
        bottomBlurShadow = new GradientDrawable(Orientation.BOTTOM_TOP,
                BLUR_SHADOWS_COLORS);
    }

    if (bottomShadow == null) {
        bottomShadow = new GradientDrawable(Orientation.BOTTOM_TOP,
                SHADOWS_COLORS);
    }

}
UberColorPickerDialog.java 文件源码 项目:bVnc 阅读 22 收藏 0 点赞 0 评论 0
/**
 * Create a linear gradient shader to show variations in value.
 */
private void setVerValSlider() {
    float[] hsv = new float[3];
    hsv[0] = mHSV[0];
    hsv[1] = mHSV[1];
    hsv[2] = 1;
    int col = Color.HSVToColor(hsv);

    int colors[] = new int[2];
    colors[0] = col;
    colors[1] = 0xFF000000;
    GradientDrawable gradDraw = new GradientDrawable(Orientation.TOP_BOTTOM, colors);
    gradDraw.setDither(true);
    gradDraw.setLevel(10000);
    gradDraw.setBounds(0, 0, SLIDER_THICKNESS, PALETTE_DIM);
    gradDraw.draw(mVerSliderCv);
}
WheelView.java 文件源码 项目:pure 阅读 28 收藏 0 点赞 0 评论 0
/**
 * Initializes resources
 */
private void initResourcesIfNecessary() {
    if (centerDrawable == null) {
        centerDrawable = getContext().getResources().getDrawable(
                R.drawable.wheel_val);
    }

    if (topShadow == null) {
        topShadow = new GradientDrawable(Orientation.TOP_BOTTOM,
                SHADOWS_COLORS);
    }

    if (bottomShadow == null) {
        bottomShadow = new GradientDrawable(Orientation.BOTTOM_TOP,
                SHADOWS_COLORS);
    }

    setBackgroundResource(R.drawable.wheel_bg);
}


问题


面经


文章

微信
公众号

扫码关注公众号