Theme.createGradient is one line short
Brought to you by:
padeler
Theme.createGradient(int, int, int) returns an int[] that is "length" long. But the for loop fills the array from 0 till lenght-2. Also, [0] is already filled prior to the for loop.
It looks like that the variable "count" must be equal to length, but I don't know if this will mess the colors. Also, the for loop must begin from 1, so that [0] is not re-appointed a new value.
Fixed. The for loop should produce count values starting from result[1].