当前位置: 首页>>代码示例>>Java>>正文


Java Window.getLayoutParams方法代码示例

本文整理汇总了Java中wei.mark.standout.ui.Window.getLayoutParams方法的典型用法代码示例。如果您正苦于以下问题:Java Window.getLayoutParams方法的具体用法?Java Window.getLayoutParams怎么用?Java Window.getLayoutParams使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在wei.mark.standout.ui.Window的用法示例。


在下文中一共展示了Window.getLayoutParams方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: bringToFront

import wei.mark.standout.ui.Window; //导入方法依赖的package包/类
/**
 * Bring the window corresponding to this id in front of all other windows.
 * The window may flicker as it is removed and restored by the system.
 *
 * @param id The id of the window to bring to the front.
 */
public final synchronized void bringToFront(int id) {
    Window window = getWindow(id);
    if (window == null) {
        throw new IllegalArgumentException("Tried to bringToFront(" + id + ") a null window.");
    }
    StandOutLayoutParams params = window.getLayoutParams();
    // remove from window manager then add back
    try {
        mWindowManager.removeView(window);
        mWindowManager.addView(window, params);
        inFront = window.id;
    } catch (Exception ex) {
        ex.printStackTrace();
    }
}
 
开发者ID:tuyendt6,项目名称:WindowsNoteMaster,代码行数:22,代码来源:StandOutWindow.java

示例2: onTouchHandleResize

import wei.mark.standout.ui.Window; //导入方法依赖的package包/类
/**
 * Internal touch handler for handling resizing the window.
 *
 * @param id
 * @param window
 * @param view
 * @param event
 * @return
 * @see {@link View#onTouchEvent(MotionEvent)}
 */
public boolean onTouchHandleResize(int id, Window window, View view, MotionEvent event) {
    StandOutLayoutParams params = (StandOutLayoutParams) window.getLayoutParams();

    switch (event.getAction()) {
        case MotionEvent.ACTION_DOWN:
            window.touchInfo.lastX = (int) event.getRawX();
            window.touchInfo.lastY = (int) event.getRawY();

            window.touchInfo.firstX = window.touchInfo.lastX;
            window.touchInfo.firstY = window.touchInfo.lastY;
            break;
        case MotionEvent.ACTION_MOVE:
            int deltaX = (int) event.getRawX() - window.touchInfo.lastX;
            int deltaY = (int) event.getRawY() - window.touchInfo.lastY;

            // update the size of the window
            params.width += deltaX;
            params.height += deltaY;

            // keep window between min/max width/height
            if (params.width >= params.minWidth && params.width <= params.maxWidth) {
                window.touchInfo.lastX = (int) event.getRawX();
            }

            if (params.height >= params.minHeight && params.height <= params.maxHeight) {
                window.touchInfo.lastY = (int) event.getRawY();
            }

            window.edit().setSize(params.width, params.height).commit();
            window.touchInfo.maxed = false;
            break;
        case MotionEvent.ACTION_UP:
            break;
    }

    onResize(id, window, view, event);

    return true;
}
 
开发者ID:tuyendt6,项目名称:WindowsNoteMaster,代码行数:50,代码来源:StandOutWindow.java

示例3: onTouchHandleResize

import wei.mark.standout.ui.Window; //导入方法依赖的package包/类
/**
 * Internal touch handler for handling resizing the window.
 * 
 * @see {@link View#onTouchEvent(MotionEvent)}
 * 
 * @param id
 * @param window
 * @param view
 * @param event
 * @return
 */
public boolean onTouchHandleResize(int id, Window window, View view, MotionEvent event) {
	StandOutLayoutParams params = (StandOutLayoutParams) window.getLayoutParams();

	switch (event.getAction()) {
	case MotionEvent.ACTION_DOWN:
		window.touchInfo.lastX = (int) event.getRawX();
		window.touchInfo.lastY = (int) event.getRawY();

		window.touchInfo.firstX = window.touchInfo.lastX;
		window.touchInfo.firstY = window.touchInfo.lastY;
		break;
	case MotionEvent.ACTION_MOVE:
		int deltaX = (int) event.getRawX() - window.touchInfo.lastX;
		int deltaY = (int) event.getRawY() - window.touchInfo.lastY;

		// update the size of the window
		params.width += deltaX;
		params.height += deltaY;

		// keep window between min/max width/height
		if (params.width >= params.minWidth && params.width <= params.maxWidth) {
			window.touchInfo.lastX = (int) event.getRawX();
		}

		if (params.height >= params.minHeight && params.height <= params.maxHeight) {
			window.touchInfo.lastY = (int) event.getRawY();
		}

		window.edit().setSize(params.width, params.height).commit();
		break;
	case MotionEvent.ACTION_UP:
		break;
	}

	onResize(id, window, view, event);

	return true;
}
 
开发者ID:MohammadAdib,项目名称:Roundr,代码行数:50,代码来源:StandOutWindow.java

示例4: onTouchHandleResize

