Sub LWM_OffsetChanged (Engine As LWEngine)
If Flyer.IsInitialized Then
Engine.Rect.Left = -Engine.CurrentOffsetX
Engine.Rect.Top = -Engine.CurrentOffsetY
Engine.Rect.Right = -Engine.CurrentOffsetX + Engine.FullWallpaperWidth
Engine.Rect.Bottom = -Engine.CurrentOffsetY + Engine.FullWallpaperHeight
Engine.Canvas.DrawBitmap(Flyer, Null, Engine.Rect)
Else
Engine.Canvas.DrawColor(Colors.Black)
Engine.Canvas.DrawText(AResMap.Get("other_placeholder_on_screen"), 120dip, 120dip, Typeface.DEFAULT_BOLD, 30, Colors.White, "LEFT")
End If
Engine.RefreshAll
End Sub
pScreenHeight=GetDeviceLayoutValues.Height
pScreenWidth=GetDeviceLayoutValues.Width
for my wallpaper App, i use 720 x 1280 pictures
not 1280 x 1280 and i only use orientations support as Portrait
Menu Projet => Orientation Support > Portrait
^^
aie
what is the exact mobile you have their device ?
800 x 1280 ?
if it is a 800 x 1280 it's normal cause our pictures is 720 x 1280 (=> we have to change this)
and why it's not locked to portrait ? !
I asked some friends and all of them is locked to portrait (when they move phone no landscape)
What solution we have to resolve this ?
Dim origRatio As Float = original.Width / original.Height
Log ("OrigineRation : " & origRatio)
Dim targetRatio As Float = TargetX / TargetY
Log(TargetX & " - " & TargetY)
Log ("TargetRation : " & targetRatio)
Dim scale As Float
But back to your question: In my case I just work with canvas to draw my stuff. And I don't have to do anything special to draw in landscape mode. When the phone is in portrait mode canvas.getWidth() is the width of my phone, when the phone is in landscape mode canvas.getWidth() is the height of my phone. So I don't have to turn it around or something like this...
Just need to know what is the event to find if it's landscape or portrait
Sub LWM_OffsetChanged (Engine As LWEngine)
Log ("width:" & GetDeviceLayoutValues.Width & " Height :" & GetDeviceLayoutValues.Height )
If GetDeviceLayoutValues.Width > GetDeviceLayoutValues.Height Then
image = ResizeImage(image, GetDeviceLayoutValues.Height, GetDeviceLayoutValues.Width )
Else
image = ResizeImage(image, GetDeviceLayoutValues.Width , GetDeviceLayoutValues.Height)
End If
B4X:Sub LWM_OffsetChanged (Engine As LWEngine) Log ("width:" & GetDeviceLayoutValues.Width & " Height :" & GetDeviceLayoutValues.Height ) If GetDeviceLayoutValues.Width > GetDeviceLayoutValues.Height Then image = ResizeImage(image, GetDeviceLayoutValues.Height, GetDeviceLayoutValues.Width ) Else image = ResizeImage(image, GetDeviceLayoutValues.Width , GetDeviceLayoutValues.Height) End If
i try this script but doesn't work
as i don't have a picture dedicated to portrait and landscape like this link (good article)
Wallpaper size and layout for 1280×800 Android tablet | Rarst.net
i have no choose to force portrait
Sub LWM_OffsetChanged (Engine As LWEngine)
If image.IsInitialized AND resized.IsInitialized = False Then
resized = ResizeImage(image, Engine.FullWallpaperWidth -230, Engine.FullWallpaperHeight)
End If
If resized.IsInitialized Then
Engine.Rect.Left = -(Engine.FullWallpaperWidth - actualImageWidth) / 2
Engine.Rect.Top = 0
Engine.Rect.Right = Engine.Rect.Left + Engine.FullWallpaperWidth
Engine.Rect.Bottom = Engine.FullWallpaperHeight
Engine.Canvas.DrawBitmap(resized, Null, Engine.Rect)
End If
Engine.RefreshAll
End Sub
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?