File tree Expand file tree Collapse file tree 6 files changed +27
-10
lines changed
templates/android_template Expand file tree Collapse file tree 6 files changed +27
-10
lines changed Original file line number Diff line number Diff line change @@ -79,7 +79,7 @@ class _PNButtonHandler(NSObject): # type: ignore[valid-type]
7979 _callback : Optional [Callable [[], None ]] = None
8080
8181 @objc_method
82- def onTap_ (self , sender : Any ) -> None :
82+ def onTap_ (self , sender : object ) -> None :
8383 try :
8484 callback = self ._callback
8585 if callback is not None :
Original file line number Diff line number Diff line change @@ -72,9 +72,26 @@ def __init__(self) -> None:
7272
7373 def add_view (self , view : Any ) -> None :
7474 self .views .append (view )
75- # Ensure view is a subview of scrollview
76- if view . native_instance not in self . native_instance . subviews :
75+ # Add as subview and size child to fill scroll view by default so content is visible
76+ try :
7777 self .native_instance .addSubview_ (view .native_instance )
78+ except Exception :
79+ pass
80+ # Default layout: if the child has no size yet, size it to fill the scroll view
81+ # and enable flexible width/height. If the child is already sized explicitly,
82+ # leave it unchanged.
83+ try :
84+ frame = getattr (view .native_instance , "frame" )
85+ size = getattr (frame , "size" , None )
86+ width = getattr (size , "width" , 0 ) if size is not None else 0
87+ height = getattr (size , "height" , 0 ) if size is not None else 0
88+ if width <= 0 or height <= 0 :
89+ bounds = self .native_instance .bounds
90+ view .native_instance .setFrame_ (bounds )
91+ # UIViewAutoresizingFlexibleWidth (2) | UIViewAutoresizingFlexibleHeight (16)
92+ view .native_instance .setAutoresizingMask_ (2 | 16 )
93+ except Exception :
94+ pass
7895
7996 @staticmethod
8097 def wrap (view : Any ) -> "ScrollView" :
Original file line number Diff line number Diff line change @@ -6,12 +6,12 @@ plugins {
66
77android {
88 namespace ' com.pythonnative.android_template'
9- compileSdk 33
9+ compileSdk 34
1010
1111 defaultConfig {
1212 applicationId " com.pythonnative.android_template"
1313 minSdk 24
14- targetSdk 33
14+ targetSdk 34
1515 versionCode 1
1616 versionName " 1.0"
1717
Original file line number Diff line number Diff line change 1616 <argument
1717 android : name =" args_json"
1818 app : argType =" string"
19- android : nullable =" true" />
19+ app : nullable =" true" />
2020 </fragment >
2121
2222</navigation >
Original file line number Diff line number Diff line change 11// Top-level build file where you can add configuration options common to all sub-projects/modules.
22plugins {
3- id ' com.android.application' version ' 8.0 .2' apply false
4- id ' com.android.library' version ' 8.0 .2' apply false
5- id ' org.jetbrains.kotlin.android' version ' 1.8.20 ' apply false
3+ id ' com.android.application' version ' 8.2 .2' apply false
4+ id ' com.android.library' version ' 8.2 .2' apply false
5+ id ' org.jetbrains.kotlin.android' version ' 1.9.22 ' apply false
66 id ' com.chaquo.python' version ' 14.0.2' apply false
77}
Original file line number Diff line number Diff line change 11# Mon Jun 19 11:09:16 PDT 2023
22distributionBase =GRADLE_USER_HOME
33distributionPath =wrapper/dists
4- distributionUrl =https\://services.gradle.org/distributions/gradle-8.0 -bin.zip
4+ distributionUrl =https\://services.gradle.org/distributions/gradle-8.2.1 -bin.zip
55zipStoreBase =GRADLE_USER_HOME
66zipStorePath =wrapper/dists
You can’t perform that action at this time.
0 commit comments