Java Code Examples for android.view.WindowManager.LayoutParams#TYPE_SYSTEM_ERROR

The following examples show how to use android.view.WindowManager.LayoutParams#TYPE_SYSTEM_ERROR . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StatusBarVolumePanel.java    From Noyze with Apache License 2.0 6 votes vote down vote up
@Override public WindowManager.LayoutParams getWindowLayoutParams() {
	int flags = (LayoutParams.FLAG_NOT_FOCUSABLE		|
                    LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH  |
                    LayoutParams.FLAG_NOT_TOUCH_MODAL      |
                    LayoutParams.FLAG_LAYOUT_INSET_DECOR   |
			     LayoutParams.FLAG_LAYOUT_IN_SCREEN		|
			     LayoutParams.FLAG_SHOW_WHEN_LOCKED	    );
	LayoutParams WPARAMS = new WindowManager.LayoutParams(
		LayoutParams.MATCH_PARENT, mStatusBarHeight, 0, 0,
		LayoutParams.TYPE_SYSTEM_ERROR, flags, PixelFormat.TRANSLUCENT);
	WPARAMS.windowAnimations = android.R.style.Animation_Dialog;
	WPARAMS.packageName = getContext().getPackageName();
	WPARAMS.setTitle(TAG);
       WPARAMS.rotationAnimation = LayoutParams.ROTATION_ANIMATION_JUMPCUT;
	WPARAMS.gravity = (Gravity.FILL_HORIZONTAL | Gravity.TOP);
	WPARAMS.screenBrightness = WPARAMS.buttonBrightness = LayoutParams.BRIGHTNESS_OVERRIDE_NONE;
	return WPARAMS;
}
 
Example 2
Source File: TestActivity.java    From android-art-res with Apache License 2.0 6 votes vote down vote up
public void onButtonClick(View v) {
    if (v == mCreateWindowButton) {
        mFloatingButton = new Button(this);
        mFloatingButton.setText("click me");
        mLayoutParams = new WindowManager.LayoutParams(
                LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, 0, 0,
                PixelFormat.TRANSPARENT);
        mLayoutParams.flags = LayoutParams.FLAG_NOT_TOUCH_MODAL
                | LayoutParams.FLAG_NOT_FOCUSABLE
                | LayoutParams.FLAG_SHOW_WHEN_LOCKED;
        mLayoutParams.type = LayoutParams.TYPE_SYSTEM_ERROR;
        mLayoutParams.gravity = Gravity.LEFT | Gravity.TOP;
        mLayoutParams.x = 100;
        mLayoutParams.y = 300;
        mFloatingButton.setOnTouchListener(this);
        mWindowManager.addView(mFloatingButton, mLayoutParams);
    }
}
 
Example 3
Source File: Util.java    From Float-Bar with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * 对windowManager进行设置
 * 
 * @param wmParams
 * @return
 */
public static WindowManager.LayoutParams getParams(WindowManager.LayoutParams wmParams) {
	wmParams = new WindowManager.LayoutParams();
	// 设置window type 下面变量2002是在屏幕区域显示,2003则可以显示在状态栏之上
	// wmParams.type = LayoutParams.TYPE_PHONE;
	// wmParams.type = LayoutParams.TYPE_SYSTEM_ALERT;
	wmParams.type = LayoutParams.TYPE_SYSTEM_ERROR;
	// 设置图片格式,效果为背景透明
	wmParams.format = PixelFormat.RGBA_8888;
	// 设置浮动窗口不可聚焦(实现操作除浮动窗口外的其他可见窗口的操作)
	// wmParams.flags = LayoutParams.FLAG_NOT_FOCUSABLE;
	// 设置可以显示在状态栏上
	wmParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
			| WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN | WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR
			| WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH;

	// 设置悬浮窗口长宽数据
	wmParams.width = WindowManager.LayoutParams.WRAP_CONTENT;
	wmParams.height = WindowManager.LayoutParams.WRAP_CONTENT;

	return wmParams;
}
 
