@@ -38,6 +38,74 @@ open class AndroidViewGroupMarginLayoutParams: Android.View.ViewGroup.LayoutPara
3838 JNI . DeleteLocalRef ( __object )
3939 }
4040
41+ //Creates a new set of layout parameters with the specified width and height.
42+ public convenience init ( width: Int , height: Int ) {
43+
44+ var __locals = [ jobject] ( )
45+
46+ var __args = [ jvalue] ( repeating: jvalue ( ) , count: 2 )
47+ __args [ 0 ] = jvalue ( i: jint ( width) )
48+ __args [ 1 ] = jvalue ( i: jint ( height) )
49+
50+ let __object = JNIMethod . NewObject (
51+ className: ViewGroupMarginLayoutParamsJNICache . className,
52+ classCache: & ViewGroupMarginLayoutParamsJNICache. jniClass,
53+ methodSig: " (II)V " ,
54+ methodCache: & ViewGroupMarginLayoutParamsJNICache. MethodID. newMethod1,
55+ args: & __args,
56+ locals: & __locals )
57+
58+ self . init ( javaObject: __object )
59+
60+ JNI . DeleteLocalRef ( __object )
61+ }
62+
63+ // Copy constructor.
64+ public convenience init ( source: Android . View . ViewGroup . LayoutParams ) {
65+
66+ var __locals = [ jobject] ( )
67+
68+ var __args = [ jvalue] ( repeating: jvalue ( ) , count: 1 )
69+ __args [ 0 ] = JNIType . toJava ( value: source, locals: & __locals)
70+
71+ let __object = JNIMethod . NewObject (
72+ className: ViewGroupMarginLayoutParamsJNICache . className,
73+ classCache: & ViewGroupMarginLayoutParamsJNICache. jniClass,
74+ methodSig: " (Landroid/view/ViewGroup$LayoutParams;)V " ,
75+ methodCache: & ViewGroupMarginLayoutParamsJNICache. MethodID. newMethod2,
76+ args: & __args,
77+ locals: & __locals )
78+
79+ self . init ( javaObject: __object )
80+
81+ JNI . DeleteLocalRef ( __object )
82+ }
83+
84+ // Creates a new set of layout parameters.
85+ public convenience init ( context: Android . Content . Context , attrs: JavaObject ) {
86+
87+ var __locals = [ jobject] ( )
88+
89+ var __args = [ jvalue] ( repeating: jvalue ( ) , count: 2 )
90+ __args [ 0 ] = JNIType . toJava ( value: context, locals: & __locals)
91+ __args [ 1 ] = JNIType . toJava ( value: attrs, locals: & __locals)
92+
93+ let __object = JNIMethod . NewObject (
94+ className: ViewGroupMarginLayoutParamsJNICache . className,
95+ classCache: & ViewGroupMarginLayoutParamsJNICache. jniClass,
96+ methodSig: " (Landroid/content/Context;Landroid/util/AttributeSet;)V " ,
97+ methodCache: & ViewGroupMarginLayoutParamsJNICache. MethodID. newMethod3,
98+ args: & __args,
99+ locals: & __locals )
100+
101+ self . init ( javaObject: __object )
102+
103+ JNI . DeleteLocalRef ( __object )
104+ }
105+ }
106+
107+ public extension AndroidViewGroupMarginLayoutParams {
108+
41109 public var bottomMargin : Int {
42110 get {
43111 let __value = JNIField . GetIntField ( fieldName: " bottomMargin " ,
@@ -102,6 +170,9 @@ open class AndroidViewGroupMarginLayoutParams: Android.View.ViewGroup.LayoutPara
102170 public var isMarginRelative : Bool {
103171 get { return getIsMarginRelative ( ) }
104172 }
173+ }
174+
175+ internal extension AndroidViewGroupMarginLayoutParams {
105176
106177 @_versioned
107178 internal func setMarginStart( _ start: Int ) {
@@ -276,6 +347,9 @@ internal extension AndroidViewGroupMarginLayoutParams {
276347 /// JNI Method ID cache
277348 struct MethodID {
278349 static var newMethod : jmethodID ?
350+ static var newMethod1 : jmethodID ?
351+ static var newMethod2 : jmethodID ?
352+ static var newMethod3 : jmethodID ?
279353 static var setMargins : jmethodID ?
280354 static var setMarginStart : jmethodID ?
281355 static var setMarginEnd : jmethodID ?
0 commit comments