Back to project page TutorialView.
The source code is released under:
This is free and unencumbered software released into the public domain. Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a co...
If you think the Android project TutorialView listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.rperryng.tutorialview; //from w w w. ja va 2s . com import android.content.Context; import android.graphics.Color; import android.util.TypedValue; public class Utils { public static final double DEFAULT_FACTOR = .35; public static int pxFromDp(Context context, int desiredDp) { return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, desiredDp, context.getResources().getDisplayMetrics()); } public static int applyAlpha(int alpha, int color) { return Color.argb(alpha, Color.red(color), Color.green(color), Color.blue(color)); } public static int getTint(int color, int factor) { int red = Color.red(color); int green = Color.green(color); int blue = Color.blue(color); return Color.argb(Color.alpha(color), red + (int) ((255 - red) * DEFAULT_FACTOR), green + (int) ((255 - green) * DEFAULT_FACTOR), blue + (int) ((255 - blue) * DEFAULT_FACTOR)); } }