@@ -115,7 +115,7 @@ public class Engine extends View implements EngineApi
115115 private NativeControlModule m_native_control_module ;
116116 private SoundModule m_sound_module ;
117117 private NotificationModule m_notification_module ;
118- private FrameLayout m_view_layout ;
118+ private RelativeLayout m_view_layout ;
119119
120120 private PowerManager .WakeLock m_wake_lock ;
121121
@@ -941,7 +941,70 @@ public String getAssetFolderEntryList(String p_path)
941941
942942////////////////////////////////////////////////////////////////////////////////
943943
944+ // Native layer view functionality
945+
946+ Object getNativeLayerContainer ()
947+ {
948+ if (m_view_layout == null )
949+ {
950+ FrameLayout t_main_view ;
951+ t_main_view = ((LiveCodeActivity )getContext ()).s_main_layout ;
952+
953+ m_view_layout = new RelativeLayout (getContext ());
954+ t_main_view .addView (m_view_layout , new FrameLayout .LayoutParams (FrameLayout .LayoutParams .MATCH_PARENT , FrameLayout .LayoutParams .MATCH_PARENT ));
955+ t_main_view .bringChildToFront (m_view_layout );
956+ }
957+
958+ return m_view_layout ;
959+ }
960+
961+ Object createNativeLayerContainer ()
962+ {
963+ return new RelativeLayout (getContext ());
964+ }
965+
966+ // insert the view into the container, layered below p_view_above if not null.
967+ void addNativeViewToContainer (Object p_view , Object p_view_above , Object p_container )
968+ {
969+ ViewGroup t_container ;
970+ t_container = (ViewGroup )p_container ;
971+
972+ int t_index ;
973+ if (p_view_above != null )
974+ t_index = t_container .indexOfChild ((View )p_view_above );
975+ else
976+ t_index = t_container .getChildCount ();
977+
978+ t_container .addView ((View )p_view , t_index , new RelativeLayout .LayoutParams (0 , 0 ));
979+ }
980+
981+ void removeNativeViewFromContainer (Object p_view )
982+ {
983+ // Remove view from its parent
984+ View t_view ;
985+ t_view = (View )p_view ;
986+
987+ ViewGroup t_parent ;
988+ t_parent = (ViewGroup )t_view .getParent ();
989+ if (t_parent != null )
990+ t_parent .removeView (t_view );
991+ }
992+
993+ void setNativeViewRect (Object p_view , int left , int top , int width , int height )
994+ {
995+ RelativeLayout .LayoutParams t_layout = new RelativeLayout .LayoutParams (width , height );
996+ t_layout .leftMargin = left ;
997+ t_layout .topMargin = top ;
998+ t_layout .addRule (RelativeLayout .ALIGN_PARENT_LEFT );
999+ t_layout .addRule (RelativeLayout .ALIGN_PARENT_TOP );
1000+
1001+ View t_view = (View )p_view ;
1002+
1003+ t_view .setLayoutParams (t_layout );
1004+ }
1005+
9441006 // native control functionality
1007+
9451008 void addNativeControl (Object p_control )
9461009 {
9471010 m_native_control_module .addControl (p_control );
@@ -952,53 +1015,6 @@ void removeNativeControl(Object p_control)
9521015 m_native_control_module .removeControl (p_control );
9531016 }
9541017
955- void removeNativeView (Object p_view )
956- {
957- View t_view = (View )p_view ;
958-
959- if (m_view_layout != null )
960- m_view_layout .removeView (t_view );
961- }
962-
963- void placeNativeViewBelow (Object p_view , Object p_superior )
964- {
965- // Remove from any existing parent
966- removeNativeView (p_view );
967-
968- // The main view
969- FrameLayout t_main_view = ((LiveCodeActivity )getContext ()).s_main_layout ;
970-
971- // Create the layout for native layers if not already done
972- if (m_view_layout == null )
973- {
974- m_view_layout = new FrameLayout ((LiveCodeActivity )getContext ());
975- t_main_view .addView (m_view_layout );
976- t_main_view .bringChildToFront (m_view_layout );
977- }
978-
979- View t_view = (View )p_view ;
980- int t_index = m_view_layout .getChildCount ();
981-
982- if (p_superior != null )
983- {
984- View t_superior = (View )p_superior ;
985- t_index = m_view_layout .indexOfChild (t_superior );
986- }
987-
988- m_view_layout .addView (t_view , t_index , new RelativeLayout .LayoutParams (0 , 0 ));
989- }
990-
991- void setNativeViewRect (Object p_view , int left , int top , int width , int height )
992- {
993- FrameLayout .LayoutParams t_layout = new FrameLayout .LayoutParams (width , height );
994- t_layout .leftMargin = left ;
995- t_layout .topMargin = top ;
996-
997- View t_view = (View )p_view ;
998-
999- t_view .setLayoutParams (t_layout );
1000- }
1001-
10021018 Object createNativeControl (String p_class_name )
10031019 {
10041020 return m_native_control_module .createControl (p_class_name );
0 commit comments