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


Java View.isEnabled方法代码示例

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


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

示例1: findViewAt

import android.view.View; //导入方法依赖的package包/类
@Nullable
private View findViewAt(@NonNull final View view, final float x, final float y) {
    if (!view.isShown() || !view.isEnabled() || !isViewAt(view, x, y)) {
        return null;
    }

    if (view instanceof ViewGroup) {
        final float transformedX = x - view.getLeft() - ViewCompat.getTranslationX(view);
        final float transformedY = y - view.getTop() - ViewCompat.getTranslationY(view);

        final ViewGroup viewGroup = (ViewGroup) view;
        final int childCount = viewGroup.getChildCount();
        for (int i = childCount - 1; i >= 0; i--) {
            final View child = viewGroup.getChildAt(i);
            final View foundView = findViewAt(child, transformedX, transformedY);
            if (foundView != null) {
                return foundView;
            }
        }
    }

    return view;
}
 
开发者ID:GlobusLTD,项目名称:recyclerview-android,代码行数:24,代码来源:ClickableViewFinder.java

示例2: positionSelector

import android.view.View; //导入方法依赖的package包/类
protected void positionSelector(int position, View sel) {
    if (position != -1) {
        this.mSelectorPosition = position;
    }
    Rect selectorRect = this.mSelectorRect;
    selectorRect.set(sel.getLeft(), sel.getTop(), sel.getRight(), sel.getBottom());
    if (sel instanceof SelectionBoundsAdjuster) {
        ((SelectionBoundsAdjuster) sel).adjustListItemSelectionBounds(selectorRect);
    }
    positionSelector(selectorRect.left, selectorRect.top, selectorRect.right, selectorRect.bottom);
    boolean isChildViewEnabled = this.mIsChildViewEnabled;
    if (sel.isEnabled() != isChildViewEnabled) {
        this.mIsChildViewEnabled = !isChildViewEnabled;
        if (getSelectedItemPosition() != -1) {
            refreshDrawableState();
        }
    }
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:19,代码来源:AbsHListView.java

示例3: findClickableViewInChild

import android.view.View; //导入方法依赖的package包/类
private boolean findClickableViewInChild(View view, int x, int y) {
    if (view instanceof ViewGroup) {
        ViewGroup viewGroup = (ViewGroup) view;
        for (int i = 0; i < viewGroup.getChildCount(); i++) {
            View child = viewGroup.getChildAt(i);
            final Rect rect = new Rect();
            child.getHitRect(rect);

            final boolean contains = rect.contains(x, y);
            if (contains) {
                return findClickableViewInChild(child, x - rect.left, y - rect.top);
            }
        }
    } else if (view != childView) {
        return (view.isEnabled() && (view.isClickable() || view.isLongClickable() || view.isFocusableInTouchMode()));
    }

    return view.isFocusableInTouchMode();
}
 
开发者ID:yangchong211,项目名称:YCUtils,代码行数:20,代码来源:MaterialRippleLayout.java

示例4: positionSelector

import android.view.View; //导入方法依赖的package包/类
protected void positionSelector(int position, View sel) {
	if (position != INVALID_POSITION) {
		mSelectorPosition = position;
	}

	final Rect selectorRect = mSelectorRect;
	selectorRect.set(sel.getLeft(), sel.getTop(), sel.getRight(),
			sel.getBottom());
	if (sel instanceof SelectionBoundsAdjuster) {
		((SelectionBoundsAdjuster) sel)
				.adjustListItemSelectionBounds(selectorRect);
	}
	positionSelector(selectorRect.left, selectorRect.top,
			selectorRect.right, selectorRect.bottom);

	final boolean isChildViewEnabled = mIsChildViewEnabled;
	if (sel.isEnabled() != isChildViewEnabled) {
		mIsChildViewEnabled = !isChildViewEnabled;
		if (getSelectedItemPosition() != INVALID_POSITION) {
			refreshDrawableState();
		}
	}
}
 
开发者ID:junchenChow,项目名称:exciting-app,代码行数:24,代码来源:AbsHListView.java

示例5: positionSelectorCompat

import android.view.View; //导入方法依赖的package包/类
protected void positionSelectorCompat(int position, View sel) {
    Rect selectorRect = this.mSelectorRect;
    selectorRect.set(sel.getLeft(), sel.getTop(), sel.getRight(), sel.getBottom());
    selectorRect.left -= this.mSelectionLeftPadding;
    selectorRect.top -= this.mSelectionTopPadding;
    selectorRect.right += this.mSelectionRightPadding;
    selectorRect.bottom += this.mSelectionBottomPadding;
    try {
        boolean isChildViewEnabled = this.mIsChildViewEnabled.getBoolean(this);
        if (sel.isEnabled() != isChildViewEnabled) {
            this.mIsChildViewEnabled.set(this, Boolean.valueOf(!isChildViewEnabled));
            if (position != -1) {
                refreshDrawableState();
            }
        }
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:20,代码来源:ListViewCompat.java

示例6: setEnabledRecursive

import android.view.View; //导入方法依赖的package包/类
private void setEnabledRecursive(View v, boolean enabled) {
	if (v == null)
		return;
	if (v.isEnabled() == enabled)
		return;
	v.setEnabled(enabled);

	if (v instanceof ViewGroup) {
		final ViewGroup vg = (ViewGroup) v;
		for (int i = vg.getChildCount() - 1; i >= 0; i--) {
			setEnabledRecursive(vg.getChildAt(i), enabled);
		}
	}
}
 
开发者ID:medalionk,项目名称:simple-share-android,代码行数:15,代码来源:DirectoryFragment.java

示例7: onItemClick

import android.view.View; //导入方法依赖的package包/类
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    if (!view.isEnabled()) {
        return;
    }
    mSelectedFolder = mListItems.get(position).mUri;
    loadFolder(mSelectedFolder);
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:9,代码来源:FolderPicker.java

示例8: positionSelector

import android.view.View; //导入方法依赖的package包/类
void positionSelector(View sel) {
    final Rect selectorRect = mSelectorRect;
    selectorRect.set(sel.getLeft(), sel.getTop(), sel.getRight(), sel.getBottom());
    positionSelector(selectorRect.left, selectorRect.top, selectorRect.right,
            selectorRect.bottom);

    final boolean isChildViewEnabled = mIsChildViewEnabled;
    if (sel.isEnabled() != isChildViewEnabled) {
        mIsChildViewEnabled = !isChildViewEnabled;
        refreshDrawableState();
    }
}
 
开发者ID:Shmilyz,项目名称:Swap,代码行数:13,代码来源:PLA_AbsListView.java

示例9: positionSelector

import android.view.View; //导入方法依赖的package包/类
void positionSelector(View sel) {
    Rect selectorRect = this.mSelectorRect;
    selectorRect.set(sel.getLeft(), sel.getTop(), sel.getRight(), sel.getBottom());
    positionSelector(selectorRect.left, selectorRect.top, selectorRect.right, selectorRect
            .bottom);
    boolean isChildViewEnabled = this.mIsChildViewEnabled;
    if (sel.isEnabled() != isChildViewEnabled) {
        this.mIsChildViewEnabled = !isChildViewEnabled;
        refreshDrawableState();
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:12,代码来源:PLA_AbsListView.java

示例10: updateViewColor

import android.view.View; //导入方法依赖的package包/类
private void updateViewColor(View v)
{
    final int attrId = v.isEnabled() ? R.attr.colorDialogContent : R.attr.colorDialogDisabledElement;
    if (v instanceof ImageButton)
    {
        ViewUtils.setImageButtonColorAttr(getContext(), (ImageButton) v, attrId);
    }
    else if (v instanceof TextView)
    {
        final TextView b = (TextView) v;
        b.setTextColor(CompatUtils.getThemeColorAttr(getContext(), attrId));
    }
}
 
开发者ID:mkulesh,项目名称:microMathematics,代码行数:14,代码来源:HorizontalNumberPicker.java

示例11: onLongPress

import android.view.View; //导入方法依赖的package包/类
private void onLongPress() {
    clearCallbacks();
    View src = this.mSrc;
    if (src.isEnabled() && !src.isLongClickable() && onForwardingStarted()) {
        src.getParent().requestDisallowInterceptTouchEvent(true);
        long now = SystemClock.uptimeMillis();
        MotionEvent e = MotionEvent.obtain(now, now, 3, 0.0f, 0.0f, 0);
        src.onTouchEvent(e);
        e.recycle();
        this.mForwarding = true;
        this.mWasLongPress = true;
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:14,代码来源:ListPopupWindow.java

示例12: get

import android.view.View; //导入方法依赖的package包/类
@Override public Boolean get(View view) {
  return view.isEnabled();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:4,代码来源:ButterKnifeTest.java

示例13: findTouchTargetViewWithPointerEvents

import android.view.View; //导入方法依赖的package包/类
/**
 * Returns the touch target View of the event given, or null if neither the given View nor any of
 * its descendants are the touch target.
 */
private static @Nullable View findTouchTargetViewWithPointerEvents(
    float eventCoords[], View view) {
  PointerEvents pointerEvents = view instanceof ReactPointerEventsView ?
      ((ReactPointerEventsView) view).getPointerEvents() : PointerEvents.AUTO;

  // Views that are disabled should never be the target of pointer events. However, their children
  // can be because some views (SwipeRefreshLayout) use enabled but still have children that can
  // be valid targets.
  if (!view.isEnabled()) {
    if (pointerEvents == PointerEvents.AUTO) {
      pointerEvents = PointerEvents.BOX_NONE;
    } else if (pointerEvents == PointerEvents.BOX_ONLY) {
      pointerEvents = PointerEvents.NONE;
    }
  }

  if (pointerEvents == PointerEvents.NONE) {
    // This view and its children can't be the target
    return null;

  } else if (pointerEvents == PointerEvents.BOX_ONLY) {
    // This view is the target, its children don't matter
    return view;

  } else if (pointerEvents == PointerEvents.BOX_NONE) {
    // This view can't be the target, but its children might.
    if (view instanceof ViewGroup) {
      View targetView = findTouchTargetView(eventCoords, (ViewGroup) view);
      if (targetView != view) {
        return targetView;
      }

      // PointerEvents.BOX_NONE means that this react element cannot receive pointer events.
      // However, there might be virtual children that can receive pointer events, in which case
      // we still want to return this View and dispatch a pointer event to the virtual element.
      // Note that this currently only applies to Nodes/FlatViewGroup as it's the only class that
      // is both a ViewGroup and ReactCompoundView (ReactTextView is a ReactCompoundView but not a
      // ViewGroup).
      if (view instanceof ReactCompoundView) {
        int reactTag = ((ReactCompoundView)view).reactTagForTouch(eventCoords[0], eventCoords[1]);
        if (reactTag != view.getId()) {
          // make sure we exclude the View itself because of the PointerEvents.BOX_NONE
          return view;
        }
      }
    }
    return null;

  } else if (pointerEvents == PointerEvents.AUTO) {
    // Either this view or one of its children is the target
    if (view instanceof ReactCompoundViewGroup) {
      if (((ReactCompoundViewGroup) view).interceptsTouchEvent(eventCoords[0], eventCoords[1])) {
        return view;
      }
    }
    if (view instanceof ViewGroup) {
      return findTouchTargetView(eventCoords, (ViewGroup) view);
    }
    return view;

  } else {
    throw new JSApplicationIllegalArgumentException(
        "Unknown pointer event type: " + pointerEvents.toString());
  }
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:70,代码来源:TouchTargetHelper.java

示例14: onSingleTapUp

import android.view.View; //导入方法依赖的package包/类
@Override
                public boolean onSingleTapUp(MotionEvent e) {
                        if (mPressedView != null) {
                                if (mRecyclerView.getScrollState() != RecyclerView.SCROLL_STATE_IDLE) {
//                                        正在滚动中,不处理
                                        return false;
                                }
                                LogUtil.e("onSingleTapUp1");
                                BaseWrappedViewHolder baseWrappedViewHolder = (BaseWrappedViewHolder) mRecyclerView.getChildViewHolder(mPressedView);
//                                头部和底部view不处理
                                if (baseWrappedViewHolder != null) {
                                        LogUtil.e("baseWrappedViewHolder");
                                        if (isHeaderViewOrFooterView(baseWrappedViewHolder.getItemViewType())) {
                                                LogUtil.e("isHeaderViewOrFooterView");
                                                return false;
                                        }
//                                        获取设置点击事件的item_view的id;
                                        Set<Integer> ids = baseWrappedViewHolder.getClickableItemIds();
                                        Set<Integer> nestIds = baseWrappedViewHolder.getNestIds();
                                        LogUtil.e("nestIds");
                                        if (ids != null && ids.size() > 0) {
                                                LogUtil.e("ids.size()");
                                                for (Integer id :
                                                        ids) {
                                                        final View childView = mPressedView.findViewById(id);
                                                        if (childView != null&&childView.getVisibility()==View.VISIBLE) {

//                                                                判断点击位置是否在该view上和该view是否可点击
                                                                if (isOnRange(e, childView) && childView.isEnabled()) {
//                                                                        这里要排除掉嵌套的recyclerView的点击事件
                                                                        if (nestIds != null && nestIds.contains(id)) {
                                                                                LogUtil.e("nestIds");
                                                                                return false;
                                                                        }
//                                                                        设置item的热点
                                                                        setChildHotSpot(childView, e);
                                                                        childView.setPressed(true);
//                                                                        点击接口
                                                                        LogUtil.e("触发item_child点击");
                                                                        onItemChildClick(baseWrappedViewHolder, id, childView, baseWrappedViewHolder.getAdapterPosition() - mBaseWrappedAdapter.getHeaderViewCount());
//                                                                        恢复效果,提交,防止堵塞
                                                                        resetView(childView);
                                                                        return true;
                                                                } else {
                                                                        LogUtil.e("isEnabled" + childView.isEnabled());
                                                                }
                                                        }
                                                }
                                        }
                                        //                                        如果执行到这里,证明没有设置点击事件,所以设置itemView的点击事件
                                        setChildHotSpot(mPressedView, e);
                                        mPressedView.setPressed(true);
                                        onItemClick(baseWrappedViewHolder, baseWrappedViewHolder.itemView.getId(), mPressedView, baseWrappedViewHolder.getAdapterPosition() - mBaseWrappedAdapter.getHeaderViewCount());
                                        resetView(mPressedView);
                                }

                        }
                        return false;
                }
 
开发者ID:HelloChenJinJun,项目名称:TestChat,代码行数:60,代码来源:BaseItemClickListener.java

示例15: onLongPress

import android.view.View; //导入方法依赖的package包/类
@Override
                public void onLongPress(MotionEvent e) {
                        if (mPressedView != null) {
                                if (mRecyclerView.getScrollState() != RecyclerView.SCROLL_STATE_IDLE) {
                                        return;
                                }
                                mPressedView.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
                                BaseWrappedViewHolder baseWrappedViewHolder = (BaseWrappedViewHolder) mRecyclerView.getChildViewHolder(mPressedView);
                                if (baseWrappedViewHolder != null) {
                                        boolean isLongClickConsume = false;
                                        if (isHeaderViewOrFooterView(baseWrappedViewHolder.getItemViewType())) {
                                                isLongClickConsume = true;
                                        }
                                        Set<Integer> ids = baseWrappedViewHolder.getLongClickableItemIds();
                                        Set<Integer> nestIds = baseWrappedViewHolder.getNestIds();
                                        if (ids != null && ids.size() > 0) {
                                                for (Integer id :
                                                        ids) {
                                                        final View childView = mPressedView.findViewById(id);
                                                        if (childView != null) {
//                                                                判断点击位置是否在该view上和该view是否可点击
                                                                if (isOnRange(e, childView) && childView.isEnabled()) {
//                                                                        这里要排除掉嵌套的recyclerView的点击事件
                                                                        if (nestIds != null && nestIds.contains(id)) {
                                                                                break;
                                                                        }
//                                                                        设置item的热点
                                                                        setChildHotSpot(childView, e);
                                                                        childView.setPressed(true);
//                                                                        点击接口
                                                                        onItemChildLongClick(baseWrappedViewHolder, id, childView, baseWrappedViewHolder.getAdapterPosition() - mBaseWrappedAdapter.getHeaderViewCount());
//                                                                        恢复效果,提交,防止堵塞
                                                                        isLongClickConsume = true;
                                                                        isPressing = true;
                                                                        break;
                                                                }
                                                        }
                                                }
                                        }
                                        if (!isLongClickConsume) {
                                                setChildHotSpot(mPressedView, e);
                                                mPressedView.setPressed(true);
                                                onItemLongClick(baseWrappedViewHolder, mPressedView, baseWrappedViewHolder.getAdapterPosition() - mBaseWrappedAdapter.getHeaderViewCount());
                                                isPressing = true;
                                        }
                                }
                        }
                }
 
开发者ID:HelloChenJinJun,项目名称:TestChat,代码行数:49,代码来源:BaseItemClickListener.java


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