Skip to content

Commit

Permalink
Fixed broken layout for buttons with configured color in messagebox o…
Browse files Browse the repository at this point in the history
…n Android.
  • Loading branch information
philippwiesemann committed Sep 25, 2014
1 parent 788a2e4 commit 51a07ad
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion android-project/src/org/libsdl/app/SDLActivity.java
Expand Up @@ -24,6 +24,7 @@
import android.util.Log;
import android.util.SparseArray;
import android.graphics.*;
import android.graphics.drawable.Drawable;
import android.media.*;
import android.hardware.*;

Expand Down Expand Up @@ -748,7 +749,14 @@ public void onClick(View v) {
// TODO set color for border of messagebox button
}
if (buttonBackgroundColor != Color.TRANSPARENT) {
button.setBackgroundColor(buttonBackgroundColor);
Drawable drawable = button.getBackground();
if (drawable == null) {
// setting the color this way removes the style
button.setBackgroundColor(buttonBackgroundColor);
} else {
// setting the color this way keeps the style (gradient, padding, etc.)
drawable.setColorFilter(buttonBackgroundColor, PorterDuff.Mode.MULTIPLY);
}
}
if (buttonSelectedColor != Color.TRANSPARENT) {
// TODO set color for selected messagebox button
Expand Down

0 comments on commit 51a07ad

Please sign in to comment.