orientation changes in a NativeActivity - android-studio

I have got a problem handling orientation changes from a nativeactivity for my opengl related app.
I have the JNI setup for two functions:
- One for setting the orientation and
- One for getting what the orientation currently is.
I am using the constants for setRequestedOrientation(int):
6 is SENSOR_LANDSCAPE,
7 is SENSOR_PORTRAIT,
4 is just SENSOR.
Now, im using config changes to handle it myself. And in this function I'm calling the java getorientation() function i setup. It is reporting correctly either landscape or portrait.
The problem comes in when i go to initialize my EGL display again. ANativeWindow_getWidth(window) is not reporting the correct width at all times. It'll work half the time. I think the engine->app->window is something being set from the parameter in android_main() and is used by egl to determine the screen dimensions.
But the value is wrong because i dont know how you go about updating the window with the correct one via config changes. anyone have any idea what i can do?

Related

Minimize / Iconify JavaFX undecorated stage on Ubuntu not working

I've created small library containing a custom window/stage to use for all my applications to have a constant and uniform look.
Basically it's just a undecorated stage with a AnchorPane which contains the customized Minimize/Maximize/Close and Resize controls.
The only problem is the method which is performed when the Minimize button is pressed. Nothing happens when running the app on my main system (Arch Linux), it looks like the application is frozen, here's a visual example:
Example image uploaded on Imgur, haven't got enough reps yet to post images
Minimize method code:
void minimizeWindow() {
window.setIconified(true);
}
On Windows 7 x64 everything works fine, the application gets iconified and also can be enlarged again.
I think this is a bug in JavaFX itself or a compatibility problem with GTK3.
Someone know how to fix this problem or got a workaround for this until this officially gets fixed?
Thanks in advance.
This is a known issue. This has already been fixed but there are few related left-overs jiras and this fix will be most-probably released with Java 9.
The release may be pushed forward, depending on the fix of the other related bugs.
You can view the details and follow up the same here :
[Linux] Stage.setIconified(true) not working with TRANSPARENT or UNDECORATED stage

XLIB - All attempts to draw on display surface fail with "BadRequest"

Due to confidentiality agreements (defense sector work) I cannot post any real code. But I have been stumped for weeks on this problem - and I have read every discussion thread I can find on StackOverflow and everywhere else to no avail. We're stumped over here and I am requesting advice or asking if anybody has seen or beat this issue.
Basic overview of the task is:
Find and manipulate a running Firefox browser on a specific display. I need to do the following:
Find the running browser instance.
Position & Size the browser to a specific location on the display.
Position the icon if/when the application is minimized.
Implement "always on top" behavior for the browser - yes we know this is a no no but in our specific case this is needed, expected, and ok.
In order to implement the above I am calling the following X APIs (in order of the above):
XOpenDisplay, XQueryTree, XGetWindowProperty
XMoveResizeWindow
{not researched yet but I think I can do what I want with a window hint}
XRaiseWindow, XNextevent
The observed behavior is:
Any API that does NOT draw on the display surface succeeds {except for XGetNextEvent - which crashes the application}
All APIs that act on the display surface directly - XMoveResize etc... - fail with error code (1) "BadRequest (invalid request code or no such operation)"
Does anybody have a thought on what might be happening to us? Any ideas would be appreciated!! Additional info follows:
x64 bit Red Hat Enterprise Linux 5.2
NVIDIA graphics hardware
XLIB 7.1.1
Thanx in advance for any assistance...

Questions about Citymaps

