Skip to content

Commit 1b338a8

Browse files
committed
Merge branch 'mrhdias-patch-1'
2 parents 506fb59 + ca5686f commit 1b338a8

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

pythonforandroid/bootstraps/sdl2/build/build.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,10 @@ def parse_args(args=None):
413413
ap.add_argument('--presplash', dest='presplash',
414414
help=('A jpeg file to use as a screen while the '
415415
'application is loading.'))
416+
ap.add_argument('--presplash-color', dest='presplash_color', default='#000000',
417+
help=('A string to set the loading screen background color. '
418+
'Suported formats are: #RRGGBB #AARRGGBB or color names '
419+
'like red, green, blue, etc.'))
416420
ap.add_argument('--wakelock', dest='wakelock', action='store_true',
417421
help=('Indicate if the application needs the device '
418422
'to stay on'))

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));

pythonforandroid/bootstraps/sdl2/build/templates/strings.tmpl.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
<resources>
33
<string name="app_name">{{ args.name }}</string>
44
<string name="private_version">0.1</string>
5+
<string name="presplash_color">{{ args.presplash_color }}</string>
56
</resources>

0 commit comments

Comments
 (0)