本文整理汇总了Java中android.view.View.hasFocusable方法的典型用法代码示例。如果您正苦于以下问题:Java View.hasFocusable方法的具体用法?Java View.hasFocusable怎么用?Java View.hasFocusable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.View
的用法示例。
在下文中一共展示了View.hasFocusable方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: layoutChunk
import android.view.View; //导入方法依赖的package包/类
protected void layoutChunk(View view, RecyclerView.LayoutParams params, RecyclerView.Recycler recycler,
RecyclerView.State state, LayoutState layoutState, LayoutChunkResult result) {
layoutChunkAddView(view, recycler, params, layoutState);
/**
* 布局第2步:
* 测量View的大小
* */
measureChildWithMargins(view, 0, 0);
/**mConsumed 保存了view的高度, 用来计算下一个view的位置*/
result.mConsumed = mOrientationHelper.getDecoratedMeasurement(view);
layoutChunkLayoutChild(view, params, layoutState, result);
// Consume the available space if the view is not removed OR changed
if (params.isItemRemoved() || params.isItemChanged()) {
result.mIgnoreConsumed = true;
}
result.mFocusable = view.hasFocusable();
}
示例2: keyPressed
import android.view.View; //导入方法依赖的package包/类
protected void keyPressed() {
if (isEnabled() && isClickable()) {
Drawable selector = this.mSelector;
Rect selectorRect = this.mSelectorRect;
if (selector == null) {
return;
}
if ((isFocused() || touchModeDrawsInPressedState()) && !selectorRect.isEmpty()) {
View v = getChildAt(this.mSelectedPosition - this.mFirstPosition);
if (v != null) {
if (!v.hasFocusable()) {
v.setPressed(true);
} else {
return;
}
}
setPressed(true);
boolean longClickable = isLongClickable();
Drawable d = selector.getCurrent();
if (d != null && (d instanceof TransitionDrawable)) {
if (longClickable) {
((TransitionDrawable) d).startTransition(ViewConfiguration.getLongPressTimeout());
} else {
((TransitionDrawable) d).resetTransition();
}
}
if (longClickable && !this.mDataChanged) {
if (this.mPendingCheckForKeyLongPress == null) {
this.mPendingCheckForKeyLongPress = new CheckForKeyLongPress(this, null);
}
this.mPendingCheckForKeyLongPress.rememberWindowAttachCount();
postDelayed(this.mPendingCheckForKeyLongPress, (long) ViewConfiguration.getLongPressTimeout());
}
}
}
}
示例3: keyPressed
import android.view.View; //导入方法依赖的package包/类
/**
* Sets the selector state to "pressed" and posts a CheckForKeyLongPress to
* see if this is a long press.
*/
protected void keyPressed() {
if (!isEnabled() || !isClickable()) {
return;
}
Drawable selector = mSelector;
Rect selectorRect = mSelectorRect;
if (selector != null && (isFocused() || touchModeDrawsInPressedState())
&& !selectorRect.isEmpty()) {
final View v = getChildAt(mSelectedPosition - mFirstPosition);
if (v != null) {
if (v.hasFocusable())
return;
v.setPressed(true);
}
setPressed(true);
final boolean longClickable = isLongClickable();
Drawable d = selector.getCurrent();
if (d != null && d instanceof TransitionDrawable) {
if (longClickable) {
((TransitionDrawable) d).startTransition(ViewConfiguration
.getLongPressTimeout());
} else {
((TransitionDrawable) d).resetTransition();
}
}
if (longClickable && !mDataChanged) {
if (mPendingCheckForKeyLongPress == null) {
mPendingCheckForKeyLongPress = new CheckForKeyLongPress();
}
mPendingCheckForKeyLongPress.rememberWindowAttachCount();
postDelayed(mPendingCheckForKeyLongPress,
ViewConfiguration.getLongPressTimeout());
}
}
}
示例4: run
import android.view.View; //导入方法依赖的package包/类
public void run() {
if (this.this$0.mTouchMode == 0) {
this.this$0.mTouchMode = 1;
View child = this.this$0.getChildAt(this.this$0.mMotionPosition - this.this$0
.mFirstPosition);
if (child != null && !child.hasFocusable()) {
this.this$0.mLayoutMode = 0;
if (this.this$0.mDataChanged) {
this.this$0.mTouchMode = 2;
return;
}
this.this$0.layoutChildren();
child.setPressed(true);
this.this$0.positionSelector(child);
this.this$0.setPressed(true);
int longPressTimeout = ViewConfiguration.getLongPressTimeout();
boolean longClickable = this.this$0.isLongClickable();
if (this.this$0.mSelector != null) {
Drawable d = this.this$0.mSelector.getCurrent();
if (d != null && (d instanceof TransitionDrawable)) {
if (longClickable) {
((TransitionDrawable) d).startTransition(longPressTimeout);
} else {
((TransitionDrawable) d).resetTransition();
}
}
}
if (!longClickable) {
this.this$0.mTouchMode = 2;
}
}
}
}
示例5: run
import android.view.View; //导入方法依赖的package包/类
public void run() {
if (mTouchMode == TOUCH_MODE_DOWN) {
mTouchMode = TOUCH_MODE_TAP;
final View child = getChildAt(mMotionPosition - mFirstPosition);
if (child != null && !child.hasFocusable()) {
mLayoutMode = LAYOUT_NORMAL;
if (!mDataChanged) {
layoutChildren();
child.setPressed(true);
positionSelector(child);
setPressed(true);
final int longPressTimeout = ViewConfiguration.getLongPressTimeout();
final boolean longClickable = isLongClickable();
if (mSelector != null) {
Drawable d = mSelector.getCurrent();
if (d != null && d instanceof TransitionDrawable) {
if (longClickable) {
((TransitionDrawable) d).startTransition(longPressTimeout);
} else {
((TransitionDrawable) d).resetTransition();
}
}
}
if (longClickable) {
} else {
mTouchMode = TOUCH_MODE_DONE_WAITING;
}
} else {
mTouchMode = TOUCH_MODE_DONE_WAITING;
}
}
}
}
示例6: run
import android.view.View; //导入方法依赖的package包/类
@Override
public void run() {
if (mTouchMode == TOUCH_MODE_DOWN) {
mTouchMode = TOUCH_MODE_TAP;
final View child = getChildAt(mMotionPosition - mFirstPosition);
if (child != null && !child.hasFocusable()) {
mLayoutMode = LAYOUT_NORMAL;
if (!mDataChanged) {
child.setPressed(true);
setPressed(true);
layoutChildren();
positionSelector(mMotionPosition, child);
refreshDrawableState();
final int longPressTimeout = ViewConfiguration
.getLongPressTimeout();
final boolean longClickable = isLongClickable();
if (mSelector != null) {
Drawable d = mSelector.getCurrent();
if (d != null && d instanceof TransitionDrawable) {
if (longClickable) {
((TransitionDrawable) d)
.startTransition(longPressTimeout);
} else {
((TransitionDrawable) d).resetTransition();
}
}
}
if (longClickable) {
if (mPendingCheckForLongPress == null) {
mPendingCheckForLongPress = new CheckForLongPress();
}
mPendingCheckForLongPress
.rememberWindowAttachCount();
postDelayed(mPendingCheckForLongPress,
longPressTimeout);
} else {
mTouchMode = TOUCH_MODE_DONE_WAITING;
}
} else {
mTouchMode = TOUCH_MODE_DONE_WAITING;
}
}
}
}