Oreo - View layout management has changed? - view

Don't flame me but prior to Oreo I used to put view in a static and keep it switching from fragments and it worked pretty well. In onCreate I simply check if the value of view is not null and in that case I was not inflating. It allowed me to do long task in a fragment in an async and switch to another fragment waiting for the async to complete.
It still works the same way with O except when I rotate the device. In that case I get a blank screen: no layout, no buttons, no text, etc.
I've read https://developer.android.com/about/versions/oreo/android-8.0-changes but didn't find anything.
Do you have an idea to fix this without changing it all?

From the way I understand it. if the Rotation is locked to portrait mode, rotating the device won't force it into landscape mode if portrait mode is locked.
Check out the following post:
android-p-feature-spotlight-rotation-can-temporarily-locked-landscape-changes
Just as annoying as Android Oreo, and unlike most OEM versions of Android I've used. There are new APIs for screen rotation in Android P so it's not clear whether apps need to implement it to be able to lock to landscape from the first go.
Also check out the Android P preview for more info regarding the rotation changes, for some reason it appears to be relevant for the Android Oreo as well.
Feature Overview
Behaviour Overview

Related

Xamarin Forms - physical keyboard dims page when no input control is present

My actual application is using a bluetooth scanner in HID mode and capturing the input on the DispatchKeyEvent of the MainActivity. It works great except that the screens dims to some dark opaque color where it looks like everything is disabled and you have to navigate back to a page with an input control and tap on it to get the screen to go back to normal.
It's not as noticeable in the stock template but in my actual application (Screen shots at bottom) the dimming is very noticeable; it's a blue-gray opaque overlay that really stands out. I have no idea why it's like that. I'd almost just be happy if my actual app dimmed like the default forms sample.
Steps:
Make a Xamarin Forms app from one of the templates.
Change nothing.
Run simulator.
Press a button on your keyboard.
Result:
The screen dims and the soft keyboard does not popup.
Next Steps:
Add an Entry control. < Entry/> will do.
Click on it and the screen brightens back up.
Delete < Entry/>
Press a key on your keyboard and the soft keyboard pops up and the screen doesn't dim again.
What I want:
To know where the dim/overlay color/opacity is set so I can change it.
To not allow the soft keyboard to try and popup at all unless there's an entry field that has focus.
Here's screenshots from the default forms app:
Not Dim:
Dimmed after pressing the keyboard:
My actual test device is a Samsung Galaxy XCover Pro running Android 10.0. I'm working on porting a native Xamarin Android app to Forms so we can run it on iOS as well. I never had this issue with my android app and I'm not sure how to track down what's happening.
Here's a before pic. I've got an Entry field focused.
After scanning a barcode with my bluetooth scanner this happens:
There is NOT any overlay/modal boxview defined in the XAML. The overlay is nothing that I added. Though I seem to have done something to influence the color; I don't see anything in my styles.xml files that would change the color from the default light gray (as shown in the sample Xamrin Forms template).
I can reproduce this with a scanner on the "Welcome to Xamaring Forms!" as well, the screenshots don't really show the change in overlay color; its much more subtle; I really would like to know why in my app the overlay is so much more obvious.
I'm still annoyed it happens at all. But just in case anyone else using a
hardware keyboard as input (or a BT scanner connected as a HID) and you thought you'd be fancy and override one of the default styles and use a pretty green accent color like this: (though stupidOverlayColor has been changed to pink just to make sure I found the issue) - don't do it.
<!-- Base theme applied regardless of API level -->
<style name="AppTheme.Base" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorControlHighlight">#color/stupidOverlayColor</item>
</style>
The moral of the story is that "colorControlHighlight" is evil and not to be overridden and used with hardware keyboards, unless you want your app to think the entire screen should get the highlight color after you scan a barcode like this:

Aframe/Three/WebXR: disable device orientation in VR mode

I am using AFrame 1.2.0 to develop a VR application and I am struggling with an issue for several days.
My goal is to allow the user to see a specific view that is set programmatically and that is absolutely unrelated to the current device orientation. In other words, I should:
stop the user see the world based on its device orientation;
force the user to see a specific point (which I set programmatically);
These steps basically mean I should be able to:
disable the user-device rotation (UNRESOLVED for VR-Mode )
set the view to a specific position with a "refresh" rate (DONE)
As I wrote, the issue is related to the first point: disabling the user-device orientation and it only affects the VR mode. Indeed, everything works properly when the view is NOT in VR-Mode, but when entering in VR-Mode I can't do it anymore.
I tried managing these framework/library/APIs:
AFrame, look-controls: I know it is possible to disable look-controls with some properties (e.g. enabled, magicWindowTrackingEnabled, magicWindowControls): it works, but only when the view is NOT in VR-Mode; (note that hmdEnabled is no more in AFRAME from 0.8v because, as far as I understood, the introduction of WebXR does not allow to manage device directly from AFrame);
THREE.DeviceOrientationControls: I know that under the hood the look-controls component uses this THREE-element, so I debugged it and tried to manage it directly (e.g. calling disconnect, dispose, enabled=false): again, it works but only when the view is NOT in VR-Mode;
WebXR: at the lowest lever, WebXR is the last API used. I debugged it and I try to manage the WebXR session, but everything is in Read-Only mode and it seems there is no function to activate/deactivate device sensors.
So, here the question: how to disable the device orientation in VR mode with AFrame/THREE/WebXR or whatever?
Thank you all.

Xamarin Image tap gestures are not always recognised

so we are developing an app on cross-platform Xamarin. We are now testing it on Android on a few real devices, and we noticed that wherever we have an image with a Tap Gesture Recognizer the tap does not always work.
We tried increasing the section by increasing the image's size and decreasing the used part of the images, but we still have this issue. Its like some times it just doesn't work, even if you did tap on the image.
How can we fix this?
Edit
We updated to the last pre-release of Xamarin.Forms (2.5.0.121934) and it seems to be fixed. We are going to continue running tests to confirm.
Put a hotspot over it or behind it setting image's input to transparent. Hotspot can be whatever works best for you, transparent boxview, contentview etc. It's sometimes better to use hotspots as you can allow users to tap a bit around the image etc.
We updated to the last pre-release of Xamarin.Forms (2.5.0.121934) and it seems to be fixed.

When I build my app my simulator looks different from my viewcontroller.xib

I was making a user interface using storyboards and when I built my app to see how it would look in the iOS simulator it didn't look like the viewcontroller in the storyboard (some of the buttons were moved around and I had to move one button way down so it was in the place i wanted it to be). Does anyone know why this is?
Yes, the reason is auto layout, it will automatically position elements on a relative basis depending on the device you're running.
You can turn autolayout off, or build for all devices at once and keep it on.
You may want to read iOS Auto Layout Demystified by Erica Sadun which goes in depth to the world of autolayout.

How to handle screen rotation on windows 8 application

i was wondering how can I handle screen rotations for windows 8 applications using c#?
I want to create several xaml files and just change them every time the screen orientation is changed. Is that even possible?
You can use the Device Window in Visual Studio to record state changes to your UI elements. In the Device Window you can select the other visual states (namely snapped, full screen portrait, full screen landscape, and filled) and then make the changes you need for the desired end state. Those changes are then captured in the VisualStateManager that's part of your XAML file. The obvious benefit here is that "it just works", you don't have to detect orientation state yourself or do any fancy XAML replacements/substitution.
Step 3 of Navigation, layout, and views tutorial has an example of this - granted, it's pretty simplistic, but should get the concepts across.
Open AppManifest file in your project and select the desired orientations .

Resources