Example usage for android.graphics.drawable ShapeDrawable ShapeDrawable

List of usage examples for android.graphics.drawable ShapeDrawable ShapeDrawable

Introduction

In this page you can find the example usage for android.graphics.drawable ShapeDrawable ShapeDrawable.

Prototype

public ShapeDrawable(Shape s) 

Source Link

Document

Creates a ShapeDrawable with a specified Shape.

Usage

From source file:android.support.v7.internal.widget.TintRatingBar.java

/**
 * Converts a drawable to a tiled version of itself. It will recursively
 * traverse layer and state list drawables.
 *//*from  w w w . jav a  2  s.  com*/
private Drawable tileify(Drawable drawable, boolean clip) {
    if (drawable instanceof DrawableWrapper) {
        Drawable inner = ((DrawableWrapper) drawable).getWrappedDrawable();
        if (inner != null) {
            inner = tileify(inner, clip);
            ((DrawableWrapper) drawable).setWrappedDrawable(inner);
        }
    } else if (drawable instanceof LayerDrawable) {
        LayerDrawable background = (LayerDrawable) drawable;
        final int N = background.getNumberOfLayers();
        Drawable[] outDrawables = new Drawable[N];

        for (int i = 0; i < N; i++) {
            int id = background.getId(i);
            outDrawables[i] = tileify(background.getDrawable(i),
                    (id == android.R.id.progress || id == android.R.id.secondaryProgress));
        }
        LayerDrawable newBg = new LayerDrawable(outDrawables);

        for (int i = 0; i < N; i++) {
            newBg.setId(i, background.getId(i));
        }

        return newBg;

    } else if (drawable instanceof BitmapDrawable) {
        final Bitmap tileBitmap = ((BitmapDrawable) drawable).getBitmap();
        if (mSampleTile == null) {
            mSampleTile = tileBitmap;
        }

        final ShapeDrawable shapeDrawable = new ShapeDrawable(getDrawableShape());
        final BitmapShader bitmapShader = new BitmapShader(tileBitmap, Shader.TileMode.REPEAT,
                Shader.TileMode.CLAMP);
        shapeDrawable.getPaint().setShader(bitmapShader);
        return (clip) ? new ClipDrawable(shapeDrawable, Gravity.LEFT, ClipDrawable.HORIZONTAL) : shapeDrawable;
    }

    return drawable;
}

From source file:ezy.ui.view.ViewPagerIndicator.java

Drawable genDrawable(int color) {
    ShapeDrawable drawable = new ShapeDrawable(new OvalShape());
    drawable.getPaint().setColor(color);
    drawable.getPaint().setAntiAlias(true);
    return drawable;
}

From source file:org.opensilk.common.ui.widget.FloatingActionButton.java

/**
 * >= api 21/*from   ww w.  j a  v  a2s . co  m*/
 */
@SuppressWarnings("NewApi")
protected RippleDrawable createRippleDrawable() {
    ShapeDrawable drawable = new ShapeDrawable(new OvalShape());
    drawable.getPaint().setColor(mColorNormal);
    return new RippleDrawable(createRippleStateList(), drawable, null);
}

From source file:br.ufrgs.ufrgsmapas.views.BuildingClusterRenderer.java

private LayerDrawable makeClusterBackground() {
    this.mColoredCircleBackground = new ShapeDrawable(new OvalShape());
    ShapeDrawable outline = new ShapeDrawable(new OvalShape());
    outline.getPaint().setColor(-2130706433);
    LayerDrawable background = new LayerDrawable(new Drawable[] { outline, this.mColoredCircleBackground });
    int strokeWidth = (int) (this.mDensity * 3.0F);
    background.setLayerInset(1, strokeWidth, strokeWidth, strokeWidth, strokeWidth);
    return background;
}

From source file:com.nick.documents.widget.FlexibleImageView.java

