Menu Bar Height in the LWUIT Form - java-me

Application develop in the J2ME using LWUIT. When I port this application on the Samsung Device it create the following problem.
int h = Display.getInstance().getDisplayWidth();
It returns 388 for the Samsung GT S5250. So when I draw an image using this dimension it displays a white strip at the bottom of the screen. When I call the Form.show() it displays correctly and height is 400 so how to resolve this issue.
I want to know how the Form size is calculated in LWUIT and how it takes MenuBar Height and white strip display at bottom of the screen.

I think you typed getDisplayWidth() where you meant to type getDisplayHeight().
Regardless, the problem you are seeing is due to a bug in the samsung device. LWUIT invokes the full screen mode in MIDP which hides the native title area, however that doesn't always happen immediately in some devices and thus LWUIT gets incorrect information from the devices. A refresh usually solves this and by the time LWUIT draws on the screen the size is corrected.
Generally the solution is rather simple, create generic code to create your image and if the image dimensions are inappropriate when you are about to draw to the screen then just recreate the image on the fly. This will also solve the issue of device rotation which might pose a problem too.

Related

How can I configure MRTK to work with touch input in editor and on mobile devices?

I'm building an application that will run on both HoloLens and mobile devices (iOS/Android). I'd like to be able to use the same manipulation handlers on all devices with the goals:
Use ARFoundation for mobile device tracking and input
Use touch input with MRTK with ManipulationHandler and otherwise use touch input as normal (UI)
Simulate touch input in the editor (using a touch screen or mouse) but retain the keyboard/mouse controller for camera positioning.
So far I've tried/found:
MixedRealityPlayspace always parents the camera, so I added the ARSessionOrigin to that component, and all the default AR components to the camera (ARCameraManager, TrackedPoseDriver, ARRayCastManager, etc.)
Customizing the MRTK pointer profile to only countain MousePointer and TouchPointer.
Removing superfluous input data providers.
Disabling Hand Simulation in the InputSimulationService
Generally speaking, the method of adding the ARSessionOrigin to the MixedRealityPlayspace works as expected and ARFoundation is trivial to set up. However, I am struggling to understand how to get the ManipulationHandler to respond to touch input.
I've run into the following issues:
Dragging on a touch screen with a finger moves the camera (editor). Disabling the InputSimulationService fixes this, but then I'm unable to move the camera...
Even with the camera disabled, clicking and dragging does not affect the ManipulationHandler.
The debug rays are drawn in the correct direction, but the default touchpointer rays draw in strange positions.
I've attached a .gif explaining this. This is using touch input in the editor. The same effect is observed running on device (Android).
This also applies to Unity UI (world space canvas) whereby clicking on a UI element does not trigger (on device or in editor), which suggests to me that this is a pointer issue not a handler issue.
I would appreciate some advice on how to correctly configure the touch input and mouse input both in editor and on device, with the goal being a raycast from the screen point using the projection matrix to create the pointer, and use two-finger touch in the same way that two hand rays are used.
Interacting with Unity UI in world space on a mobile phone is supposed to work in MRTK, but there are few bugs in the input system preventing it from working. The issue is tracked here: https://github.com/microsoft/MixedRealityToolkit-Unity/issues/5390.
The fix has not been checked in, but you can apply a workaround for now (thanks largely to the work you yourself did, newske!). The workaround is posted in the issue. Please see https://gist.github.com/julenka/ccb662c2cf2655627c95ffc708cf5a69. Just replace each file in MRTK with the version in the gist.

MergEXT MergZXing layer and barcode not reading

