Java Code Examples for android.graphics.Color#parseColor()

The following examples show how to use android.graphics.Color#parseColor() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HelperUrl.java    From iGap-Android with GNU Affero General Public License v3.0 6 votes vote down vote up
private static void insertIgapBot(final SpannableStringBuilder strBuilder, final int start, final int end) {

        ClickableSpan clickable = new ClickableSpan() {
            public void onClick(View view) {
                G.isLinkClicked = true;
                String botCommandText = strBuilder.toString().substring(start, end);

                if (G.onBotClick != null) {
                    G.onBotClick.onBotCommandText(botCommandText);
                }
            }

            @Override
            public void updateDrawState(TextPaint ds) {
                ds.linkColor = Color.parseColor(G.linkColor);
                super.updateDrawState(ds);
                ds.setUnderlineText(false);
            }
        };

        strBuilder.setSpan(clickable, start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
    }
 
Example 2
Source File: ColorPreference.java    From FireFiles with Apache License 2.0 6 votes vote down vote up
private void initAttrs(AttributeSet attrs, int defStyle) {
    TypedArray a = getContext().getTheme().obtainStyledAttributes(
            attrs, R.styleable.ColorPreference, defStyle, defStyle);

    try {
        mItemLayoutId = a.getResourceId(R.styleable.ColorPreference_itemLayout, mItemLayoutId);
        mNumColumns = a.getInteger(R.styleable.ColorPreference_numColumns, mNumColumns);
        int choicesResId = a.getResourceId(R.styleable.ColorPreference_choices,
                R.array.default_color_choice_values);
        if (choicesResId > 0) {
            String[] choices = a.getResources().getStringArray(choicesResId);
            mColorChoices = new int[choices.length];
            for (int i = 0; i < choices.length; i++) {
                mColorChoices[i] = Color.parseColor(choices[i]);
            }
        }

    } finally {
        a.recycle();
    }

    setWidgetLayoutResource(mItemLayoutId);
}
 
Example 3
Source File: ProductRecommentationActivity.java    From FaceT with Mozilla Public License 2.0 5 votes vote down vote up
private void compareColor() {
    Resources res = getResources();
    matchColorList = new HashMap();
    foundationMatchedColor = new ArrayList<>();
    final String[] categoryArray = res.getStringArray(R.array.category_type_array);
    List<ProductTypeTwo> values = new ArrayList<>(mProducts.values());
    List<String> keys = new ArrayList<>(mProducts.keySet());
    double[] temp = new double[3];
    for (int i = 0; i < keys.size(); i++) {
        if (values.get(i) != null && values.get(i).getCategory().equals(categoryArray[1])) {
            Log.d(TAG + "1 sortProduct: ", keys.get(i) + " " + values.get(0).getProductName());
            int color1 = 0, b = 0, g = 0, r = 0;
            colorMatchTemp = new ArrayList<>();
            for (int j = 0; j < values.get(i).getColor().size(); j++) {
                color1 = Color.parseColor(values.get(i).getColor().get(j).get(0));
                b = (color1) & 0xFF;
                g = (color1 >> 8) & 0xFF;
                r = (color1 >> 16) & 0xFF;
                Log.d(TAG + " stringColorRGBToRGB  , r ,g ,b ", " " + r + " " + g + " " + b + "");
                temp[0] = r;
                temp[1] = g;
                temp[2] = b;
                if (similarTo(detectedRGBvalue, temp)) {
                    mFoundationProducts.put(keys.get(i), values.get(i));
                    colorMatchTemp.add(values.get(i).getColor().get(j).get(0));
                    foundationMatchedColor.add(values.get(i).getColor().get(j).get(0));
                }
            }

            if (colorMatchTemp.size() > 0) {
                matchColorList.put(keys.get(i), colorMatchTemp);
                Log.d("    matchColorList.put(keys.get(i), colorMatchTemp)", keys.get(i).toString() + " : " + colorMatchTemp.toString());
            }
        }
        Log.d(" color matched ", matchColorList.toString());
    }

}
 
Example 4
Source File: GosDeploy.java    From gokit-android with MIT License 5 votes vote down vote up
/**
 * 设置Button文字颜色
 * 
 * @return
 */
public static int setButtonTextColor() {
	int buttonTextcolor = context.getResources().getColor(R.color.black);
	String ButtonTextColor_FromMap = infoMap.get(ButtonTextColor_Key).toString();
	if (!TextUtils.isEmpty(ButtonTextColor_FromMap)) {
		buttonTextcolor = Color.parseColor("#" + ButtonTextColor_FromMap);
	}

	return buttonTextcolor;
}
 
Example 5
Source File: HelperUrl.java    From iGap-Android with GNU Affero General Public License v3.0 5 votes vote down vote up
public static void openBrowser(String url) {
    final CustomTabsHelperFragment mCustomTabsHelperFragment = CustomTabsHelperFragment.attachTo((FragmentActivity) G.currentActivity);

    int mColorPrimary = Color.parseColor(G.appBarColor);
    final Uri PROJECT_URI = Uri.parse(url);

    CustomTabsIntent mCustomTabsIntent = new CustomTabsIntent.Builder().enableUrlBarHiding().setToolbarColor(mColorPrimary).setShowTitle(true).build();

    mCustomTabsHelperFragment.setConnectionCallback(new CustomTabsActivityHelper.ConnectionCallback() {
        @Override
        public void onCustomTabsConnected() {
            mCustomTabsHelperFragment.mayLaunchUrl(PROJECT_URI, null, null);
        }

        @Override
        public void onCustomTabsDisconnected() {
        }
    });

    CustomTabsHelperFragment.open(G.currentActivity, mCustomTabsIntent, PROJECT_URI, new CustomTabsActivityHelper.CustomTabsFallback() {
        @Override
        public void openUri(Activity activity, Uri uri) {
            try {
                activity.startActivity(new Intent(Intent.ACTION_VIEW, uri));
            } catch (ActivityNotFoundException e) {
                e.printStackTrace();
            }
        }
    });
}
 
Example 6
Source File: MainActivity.java    From TextHighlighter with MIT License 5 votes vote down vote up
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
  if (s.toString().isEmpty()) {
    textHighlighter.setBackgroundColor(DEFAULT_BG_COLOR);
  } else {
    try {
      int color = Color.parseColor("#" + s.toString());
      textHighlighter.setBackgroundColor(color);
    } catch (IllegalArgumentException iae) {
      textHighlighter.resetBackgroundColor();
    }
  }
  textHighlighter.invalidate(matcher);
}
 
