本文整理了Java中android.view.View.hasWindowFocus()
方法的一些代码示例,展示了View.hasWindowFocus()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。View.hasWindowFocus()
方法的具体详情如下:
包路径:android.view.View
类名称:View
方法名:hasWindowFocus
暂无
代码示例来源:origin: square/assertj-android
public S isNotInFocusedWindow() {
isNotNull();
assertThat(actual.hasWindowFocus()) //
.overridingErrorMessage("Expected to not be in a focused window but was") //
.isFalse();
return myself;
}
代码示例来源:origin: square/assertj-android
public S isInFocusedWindow() {
isNotNull();
assertThat(actual.hasWindowFocus()) //
.overridingErrorMessage("Expected to be in a focused window but was not") //
.isTrue();
return myself;
}
代码示例来源:origin: RobotiumTech/robotium
/**
* Returns the most recent view container
*
* @param views the views to check
* @return the most recent view container
*/
private final View getRecentContainer(View[] views) {
View container = null;
long drawingTime = 0;
View view;
for(int i = 0; i < views.length; i++){
view = views[i];
if (view != null && view.isShown() && view.hasWindowFocus() && view.getDrawingTime() > drawingTime) {
container = view;
drawingTime = view.getDrawingTime();
}
}
return container;
}
代码示例来源:origin: com.squareup.assertj/assertj-android
public S isNotInFocusedWindow() {
isNotNull();
assertThat(actual.hasWindowFocus()) //
.overridingErrorMessage("Expected to not be in a focused window but was") //
.isFalse();
return myself;
}
代码示例来源:origin: com.squareup.assertj/assertj-android
public S isInFocusedWindow() {
isNotNull();
assertThat(actual.hasWindowFocus()) //
.overridingErrorMessage("Expected to be in a focused window but was not") //
.isTrue();
return myself;
}
代码示例来源:origin: Meituan-Dianping/Shield
public void setSubView(View subView) {
removeAllViews();
this.subView = subView;
if (this.subView != null && this.subView.getParent() != this) {
if (this.subView.getParent() instanceof ViewGroup) {
((ViewGroup) this.subView.getParent()).removeView(this.subView);
}
addView(this.subView);
if (this.subView.hasFocus() || this.subView.hasWindowFocus()) {
this.subView.requestFocus();
}
}
}
代码示例来源:origin: WeAreFairphone/FP2-Launcher
public void run() {
if ((mView.getParent() != null) && mView.hasWindowFocus()
&& !mHasPerformedLongPress) {
if (mView.performLongClick()) {
mView.setPressed(false);
mHasPerformedLongPress = true;
}
}
}
}
代码示例来源:origin: stackoverflow.com
public static boolean isActiveDialog(Dialog dialog) {
if (!dialog.isShowing())
return false;
Window dialogWindow = dialog.getWindow();
if (dialogWindow != null) {
View decorView = dialogWindow.getDecorView();
if (decorView != null)
return decorView.hasWindowFocus();
}
return false;
}
代码示例来源:origin: alibaba/android_viewtracker
private void wrapExposureCurrentView(View view, Map<String, ExposureModel> lastVisibleViewMap,
Map<String, ExposureModel> currentVisibleViewMap) {
String viewTag = (String) view.getTag(TrackerConstants.VIEW_TAG_UNIQUE_NAME);
HashMap<String, Object> params = (HashMap<String, Object>) view.getTag(TrackerConstants.VIEW_TAG_PARAM);
boolean isWindowChange = view.hasWindowFocus();
boolean exposureValid = checkExposureViewDimension(view);
boolean needExposureProcess = isWindowChange && exposureValid;
if (!needExposureProcess) {
return;
}
// only add the visible view in screen
if (lastVisibleViewMap.containsKey(viewTag)) {
ExposureModel model = lastVisibleViewMap.get(viewTag);
model.params = params;
currentVisibleViewMap.put(viewTag, model);
} else if (!currentVisibleViewMap.containsKey(viewTag)) {
ExposureModel model = new ExposureModel();
model.beginTime = System.currentTimeMillis();
model.tag = viewTag;
model.params = params;
currentVisibleViewMap.put(viewTag, model);
}
}
代码示例来源:origin: luili16/UIMocker
private View getRecentContainer(List<View> views) {
View container = null;
long drawingTime = 0;
View view;
for (int i = 0; i < views.size(); i++) {
view = views.get(i);
if (view != null && view.isShown() && view.hasWindowFocus() &&
view.getDrawingTime() > drawingTime) {
container = view;
drawingTime = view.getDrawingTime();
}
}
return container;
}
代码示例来源:origin: rockon999/LeanbackLauncher
protected void setHasFocus(boolean hasFocus) {
if (this.mEnabled && this.mTargetView.getVisibility() == 0 && this.mTargetView.isAttachedToWindow() && this.mTargetView.hasWindowFocus()) {
animateFocus(hasFocus);
} else {
setFocusImmediate(hasFocus);
}
}
代码示例来源:origin: MoMoWait/LeanbackLauncher
protected void setHasFocus(boolean hasFocus) {
if (this.mEnabled && this.mTargetView.getVisibility() == 0 && this.mTargetView.isAttachedToWindow() && this.mTargetView.hasWindowFocus()) {
animateFocus(hasFocus);
} else {
setFocusImmediate(hasFocus);
}
}
代码示例来源:origin: enricocid/LaunchEnr
public void run() {
if ((mView.getParent() != null) && mView.hasWindowFocus()
&& !mHasPerformedLongPress) {
boolean handled;
if (mListener != null) {
handled = mListener.onLongClick(mView);
} else {
handled = mView.performLongClick();
}
if (handled) {
mView.setPressed(false);
mHasPerformedLongPress = true;
}
}
}
}
代码示例来源:origin: fookwood/Launcher3
public void run() {
if ((mView.getParent() != null) && mView.hasWindowFocus()
&& !mHasPerformedLongPress) {
boolean handled;
if (mListener != null) {
handled = mListener.onLongClick(mView);
} else {
handled = mView.performLongClick();
}
if (handled) {
mView.setPressed(false);
mHasPerformedLongPress = true;
}
}
}
}
代码示例来源:origin: klinker24/Android-Blur-Launcher
public void run() {
if ((mView.getParent() != null) && mView.hasWindowFocus()
&& !mHasPerformedLongPress) {
boolean handled;
if (mListener != null) {
handled = mListener.onLongClick(mView);
} else {
handled = mView.performLongClick();
}
if (handled) {
mView.setPressed(false);
mHasPerformedLongPress = true;
}
}
}
}
代码示例来源:origin: nenick/espresso-macchiato
private static View getRecentContainer(View[] views) {
View container = null;
long drawingTime = 0;
for (View view : views) {
if (view != null && view.isShown() && view.hasWindowFocus() && view.getDrawingTime() > drawingTime) {
container = view;
drawingTime = view.getDrawingTime();
}
}
return container;
}
代码示例来源:origin: klinker24/launcher3
public void run() {
if ((mView.getParent() != null) && mView.hasWindowFocus()
&& !mHasPerformedLongPress) {
boolean handled;
if (mListener != null) {
handled = mListener.onLongClick(mView);
} else {
handled = mView.performLongClick();
}
if (handled) {
mView.setPressed(false);
mHasPerformedLongPress = true;
}
}
}
}
代码示例来源:origin: com.jayway.android.robotium/robotium-solo
/**
* Returns the most recent view container
*
* @param views the views to check
* @return the most recent view container
*/
private final View getRecentContainer(View[] views) {
View container = null;
long drawingTime = 0;
View view;
for(int i = 0; i < views.length; i++){
view = views[i];
if (view != null && view.isShown() && view.hasWindowFocus() && view.getDrawingTime() > drawingTime) {
container = view;
drawingTime = view.getDrawingTime();
}
}
return container;
}
代码示例来源:origin: Meituan-Dianping/Shield
for (int i = 0; i < topContainer.getChildCount(); i++) {
View child = topContainer.getChildAt(i);
if (child.hasWindowFocus() || child.hasFocus()) {
topFocus = true;
break;
代码示例来源:origin: jbruchanov/AnUitor
data.put("HasWindowFocus", v.hasWindowFocus());
data.put("IsDrawingCacheEnabled", v.isDrawingCacheEnabled());
data.put("IsFocused", v.isFocused());
内容来源于网络,如有侵权,请联系作者删除!