Just started working with this awesome external but have a couple of questions.
When the control is evoked, is it always the top layer or can I have a background transparent image on top of it so I can frame the control nicely?
Also, my testing seems to read most Barcodes but when it comes down to reading Barcodes on hard drives, the control does not want to decode those.... Too dense of bar code pattern?
I am very impressed thus far with the ease of use of your externals. Makes we want to code more for mobile devices!
an overlaying transparent image is not possible, as far as i know.
but couldnĀ“t you use
command mergZXingControlSetRect pLeft,pTop,pRight,pBottom
to define the rect of that scanner after creation
or
command mergZXingControlCreate pLeft,pTop,pRight,pBottom
to create the scanner control in the specified rect.
Set the rect smaller than the width and the height of the screen.
You could then use an underlying image, which is displayed outside of the scanner rect, to show the frame around scanner control. Did not test it myself, but i would assume that this should work.
Unfortunately the native controls in externals and the ones the engine provides are added as views on top of the LiveCode view. That means you can't intermingle LiveCode controls with them. One thing that some users have done is add a web view with a transparent background and a load a png image. If you create the barcode view first and the web view second then the web view will be on top.

Drawing a Rectangle that never dissapears

I have to draw a transparent square, that never disappears from the user's interface, by clicking to other windows the rectangle remains, only the windows/application content has to be shown behind.
I have thought of doing it with OpenGl or Flex or Canvas , but the problem is whenever I click on another window the programmed rectangle disappears .The rectangle has to act as a default image but has to be always at the foreground.
Do I have to mess with the operating system(Linux, Mac or Windows), by creating this image as default?
here is one example
http://i42.tinypic.com/15g3vxh.png
You can do that with Java pretty easy. See this link for code examples. If you got your transparent Image, you can use the setAlwaysOnTop(true); Method on the Object, and you are good to go. The only things that could get in front of that are other Applications that are using that method.

UIImageView doesn't obey it's content mode

I am designing an iOS App where there is a View controller with an embedded view controller in view at the bottom, and an image at the top. However, I'm having problems with the Image view. Without image view, everything is OK. When I put the image view, the image view doesn't fit in the image correctly. Here is how it looks in the interface builder (set to Scale to Fill):
When I run it in my iPod Touch (iOS 6), This is how it looks:
The image's aspect ratio is different than shown in the Interface Builder. Then, I try setting the image mode to Aspect Fill (which is actually the one I want):
This is exactly what I actually want, but when I run it, the image fills almost the entire screen:
Notice how my friend picker view controller is left behind the image view. The layout of the entire view controller is correct (embedded view controller is located correctly, notice at the point where the image ends in the last screenshot, it starts from J, meaning that it continues to the top behind the image), it's only the image view that is occupying too much space. I've tried different arrangements of the frame rectangle, and tried toggling Auto-layout of iOS 6. Neither did help. Am I missing an obvious point, or is it a bug with the layout system of iOS. (probably the second one, as WYSIWYG fails between Interface Builder and actual app) Are there any workarounds (other than cropping the portion of the image in Photoshop at the exact size that I want)?
Thanks,
Can.
UPDATE: A workaround that I've currently found is to put the image view in another view, and set the parent view's clip subviews property ticked. But the image view itself is still not behaving correctly, and even though this currently solved my problem, it is not a real solution, so any solution answers are welcome.

J2ME, LWUIT (V. 1.2) - Menu bar from bottom to the right of the screen!

I'm working with the mobile graphic framework LWUIT (V. 1.2) to develop an application for Nokia N97.
Results are striking and elegant but I have a problem: when I rotate mobile screen, menu bar doesn't switch from bottom to the right of screen. Commands remain on the bottom while correspondent mobile buttons are now on the right...
Is there an event that I can intercept when the user open or rotate mobile screen? Or I have to extend some library class to make this behaviour automatic? Or anithing else?
Anyone of you can describe a solution?
Thanks in advance
I didn't use LWUIT much, but you can insert following parameter to jad:
Nokia-MIDlet-App-Orientation: portrait
This should disable auto-rotating on Nokia S60 5th.
If you want to catch an event when the screen rotates, you can check canvas.getWidth() and canvas.getHeight(). If device's screen is not square, its width and height should change.

Resources