@SuppressLint("DrawAllocation")
@Override/*from  w  w w.  j a v  a2 s  .  c o  m*/
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
    super.onLayout(changed, left, top, right, bottom);
    final float density = getContext().getResources().getDisplayMetrics().density;
    mDiameter = Math.min(getMeasuredWidth(), getMeasuredHeight());
    if (mDiameter <= 0) {
        mDiameter = (int) density * DEFAULT_CIRCLE_DIAMETER;
    }
    if (getBackground() == null && mCircleBackgroundEnabled) {
        mBgCircle = new ShapeDrawable(new OvalShape());
        ViewCompat.setElevation(this, SHADOW_ELEVATION * density);
        mBgCircle.getPaint().setColor(mBgColor);
        setBackground(mBgCircle);
    }
    mProgressDrawable.setBackgroundColor(mBgColor);
    mProgressDrawable.setColorSchemeColors(mRingColors);
    mProgressDrawable.setSizeParameters(mDiameter, mDiameter,
            mInnerRadius <= 0 ? (mDiameter - mProgressStokeWidth * 2) / 4 : mInnerRadius, mProgressStokeWidth,
            mProgressStokeWidth * 4, mProgressStokeWidth * 2);
    super.setImageDrawable(null);
    super.setImageDrawable(mProgressDrawable);
    mProgressDrawable.setAlpha(255);
    mHandler.postDelayed(new Runnable() {
        @Override
        public void run() {
            mProgressDrawable.start();
        }
    }, ANIMATE_START_DELAY);
}

From source file:am.widget.MaterialProgressImageView.java

/**
 * /* w  ww  . ja  va2  s  .  co m*/
 *
 * @param color 
 */
public void setShadowsCircleBackground(int color) {
    if (background == null) {
        if (elevationSupported()) {
            background = new ShapeDrawable(new OvalShape());
        } else {
            background = new ShapeDrawable(new OvalShadow());
        }
    }
    background.getPaint().setColor(color);
    showShadowsCircle = true;
    super.setBackgroundDrawable(background);
}

From source file:org.opensilk.common.ui.widget.FloatingActionButton.java

/**
 * <= api 19/*from  ww  w.  j  av a  2 s. c  o  m*/
 */
protected Drawable createSelectableDrawable() {

    ShapeDrawable drawableNormal = new ShapeDrawable(new OvalShape());
    drawableNormal.getPaint().setColor(mColorNormal);

    StateListDrawable stateDrawable = new StateListDrawable();

    ShapeDrawable drawableHighlight = new ShapeDrawable(new OvalShape());
    drawableHighlight.getPaint().setColor(mColorPressed);

    stateDrawable.addState(new int[] { android.R.attr.state_pressed }, drawableHighlight);
    stateDrawable.addState(new int[0], null);

    LayerDrawable layerDrawable = new LayerDrawable(new Drawable[] { drawableNormal, stateDrawable });

    return layerDrawable;
}

From source file:eu.trentorise.smartcampus.widget.shortcuts.StackWidgetService.java