import wei.mark.standout.ui.Window; //导入方法依赖的package包/类
/**
 * Internal touch handler for handling resizing the window.
 * 
 * @see {@link View#onTouchEvent(MotionEvent)}
 * 
 * @param id
 * @param window
 * @param view
 * @param event
 * @return
 */
public boolean onTouchHandleResize(int id, Window window, View view, MotionEvent event) {
	StandOutLayoutParams params = (StandOutLayoutParams) window.getLayoutParams();

	switch (event.getAction()) {
	case MotionEvent.ACTION_DOWN:
		window.touchInfo.lastX = (int) event.getRawX();
		window.touchInfo.lastY = (int) event.getRawY();

		window.touchInfo.firstX = window.touchInfo.lastX;
		window.touchInfo.firstY = window.touchInfo.lastY;
		break;
	case MotionEvent.ACTION_MOVE:
		int deltaX = (int) event.getRawX() - window.touchInfo.lastX;
		int deltaY = (int) event.getRawY() - window.touchInfo.lastY;

		// update the size of the window
		params.width += deltaX;
		params.height += deltaY;

		// keep window between min/max width/height
		if (params.width >= params.minWidth && params.width <= params.maxWidth) {
			window.touchInfo.lastX = (int) event.getRawX();
		}

		if (params.height >= params.minHeight && params.height <= params.maxHeight) {
			window.touchInfo.lastY = (int) event.getRawY();
		}

		window.edit().setSize(params.width, params.height).commit();
		window.touchInfo.maxed = false;
		break;
	case MotionEvent.ACTION_UP:
		break;
	}

	onResize(id, window, view, event);

	return true;
}
 
开发者ID:tmatz,项目名称:FloatingStickies-custom,代码行数:51,代码来源:StandOutWindow.java

示例5: onTouchHandleResize

import wei.mark.standout.ui.Window; //导入方法依赖的package包/类
/**
 * Internal touch handler for handling resizing the window.
 * 
 * @see {@link View#onTouchEvent(MotionEvent)}
 * 
 * @param id
 * @param window
 * @param view
 * @param event
 * @return
 */
public boolean onTouchHandleResize(int id, Window window, View view,
		MotionEvent event) {
	StandOutLayoutParams params = window
			.getLayoutParams();

	switch (event.getAction()) {
		case MotionEvent.ACTION_DOWN:
			window.touchInfo.lastX = (int) event.getRawX();
			window.touchInfo.lastY = (int) event.getRawY();

			window.touchInfo.firstX = window.touchInfo.lastX;
			window.touchInfo.firstY = window.touchInfo.lastY;
			break;
		case MotionEvent.ACTION_MOVE:
			int deltaX = (int) event.getRawX() - window.touchInfo.lastX;
			int deltaY = (int) event.getRawY() - window.touchInfo.lastY;

			// update the size of the window
			params.width += deltaX;
			params.height += deltaY;

			// keep window between min/max width/height
			if (params.width >= params.minWidth
					&& params.width <= params.maxWidth) {
				window.touchInfo.lastX = (int) event.getRawX();
			}

			if (params.height >= params.minHeight
					&& params.height <= params.maxHeight) {
				window.touchInfo.lastY = (int) event.getRawY();
			}

			window.edit().setSize(params.width, params.height).commit();
			break;
		case MotionEvent.ACTION_UP:
			break;
	}

	onResize(id, window, view, event);

	return true;
}
 
开发者ID:fatangare,项目名称:LogcatViewer,代码行数:54,代码来源:StandOutWindow.java

示例6: onTouchHandleResize

import wei.mark.standout.ui.Window; //导入方法依赖的package包/类
/**
 * Internal touch handler for handling resizing the window.
 * 
 * @see {@link View#onTouchEvent(MotionEvent)}
 * 
 * @param id
 * @param window
 * @param view
 * @param event
 * @return
 */
public boolean onTouchHandleResize(int id, Window window, View view,
		MotionEvent event) {
	StandOutLayoutParams params = (StandOutLayoutParams) window
			.getLayoutParams();

	switch (event.getAction()) {
		case MotionEvent.ACTION_DOWN:
			window.touchInfo.lastX = (int) event.getRawX();
			window.touchInfo.lastY = (int) event.getRawY();

			window.touchInfo.firstX = window.touchInfo.lastX;
			window.touchInfo.firstY = window.touchInfo.lastY;
			break;
		case MotionEvent.ACTION_MOVE:
			int deltaX = (int) event.getRawX() - window.touchInfo.lastX;
			int deltaY = (int) event.getRawY() - window.touchInfo.lastY;

			// update the size of the window
			params.width += deltaX;
			params.height += deltaY;

			// keep window between min/max width/height
			if (params.width >= params.minWidth
					&& params.width <= params.maxWidth) {
				window.touchInfo.lastX = (int) event.getRawX();
			}

			if (params.height >= params.minHeight
					&& params.height <= params.maxHeight) {
				window.touchInfo.lastY = (int) event.getRawY();
			}

			window.edit().setSize(params.width, params.height).commit();
			break;
		case MotionEvent.ACTION_UP:
			break;
	}

	onResize(id, window, view, event);

	return true;
}
 
