Skip to content

Commit 13bda42

Browse files
committed
Merge branch 'patch-1' of https://github.com/mrhdias/python-for-android into mrhdias-patch-1
2 parents 506fb59 + 36d5492 commit 13bda42

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

pythonforandroid/bootstraps/sdl2/build/src/org/kivy/android/PythonActivity.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import java.io.InputStream;
3131
import android.graphics.Bitmap;
3232
import android.graphics.BitmapFactory;
33+
import android.graphics.Color;
3334

3435
import org.libsdl.app.SDLActivity;
3536

@@ -356,6 +357,23 @@ protected void showLoadingScreen() {
356357

357358
mImageView = new ImageView(this);
358359
mImageView.setImageBitmap(bitmap);
360+
361+
/*
362+
* Set the presplash loading screen background color
363+
* https://developer.android.com/reference/android/graphics/Color.html
364+
* Parse the color string, and return the corresponding color-int.
365+
* If the string cannot be parsed, throws an IllegalArgumentException exception.
366+
* Supported formats are: #RRGGBB #AARRGGBB or one of the following names:
367+
* 'red', 'blue', 'green', 'black', 'white', 'gray', 'cyan', 'magenta', 'yellow',
368+
* 'lightgray', 'darkgray', 'grey', 'lightgrey', 'darkgrey', 'aqua', 'fuchsia',
369+
* 'lime', 'maroon', 'navy', 'olive', 'purple', 'silver', 'teal'.
370+
*/
371+
String backgroundColor = resourceManager.getString("presplash_color");
372+
if (backgroundColor != null) {
373+
try {
374+
mImageView.setBackgroundColor(Color.parseColor(backgroundColor));
375+
} catch (IllegalArgumentException e) {}
376+
}
359377
mImageView.setLayoutParams(new ViewGroup.LayoutParams(
360378
ViewGroup.LayoutParams.FILL_PARENT,
361379
ViewGroup.LayoutParams.FILL_PARENT));

0 commit comments

Comments
 (0)