Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit eb401e3

Browse files
committed
[[ Android ]] Use AbsoluteLayout class to position native layers
This patch modifies the Android native layer code to replace the current implementation based on RelativeLayout to one based on AbsouteLayout. This fixes an issue where native layers would be resized if their bounds exceed the group that contains them.
1 parent fd3810a commit eb401e3

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

engine/src/java/com/runrev/android/Engine.java

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public interface LifecycleListener
131131
private SoundModule m_sound_module;
132132
private NotificationModule m_notification_module;
133133
private NFCModule m_nfc_module;
134-
private RelativeLayout m_view_layout;
134+
private AbsoluteLayout m_view_layout;
135135

136136
private PowerManager.WakeLock m_wake_lock;
137137

@@ -1095,7 +1095,7 @@ Object getNativeLayerContainer()
10951095
FrameLayout t_main_view;
10961096
t_main_view = ((LiveCodeActivity)getContext()).s_main_layout;
10971097

1098-
m_view_layout = new RelativeLayout(getContext());
1098+
m_view_layout = new AbsoluteLayout(getContext());
10991099
t_main_view.addView(m_view_layout, new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT));
11001100
t_main_view.bringChildToFront(m_view_layout);
11011101
}
@@ -1105,7 +1105,7 @@ Object getNativeLayerContainer()
11051105

11061106
Object createNativeLayerContainer()
11071107
{
1108-
return new RelativeLayout(getContext());
1108+
return new AbsoluteLayout(getContext());
11091109
}
11101110

11111111
// insert the view into the container, layered below p_view_above if not null.
@@ -1120,7 +1120,7 @@ void addNativeViewToContainer(Object p_view, Object p_view_above, Object p_conta
11201120
else
11211121
t_index = t_container.getChildCount();
11221122

1123-
t_container.addView((View)p_view, t_index, new RelativeLayout.LayoutParams(0, 0));
1123+
t_container.addView((View)p_view, t_index, new AbsoluteLayout.LayoutParams(0, 0, 0, 0));
11241124
}
11251125

11261126
void removeNativeViewFromContainer(Object p_view)
@@ -1137,11 +1137,7 @@ void removeNativeViewFromContainer(Object p_view)
11371137

11381138
void setNativeViewRect(Object p_view, int left, int top, int width, int height)
11391139
{
1140-
RelativeLayout.LayoutParams t_layout = new RelativeLayout.LayoutParams(width, height);
1141-
t_layout.leftMargin = left;
1142-
t_layout.topMargin = top;
1143-
t_layout.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
1144-
t_layout.addRule(RelativeLayout.ALIGN_PARENT_TOP);
1140+
AbsoluteLayout.LayoutParams t_layout = new AbsoluteLayout.LayoutParams(width, height, left, top);
11451141

11461142
View t_view = (View)p_view;
11471143

0 commit comments

Comments
 (0)