1、I want to create a circle and set an image that customized to fill the circle,use this as a marker on the map, not only could change the image but also the color of circle anytime,what can I do to implements this function? Please look at the picture below!
2、Like your CityMaps app show,when I enlarge the map, some business icon that hide are show on the map,which are hide again while shrink the map, How to achieve this effect?
3、After I initialization the Object Marker and called the method marker.setFadeTime(3000),the software give my tips the method is no exist and I see the class Marker.java but really not find the method,Why is it so?
4、I want to add some stars beside the marker like this:
What can I do to add the stars?the label only can set the text beside the marker.
5、I want to load your maps at the fragment,not the activity that extends FragmentActivity,I found the SupportCitymapsMapFragment is no use,What I can do to complete this requirement?
6、In your apps,it is locate that place after input New York in the search box,What can i do to complete this function whatever i input?
7、During I develop the apps about the Citymaps,I found a serious problem so that your apps had happend too. When I run the apps, the program force flash back all of a sudden and I run your apps Citymaps at this time,the problems are same of the front,I found some error in logical view that is follows:15327-15374/com.map.maplbs A/libc﹕ Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1), thread 15374 (Thread-1819).
To solve the problem,I must restart my device. Why is it so?
I am a developer on the Citymaps SDK, I will do my best to answer your questions.
1) I recommend using the Android Canvas API to construct the images, and then use a Marker to display it on the map. See the documentation for details: http://developer.citymaps.com/markers
2) This is built into the Citymaps BusinessLayer. This functionality is not exposed through an API. If you wish to use the Citymaps BusinessLayer, you should create a CitymapsMapView or CitymapsMapFragment/SupportCitymapsMapFragment and it will automatically be added to your map.
3) At this time, there appears to be a known issue with the fadeTime API. Thank you for bringing this to our attention. We will fix it in an upcoming release. For now, you can animate the alpha property of the Marker.
4) Once again, the functionality of the BusinessLayer is not directly exposed. If you wish to create similar markers, I recommend you construct the image using Android's Canvas and then adding it as a Marker to the map.
5) If you wish to load the map inside of a fragment, you can accomplish this using child fragments (check Android documentation for more details). You can also accomplish this by instantiating CitymapsMapView or MapView directly and adding it to your view hierarchy either in XML or in code. However if you do this, remember to call the lifecycle methods on your map instance, or else the map will not behave properly.
6) If you wish to have a search in your app, it is up to you to implement this feature. We do not currently provide a search API out of the box.
7) Thank you for the bug report. We will investigate this issue and fix it in a future release.
If you have any more questions, feel free to ask, and thank you for using the Citymaps SDK.

show a specific view when application returns to foreground [duplicate]

How do I prevent my GUI from redraw when it comes back from lock screen after receiving a UILocalNotification? In didReceiveLocalNotification I present a modal view, but the old state of my view controllers is shown for a moment before that. How do I prevent this?
Also the order of events I get when I come back on local notification from background is as following:
1. UIApplicationWillEnterForegroundNotification
2. UIApplicationDidBecomeActiveNotification
3. didReceiveLocalNotification
When I come from lock screen:
1. didReceiveLocalNotification
2. UIApplicationDidBecomeActiveNotification
Why is this difference and whether there is something else I'm missing?
Thanks
Here's how it was solved. May be it's not the way, but it worked for me. Since my application is voip/audio, it doesn't come to didFinishLaunchingWithOptions... I found out, that iOS uses a cached image from a previous state for animation when it resumes from background or from sleep mode. So the solution is basically to exchange this cached image with my default.png image. I do it in applicationWillResignActive delegate. There I add a modal view with a Default.png picture and dismiss it in applicationDidBecomeActive. This is really in short. Hopefully it will help somebody else with the same problem.
You can provide a custom image that is displayed when launching/resuming from a local notification. Simply set the alertLaunchImage property on your local notification to the name of the correct image.
From the Docs:
The string is a filename of an image file in the application bundle. This image is a launching image specified for a given notification; when the user taps the action button (for example, “View”) or moves the action slider, the image is used in place of the default launching image. If the value of this property is nil (the default), the system either uses the previous snapshot, uses the image identified by the UILaunchImageFile key in the application’s Info.plist file, or falls back to Default.png.
alertLaunchImage

redraw GUI on didreceivelocalnotification when come from lock screen iphone

How do I prevent my GUI from redraw when it comes back from lock screen after receiving a UILocalNotification? In didReceiveLocalNotification I present a modal view, but the old state of my view controllers is shown for a moment before that. How do I prevent this?
Also the order of events I get when I come back on local notification from background is as following:
1. UIApplicationWillEnterForegroundNotification
2. UIApplicationDidBecomeActiveNotification
3. didReceiveLocalNotification
When I come from lock screen:
1. didReceiveLocalNotification
2. UIApplicationDidBecomeActiveNotification
Why is this difference and whether there is something else I'm missing?
Thanks
Here's how it was solved. May be it's not the way, but it worked for me. Since my application is voip/audio, it doesn't come to didFinishLaunchingWithOptions... I found out, that iOS uses a cached image from a previous state for animation when it resumes from background or from sleep mode. So the solution is basically to exchange this cached image with my default.png image. I do it in applicationWillResignActive delegate. There I add a modal view with a Default.png picture and dismiss it in applicationDidBecomeActive. This is really in short. Hopefully it will help somebody else with the same problem.
You can provide a custom image that is displayed when launching/resuming from a local notification. Simply set the alertLaunchImage property on your local notification to the name of the correct image.
From the Docs:
The string is a filename of an image file in the application bundle. This image is a launching image specified for a given notification; when the user taps the action button (for example, “View”) or moves the action slider, the image is used in place of the default launching image. If the value of this property is nil (the default), the system either uses the previous snapshot, uses the image identified by the UILaunchImageFile key in the application’s Info.plist file, or falls back to Default.png.
alertLaunchImage

Resources