[mw_shl_code=delphi,true]procedure TBaiduMap.InitInstance;
var
Rect: JRect;
begin
CallInUIThreadAndWaitFinishing(
procedure
begin
FJNativeLayout := TJNativeLayout.JavaClass.init(SharedActivity,
MainActivity.getWindow.getDecorView.getWindowToken);
FMapView := TJMapView.JavaClass.init(SharedActivity);
Rect := TJRect.JavaClass.init(0, 0, Round(Size.Height),
Round(Size.Width));
FMapView.requestFocus(0, Rect);
FJNativeLayout.setPosition(0, 0);
FJNativeLayout.setSize(Round(Size.Height), Round(Size.Width));
FJNativeLayout.setControl(FMapView);
RealignView;
end);
end;
procedure TBaiduMap.RealignView;
const
VideoExtraSpace = 100;
// To be sure that destination rect will fit to fullscreen
var
MapRect: TRectF;
RoundedRect: TRect;
LSizeF: TPointF;
LRealBounds: TRectF;
LRealPosition, LRealSize: TPointF;
begin
if (FJNativeLayout <> nil) then
begin
LRealPosition := Self.LocalToAbsolute(TPointF.Zero) * FScale;
LSizeF := TPointF.Create(Self.Size.Size.cx, Self.Size.Size.cy);
LRealSize := Self.LocalToAbsolute(LSizeF) * FScale;
LRealBounds := TRectF.Create(LRealPosition, LRealSize);