android-windowmanager

How to start a activity from a broadcast receiver when the screen is locked in Android Q

淺唱寂寞╮ 提交于 2021-01-28 02:20:42
问题 I am trying to implement an alarm based application in Android Q using a broadcast receiver. I am running a foreground service using notification for triggering the alarm broadcast receiver. The service is working fine and it is also triggering the broadcast receiver. If we close the application or lock the screen after setting an alarm, the service will be running in the foreground with a notification. When the alarm broadcast is called I am trying to open a new activity when the screen is

Android App on Chrome OS does not get the proper DisplayMetrics window height

社会主义新天地 提交于 2020-12-15 03:41:34
问题 I need to get the height of the available Android app's screen on a Chrome OS device. I am using DisplayMetrics to get the height dimension. However, displayMetrics.heightPixels does not get the full height of the app screen on Chrome OS devices. There is always a small gap on Chrome OS devices. This can be visualized using the WindowManager example I have provided below. Just copy and paste this into your main activity and run the app in a Chrome OS device (I used Google Pixel Slate) and

Make clear about addFlags and setFlags in android.view.Window class

大憨熊 提交于 2020-03-18 06:52:20
问题 I know what setFlags does is replacing the old flags with the new ones. And addFlags is appending more flag. I'm just confused why are the arguments in setFlags method that I've seen usually the same? For example: getWindow().setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION, WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION); //or getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); After taking a look at android

Make clear about addFlags and setFlags in android.view.Window class

試著忘記壹切 提交于 2020-03-18 06:50:18
问题 I know what setFlags does is replacing the old flags with the new ones. And addFlags is appending more flag. I'm just confused why are the arguments in setFlags method that I've seen usually the same? For example: getWindow().setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION, WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION); //or getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); After taking a look at android

Dark-text transparent status bar with opaque navigation bar

自闭症网瘾萝莉.ら 提交于 2020-02-03 05:38:10
问题 Wait, it is not a duplicate A similar question has been asked here, but not addressing dark-text status bar. What I want to do I want to achieve 3 things at the same time : Transparent status bar (Not hiding it!) Dark-text status bar Opaque (or black) navigation bar (which does not let activity content inflate underneath it ) What I have tried The solution getWindow().getDecorView().setSystemUiVisibility( View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN); can only

Adding focusable view to window manager without losing responsiveness on background

亡梦爱人 提交于 2020-01-24 04:34:37
问题 I have following problem: I want to create a toolbar, with general setting for device (TV) by adding view to window manager. My toolbar is visible in the bottom of screen and it is an overlay on currently selected application. It has following parameters/flags: WindowManager.LayoutParams.TYPE_SYSTEM_ALERT - WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH - WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE - WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL - PixelFormat.TRANSLUCENT When I click

Android : Place non-clickable view above all application windows but below notification bar

荒凉一梦 提交于 2020-01-17 14:23:11
问题 Sorry for the long title. I would basically like to add a SurfaceView as a window that appears above all windows but not above the notification bar (even when dragged down). The code I currently have is: WindowManager.LayoutParams params = new WindowManager.LayoutParams(WindowManager.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY, WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH, PixelFormat.TRANSLUCENT); This works

Dismissing a custom incoming call screen on Android when the call is answered or the phone stops ringing

耗尽温柔 提交于 2020-01-16 02:55:09
问题 I want to have a custom incoming call screen that shows up when there is an incoming call, and get dismissed if the call is answered or the phone stops ringing. I've searched several posts on Stackoverflow to show me how can I implement that, and so far I am nearly there and after checking pros and cons of each approach in terms of how fast the screen gets shown, I've settled on the WindowManager approach. Whenever I call wm.removeView(ly) I get the stack below 07-08 20:36:41.002 27547-27547

How to get the window instance from a view?

▼魔方 西西 提交于 2020-01-14 19:22:09
问题 i add a view in the windowManager via mWindowManager.addview() . Now i would like to know if it's possible to get the window instance. their is myView.getWindowID() and myView.getWindowToken() but i can't find a way to retrieve from it the window instance 回答1: If your View has been attached to Activity , you can do like this. View view; // your view if (view.getContext() instanceof Activity) { Window window = ((Activity) view.getContext()).getWindow(); } After API 19, there is a convenient

How does Facebook Messenger draw a chathead? (Android)

非 Y 不嫁゛ 提交于 2020-01-10 04:07:05
问题 I know this has already been asked a lot of times here on StackOverflow, but I'm fascinated how Facebook Messenger draws the Chatheads. I followed this tutorial to place an ImageView as an overlay. However, dragging it around is very sluggish, unlike Chatheads which show extremely smooth animation. Turning on the "Show GPU view updates" option in Developer options flashes the screen while a Chathead is being dragged. However, dragging my ImageView doesn't trigger any flashing. Here's a small