Java Code Examples for android.graphics.LinearGradient#setLocalMatrix()

The following examples show how to use android.graphics.LinearGradient#setLocalMatrix() . 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: PollVotesAlert.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
private void updatePlaceholder() {
    if (placeholderPaint == null) {
        return;
    }
    int color0 = Theme.getColor(Theme.key_dialogBackground);
    int color1 = Theme.getColor(Theme.key_dialogBackgroundGray);
    color0 = AndroidUtilities.getAverageColor(color1, color0);
    placeholderPaint.setColor(color1);
    placeholderGradient = new LinearGradient(0, 0, gradientWidth = AndroidUtilities.dp(500), 0, new int[]{color1, color0, color1}, new float[]{0.0f, 0.18f, 0.36f}, Shader.TileMode.REPEAT);
    placeholderPaint.setShader(placeholderGradient);
    placeholderMatrix = new Matrix();
    placeholderGradient.setLocalMatrix(placeholderMatrix);
}
 
Example 2
Source File: PollVotesAlert.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
private void updatePlaceholder() {
    if (placeholderPaint == null) {
        return;
    }
    int color0 = Theme.getColor(Theme.key_dialogBackground);
    int color1 = Theme.getColor(Theme.key_dialogBackgroundGray);
    color0 = AndroidUtilities.getAverageColor(color1, color0);
    placeholderPaint.setColor(color1);
    placeholderGradient = new LinearGradient(0, 0, gradientWidth = AndroidUtilities.dp(500), 0, new int[]{color1, color0, color1}, new float[]{0.0f, 0.18f, 0.36f}, Shader.TileMode.REPEAT);
    placeholderPaint.setShader(placeholderGradient);
    placeholderMatrix = new Matrix();
    placeholderGradient.setLocalMatrix(placeholderMatrix);
}