本文整理汇总了Java中wei.mark.standout.constants.StandOutFlags类的典型用法代码示例。如果您正苦于以下问题:Java StandOutFlags类的具体用法?Java StandOutFlags怎么用?Java StandOutFlags使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
StandOutFlags类属于wei.mark.standout.constants包,在下文中一共展示了StandOutFlags类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onInterceptTouchEvent
import wei.mark.standout.constants.StandOutFlags; //导入依赖的package包/类
@Override
public boolean onInterceptTouchEvent(MotionEvent event) {
StandOutLayoutParams params = getLayoutParams();
// focus window
if (event.getAction() == MotionEvent.ACTION_DOWN) {
if (mContext.getFocusedWindow() != this) {
mContext.focus(id);
}
}
// multitouch
if (event.getPointerCount() >= 2 && Utils.isSet(flags, StandOutFlags.FLAG_WINDOW_PINCH_RESIZE_ENABLE) && (event.getAction() & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_POINTER_DOWN) {
touchInfo.scale = 1;
touchInfo.dist = -1;
touchInfo.firstWidth = params.width;
touchInfo.firstHeight = params.height;
return true;
}
return false;
}
示例2: addFunctionality
import wei.mark.standout.constants.StandOutFlags; //导入依赖的package包/类
/**
* Implement StandOut specific additional functionalities.
* <p/>
* <p/>
* Currently, this method does the following:
* <p/>
* <p/>
* Attach resize handles: For every View found to have id R.id.corner,
* attach an OnTouchListener that implements resizing the window.
*
* @param root The view hierarchy that is part of the window.
*/
void addFunctionality(View root) {
// corner for resize
if (!Utils.isSet(flags, StandOutFlags.FLAG_ADD_FUNCTIONALITY_RESIZE_DISABLE)) {
View corner = root.findViewById(R.id.corner);
if (corner != null) {
corner.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
// handle dragging to move
boolean consumed = mContext.onTouchHandleResize(id, Window.this, v, event);
return consumed;
}
});
}
}
}
示例3: focus
import wei.mark.standout.constants.StandOutFlags; //导入依赖的package包/类
/**
* Request focus for the window corresponding to this id. A maximum of one
* window can have focus, and that window will receive all key events,
* including Back and Menu.
*
* @param id The id of the window.
* @return True if focus changed successfully, false if it failed.
*/
public final synchronized boolean focus(int id) {
try {
// check if that window is focusable
final Window window = getWindow(id);
if (window == null) {
throw new IllegalArgumentException("Tried to focus(" + id + ") a null window.");
}
if (!Utils.isSet(window.flags, StandOutFlags.FLAG_WINDOW_FOCUSABLE_DISABLE)) {
// remove focus from previously focused window
if (sFocusedWindow != null) {
unfocus(sFocusedWindow);
}
return window.onFocus(true);
}
} catch (Exception e) {
}
return false;
}
示例4: StandOutLayoutParams
import wei.mark.standout.constants.StandOutFlags; //导入依赖的package包/类
/**
* @param id The id of the window.
*/
public StandOutLayoutParams(int id) {
super(200, 200, TYPE_PHONE, StandOutLayoutParams.FLAG_NOT_TOUCH_MODAL | StandOutLayoutParams.FLAG_WATCH_OUTSIDE_TOUCH, PixelFormat.TRANSLUCENT);
int windowFlags = getFlags(id);
setFocusFlag(false);
if (!Utils.isSet(windowFlags, StandOutFlags.FLAG_WINDOW_EDGE_LIMITS_ENABLE)) {
// windows may be moved beyond edges
flags |= FLAG_LAYOUT_NO_LIMITS;
}
x = getX(id, width);
y = getY(id, height);
gravity = Gravity.TOP | Gravity.LEFT;
threshold = 10;
minWidth = minHeight = 0;
maxWidth = maxHeight = Integer.MAX_VALUE;
}
示例5: onInterceptTouchEvent
import wei.mark.standout.constants.StandOutFlags; //导入依赖的package包/类
@Override
public boolean onInterceptTouchEvent(MotionEvent event) {
StandOutLayoutParams params = getLayoutParams();
// focus window
if (event.getAction() == MotionEvent.ACTION_DOWN) {
if (mContext.getFocusedWindow() != this) {
mContext.focus(id);
}
}
// multitouch
if (event.getPointerCount() >= 2
&& Utils.isSet(flags,
StandOutFlags.FLAG_WINDOW_PINCH_RESIZE_ENABLE)
&& (event.getAction() & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_POINTER_DOWN) {
touchInfo.scale = 1;
touchInfo.dist = -1;
touchInfo.firstWidth = params.width;
touchInfo.firstHeight = params.height;
return true;
}
return false;
}
示例6: focus
import wei.mark.standout.constants.StandOutFlags; //导入依赖的package包/类
/**
* Request focus for the window corresponding to this id. A maximum of one
* window can have focus, and that window will receive all key events,
* including Back and Menu.
*
* @param id
* The id of the window.
* @return True if focus changed successfully, false if it failed.
*/
public final synchronized boolean focus(int id) {
// check if that window is focusable
final Window window = getWindow(id);
if (window == null) {
throw new IllegalArgumentException("Tried to focus(" + id
+ ") a null window.");
}
if (!Utils.isSet(window.flags,
StandOutFlags.FLAG_WINDOW_FOCUSABLE_DISABLE)) {
// remove focus from previously focused window
if (sFocusedWindow != null) {
unfocus(sFocusedWindow);
}
return window.onFocus(true);
}
return false;
}
示例7: StandOutLayoutParams
import wei.mark.standout.constants.StandOutFlags; //导入依赖的package包/类
/**
* @param id
* The id of the window.
*/
public StandOutLayoutParams(int id) {
super(200, 200, TYPE_PHONE,
StandOutLayoutParams.FLAG_NOT_TOUCH_MODAL
| StandOutLayoutParams.FLAG_WATCH_OUTSIDE_TOUCH,
PixelFormat.TRANSLUCENT);
int windowFlags = getFlags(id);
setFocusFlag(false);
if (!Utils.isSet(windowFlags,
StandOutFlags.FLAG_WINDOW_EDGE_LIMITS_ENABLE)) {
// windows may be moved beyond edges
flags |= FLAG_LAYOUT_NO_LIMITS;
}
x = getX(id, width);
y = getY(id, height);
gravity = Gravity.TOP | Gravity.LEFT;
threshold = 10;
minWidth = minHeight = 0;
maxWidth = maxHeight = Integer.MAX_VALUE;
}
示例8: onInterceptTouchEvent
import wei.mark.standout.constants.StandOutFlags; //导入依赖的package包/类
@Override
public boolean onInterceptTouchEvent(MotionEvent event) {
StandOutLayoutParams params = getLayoutParams();
// focus window
if (event.getAction() == MotionEvent.ACTION_DOWN) {
if (mContext.getFocusedWindow() != this) {
mContext.focus(id);
}
}
// multitouch
if (event.getPointerCount() >= 2 && Utils.isSet(flags, StandOutFlags.FLAG_WINDOW_PINCH_RESIZE_ENABLE) && (event.getAction() & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_POINTER_DOWN) {
touchInfo.scale = 1;
touchInfo.dist = -1;
touchInfo.firstWidth = params.width;
touchInfo.firstHeight = params.height;
return true;
}
return false;
}
示例9: focus
import wei.mark.standout.constants.StandOutFlags; //导入依赖的package包/类
/**
* Request focus for the window corresponding to this id. A maximum of one
* window can have focus, and that window will receive all key events,
* including Back and Menu.
*
* @param id
* The id of the window.
* @return True if focus changed successfully, false if it failed.
*/
public final synchronized boolean focus(int id) {
// check if that window is focusable
final Window window = getWindow(id);
if (window == null) {
return false;
}
if (!Utils.isSet(window.flags, StandOutFlags.FLAG_WINDOW_FOCUSABLE_DISABLE)) {
// remove focus from previously focused window
if (sFocusedWindow != null) {
unfocus(sFocusedWindow);
}
return window.onFocus(true);
}
return false;
}
示例10: StandOutLayoutParams
import wei.mark.standout.constants.StandOutFlags; //导入依赖的package包/类
/**
* @param id
* The id of the window.
*/
public StandOutLayoutParams(int id) {
super(200, 200, PreferenceManager.getDefaultSharedPreferences(StandOutWindow.this).getInt("type", LayoutParams.TYPE_SYSTEM_OVERLAY), PreferenceManager.getDefaultSharedPreferences(StandOutWindow.this).getInt("flags", StandOutLayoutParams.FLAG_SHOW_WHEN_LOCKED), PixelFormat.RGBA_8888);
int windowFlags = getFlags(id);
setFocusFlag(false);
if (!Utils.isSet(windowFlags, StandOutFlags.FLAG_WINDOW_EDGE_LIMITS_ENABLE)) {
// windows may be moved beyond edges
flags |= FLAG_LAYOUT_NO_LIMITS;
}
x = getX(id, width);
y = getY(id, height);
gravity = Gravity.TOP | Gravity.LEFT;
threshold = 10;
minWidth = minHeight = 0;
maxWidth = maxHeight = Integer.MAX_VALUE;
}
示例11: addFunctionality
import wei.mark.standout.constants.StandOutFlags; //导入依赖的package包/类
/**
* Implement StandOut specific additional functionalities.
*
* <p>
* Currently, this method does the following:
*
* <p>
* Attach resize handles: For every View found to have id R.id.corner,
* attach an OnTouchListener that implements resizing the window.
*
* @param root
* The view hierarchy that is part of the window.
*/
void addFunctionality(View root) {
// corner for resize
if (!Utils.isSet(flags, StandOutFlags.FLAG_ADD_FUNCTIONALITY_RESIZE_DISABLE)) {
View corner = root.findViewById(R.id.corner);
if (corner != null) {
corner.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
// handle dragging to move
boolean consumed = mContext.onTouchHandleResize(id, Window.this, v, event);
return consumed;
}
});
}
}
}
示例12: focus
import wei.mark.standout.constants.StandOutFlags; //导入依赖的package包/类
/**
* Request focus for the window corresponding to this id. A maximum of one
* window can have focus, and that window will receive all key events,
* including Back and Menu.
*
* @param id
* The id of the window.
* @return True if focus changed successfully, false if it failed.
*/
public final synchronized boolean focus(int id) {
try {
// check if that window is focusable
final Window window = getWindow(id);
if (window == null) {
throw new IllegalArgumentException("Tried to focus(" + id + ") a null window.");
}
if (!Utils.isSet(window.flags, StandOutFlags.FLAG_WINDOW_FOCUSABLE_DISABLE)) {
// remove focus from previously focused window
if (sFocusedWindow != null) {
unfocus(sFocusedWindow);
}
return window.onFocus(true);
}
} catch (Exception e) {
}
return false;
}
示例13: StandOutLayoutParams
import wei.mark.standout.constants.StandOutFlags; //导入依赖的package包/类
/**
* @param id
* The id of the window.
*/
public StandOutLayoutParams(int id) {
super(200, 200, TYPE_PHONE, StandOutLayoutParams.FLAG_NOT_TOUCH_MODAL | StandOutLayoutParams.FLAG_WATCH_OUTSIDE_TOUCH, PixelFormat.TRANSLUCENT);
int windowFlags = getFlags(id);
setFocusFlag(false);
if (!Utils.isSet(windowFlags, StandOutFlags.FLAG_WINDOW_EDGE_LIMITS_ENABLE)) {
// windows may be moved beyond edges
flags |= FLAG_LAYOUT_NO_LIMITS;
}
x = getX(id, width);
y = getY(id, height);
gravity = Gravity.TOP | Gravity.LEFT;
threshold = 10;
minWidth = minHeight = 0;
maxWidth = maxHeight = Integer.MAX_VALUE;
}
示例14: getFlags
import wei.mark.standout.constants.StandOutFlags; //导入依赖的package包/类
@Override
public int getFlags(int id) {
return StandOutFlags.FLAG_DECORATION_SYSTEM |
StandOutFlags.FLAG_BODY_MOVE_ENABLE |
StandOutFlags.FLAG_WINDOW_EDGE_LIMITS_ENABLE |
StandOutFlags.FLAG_WINDOW_BRING_TO_FRONT_ON_TAP |
StandOutFlags.FLAG_WINDOW_PINCH_RESIZE_ENABLE;
}
示例15: setPosition
import wei.mark.standout.constants.StandOutFlags; //导入依赖的package包/类
/**
* Set the position of this window in absolute pixels.
*
* @param x
* @param y
* @param skip Don't call {@link #setPosition(int, int)} and
* {@link #setSize(int, int)} to avoid stack overflow.
* @return The same Editor, useful for method chaining.
*/
private Editor setPosition(int x, int y, boolean skip) {
if (mParams != null) {
if (anchorX < 0 || anchorX > 1 || anchorY < 0 || anchorY > 1) {
throw new IllegalStateException("Anchor point must be between 0 and 1, inclusive.");
}
// sets the x and y correctly according to anchorX and
// anchorY
if (x != UNCHANGED) {
mParams.x = (int) (x - mParams.width * anchorX);
}
if (y != UNCHANGED) {
mParams.y = (int) (y - mParams.height * anchorY);
}
if (Utils.isSet(flags, StandOutFlags.FLAG_WINDOW_EDGE_LIMITS_ENABLE)) {
// if gravity is not TOP|LEFT throw exception
if (mParams.gravity != (Gravity.TOP | Gravity.LEFT)) {
throw new IllegalStateException("The window " + id + " gravity must be TOP|LEFT if FLAG_WINDOW_EDGE_LIMITS_ENABLE or FLAG_WINDOW_EDGE_TILE_ENABLE is set.");
}
// keep window inside edges
mParams.x = Math.min(Math.max(mParams.x, 0), displayWidth - mParams.width);
mParams.y = Math.min(Math.max(mParams.y, 0), displayHeight - mParams.height);
}
}
return this;
}