Android on-screen keyboard and B4A - basic4android

I am wondering about the on-screen keyboard (osk).
When I’m in portrait mode the osk shows up on the bottom of the screen and only covers up the lower portion of my app. This is ideal because you can still see my text box which is located in the upper portion of the app. But when the orientation is changed to landscape, the osk covers up the entire app (hiding my text box) with its own text area.
This osk text area only shows in landscape mode. Is this how the osk behaves on all Androids or is it specific to Samsung Tab 7" or something else?
Is there a way to prevent the osk from displaying its own text box in landscape mode? If not, I will have to design my own osk. If I do design my own osk can I still take advantage of Android's auto completion through B4A?
I have tried the AutoCompleteEditText but it does not work the way that the Android auto completion does which is closer to what I need.
Any suggestions?
Thank you for your help,
Bob Gately

Better answer. You can use the reflection library to disable the full screen keyboard:
Dim r As Reflector
r.Target = EditText1
r.RunMethod2("setImeOptions", 268435456, "java.lang.int") 'IME_FLAG_NO_EXTRACT_UI constant

This is the default behavior of all Androids when in landscape.
You may want to see this link for an implementation of custom keyboards:

Related

Flutter: Draw/extend within notch area in landscape mode

Objective:
Extend into/draw within android notch area, specifically in landscape mode. Testing with 2 physical devices results in the notch area being unusable (black) in landscape mode.
Note:
Utilising extendBodyBehindAppBar, ExtendBody and SystemChrome.setEnabledSystemUI mode etc successfully extends into the notch area in PORTRAIT mode, however when the screen is rotated to landscape, the notch area is truncated and not utilised.
Problem: When extending the screen in landscape mode on most devices with curved corners the screen looks stupid and imbalanced with a squared-off black area in the notch section and curved at the other end.
Cheers guys.
Turns out, as it currently stands it's an open issue.
See Github issue #59236
https://github.com/flutter/flutter/issues/59236
On NATIVE Android 3 options exist to control drawing in the cut-out 'notch' area:
LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT
This is the default behaviour. Content renders into the cut-out area while in portrait mode, but content is letterboxed while in landscape mode.
LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES
Content renders into the cutout area in both portrait and landscape modes.
LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER
Content never renders into the cutout area.
Further native Android information can be found here:
https://developer.android.com/guide/topics/display-cutout
As it stands, the native Android equivalent of LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT seems to be stuck on flutter.
If anyone manages to work around this (perhaps platform channel stuff?), please comment.
I've faced the same problem, but looks like in addition to
SystemChrome.setEnabledSystemUIOverlays([]);
we should add the following to Android style.xml:
<style name="AppTheme" parent="#android:style/Theme.Black.NoTitleBar">
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
</style>
Tested this on a flutter demo project with Samsung S21 Ultra that has a notch and everything works as expected in a portrait and landscape modes.
Please note that I use flutter 1.22.6, but I am sure that the same approach should work on the latest flutter.

Set a Drawer to portrait even if image goes to landscape

I am using this template to build out an App. First attempt at App building but want to use this for an online exhibition platform for my paintings and photography etc. This is from a Google Flutter demo on Youtube.
https://github.com/MarcinusX/drawer_challenge/blob/master/lib/main.dart
When you run the app in custom guitar drawer mode(set the flip Bool to true ) the Drawer is set to the left side of the screen(portrait mode). I want to use the length of the screen for info and other menu items for the App.
however i need to display the images and paintings in landscape mode.
this is the issue. Is there a way to leave the Drawer as it would be in portrait mode?
ie when the user turns the device to landscape mode, then the Drawer will turn up from the bottom of the screen, and not the left side of the screen as it currently does?
or is there a way to set an image into landscape mode through ratio change that could be done without orientating the device to landscape?
I tried transform.rotate on the image but that means it get renders in portrait mode in landscape orientation. I also tried playing with the Transform.translate but can't work out how to set the Sizebox differently
I am new to this and wish to use the lockdown time to have a place for my work of the last 15 years so can work out how to code the images and place the controls and audio player for the App but if i can get the basic structure set then i can get going with the design.
any help would be great but if need be I will have to design the App around this
....
app in portrait mode
app in landscape mode, want drawer to turn in from bottom of screen not left edge

Infinite scroll in landscape LWUIT

