Sfoglia il codice sorgente

dist: Fix for Android configuration changes restarting app

Intended to address most of #1216
rdb 1 anno fa
parent
commit
6f0fa2b4ec
2 ha cambiato i file con 3 aggiunte e 3 eliminazioni
  1. 2 2
      direct/src/dist/_android.py
  2. 1 1
      direct/src/dist/commands.py

+ 2 - 2
direct/src/dist/_android.py

@@ -50,7 +50,7 @@ def flag_resource(id, **values):
         bitmask = 0
         flags = attrib.value.split('|')
         for flag in flags:
-            bitmask = values[flag]
+            bitmask |= values[flag]
         attrib.compiled_item.prim.int_hexadecimal_value = bitmask
     return compile
 
@@ -169,9 +169,9 @@ ANDROID_ATTRIBUTES = {
     'allowTaskReparenting': bool_resource(0x1010204),
     'alwaysRetainTaskState': bool_resource(0x1010203),
     'clearTaskOnLaunch': bool_resource(0x1010015),
+    'configChanges': flag_resource(0x0101001f, mcc=0x0001, mnc=0x0002, locale=0x0004, touchscreen=0x0008, keyboard=0x0010, keyboardHidden=0x0020, navigation=0x0040, orientation=0x0080, screenLayout=0x0100, uiMode=0x0200, screenSize=0x0400, smallestScreenSize=0x0800, layoutDirection=0x2000, colorMode=0x4000, grammaticalGender=0x8000, fontScale=0x40000000, fontWeightAdjustment=0x10000000),
     'debuggable': bool_resource(0x0101000f),
     'documentLaunchMode': enum_resource(0x1010445, "none", "intoExisting", "always", "never"),
-    'configChanges': flag_resource(0x0101001f, mcc=0x0001, mnc=0x0002, locale=0x0004, touchscreen=0x0008, keyboard=0x0010, keyboardHidden=0x0020, navigation=0x0040, orientation=0x0080, screenLayout=0x0100, uiMode=0x0200, screenSize=0x0400, smallestScreenSize=0x0800, layoutDirection=0x2000, fontScale=0x40000000),
     'enabled': bool_resource(0x101000e),
     'excludeFromRecents': bool_resource(0x1010017),
     'exported': bool_resource(0x1010010),

+ 1 - 1
direct/src/dist/commands.py

@@ -831,7 +831,7 @@ class build_apps(setuptools.Command):
             activity.set('android:name', 'org.panda3d.android.PythonActivity')
             activity.set('android:label', appname)
             activity.set('android:theme', '@android:style/Theme.NoTitleBar')
-            activity.set('android:configChanges', 'orientation|keyboardHidden')
+            activity.set('android:configChanges', 'layoutDirection|locale|grammaticalGender|fontScale|fontWeightAdjustment|orientation|uiMode|screenLayout|screenSize|smallestScreenSize|keyboard|keyboardHidden|navigation')
             activity.set('android:launchMode', 'singleInstance')
 
             act_icon = self.icon_objects.get(appname)