Example 7
Source File: SingleMakeupActivity.java    From FaceT with Mozilla Public License 2.0 5 votes vote down vote up
private int stringColorRGBToARGB(String hexColor, int valueA, int valueR, int valueG, int valueB) {
        //get color from db
//        int color = Color.parseColor("#FF783928");
        int color1 = Color.parseColor(hexColor);
        int b = (color1) & 0xFF;
        int g = (color1 >> 8) & 0xFF;
        int r = (color1 >> 16) & 0xFF;
        int a = valueA;
        Log.d(TAG + " stringColorRGBToARGB a , r ,g ,b ", a + " " + r + " " + g + " " + b + "");

        if (r + valueR > 255)
            r = 255;
        else if (r + valueR < 0)
            r = 0;
        else
            r = r + valueR;

        if (g + valueG > 255)
            g = 255;
        else if (g + valueG < 0)
            g = 0;
        else
            g = g + valueG;

        if (b + valueB > 255)
            b = 255;
        else if (b + valueB < 0)
            b = 0;
        else
            b = b + valueB;

        int color2 = a << 24 | r << 16 | g << 8 | b << 0;
//        Log.d(TAG + " color1_color2 ", color1 + " : " + color2);
        return color2;
    }
 
Example 8
Source File: Utils.java    From android-discourse with Apache License 2.0 5 votes vote down vote up
public static void displayInstantAnswer(View view, BaseModel model) {
    TextView title = (TextView) view.findViewById(R.id.uv_title);
    TextView detail = (TextView) view.findViewById(R.id.uv_detail);
    View suggestionDetails = view.findViewById(R.id.uv_suggestion_details);
    ImageView image = (ImageView) view.findViewById(R.id.uv_icon);
    if (model instanceof Article) {
        Article article = (Article) model;
        image.setImageResource(R.drawable.uv_article);
        title.setText(article.getTitle());
        if (article.getTopicName() != null) {
            detail.setVisibility(View.VISIBLE);
            detail.setText(article.getTopicName());
        } else {
            detail.setVisibility(View.GONE);
        }
        suggestionDetails.setVisibility(View.GONE);
    } else if (model instanceof Suggestion) {
        Suggestion suggestion = (Suggestion) model;
        image.setImageResource(R.drawable.uv_idea);
        title.setText(suggestion.getTitle());
        detail.setVisibility(View.VISIBLE);
        detail.setText(suggestion.getForumName());
        if (suggestion.getStatus() != null) {
            View statusColor = suggestionDetails.findViewById(R.id.uv_suggestion_status_color);
            TextView status = (TextView) suggestionDetails.findViewById(R.id.uv_suggestion_status);
            int color = Color.parseColor(suggestion.getStatusColor());
            suggestionDetails.setVisibility(View.VISIBLE);
            status.setText(suggestion.getStatus().toUpperCase(Locale.getDefault()));
            status.setTextColor(color);
            statusColor.setBackgroundColor(color);
        } else {
            suggestionDetails.setVisibility(View.GONE);
        }

    }
}
 