While I'm developing an application with the Nokia 2.0 SDK, I've found this bug in my app.
When the device is in Portrait mode, the Form's scroll works fine but when I change the orientation to Landscape I find that the scroll makes bigger than the info in the page.
How can I solve that?
Seems like a bug in the S40 port. Just detect the orientation change (by overriding Form's size changed) and call setText() again. It will trigger a recalculation of the rows in the text area.
I solved it!
I forget to put the layout to the Form and it doesn't recalculate the size.
Now it's working! Great!

Interface builder problem when Iphone app converted to Universal app

I built an iphone app and in one of the views(buit using IB), I put an activity indicator ( little spinner indicating network activity) in the middle. It works fine on my iphone but once I use an Ipad the spinner goes to the to left corner. So the spinner never correspond to the intended location on Ipad no matter where I move it in IB.
Any suggestion to solve this problem? Do I have to rebuild the app specifically for ipad?
Thanks
In Interface Builder, select the Activity Indicator and open the Size Inspector.
Default shortcut in Xcode 4 is ⌥ ⌘ 5, icon looks like a ruler.
Second section, on the left, a box labeled "Autosizing". The bars around the outside turn each anchor on or off, and the arrows inside turn autoresizing on/off for either direction (x / y)
With the indicator centered in the view, turn all four anchors on.
Solid red is on, semitransparent is off.

Best way to create Default.png image for iPhone app

Originally I though I'll just take a screenshot of my app on the iPhone then tweak it in Photoshop.
The images should be 480 x 320 according to Apple doc, and the dimensions of my screenshot are 480 x 320. But, the screenshot contains notification area (where reception bars, battery life, etc. are displayed)
So, if I chop that part off my image will be a bit shorter and not 480px high.
What do I do? Submit a shorter image? Stretch it up so it's 480px but without the notification bar? Submit it with the notification bar in the image?
How did you create your Default.png?
There is support in Xcode for creating the default image. With the device connected, open the Organizer (Window > Organizer). Click the Screenshot tab, take a screenshot and click "Save as default image..." Choose your project and bingo jingo, you're done.
You can leave the notification area in the screenshot. The iPhone will draw the real notification bar over it.
iOS 7 update: the iOS 7 Transition Guide explicitly requires this:
Update the launch image to include the status bar area if it doesn’t already do so.
I think the best way to do it is to use the Xcode screenshotter & edit some of the GUI elements out, like the artwork or text on your buttons so people don't get frustrated when pushing 'buttons' on the Default.png doesn't make your app respond.
If you have a status bar, then you should design 320x460 (less 20 pixels).
Though it is correct that you can leave it at 320x480 and have the real status bar paint over the default.png, it will look weird when the phone is in Internet tethering mode or has a call on hold (another 20 pixels).
By cropping to 320x460, it looks better when in tethering mode.
Just edit out the notification area to match the background of the rest of the image. As long as your image is 480x320 you should be fine.
However, if your app takes more than a few seconds to load, you may want to rethink using a screenshot of your app as the startup screen. People might get confused and think the app is finished loading, when in fact it is not. I've seen some apps produce a "stylized" version of their UI in Photoshop, making it clear that it's just an image and not the actual UI.
you should remember that you maybe need also some space for an In-Call status bar or the Tethering status bar. this bar has a height of 20 pixels. Even apple does not make it right. Put a call on hold and start "Photos" or the "Weather" app, then you can see what I mean. To test that you can use the menu "Toggle In-Call Status Bar" in the iPhone Simulator app.
you can use a real 480x320 image if you add the boolean key UIStatusBarHidden to your Info.plist file and set it as true.
Take a screen shot as many of the answers already mention. However, if your screen shot includes the status bar, you should remove it/replace it with a transparent strip instead. It is true that the iPhone will cover this part of Default.png with the current status bar however, if you run the iPhone app on the iPad, you will still be able to see this part of Default.png.
I built a slightly modified version of the initial view in IB, ran the app with that and took a screen shot. That way, everything looks very iPhoney, no Photoshop needed. Don't worry too much about clipping the top, it will mirror how the view actually looks when loaded if more stuff covers it.
Apple recommends something similar to what the user will see when the app loads. E.g. for my Sudoku app, instead of the grid, the default.png shows a "please wait" message. When the app is loaded, that disappears and you see the grid you can interact with. It looks fluid, and it's obvious when it's loading and when you can interact.
Finally, the interface uses some toolbar buttons. In the default.png they are in the disabled state (grey text). When the app is loaded, they are enabled and change color.