@Override
public RemoteViews getViewAt(int position) {
    // position will always range from 0 to getCount() - 1.

    // We construct a remote views item based on our widget item xml
    // file, and set the
    // text based on the position.
    RemoteViews rv = new RemoteViews(mContext.getPackageName(), R.layout.widget_item);
    ShapeDrawable sd1 = new ShapeDrawable(new RectShape());
    sd1.getPaint().setColor(0xFFFFFFFF);
    sd1.getPaint().setStyle(Style.STROKE);
    sd1.getPaint().setStrokeWidth(1);/*from w w w .j av  a2s . c o  m*/
    Canvas c = new Canvas();
    sd1.draw(c);
    Bitmap b = Bitmap.createBitmap(120, 120, Bitmap.Config.ARGB_8888);
    c.drawBitmap(b, 0, 0, sd1.getPaint());
    // Next, we set a fill-intent which will be used to fill-in the
    // pending intent template
    // which is set on the collection view in StackWidgetProvider.

    if (ALLPREFERENCES != null && ALLPREFERENCES[position] != null) { //ALLPREFERENCES  dimensionato come le preferenze selezionate

        BookmarkDescriptor myDescriptor = ALLPREFERENCES[position];

        // set the widgetbutton
        if (WidgetHelper.PARAM_TYPE.equals(myDescriptor.params.get(0).name)) { //controllare con gli input da config activity?
            String type = myDescriptor.params.get(0).value;
            if (WidgetHelper.TYPE_DT.equals(type)) {
                // dt -> put icons and hide text
                rv.setViewVisibility(R.id.text_widget_item, View.GONE);
                rv.setImageViewResource(R.id.image_widget_item,
                        Integer.parseInt(myDescriptor.params.get(2).value));

                rv.setInt(R.id.image_widget_item, "setBackgroundResource", R.drawable.rounded_border_dt);

            } else if (WidgetHelper.TYPE_JP.equals(type)) {
                // jp -> put text and hide icon

                rv.setViewVisibility(R.id.image_widget_item, View.GONE);
                // rv.setImageViewBitmap(R.id.text_widget_item,
                // getBackground(Color.parseColor("#6EB046")));
                if (!("0".equals(myDescriptor.params.get(2).value))) {
                    //bus
                    rv.setTextViewTextSize(R.id.text_widget_item, TypedValue.COMPLEX_UNIT_DIP, 80);

                    rv.setTextViewText(R.id.text_widget_item, RoutesHelper.getShortNameByRouteIdAndAgencyID(
                            myDescriptor.params.get(4).value, myDescriptor.params.get(3).value)); //4,3
                    rv.setTextColor(R.id.text_widget_item, Integer.parseInt(myDescriptor.params.get(2).value));//rv.setInt(R.id.text_widget_item, "setBackgroundColor",
                    //Integer.parseInt(myDescriptor.params.get(2).value));
                    rv.setInt(R.id.text_widget_item, "setBackgroundResource", R.drawable.rounded_border_jp);

                } else {
                    //train
                    rv.setTextViewTextSize(R.id.text_widget_item, TypedValue.COMPLEX_UNIT_DIP, 12);
                    //controllo contesto getRouteDescriptor i vari parametri
                    rv.setTextViewText(R.id.text_widget_item,
                            mContext.getString(
                                    RoutesHelper.getRouteDescriptorByRouteId(myDescriptor.params.get(3).value,
                                            myDescriptor.params.get(4).value).getNameResource()));
                    rv.setTextColor(R.id.text_widget_item, Color.BLACK);//Int(R.id.text_widget_item, "setBackgroundColor",Color.BLACK);
                    rv.setInt(R.id.text_widget_item, "setBackgroundResource", R.drawable.rounded_border_jp);

                }

            } else if (WidgetHelper.TYPE_JP_PARKINGS.equals(type)) {
                // jp parcheggio -> put text and hide icon
                rv.setViewVisibility(R.id.text_widget_item, View.GONE);
                rv.setImageViewResource(R.id.image_widget_item,
                        Integer.parseInt(myDescriptor.params.get(2).value));
                rv.setInt(R.id.image_widget_item, "setBackgroundResource", R.drawable.rounded_border_jp);

            }
            BookmarkDescriptor bookmark = myDescriptor;
            Bundle extras = new Bundle();
            extras.putString(StackWidgetProvider.EXTRA_INTENT, bookmark.getIntent());
            if (bookmark.getParams() != null) {
                for (Param param : bookmark.getParams()) {
                    extras.putString(param.name, param.value);

                }

            }
            Intent fillInIntent = new Intent(bookmark.getIntent());
            fillInIntent.putExtras(extras);
            rv.setOnClickFillInIntent(R.id.layout, fillInIntent);
        }

    }
    // Return the remote views object.
    // AppWidgetManager manager = AppWidgetManager.getInstance(mContext);
    // manager.updateAppWidget(thisWidget, rv);
    return rv;
}