Example 4
Source File: StatusBarVolumePanel.java    From Noyze with Apache License 2.0 6 votes vote down vote up
@Override public WindowManager.LayoutParams getWindowLayoutParams() {
	int flags = (LayoutParams.FLAG_NOT_FOCUSABLE		|
                    LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH  |
                    LayoutParams.FLAG_NOT_TOUCH_MODAL      |
                    LayoutParams.FLAG_LAYOUT_INSET_DECOR   |
			     LayoutParams.FLAG_LAYOUT_IN_SCREEN		|
			     LayoutParams.FLAG_SHOW_WHEN_LOCKED	    );
	LayoutParams WPARAMS = new WindowManager.LayoutParams(
		LayoutParams.MATCH_PARENT, mStatusBarHeight, 0, 0,
		LayoutParams.TYPE_SYSTEM_ERROR, flags, PixelFormat.TRANSLUCENT);
	WPARAMS.windowAnimations = android.R.style.Animation_Dialog;
	WPARAMS.packageName = getContext().getPackageName();
	WPARAMS.setTitle(TAG);
       WPARAMS.rotationAnimation = LayoutParams.ROTATION_ANIMATION_JUMPCUT;
	WPARAMS.gravity = (Gravity.FILL_HORIZONTAL | Gravity.TOP);
	WPARAMS.screenBrightness = WPARAMS.buttonBrightness = LayoutParams.BRIGHTNESS_OVERRIDE_NONE;
	return WPARAMS;
}
 
Example 5
Source File: Util.java    From Float-Bar with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * 对windowManager进行设置
 * 
 * @param wmParams
 * @return
 */
public static WindowManager.LayoutParams getParams(WindowManager.LayoutParams wmParams) {
	wmParams = new WindowManager.LayoutParams();
	// 设置window type 下面变量2002是在屏幕区域显示,2003则可以显示在状态栏之上
	// wmParams.type = LayoutParams.TYPE_PHONE;
	// wmParams.type = LayoutParams.TYPE_SYSTEM_ALERT;
	wmParams.type = LayoutParams.TYPE_SYSTEM_ERROR;
	// 设置图片格式,效果为背景透明
	wmParams.format = PixelFormat.RGBA_8888;
	// 设置浮动窗口不可聚焦(实现操作除浮动窗口外的其他可见窗口的操作)
	// wmParams.flags = LayoutParams.FLAG_NOT_FOCUSABLE;
	// 设置可以显示在状态栏上
	wmParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
			| WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN | WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR
			| WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH;

	// 设置悬浮窗口长宽数据
	wmParams.width = WindowManager.LayoutParams.WRAP_CONTENT;
	wmParams.height = WindowManager.LayoutParams.WRAP_CONTENT;

	return wmParams;
}
 
Example 6
Source File: LockLayer.java    From BigApp_Discuz_Android with Apache License 2.0 5 votes vote down vote up
private void init() {
	isLocked = false;
	mWindowManager = mActivty.getWindowManager();
	mLockViewLayoutParams = new LayoutParams();
	mLockViewLayoutParams.width = LayoutParams.MATCH_PARENT;
	mLockViewLayoutParams.height = LayoutParams.MATCH_PARENT;
	// 实现关键
	mLockViewLayoutParams.type = LayoutParams.TYPE_SYSTEM_ERROR;
	// apktool value,这个值具体是哪个变量还请网友帮忙
	mLockViewLayoutParams.flags = 1280;
}
 
Example 7
Source File: VolumePanel.java    From Noyze with Apache License 2.0 5 votes vote down vote up
@Override
   protected WindowManager.LayoutParams getWindowParams() {
	if (null == mWindowAttributes) {
		mWindowAttributes = getWindowLayoutParams();
		if (null != mWindowAttributes) {
               mWindowAttributes.type = ((isInteractive()) ?
                       LayoutParams.TYPE_SYSTEM_ERROR : LayoutParams.TYPE_SYSTEM_OVERLAY);
           }
	}
	return mWindowAttributes;
}
 
Example 8
Source File: VolumePanel.java    From Noyze with Apache License 2.0 5 votes vote down vote up
@Override
   protected WindowManager.LayoutParams getWindowParams() {
	if (null == mWindowAttributes) {
		mWindowAttributes = getWindowLayoutParams();
		if (null != mWindowAttributes) {
               mWindowAttributes.type = ((isInteractive()) ?
                       LayoutParams.TYPE_SYSTEM_ERROR : LayoutParams.TYPE_SYSTEM_OVERLAY);
           }
	}
	return mWindowAttributes;
}