Example 9
Source File: GalleryActivity.java    From Overchan-Android with GNU General Public License v3.0 5 votes vote down vote up
private Spanned getSpannedText(String message) {
    message = " " + message + " ";
    SpannableStringBuilder spanned = new SpannableStringBuilder(message);
    for (Object span : new Object[] { new ForegroundColorSpan(Color.WHITE), new BackgroundColorSpan(Color.parseColor("#88000000")) }) { 
        spanned.setSpan(span, 0, message.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
    }
    return spanned;
}
 
Example 10
Source File: StepView.java    From StepView with Apache License 2.0 5 votes vote down vote up
private void initData(Context context) {
    mStrokeWidth = dip2px(context, 1);
    mLineDistance = dip2px(context, 10);
    mBigTextSize = dip2px(context, 50);
    mSmallTextSize = dip2px(context, 15);
    mDotSize = dip2px(context, 5);
    mColor = Color.parseColor("#ffffff");
}
 
Example 11
Source File: Utils.java    From DialogSheet with MIT License 4 votes vote down vote up
@ColorInt
static int getTextColorSec(int color) {
    return isColorLight(color) ? Color.parseColor("#8A000000") : Color.parseColor("#B3FFFFFF");
}
 
Example 12
Source File: CustomThemeWrapper.java    From Infinity-For-Reddit with GNU Affero General Public License v3.0 4 votes vote down vote up
private static CustomTheme getCalmPastel(Context context) {
    CustomTheme customTheme = new CustomTheme(context.getString(R.string.theme_name_calm_pastel));
    customTheme.isLightTheme = true;
    customTheme.isDarkTheme = false;
    customTheme.isAmoledTheme = false;
    customTheme.colorPrimary = Color.parseColor("#D48AE0");
    customTheme.colorPrimaryDark = Color.parseColor("#D476E0");
    customTheme.colorAccent = Color.parseColor("#775EFF");
    customTheme.colorPrimaryLightTheme = Color.parseColor("#D48AE0");
    customTheme.primaryTextColor = Color.parseColor("#000000");
    customTheme.secondaryTextColor = Color.parseColor("#8A000000");
    customTheme.postTitleColor = Color.parseColor("#000000");
    customTheme.postContentColor = Color.parseColor("#8A000000");
    customTheme.commentColor = Color.parseColor("#000000");
    customTheme.buttonTextColor = Color.parseColor("#FFFFFF");
    customTheme.backgroundColor = Color.parseColor("#DAD0DE");
    customTheme.cardViewBackgroundColor = Color.parseColor("#C0F0F4");
    customTheme.commentBackgroundColor = Color.parseColor("#C0F0F4");
    customTheme.bottomAppBarBackgroundColor = Color.parseColor("#D48AE0");
    customTheme.primaryIconColor = Color.parseColor("#000000");
    customTheme.bottomAppBarIconColor = Color.parseColor("#000000");
    customTheme.postIconAndInfoColor = Color.parseColor("#000000");
    customTheme.commentIconAndInfoColor = Color.parseColor("#000000");
    customTheme.toolbarPrimaryTextAndIconColor = Color.parseColor("#3C4043");
    customTheme.toolbarSecondaryTextColor = Color.parseColor("#3C4043");
    customTheme.circularProgressBarBackground = Color.parseColor("#D48AE0");
    customTheme.tabLayoutWithExpandedCollapsingToolbarTabBackground = Color.parseColor("#FFFFFF");
    customTheme.tabLayoutWithExpandedCollapsingToolbarTextColor = Color.parseColor("#D48AE0");
    customTheme.tabLayoutWithExpandedCollapsingToolbarTabIndicator = Color.parseColor("#D48AE0");
    customTheme.tabLayoutWithCollapsedCollapsingToolbarTabBackground = Color.parseColor("#D48AE0");
    customTheme.tabLayoutWithCollapsedCollapsingToolbarTextColor = Color.parseColor("#3C4043");
    customTheme.tabLayoutWithCollapsedCollapsingToolbarTabIndicator = Color.parseColor("#3C4043");
    customTheme.upvoted = Color.parseColor("#E91E63");
    customTheme.downvoted = Color.parseColor("#007DDE");
    customTheme.postTypeBackgroundColor = Color.parseColor("#0D47A1");
    customTheme.postTypeTextColor = Color.parseColor("#FFFFFF");
    customTheme.spoilerBackgroundColor = Color.parseColor("#EE02EB");
    customTheme.spoilerTextColor = Color.parseColor("#FFFFFF");
    customTheme.nsfwBackgroundColor = Color.parseColor("#FF4081");
    customTheme.nsfwTextColor = Color.parseColor("#FFFFFF");
    customTheme.flairBackgroundColor = Color.parseColor("#00AA8C");
    customTheme.flairTextColor = Color.parseColor("#FFFFFF");
    customTheme.awardsBackgroundColor = Color.parseColor("#EEAB02");
    customTheme.awardsTextColor = Color.parseColor("#FFFFFF");
    customTheme.archivedTint = Color.parseColor("#B4009F");
    customTheme.lockedIconTint = Color.parseColor("#EE7302");
    customTheme.crosspostIconTint = Color.parseColor("#FF4081");
    customTheme.stickiedPostIconTint = Color.parseColor("#0D47A1");
    customTheme.subscribed = Color.parseColor("#FF4081");
    customTheme.unsubscribed = Color.parseColor("#0D47A1");
    customTheme.username = Color.parseColor("#0D47A1");
    customTheme.subreddit = Color.parseColor("#E91E63");
    customTheme.authorFlairTextColor = Color.parseColor("#EE02C4");
    customTheme.submitter = Color.parseColor("#EE8A02");
    customTheme.moderator = Color.parseColor("#00BA81");
    customTheme.singleCommentThreadBackgroundColor = Color.parseColor("#25D5E5");
    customTheme.unreadMessageBackgroundColor = Color.parseColor("#25D5E5");
    customTheme.dividerColor = Color.parseColor("#E0E0E0");
    customTheme.noPreviewLinkBackgroundColor = Color.parseColor("#E0E0E0");
    customTheme.voteAndReplyUnavailableButtonColor = Color.parseColor("#F0F0F0");
    customTheme.commentVerticalBarColor1 = Color.parseColor("#1565C0");
    customTheme.commentVerticalBarColor2 = Color.parseColor("#EE02BE");
    customTheme.commentVerticalBarColor3 = Color.parseColor("#02DFEE");
    customTheme.commentVerticalBarColor4 = Color.parseColor("#EED502");
    customTheme.commentVerticalBarColor5 = Color.parseColor("#EE0220");
    customTheme.commentVerticalBarColor6 = Color.parseColor("#02EE6E");
    customTheme.commentVerticalBarColor7 = Color.parseColor("#EE4602");
    customTheme.fabIconColor = Color.parseColor("#000000");
    customTheme.chipTextColor = Color.parseColor("#FFFFFF");
    customTheme.navBarColor = Color.parseColor("#D48AE0");
    customTheme.isLightStatusBar = true;
    customTheme.isLightNavBar = true;
    customTheme.isChangeStatusBarIconColorAfterToolbarCollapsedInImmersiveInterface = false;

    return customTheme;
}
 
Example 13
Source File: WaistMeasurementView.java    From openScale with GNU General Public License v3.0 4 votes vote down vote up
@Override
public int getColor() {
    return Color.parseColor("#FF7043");
}
 
Example 14
Source File: TickColor.java    From tickmate with GNU General Public License v3.0 4 votes vote down vote up
public Drawable getDrawable(int alpha) {
    Log.d(TAG, "getTickedButtonDrawable " + getName());
    ColorDrawable cd = new ColorDrawable(Color.parseColor(hex()));
    cd.setAlpha(alpha);
    return cd;
}
 
Example 15
Source File: CustomThemeWrapper.java    From Infinity-For-Reddit with GNU Affero General Public License v3.0 4 votes vote down vote up
public static CustomTheme getIndigoDark(Context context) {
    CustomTheme customTheme = new CustomTheme(context.getString(R.string.theme_name_indigo_dark));
    customTheme.isLightTheme = false;
    customTheme.isDarkTheme = true;
    customTheme.isAmoledTheme = false;
    customTheme.colorPrimary = Color.parseColor("#242424");
    customTheme.colorPrimaryDark = Color.parseColor("#121212");
    customTheme.colorAccent = Color.parseColor("#FF4081");
    customTheme.colorPrimaryLightTheme = Color.parseColor("#1565C0");
    customTheme.primaryTextColor = Color.parseColor("#FFFFFF");
    customTheme.secondaryTextColor = Color.parseColor("#B3FFFFFF");
    customTheme.postTitleColor = Color.parseColor("#FFFFFF");
    customTheme.postContentColor = Color.parseColor("#B3FFFFFF");
    customTheme.commentColor = Color.parseColor("#FFFFFF");
    customTheme.buttonTextColor = Color.parseColor("#FFFFFF");
    customTheme.backgroundColor = Color.parseColor("#121212");
    customTheme.cardViewBackgroundColor = Color.parseColor("#242424");
    customTheme.commentBackgroundColor = Color.parseColor("#242424");
    customTheme.bottomAppBarBackgroundColor = Color.parseColor("#121212");
    customTheme.primaryIconColor = Color.parseColor("#FFFFFF");
    customTheme.bottomAppBarIconColor = Color.parseColor("#FFFFFF");
    customTheme.postIconAndInfoColor = Color.parseColor("#B3FFFFFF");
    customTheme.commentIconAndInfoColor = Color.parseColor("#B3FFFFFF");
    customTheme.toolbarPrimaryTextAndIconColor = Color.parseColor("#FFFFFF");
    customTheme.toolbarSecondaryTextColor = Color.parseColor("#FFFFFF");
    customTheme.circularProgressBarBackground = Color.parseColor("#242424");
    customTheme.tabLayoutWithExpandedCollapsingToolbarTabBackground = Color.parseColor("#242424");
    customTheme.tabLayoutWithExpandedCollapsingToolbarTextColor = Color.parseColor("#FFFFFF");
    customTheme.tabLayoutWithExpandedCollapsingToolbarTabIndicator = Color.parseColor("#FFFFFF");
    customTheme.tabLayoutWithCollapsedCollapsingToolbarTabBackground = Color.parseColor("#242424");
    customTheme.tabLayoutWithCollapsedCollapsingToolbarTextColor = Color.parseColor("#FFFFFF");
    customTheme.tabLayoutWithCollapsedCollapsingToolbarTabIndicator = Color.parseColor("#FFFFFF");
    customTheme.upvoted = Color.parseColor("#E91E63");
    customTheme.downvoted = Color.parseColor("#007DDE");
    customTheme.postTypeBackgroundColor = Color.parseColor("#1565C0");
    customTheme.postTypeTextColor = Color.parseColor("#FFFFFF");
    customTheme.spoilerBackgroundColor = Color.parseColor("#EE02EB");
    customTheme.spoilerTextColor = Color.parseColor("#FFFFFF");
    customTheme.nsfwBackgroundColor = Color.parseColor("#FF4081");
    customTheme.nsfwTextColor = Color.parseColor("#FFFFFF");
    customTheme.flairBackgroundColor = Color.parseColor("#00AA8C");
    customTheme.flairTextColor = Color.parseColor("#FFFFFF");
    customTheme.awardsBackgroundColor = Color.parseColor("#EEAB02");
    customTheme.awardsTextColor = Color.parseColor("#FFFFFF");
    customTheme.archivedTint = Color.parseColor("#B4009F");
    customTheme.lockedIconTint = Color.parseColor("#EE7302");
    customTheme.crosspostIconTint = Color.parseColor("#FF4081");
    customTheme.stickiedPostIconTint = Color.parseColor("#1565C0");
    customTheme.subscribed = Color.parseColor("#FF4081");
    customTheme.unsubscribed = Color.parseColor("#1565C0");
    customTheme.username = Color.parseColor("#1E88E5");
    customTheme.subreddit = Color.parseColor("#E91E63");
    customTheme.authorFlairTextColor = Color.parseColor("#EE02C4");
    customTheme.submitter = Color.parseColor("#EE8A02");
    customTheme.moderator = Color.parseColor("#00BA81");
    customTheme.singleCommentThreadBackgroundColor = Color.parseColor("#123E77");
    customTheme.unreadMessageBackgroundColor = Color.parseColor("#123E77");
    customTheme.dividerColor = Color.parseColor("#69666C");
    customTheme.noPreviewLinkBackgroundColor = Color.parseColor("#424242");
    customTheme.voteAndReplyUnavailableButtonColor = Color.parseColor("#3C3C3C");
    customTheme.commentVerticalBarColor1 = Color.parseColor("#1565C0");
    customTheme.commentVerticalBarColor2 = Color.parseColor("#C300B3");
    customTheme.commentVerticalBarColor3 = Color.parseColor("#00B8DA");
    customTheme.commentVerticalBarColor4 = Color.parseColor("#EDCA00");
    customTheme.commentVerticalBarColor5 = Color.parseColor("#EE0219");
    customTheme.commentVerticalBarColor6 = Color.parseColor("#00B925");
    customTheme.commentVerticalBarColor7 = Color.parseColor("#EE4602");
    customTheme.fabIconColor = Color.parseColor("#FFFFFF");
    customTheme.chipTextColor = Color.parseColor("#FFFFFF");
    customTheme.navBarColor = Color.parseColor("#121212");
    customTheme.isLightStatusBar = false;
    customTheme.isLightNavBar = false;
    customTheme.isChangeStatusBarIconColorAfterToolbarCollapsedInImmersiveInterface = false;

    return customTheme;
}
 
Example 16
Source File: StatusBarModule.java    From react-native-android-statusbar with MIT License 4 votes vote down vote up
@ReactMethod
public void setHexColor(String hex){
    int color = Color.parseColor(hex);
    setStatusColor(color);
}
 
Example 17
Source File: Card.java    From tv-samples with Apache License 2.0 4 votes vote down vote up
public int getSelectedColor() {
    if (mSelectedColor == null) return -1;
    return Color.parseColor(mSelectedColor);
}
 
Example 18
Source File: BusLineOverlay.java    From TraceByAmap with MIT License 4 votes vote down vote up
protected int getBusColor() {
    return Color.parseColor("#537edc");
}
 
Example 19
Source File: ProgressPieView.java    From okhttp-OkGo with Apache License 2.0 4 votes vote down vote up
private void init(Context context, AttributeSet attrs) {
    mDisplayMetrics = context.getResources().getDisplayMetrics();

    mStrokeWidth = mStrokeWidth * mDisplayMetrics.density;
    mTextSize = mTextSize * mDisplayMetrics.scaledDensity;

    final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ProgressPieView);
    final Resources res = getResources();

    mMax = a.getInteger(R.styleable.ProgressPieView_ppvMax, mMax);
    mProgress = a.getInteger(R.styleable.ProgressPieView_ppvProgress, mProgress);
    mStartAngle = a.getInt(R.styleable.ProgressPieView_ppvStartAngle, mStartAngle);
    mInverted = a.getBoolean(R.styleable.ProgressPieView_ppvInverted, mInverted);
    mCounterclockwise = a.getBoolean(R.styleable.ProgressPieView_ppvCounterclockwise, mCounterclockwise);
    mStrokeWidth = a.getDimension(R.styleable.ProgressPieView_ppvStrokeWidth, mStrokeWidth);
    mTypeface = a.getString(R.styleable.ProgressPieView_ppvTypeface);
    mTextSize = a.getDimension(R.styleable.ProgressPieView_android_textSize, mTextSize);
    mText = a.getString(R.styleable.ProgressPieView_android_text);

    mShowStroke = a.getBoolean(R.styleable.ProgressPieView_ppvShowStroke, mShowStroke);
    mShowText = a.getBoolean(R.styleable.ProgressPieView_ppvShowText, mShowText);
    mImage = a.getDrawable(R.styleable.ProgressPieView_ppvImage);

    int backgroundColor = Color.parseColor("#00000000");
    backgroundColor = a.getColor(R.styleable.ProgressPieView_ppvBackgroundColor, backgroundColor);
    int progressColor = Color.parseColor("#33b5e5");
    progressColor = a.getColor(R.styleable.ProgressPieView_ppvProgressColor, progressColor);
    int strokeColor = Color.parseColor("#33b5e5");
    strokeColor = a.getColor(R.styleable.ProgressPieView_ppvStrokeColor, strokeColor);
    int textColor = Color.parseColor("#333333");
    textColor = a.getColor(R.styleable.ProgressPieView_android_textColor, textColor);

    mProgressFillType = a.getInteger(R.styleable.ProgressPieView_ppvProgressFillType, mProgressFillType);

    a.recycle();

    mBackgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mBackgroundPaint.setColor(backgroundColor);
    mBackgroundPaint.setStyle(Paint.Style.FILL);

    mProgressPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mProgressPaint.setColor(progressColor);
    mProgressPaint.setStyle(Paint.Style.FILL);

    mStrokePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mStrokePaint.setColor(strokeColor);
    mStrokePaint.setStyle(Paint.Style.STROKE);
    mStrokePaint.setStrokeWidth(mStrokeWidth);

    mTextPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mTextPaint.setColor(textColor);
    mTextPaint.setTextSize(mTextSize);
    mTextPaint.setTextAlign(Paint.Align.CENTER);

    mInnerRectF = new RectF();
    mImageRect = new Rect();
}
 
Example 20
Source File: Utils.java    From FireFiles with Apache License 2.0 4 votes vote down vote up
public static int getActionButtonColor(int color1) {
    int color2 = Color.parseColor("#ffffff");
    return blendColors(color1, color2, 0.9f);
}