开发者ID:ObsidianX,项目名称:xposed-spenonly,代码行数:54,代码来源:StandOutWindow.java

示例7: onTouchHandleMove

import wei.mark.standout.ui.Window; //导入方法依赖的package包/类
/**
 * Internal touch handler for handling moving the window.
 * 
 * @see {@link View#onTouchEvent(MotionEvent)}
 * 
 * @param id
 * @param window
 * @param view
 * @param event
 * @return
 */
public boolean onTouchHandleMove(int id, Window window, View view, MotionEvent event) {
	StandOutLayoutParams params = window.getLayoutParams();

	// how much you have to move in either direction in order for the
	// gesture to be a move and not tap

	int totalDeltaX = window.touchInfo.lastX - window.touchInfo.firstX;
	int totalDeltaY = window.touchInfo.lastY - window.touchInfo.firstY;

	switch (event.getAction()) {
	case MotionEvent.ACTION_DOWN:
		window.touchInfo.lastX = (int) event.getRawX();
		window.touchInfo.lastY = (int) event.getRawY();

		window.touchInfo.firstX = window.touchInfo.lastX;
		window.touchInfo.firstY = window.touchInfo.lastY;
		break;
	case MotionEvent.ACTION_MOVE:
		int deltaX = (int) event.getRawX() - window.touchInfo.lastX;
		int deltaY = (int) event.getRawY() - window.touchInfo.lastY;

		window.touchInfo.lastX = (int) event.getRawX();
		window.touchInfo.lastY = (int) event.getRawY();

		if (window.touchInfo.moving || Math.abs(totalDeltaX) >= params.threshold || Math.abs(totalDeltaY) >= params.threshold) {
			window.touchInfo.moving = true;

			// if window is moveable
			if (Utils.isSet(window.flags, StandOutFlags.FLAG_BODY_MOVE_ENABLE)) {

				// update the position of the window
				if (event.getPointerCount() == 1) {
					params.x += deltaX;
					params.y += deltaY;
				}

				window.edit().setPosition(params.x, params.y).commit();
			}
		}
		break;
	case MotionEvent.ACTION_UP:
		window.touchInfo.moving = false;

		if (event.getPointerCount() == 1) {

			// bring to front on tap
			boolean tap = Math.abs(totalDeltaX) < params.threshold && Math.abs(totalDeltaY) < params.threshold;
			if (tap && Utils.isSet(window.flags, StandOutFlags.FLAG_WINDOW_BRING_TO_FRONT_ON_TAP)) {
				StandOutWindow.this.bringToFront(id);
			}
		}

		// bring to front on touch
		else if (Utils.isSet(window.flags, StandOutFlags.FLAG_WINDOW_BRING_TO_FRONT_ON_TOUCH)) {
			StandOutWindow.this.bringToFront(id);
		}

		break;
	}

	onMove(id, window, view, event);

	return true;
}
 
开发者ID:MohammadAdib,项目名称:Roundr,代码行数:76,代码来源:StandOutWindow.java

示例8: onTouchHandleResize

import wei.mark.standout.ui.Window; //导入方法依赖的package包/类
/**
 * Internal touch handler for handling resizing the window.
 * 
 * @see {@link android.view.View#onTouchEvent(android.view.MotionEvent)}
 * 
 * @param id
 * @param window
 * @param view
 * @param event
 * @return
 */
public boolean onTouchHandleResize(int id, Window window, View view,
		MotionEvent event) {
	StandOutLayoutParams params = (StandOutLayoutParams) window
			.getLayoutParams();

	switch (event.getAction()) {
		case MotionEvent.ACTION_DOWN:
			window.touchInfo.lastX = (int) event.getRawX();
			window.touchInfo.lastY = (int) event.getRawY();

			window.touchInfo.firstX = window.touchInfo.lastX;
			window.touchInfo.firstY = window.touchInfo.lastY;
			break;
		case MotionEvent.ACTION_MOVE:
			int deltaX = (int) event.getRawX() - window.touchInfo.lastX;
			int deltaY = (int) event.getRawY() - window.touchInfo.lastY;

			// update the size of the window
			params.width += deltaX;
			params.height += deltaY;

			// keep window between min/max width/height
			if (params.width >= params.minWidth
					&& params.width <= params.maxWidth) {
				window.touchInfo.lastX = (int) event.getRawX();
			}

			if (params.height >= params.minHeight
					&& params.height <= params.maxHeight) {
				window.touchInfo.lastY = (int) event.getRawY();
			}

			window.edit().setSize(params.width, params.height).commit();
			break;
		case MotionEvent.ACTION_UP:
			break;
	}

	onResize(id, window, view, event);

	return true;
}
 
开发者ID:sakchhams,项目名称:widgets,代码行数:54,代码来源:StandOutWindow.java


注:本文中的wei.mark.standout.ui.Window.getLayoutParams方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。