Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class ComponentBase {
- public function handleCreate(native:Bool) {
- trace('handleCreate ${Type.getClassName(Type.getClass(this))} - native: ${native}, context: ${MainActivity.context}');
- var className:String = Type.getClassName(Type.getClass(this));
- var nativeComponentClass:String = Toolkit.nativeConfig.query('component[id=${className}].@class', 'android.widget.RelativeLayout');
- trace(nativeComponentClass);
- view = Type.createInstance(Type.resolveClass(nativeComponentClass), [MainActivity.context]);
- trace(view);
- }
- private function handlePosition(left:Null<Float>, top:Null<Float>, style:Style) {
- trace('handlePosition ${Type.getClassName(Type.getClass(this))} - left: ${left}, top: ${top}');
- var params:RelativeLayout_LayoutParams = cast(view.getLayoutParams(), RelativeLayout_LayoutParams);
- if (params == null) {
- params = new RelativeLayout_LayoutParams(ViewGroup_LayoutParams.WRAP_CONTENT, ViewGroup_LayoutParams.WRAP_CONTENT);
- }
- params.leftMargin = Std.int(left);
- params.topMargin = Std.int(top);
- view.setLayoutParams(params);
- }
- private function handleSize(width:Null<Float>, height:Null<Float>, style:Style) {
- trace('handleSize ${Type.getClassName(Type.getClass(this))} - width: ${width}, height: ${height}');
- var params:RelativeLayout_LayoutParams = cast(view.getLayoutParams(), RelativeLayout_LayoutParams);
- if (params == null) {
- params = new RelativeLayout_LayoutParams(ViewGroup_LayoutParams.WRAP_CONTENT, ViewGroup_LayoutParams.WRAP_CONTENT);
- }
- params.width = Std.int(width);
- params.height = Std.int(height);
- view.setLayoutParams(params);
- }
- private function handleAddComponent(child:Component):Component {
- if (Std.is(view, android.view.ViewGroup)) {
- cast(view, android.view.ViewGroup).addView(child.view);
- }
- return child;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement