I'm working on an application to record wounds with the camera2-api. For this I scan a qr-code with the patient data and then start to take picture of the wound. But when the activity (to take pictures) launches it seems like the screen gtes dimmed till I touch the screen and I dont know why
I think its up to the device because I use the same fragment for scanning and to take pictures and when I launch the ScanActivity the issue dosn't accure
What I have already tried
Change the display options of the device (brightness of the
screen adjust automatically to your environment).
Change the power saving mode activation time to 30 minutes
Set the AE state like this
captureRequestBuilder.set(CaptureRequest.CONTROL_AE_PRECAPTURE_TRIGGER,
CaptureRequest.CONTROL_AE_PRECAPTURE_TRIGGER_START);
and
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
My questions
I'm not sure if the screen gets darker because of the exposure of the camera, the brightness of the screen or maybe the device switch to the
power saving mode.
How can i prevent that?
i got the solution. There was a AlertDialog without a view. At the begin i show the user the number of pictures but if the number is 0 no view added to the alert and that looks like the screen is dimming
Related
I'm trying to get my Android app to keep the screen unlocked as long as the app is running. I easily solved this problem with setting this flag - WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON - in each activity.
But now I'd also like to allow the screen to dim and stay dimmed until a touch event is registered. I tried to mess with window object's screenBrightness and dimAmount but none of these worked (no changes in the brightness were made). Any ideas if I can implement this feature?
As a last resort I'd think a black dialog with alpha .5 covering the whole screen would work, but I don't know if this solution will have the same effect as an actual dim, battery-saving wise
I have a timer-like app, for which I want the screen to dim to the screen brightness minimum, after a certain amount of time but never go off.
The exact same behaviour as the android timer app does. I tried to look for the exact commands in the source code of the timer (link) but could not find it.
As far as I can tell when the timer is running and you are in the timer fragment the screen goes dim (darkened) 5 seconds before the screen time out time that has been set in the android settings. So for example, if you have set the screen timeout to 30 secs and you start the timer and do not touch the screen or press any button, the screen will go to minimum brightness after 25 seconds but the screen won't turn off. If you interact with the phone the screen goes to the preset brightness.
I want to replicate this exact behaviour and I think I have to use
window.attributes.screenBrightness == WindowManager.LayoutParams.BRIGHTNESS_OVERRIDE_OFF
and
override fun onUserInteraction()
but I am not sure how to time it.
Where can I find this behaviour in the source code of the android timer?
How can I replicate this behaviour?
I'm trying to set System Screen Brightness instantaneously. I'm using a service to do that. Here it the code that I'm using.
Settings.System.putInt(cResolver,
Settings.System.SCREEN_BRIGHTNESS, 255);
This code works fine. But it is not instantaneous. The screen brightness value changes but the screen still looks dull. I can confirm this by reading back the screen brightness value and it is 255. If I lock the screen and come back, the screen is fully bright. How can I achieve this that the moment I set the system brightness to the maximum, I see fully bright screen?
BTW, I want to do this using a service and not an activity!
I would take a look at this link, specifically the first answer. It's a bit hackish though.
Changing screen brightness programmatically (as with the power widget)
Essentially you need to force the screen to refresh through starting a dummy activity and then finish() said dummy activity. I would have commented but I don't have enough points.
I have a video that plays in portrait mode. At the end of the video, I need to display some views over it. This works fine so far.
I am however, having a problem where views that are over the last frame of a video don't redraw properly when coming back to the activity after turning the screen off, then on again, then unlocking the screen.
What i'm observing is that when the screen comes back on and I unlock. My video and images are first rendered outside of fullscreen mode (with the status bar still showing) then the screen will go into fullscreen mode shifting all of the views up and causing artifacting.
It seems like the views are being shifted out of their view bounds by the transition to fullscreen after they are rendered.
I'm really stumped as to how to prevent this from happening.
Here is the sandbox project on github to avoid making this a post full of code.
The basic setup for the project is this:
Fragment activity has a video view and a button view on it's layout.
It then adds a fragment into a contentView container. The contentView fades in 1 second prior to the end of video playback.
Everything works smoothly and the problem is with returning back to the app after powering the screen on and off.
Also, sometimes the video will just drop out entirely, leaving the views sitting atop a black background.
Thanks in advance for any help you can provide.
Here's the artifacting that happens when you turn the screen off, back on, and unlock.
Note that I had to take a picture of it. On DDMS the screenshot tool sees the images properly.
rather than prevent the screen from turning off, you can opt in to receive an event when the user unlocks the keyguard after waking the phone.
At this point, it might be a good idea to call View.invalidate on both of your views, this should cause a redraw. The draw chain is very flaky while the lock screen is up, because your app is technically visible, just under the lock screen.
registerReceiver(new BroadcastReceiver() {
#Override
public void onReceive(Context ctx, Intent intent) {
if(intent.getAction().equals(Intent.ACTION_USER_PRESENT))
}
}, new IntentFilter(Intent.ACTION_USER_PRESENT));
It looks like the overlay layout was shifted by controller bar.
Don't you think it was affected by controller (play/pause/ff/rew + progress) area?
there may be a way to prevent the screen going off in 1st place as this would be good resolving your re draw issues, hope this helps.
I wanted to put together a few screen shots for an app to use in a "walkthrough". I have finally got the Android Debug bridge to work and can bring up the screen capture feature.
What i am wondering is this.
Is it possible to capture a screen press in the screen shot? For example in the picture below you can see the screen option " Home Button Launch " is highlighted, I would like to accomplish this same thing, as I press the buttons, ex : Menu>WallPaper> and so on.
two options:
if you spin the mouse wheel, it will cycle through the views (including button views) so you can make it appear as if it were pressed
Or just temporarily change the image of the button you want to appear as depressed to be your depressed image.
In the sample picture you linked I think that the person is not actually capturing a "screen press" they just used the scroll ball / d pad to navigate to that item in the list (which puts it into "selected" mode which with the default selector item as the background generally makes it look some shade of orange on most(but not all) devices. Then they took the screen shot while that item was selected. To do this you need a device with a scroll ball or d/pad that will let you navigate around the screen like that (the newer tablets don't have this ability that i've found, everything is touchscreen only, If you are using one of these devices you'll have to edit your code a little bit to call .getFocus() for each view you want to be highlighted one at a time.) Then just highlight a view and save the screen shot and repeat for every view you wish to have a screen shot of.
Edit: I am pretty sure the evo doesn't have any sort of scrolling device (track ball or d-pad etc).
if you spin the mouse wheel, it will cycle through the views (including button views) so you can make it appear as if it were pressed
Doesn't work for me on Moto Xoom, do you do it after you press the screen capture button while the picture is displayed in the window inside of eclipse? This would make this process much quicker and easier if I could get it to work, thanks for the info.
Unless you can get that mouse wheel to work I think the easiest way to do it is override one of the hardware buttons temporarily (back, or volume up/down would work I think) to cycle focus through all of the views in your layout. that way you don't have to call getFocus() one by one and recompile and run it for every different view you want a highlighted pic of. Then just use that button to cycle through the views and save a pic of each.