From source file:io.puzzlebox.jigsaw.ui.EEGFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    v = inflater.inflate(R.layout.fragment_eeg, container, false);

    //      requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
    //      setContentView(R.layout.main);
    //      getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.title);

    progressBarAttention = (ProgressBar) v.findViewById(R.id.progressBarAttention);
    final float[] roundedCorners = new float[] { 5, 5, 5, 5, 5, 5, 5, 5 };
    ShapeDrawable progressBarAttentionDrawable = new ShapeDrawable(
            new RoundRectShape(roundedCorners, null, null));
    String progressBarAttentionColor = "#FF0000";
    progressBarAttentionDrawable.getPaint().setColor(Color.parseColor(progressBarAttentionColor));
    ClipDrawable progressAttention = new ClipDrawable(progressBarAttentionDrawable, Gravity.LEFT,
            ClipDrawable.HORIZONTAL);/*w  w w .  j av  a2s  . co  m*/
    progressBarAttention.setProgressDrawable(progressAttention);
    progressBarAttention
            .setBackgroundDrawable(getResources().getDrawable(android.R.drawable.progress_horizontal));

    progressBarMeditation = (ProgressBar) v.findViewById(R.id.progressBarMeditation);
    ShapeDrawable progressBarMeditationDrawable = new ShapeDrawable(
            new RoundRectShape(roundedCorners, null, null));
    String progressBarMeditationColor = "#0000FF";
    progressBarMeditationDrawable.getPaint().setColor(Color.parseColor(progressBarMeditationColor));
    ClipDrawable progressMeditation = new ClipDrawable(progressBarMeditationDrawable, Gravity.LEFT,
            ClipDrawable.HORIZONTAL);
    progressBarMeditation.setProgressDrawable(progressMeditation);
    progressBarMeditation
            .setBackgroundDrawable(getResources().getDrawable(android.R.drawable.progress_horizontal));

    progressBarSignal = (ProgressBar) v.findViewById(R.id.progressBarSignal);
    ShapeDrawable progressBarSignalDrawable = new ShapeDrawable(new RoundRectShape(roundedCorners, null, null));
    String progressBarSignalColor = "#00FF00";
    progressBarSignalDrawable.getPaint().setColor(Color.parseColor(progressBarSignalColor));
    ClipDrawable progressSignal = new ClipDrawable(progressBarSignalDrawable, Gravity.LEFT,
            ClipDrawable.HORIZONTAL);
    progressBarSignal.setProgressDrawable(progressSignal);
    progressBarSignal.setBackgroundDrawable(getResources().getDrawable(android.R.drawable.progress_horizontal));
    //      progressBarSignal.setProgress(tgSignal);

    progressBarPower = (ProgressBar) v.findViewById(R.id.progressBarPower);
    ShapeDrawable progressBarPowerDrawable = new ShapeDrawable(new RoundRectShape(roundedCorners, null, null));
    String progressBarPowerColor = "#FFFF00";
    progressBarPowerDrawable.getPaint().setColor(Color.parseColor(progressBarPowerColor));
    ClipDrawable progressPower = new ClipDrawable(progressBarPowerDrawable, Gravity.LEFT,
            ClipDrawable.HORIZONTAL);
    progressBarPower.setProgressDrawable(progressPower);
    progressBarPower.setBackgroundDrawable(getResources().getDrawable(android.R.drawable.progress_horizontal));

    progressBarBlink = (ProgressBar) v.findViewById(R.id.progressBarBlink);
    //      ShapeDrawable progressBarRangeDrawable = new ShapeDrawable(new RoundRectShape(roundedCorners, null,null));
    ShapeDrawable progressBarRangeDrawable = new ShapeDrawable();
    //      String progressBarRangeColor = "#FF00FF";
    //      String progressBarRangeColor = "#990099";
    String progressBarRangeColor = "#BBBBBB";
    progressBarRangeDrawable.getPaint().setColor(Color.parseColor(progressBarRangeColor));
    ClipDrawable progressRange = new ClipDrawable(progressBarRangeDrawable, Gravity.LEFT,
            ClipDrawable.HORIZONTAL);
    progressBarBlink.setProgressDrawable(progressRange);
    progressBarBlink.setBackgroundDrawable(getResources().getDrawable(android.R.drawable.progress_horizontal));

    progressBarBlink.setMax(ThinkGearService.blinkRangeMax);

    // setup the Raw EEG History plot
    eegRawHistoryPlot = (XYPlot) v.findViewById(R.id.eegRawHistoryPlot);
    //      eegRawHistorySeries = new SimpleXYSeries("Raw EEG");
    eegRawHistorySeries = new SimpleXYSeries("");

    // Use index value as xVal, instead of explicit, user provided xVals.
    //      eegRawHistorySeries.useImplicitXVals();

    // Setup the boundary mode, boundary values only applicable in FIXED mode.

    if (eegRawHistoryPlot != null) {

        //         eegRawHistoryPlot.setDomainBoundaries(0, EEG_RAW_HISTORY_SIZE, BoundaryMode.FIXED);
        //         eegRawHistoryPlot.setDomainBoundaries(0, ThinkGearService.EEG_RAW_HISTORY_SIZE, BoundaryMode.FIXED);
        //      eegRawHistoryPlot.setDomainBoundaries(0, EEG_RAW_HISTORY_SIZE, BoundaryMode.AUTO);
        //      eegRawHistoryPlot.setRangeBoundaries(-32767, 32767, BoundaryMode.FIXED);
        //      eegRawHistoryPlot.setRangeBoundaries(-32767, 32767, BoundaryMode.AUTO);
        //         eegRawHistoryPlot.setRangeBoundaries(-256, 256, BoundaryMode.GROW);
        eegRawHistoryPlot.setDomainBoundaries(0, ThinkGearService.EEG_RAW_FREQUENCY, BoundaryMode.FIXED);
        eegRawHistoryPlot.setRangeBoundaries(0, 1, BoundaryMode.GROW);

        eegRawHistoryPlot.addSeries(eegRawHistorySeries,
                new LineAndPointFormatter(Color.rgb(200, 100, 100), Color.BLACK, null, null));

        // Thin out domain and range tick values so they don't overlap
        eegRawHistoryPlot.setDomainStepValue(5);
        eegRawHistoryPlot.setTicksPerRangeLabel(3);

        //      eegRawHistoryPlot.setRangeLabel("Amplitude");

        // Sets the dimensions of the widget to exactly contain the text contents
        eegRawHistoryPlot.getDomainLabelWidget().pack();
        eegRawHistoryPlot.getRangeLabelWidget().pack();

        // Only display whole numbers in labels
        eegRawHistoryPlot.getGraphWidget().setDomainValueFormat(new DecimalFormat("0"));
        eegRawHistoryPlot.getGraphWidget().setRangeValueFormat(new DecimalFormat("0"));

        // Hide domain and range labels
        eegRawHistoryPlot.getGraphWidget().setDomainLabelWidth(0);
        eegRawHistoryPlot.getGraphWidget().setRangeLabelWidth(0);

        // Hide legend
        eegRawHistoryPlot.getLegendWidget().setVisible(false);

        // setGridPadding(float left, float top, float right, float bottom)
        eegRawHistoryPlot.getGraphWidget().setGridPadding(0, 0, 0, 0);

        //      eegRawHistoryPlot.getGraphWidget().setDrawMarkersEnabled(false);

        //      final PlotStatistics histStats = new PlotStatistics(1000, false);
        //      eegRawHistoryPlot.addListener(histStats);

    }

    seekBarAttention = (SeekBar) v.findViewById(R.id.seekBarAttention);
    seekBarAttention.setOnSeekBarChangeListener(this);
    seekBarMeditation = (SeekBar) v.findViewById(R.id.seekBarMeditation);
    seekBarMeditation.setOnSeekBarChangeListener(this);

    //      spinnerEEG = (Spinner) v.findViewById(R.id.spinnerEEG);

    String[] items = new String[] { "NeuroSky MindWave Mobile", "Emotiv Insight", "InteraXon Muse" };

    //      if (ThinkGearService.eegConnected || ThinkGearService.eegConnecting)
    //         items = new String[] {"NeuroSky MindWave Mobile", "Emotiv Insight", "InteraXon Muse"};
    if (MuseService.eegConnected || MuseService.eegConnecting)
        items = new String[] { "InteraXon Muse", "Emotiv Insight", "NeuroSky MindWave Mobile" };

    spinnerEEG = (Spinner) v.findViewById(R.id.spinnerEEG);

    //      ArrayAdapter<String> adapter = new ArrayAdapter<>(getActivity().getApplicationContext(),
    //              android.R.layout.simple_spinner_item, items);

    ArrayAdapter<String> adapter = new ArrayAdapter<>(getActivity().getApplicationContext(),
            R.layout.spinner_item, items);

    //      ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.spinner_item,list);

    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    spinnerEEG.setAdapter(adapter);

    if (android.os.Build.VERSION.SDK_INT >= 16)
        spinnerEEG.setPopupBackgroundDrawable(new ColorDrawable(Color.DKGRAY));

    //      imageViewStatus = (ImageView) v.findViewById(R.id.imageViewStatus);

    textViewSessionTime = (TextView) v.findViewById(R.id.textViewSessionTime);

    Button connectEEG = (Button) v.findViewById(R.id.buttonConnectEEG);
    connectEEG.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            connectHeadset();
        }
    });

    if (ThinkGearService.eegConnected) {
        connectEEG.setText("Disconnect EEG");
        spinnerEEG.setEnabled(false);
    }
    if (MuseService.eegConnected) {
        connectEEG.setText("Disconnect EEG");
        //         spinnerEEG.setSelection(spinnerEEG.getPosition(DEFAULT_CURRENCY_TYPE));
        //         spinnerEEG.setSelection(spinnerEEG.getAdapter(). .getPosition(DEFAULT_CURRENCY_TYPE));
        spinnerEEG.setEnabled(false);
    }

    //      Button saveSession = (Button) v.findViewById(R.id.buttonSaveSession);
    //      saveSession.setOnClickListener(new View.OnClickListener() {
    //         @Override
    //         public void onClick(View v) {
    //
    //            Intent intent = new Intent(getActivity(), CreateSessionFileInGoogleDrive.class);
    //            startActivity(intent);
    //
    ////            Toast.makeText((getActivity()),
    ////                    "Session data saved to Google Drive",
    ////                    Toast.LENGTH_SHORT).show();
    //         }
    //      });

    //      Button exportToCSV = (Button) v.findViewById(R.id.buttonExportCSV);
    //      exportToCSV.setOnClickListener(new View.OnClickListener() {
    //         @Override
    //         public void onClick(View v) {
    //            Log.d(TAG, "SessionSingleton.getInstance().exportDataToCSV");
    ////            String path = SessionSingleton.getInstance().getTimestampPS4();
    //            SessionSingleton.getInstance().exportDataToCSV(null, null);
    //
    //            Toast.makeText((getActivity()),
    //                    "Session data exported to:\n" + SessionSingleton.getInstance().getTimestampPS4() + ".csv",
    //                    Toast.LENGTH_LONG).show();
    //         }
    //      });

    Button resetSession = (Button) v.findViewById(R.id.buttonResetSession);
    resetSession.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

            resetSession();

        }
    });

    intentThinkGear = new Intent(getActivity(), ThinkGearService.class);
    intentMuse = new Intent(getActivity(), MuseService.class);

    /**
     * Update settings according to default UI
     */

    updateScreenLayout();

    updatePowerThresholds();
    updatePower();

    return v;

}

From source file:com.github.refreshloadlayout.ProgressView.java

@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
    super.onLayout(changed, left, top, right, bottom);
    final float density = getContext().getResources().getDisplayMetrics().density;
    mDiameter = Math.min(getMeasuredWidth(), getMeasuredHeight());
    if (mDiameter <= 0) {
        mDiameter = (int) density * DEFAULT_CIRCLE_DIAMETER;
    }//from   www  .j  a va  2  s . c o  m
    if (getBackground() == null && mCircleBackgroundEnabled) {
        final int shadowYOffset = (int) (density * Y_OFFSET);
        final int shadowXOffset = (int) (density * X_OFFSET);
        if (elevationSupported()) {
            mBgCircle = new ShapeDrawable(new OvalShape());
            ViewCompat.setElevation(this, SHADOW_ELEVATION * density);
        } else {
            OvalShape oval = new OvalShadow(mShadowRadius, mDiameter - mShadowRadius * 2);
            mBgCircle = new ShapeDrawable(oval);
            ViewCompat.setLayerType(this, ViewCompat.LAYER_TYPE_SOFTWARE, mBgCircle.getPaint());
            mBgCircle.getPaint().setShadowLayer(mShadowRadius, shadowXOffset, shadowYOffset, KEY_SHADOW_COLOR);
            final int padding = mShadowRadius;
            // set padding so the inner image sits correctly within the shadow.
            setPadding(padding, padding, padding, padding);
        }
        mBgCircle.getPaint().setColor(mBackGroundColor);
        setBackgroundDrawable(mBgCircle);
    }
    mProgressDrawable.setBackgroundColor(mBackGroundColor);
    mProgressDrawable.setColorSchemeColors(mColors);
    mProgressDrawable.setSizeParameters(mDiameter, mDiameter,
            mInnerRadius <= 0 ? (mDiameter - mProgressStokeWidth * 2) / 4 : mInnerRadius, mProgressStokeWidth,
            mArrowWidth < 0 ? mProgressStokeWidth * 4 : mArrowWidth,
            mArrowHeight < 0 ? mProgressStokeWidth * 2 : mArrowHeight);
    if (isShowArrow()) {
        mProgressDrawable.setArrowScale(1f);
        mProgressDrawable.showArrow(true);
    }
    super.setImageDrawable(null);
    super.setImageDrawable(mProgressDrawable);
    mProgressDrawable.setAlpha(255);
    if (getVisibility() == VISIBLE) {
        mProgressDrawable.setStartEndTrim(0, (float) 0.8);
    }
}