Java 类android.widget.Checkable 实例源码

项目:GitHub    文件:FreeFlowContainer.java   
/**
 * Perform a quick, in-place update of the checked or activated state on all
 * visible item views. This should only be called when a valid choice mode
 * is active.
 */
private void updateOnScreenCheckedViews() {
    Iterator<?> it = frames.entrySet().iterator();
    View child = null;
    while (it.hasNext()) {
        Map.Entry<?, FreeFlowItem> pairs = (Map.Entry<?, FreeFlowItem>) it
                .next();
        child = pairs.getValue().view;
        boolean isChecked = isChecked(pairs.getValue().itemSection,
                pairs.getValue().itemIndex);
        if (child instanceof Checkable) {
            ((Checkable) child).setChecked(isChecked);
        } else {
            child.setActivated(isChecked);
        }
    }
}
项目:PageScrollView    文件:PageScrollTab.java   
protected void setSelectedTab(int position, boolean fromViewPageListener) {
    if (!fromViewPageListener) {
        mCurrentPosition = position;
        mCurrentPositionOffset = 0;
    }
    View v = getVirtualChildAt(position, true);
    if (mPreCheckView == null || mPreCheckView != v) {
        if (mAutoCheckState) {
            if (mPreCheckView instanceof Checkable) {
                ((Checkable) mPreCheckView).setChecked(false);
            }
        }
        mPreCheckView = v;
        if (v instanceof Checkable) {
            ((Checkable) v).setChecked(true);
        }
    }
    invalidate();
}
项目:PageScrollView    文件:PageScrollTab.java   
public boolean setCheckedAtPosition(int pos, boolean checked) {
    if (pos < 0) {
        pos = mCurrentPosition;
    }
    int itemCount = getTabItemCount();
    if (pos >= 0 && pos < itemCount) {
        View v = getVirtualChildAt(pos, true);
        if (v instanceof Checkable) {
            Checkable cv = (Checkable) v;
            if (cv.isChecked() != checked) {
                cv.setChecked(checked);
                return true;
            }
        }
    }
    return false;
}
项目:Swface    文件:AdapterWrapper.java   
@Override
public WrapperView getView(int position, View convertView, ViewGroup parent) {
    WrapperView wv = (convertView == null) ? new WrapperView(mContext) : (WrapperView) convertView;
    View item = mDelegate.getView(position, wv.mItem, parent);
    View header = null;
    if (previousPositionHasSameHeader(position)) {
        recycleHeaderIfExists(wv);
    } else {
        header = configureHeader(wv, position);
    }
    if((item instanceof Checkable) && !(wv instanceof CheckableWrapperView)) {
        // Need to create Checkable subclass of WrapperView for ListView to work correctly
        wv = new CheckableWrapperView(mContext);
    } else if(!(item instanceof Checkable) && (wv instanceof CheckableWrapperView)) {
        wv = new WrapperView(mContext);
    }
    wv.update(item, header, mDivider, mDividerHeight);
    return wv;
}
项目:Hotspot-master-devp    文件:AdapterWrapper.java   
@Override
public WrapperView getView(int position, View convertView, ViewGroup parent) {
    WrapperView wv = (convertView == null) ? new WrapperView(mContext) : (WrapperView) convertView;
    View item = mDelegate.getView(position, wv.mItem, parent);
    View header = null;
    if (previousPositionHasSameHeader(position)) {
        recycleHeaderIfExists(wv);
    } else {
        header = configureHeader(wv, position);
    }
    if((item instanceof Checkable) && !(wv instanceof CheckableWrapperView)) {
        // Need to create Checkable subclass of WrapperView for ListView to work correctly
        wv = new CheckableWrapperView(mContext);
    } else if(!(item instanceof Checkable) && (wv instanceof CheckableWrapperView)) {
        wv = new WrapperView(mContext);
    }
    wv.update(item, header, mDivider, mDividerHeight);
    return wv;
}
项目:letv    文件:AbsHListView.java   
private void updateOnScreenCheckedViews() {
    boolean useActivated;
    int firstPos = this.mFirstPosition;
    int count = getChildCount();
    if (VERSION.SDK_INT >= 11) {
        useActivated = true;
    } else {
        useActivated = false;
    }
    for (int i = 0; i < count; i++) {
        View child = getChildAt(i);
        int position = firstPos + i;
        if (child instanceof Checkable) {
            ((Checkable) child).setChecked(((Boolean) this.mCheckStates.get(position, Boolean.valueOf(false))).booleanValue());
        } else if (useActivated) {
            child.setActivated(((Boolean) this.mCheckStates.get(position, Boolean.valueOf(false))).booleanValue());
        }
    }
}
项目:exciting-app    文件:AbsHListView.java   
/**
 * Perform a quick, in-place update of the checked or activated state on all
 * visible item views. This should only be called when a valid choice mode
 * is active.
 */
private void updateOnScreenCheckedViews() {
    final int firstPos = mFirstPosition;
    final int count = getChildCount();
    final boolean useActivated = android.os.Build.VERSION.SDK_INT >= 11;
    for (int i = 0; i < count; i++) {
        final View child = getChildAt(i);
        final int position = firstPos + i;

        if (child instanceof Checkable) {
            ((Checkable) child).setChecked(mCheckStates
                    .get(position, false));
        } else if (useActivated) {
            child.setActivated(mCheckStates.get(position, false));
        }
    }
}
项目:StickyListHeadersWithRefreshAndLoadMore    文件:AdapterWrapper.java   
@Override
public WrapperView getView(int position, View convertView, ViewGroup parent) {
    WrapperView wv = (convertView == null) ? new WrapperView(mContext) : (WrapperView) convertView;
    View item = mDelegate.getView(position, wv.mItem, parent);
    View header = null;
    if (previousPositionHasSameHeader(position)) {
        recycleHeaderIfExists(wv);
    } else {
        header = configureHeader(wv, position);
    }
    if((item instanceof Checkable) && !(wv instanceof CheckableWrapperView)) {
        // Need to create Checkable subclass of WrapperView for ListView to work correctly
        wv = new CheckableWrapperView(mContext);
    } else if(!(item instanceof Checkable) && (wv instanceof CheckableWrapperView)) {
        wv = new WrapperView(mContext);
    }
    wv.update(item, header, mDivider, mDividerHeight);
    return wv;
}
项目:android-open-project-demo-master    文件:UsersPhotosCursorAdapter.java   
@Override
public void bindView(View view, Context context, Cursor cursor) {
    PhotoItemLayout layout = (PhotoItemLayout) view;
    PhotupImageView iv = layout.getImageView();

    final PhotoUpload upload = MediaStoreCursorHelper.photosCursorToSelection(
            MediaStoreCursorHelper.MEDIA_STORE_CONTENT_URI, cursor);

    if (null != upload) {
        iv.requestThumbnail(upload, true);
        layout.setPhotoSelection(upload);

        if (null != mController) {
            ((Checkable) view).setChecked(mController.isSelected(upload));
        }
    }
}
项目:DE-MVP-Clean    文件:SentenceDetailPageAdapter.java   
@Override
public Object instantiateItem(ViewGroup container, int position) {
    View view = mInflater.inflate(R.layout.sentence_detail, null);
    final Sentence sentence = mSentences.get(position);
    JSONObject content = sentence.getJsonObjectContent();
    final Checkable checkable = (Checkable) view.findViewById(R.id.content);
    checkable.setChecked(sentence.getIsStar());
    final CheckableImageView favoriteBtn = (CheckableImageView) view.findViewById(R.id.favorite);
    favoriteBtn.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            checkable.toggle();
            if (mFavoriteClickListener != null) {
                mFavoriteClickListener.onFavoriteClick(sentence, checkable.isChecked());
            }
        }
    });
    ((TextView) view.findViewById(R.id.day)).setText(sentence.getDateline());
    ((TextView) view.findViewById(R.id.en_content)).setText("  " + sentence.getContent());
    ((TextView) view.findViewById(R.id.cn_content)).setText("  " + content.optString("note"));
    loadImg(sentence, (NetworkImageView) view.findViewById(R.id.image));
    container.addView(view);
    return view;
}
项目:DE-MVP-Clean    文件:SentencesAdapter.java   
@Override
public void onBindViewHolder(final ViewHolder holder, int position) {
    final Sentence sentence = mSentences.get(position);
    holder.mCheckable.setChecked(sentence.getIsStar());
    holder.mIndicatorView.setVisibility(mFocusedSentenceId == sentence.getId() ? View.VISIBLE : View.INVISIBLE);
    holder.mContentTextView.setText(sentence.getContent());
    holder.mDayTextView.setText(sentence.getDateline());
    final Checkable checkable = holder.mCheckable;
    holder.mImageView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            checkable.toggle();
            if (mFavoriteClickListener != null) {
                mFavoriteClickListener.onFavoriteClick(sentence, checkable.isChecked());
            }
        }
    });
    holder.itemView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if (mOnItemClickListener != null) {
                mOnItemClickListener.onSentenceItemClicked(sentence);
            }
        }
    });
}
项目:AyoSunny    文件:AdapterWrapper.java   
@Override
public WrapperView getView(int position, View convertView, ViewGroup parent) {
    WrapperView wv = (convertView == null) ? new WrapperView(mContext) : (WrapperView) convertView;
    View item = mDelegate.getView(position, wv.mItem, parent);
    View header = null;
    if (previousPositionHasSameHeader(position)) {
        recycleHeaderIfExists(wv);
    } else {
        header = configureHeader(wv, position);
    }
    if((item instanceof Checkable) && !(wv instanceof CheckableWrapperView)) {
        // Need to create Checkable subclass of WrapperView for ListView to work correctly
        wv = new CheckableWrapperView(mContext);
    } else if(!(item instanceof Checkable) && (wv instanceof CheckableWrapperView)) {
        wv = new WrapperView(mContext);
    }
    wv.update(item, header, mDivider, mDividerHeight);
    return wv;
}
项目:TheSceneryAlong    文件:AdapterWrapper.java   
@Override
public WrapperView getView(int position, View convertView, ViewGroup parent) {
    WrapperView wv = (convertView == null) ? new WrapperView(mContext) : (WrapperView) convertView;
    View item = mDelegate.getView(position, wv.mItem, parent);
    View header = null;
    if (previousPositionHasSameHeader(position)) {
        recycleHeaderIfExists(wv);
    } else {
        header = configureHeader(wv, position);
    }
    if((item instanceof Checkable) && !(wv instanceof CheckableWrapperView)) {
        // Need to create Checkable subclass of WrapperView for ListView to work correctly
        wv = new CheckableWrapperView(mContext);
    } else if(!(item instanceof Checkable) && (wv instanceof CheckableWrapperView)) {
        wv = new WrapperView(mContext);
    }
    wv.update(item, header, mDivider, mDividerHeight);
    return wv;
}
项目:GitHub    文件:BaseViewHolder.java   
/**
 * Sets the checked status of a checkable.
 *
 * @param viewId  The view id.
 * @param checked The checked status;
 * @return The BaseViewHolder for chaining.
 */
public BaseViewHolder setChecked(@IdRes int viewId, boolean checked) {
    View view = getView(viewId);
    // View unable cast to Checkable
    if (view instanceof Checkable) {
        ((Checkable) view).setChecked(checked);
    }
    return this;
}
项目:GitHub    文件:BaseViewHolder.java   
/**
 * Sets the checked status of a checkable.
 *
 * @param viewId  The view id.
 * @param checked The checked status;
 * @return The BaseViewHolder for chaining.
 */
public BaseViewHolder setChecked(@IdRes int viewId, boolean checked) {
    View view = getView(viewId);
    // View unable cast to Checkable
    if (view instanceof Checkable) {
        ((Checkable) view).setChecked(checked);
    }
    return this;
}
项目:ultrasonic    文件:DragSortItemViewCheckable.java   
@Override
public boolean isChecked() {
    View child = getChildAt(0);
    if (child instanceof Checkable)
        return ((Checkable) child).isChecked();
    else
        return false;
}
项目:ultrasonic    文件:DragSortListView.java   
@Override
public View getView(int position, View convertView, ViewGroup parent) {

    DragSortItemView v;
    View child;
    // Log.d("mobeta",
    // "getView: position="+position+" convertView="+convertView);
    if (convertView != null) {
        v = (DragSortItemView) convertView;
        View oldChild = v.getChildAt(0);

        child = mAdapter.getView(position, oldChild, DragSortListView.this);
        if (child != oldChild) {
            // shouldn't get here if user is reusing convertViews
            // properly
            if (oldChild != null) {
                v.removeViewAt(0);
            }
            v.addView(child);
        }
    } else {
        child = mAdapter.getView(position, null, DragSortListView.this);
        if (child instanceof Checkable) {
            v = new DragSortItemViewCheckable(getContext());
        } else {
            v = new DragSortItemView(getContext());
        }
        v.setLayoutParams(new AbsListView.LayoutParams(
                ViewGroup.LayoutParams.FILL_PARENT,
                ViewGroup.LayoutParams.WRAP_CONTENT));
        v.addView(child);
    }

    // Set the correct item height given drag state; passed
    // View needs to be measured if measurement is required.
    adjustItem(position + getHeaderViewsCount(), v, true);

    return v;
}
项目:yyox    文件:CheckableLinearLayout.java   
@Override
protected void onFinishInflate() {
    super.onFinishInflate();
    int childCount = getChildCount();
    for (int i = 0; i < childCount; i++) {
        View v = getChildAt(i);
        if (v instanceof Checkable) {
            mCheckableSet.add((Checkable) v);
        }
    }
}
项目:yyox    文件:CheckableLinearLayout.java   
@Override
public void setChecked(boolean checked) {
    if (checked == mChecked) {
        return;
    }
    mChecked = checked;
    for (Checkable checkable : mCheckableSet) {
        checkable.setChecked(checked);
    }
    refreshDrawableState();
}
项目:godlibrary    文件:SimpleAdapter.java   
private void bindData(ViewHolder viewHolder, int position, List<? extends Map<String, ?>> mData) {
    Map<String, ?> map = mData.get(position);
    final int count = mTo.length;
    for (int i = 0; i < count; i++) {
        Object v = viewHolder.clientView[i];
        Object data = map.get(mFrom[i]);
        String text = data == null ? "" : data.toString();
        if (text == null) {
            text = "";
        }
        if (v instanceof Checkable) {
            if (data instanceof Boolean) {
                ((Checkable) v).setChecked((Boolean) data);
            } else if (v instanceof TextView) {
                // Note: keep the instanceof TextView check at the bottom of these
                // ifs since a lot of views are TextViews (e.g. CheckBoxes).
                setViewText((TextView) v, text);
            } else {
                throw new IllegalStateException(v.getClass().getName() +
                        " should be bound to a Boolean, not a " +
                        (data == null ? "<unknown type>" : data.getClass()));
            }
        } else if (v instanceof TextView) {
            // Note: keep the instanceof TextView check at the bottom of these
            // ifs since a lot of views are TextViews (e.g. CheckBoxes).
            setViewText((TextView) v, text);
        } else if (v instanceof ImageView) {
            if (data instanceof Integer) {
                setViewImage((ImageView) v, (Integer) data);
            } else {
                setViewImage((ImageView) v, text);
            }
        } else {
            throw new IllegalStateException(v.getClass().getName() + " is not a " +
                    " view that can be bounds by this SimpleAdapter");
        }
    }
}
项目:NoticeDog    文件:DragSortItemViewCheckable.java   
@Override
public boolean isChecked() {
    View child = getChildAt(0);
    if (child instanceof Checkable)
        return ((Checkable) child).isChecked();
    else
        return false;
}
项目:NoticeDog    文件:DragSortListView.java   
@Override
public View getView(int position, View convertView, ViewGroup parent) {

    DragSortItemView v;
    View child;
    // Log.d("mobeta",
    // "getView: position="+position+" convertView="+convertView);
    if (convertView != null) {
        v = (DragSortItemView) convertView;
        View oldChild = v.getChildAt(0);

        child = mAdapter.getView(position, oldChild, DragSortListView.this);
        if (child != oldChild) {
            // shouldn't get here if user is reusing convertViews
            // properly
            if (oldChild != null) {
                v.removeViewAt(0);
            }
            v.addView(child);
        }
    } else {
        child = mAdapter.getView(position, null, DragSortListView.this);
        if (child instanceof Checkable) {
            v = new DragSortItemViewCheckable(getContext());
        } else {
            v = new DragSortItemView(getContext());
        }
        v.setLayoutParams(new LayoutParams(
                ViewGroup.LayoutParams.FILL_PARENT,
                ViewGroup.LayoutParams.WRAP_CONTENT));
        v.addView(child);
    }

    // Set the correct item height given drag state; passed
    // View needs to be measured if measurement is required.
    adjustItem(position + getHeaderViewsCount(), v, true);

    return v;
}
项目:garras    文件:BaseViewHolder.java   
/**
 * Sets the checked status of a checkable.
 *
 * @param viewId  The view id.
 * @param checked The checked status;
 * @return The BaseViewHolder for chaining.
 */
public BaseViewHolder setChecked(@IdRes int viewId, boolean checked) {
    View view = getView(viewId);
    // View unable cast to Checkable
    if (view instanceof Checkable) {
        ((Checkable) view).setChecked(checked);
    }
    return this;
}
项目:SimpleMutiTypeAdapter    文件:BaseViewHolder.java   
/**
 * Sets the checked status of a checkable.
 *
 * @param viewId  The view id.
 * @param checked The checked status;
 * @return The BaseViewHolder for chaining.
 */
public BaseViewHolder setChecked(@IdRes int viewId, boolean checked) {
    View view = getView(viewId);
    // View unable cast to Checkable
    if (view instanceof Checkable) {
        ((Checkable) view).setChecked(checked);
    }
    return this;
}
项目:Udacity_Sunshine    文件:ItemChoiceManager.java   
public void onBindViewHolder(RecyclerView.ViewHolder vh, int position) {
    boolean checked = isItemChecked(position);
    if (vh.itemView instanceof Checkable) {
        ((Checkable) vh.itemView).setChecked(checked);
    }
    ViewCompat.setActivated(vh.itemView, checked);
}
项目:android-radiobutton-extended    文件:MainActivity.java   
@Override
public <V extends View & Checkable> void onCheckedChange(ExampleViewHolder vh, V view, boolean isChecked) {
    if (view.isPressed()) {
        Toast.makeText(
                MainActivity.this,
                String.format(
                        "position=%d; label=%s; isChecked=%b;",
                        vh.getAdapterPosition(),
                        vh.getRadioButton().getText(),
                        isChecked
                ),
                Toast.LENGTH_SHORT
        ).show();
    }
}
项目:android-radiobutton-extended    文件:SecondActivity.java   
@Override
public <V extends View & Checkable> void onCheckedChange(SecondViewHolder holder, V view, boolean isChecked) {
    if (view.isPressed()) {
        Toast.makeText(
                SecondActivity.this,
                String.format(
                        "position=%d; label=%s; isChecked=%b;",
                        holder.getAdapterPosition(),
                        holder.getLabel().getText(),
                        isChecked
                ),
                Toast.LENGTH_SHORT
        ).show();
    }
}
项目:recyclerview-android    文件:ChoiceModeHelper.java   
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void setViewHolderChecked(@NonNull final RecyclerView.ViewHolder viewHolder,
                                  final boolean isChecked) {
    final View itemView = viewHolder.itemView;
    if (isCheckableView(viewHolder)) {
        ((Checkable) itemView).setChecked(isChecked);
    } else if (shouldUseActivated(viewHolder)) {
        itemView.setActivated(isChecked);
    }
}
项目:recyclerview-android    文件:ChoiceModeHelper.java   
private boolean isCheckableView(@NonNull final RecyclerView.ViewHolder viewHolder) {
    final int viewType = viewHolder.getItemViewType();
    if (mCheckableViewTypes.indexOfKey(viewType) >= 0) {
        return mCheckableViewTypes.get(viewType);

    } else {
        final boolean isCheckable = Checkable.class.isInstance(viewHolder.itemView);
        mCheckableViewTypes.put(viewType, isCheckable);
        return isCheckable;
    }
}
项目:chromium-for-android-56-debug-video    文件:BookmarkRecyclerView.java   
@Override
public void onSelectionStateChange(List<BookmarkId> selectedBookmarks) {
    if (!mDelegate.getSelectionDelegate().isSelectionEnabled()) {
        for (int i = 0; i < getLayoutManager().getChildCount(); ++i) {
            View child = getLayoutManager().getChildAt(i);
            if (child instanceof Checkable) ((Checkable) child).setChecked(false);
        }
    }
}
项目:letv    文件:HListView.java   
@TargetApi(11)
private void setupChild(View child, int position, int x, boolean flowDown, int childrenTop, boolean selected, boolean recycled) {
    boolean isSelected = selected && shouldShowSelector();
    boolean updateChildSelected = isSelected != child.isSelected();
    int mode = this.mTouchMode;
    boolean isPressed = mode > 0 && mode < 3 && this.mMotionPosition == position;
    boolean updateChildPressed = isPressed != child.isPressed();
    boolean needToMeasure = !recycled || updateChildSelected || child.isLayoutRequested();
    LayoutParams p = (LayoutParams) child.getLayoutParams();
    if (p == null) {
        p = (LayoutParams) generateDefaultLayoutParams();
    }
    p.viewType = this.mAdapter.getItemViewType(position);
    if ((!recycled || p.forceAdd) && !(p.recycledHeaderFooter && p.viewType == -2)) {
        p.forceAdd = false;
        if (p.viewType == -2) {
            p.recycledHeaderFooter = true;
        }
        addViewInLayout(child, flowDown ? -1 : 0, p, true);
    } else {
        attachViewToParent(child, flowDown ? -1 : 0, p);
    }
    if (updateChildSelected) {
        child.setSelected(isSelected);
    }
    if (updateChildPressed) {
        child.setPressed(isPressed);
    }
    if (!(this.mChoiceMode == 0 || this.mCheckStates == null)) {
        if (child instanceof Checkable) {
            ((Checkable) child).setChecked(((Boolean) this.mCheckStates.get(position, Boolean.valueOf(false))).booleanValue());
        } else if (VERSION.SDK_INT >= 11) {
            child.setActivated(((Boolean) this.mCheckStates.get(position, Boolean.valueOf(false))).booleanValue());
        }
    }
    if (needToMeasure) {
        int childWidthSpec;
        int childHeightSpec = ViewGroup.getChildMeasureSpec(this.mHeightMeasureSpec, this.mListPadding.top + this.mListPadding.bottom, p.height);
        int lpWidth = p.width;
        if (lpWidth > 0) {
            childWidthSpec = MeasureSpec.makeMeasureSpec(lpWidth, 1073741824);
        } else {
            childWidthSpec = MeasureSpec.makeMeasureSpec(0, 0);
        }
        child.measure(childWidthSpec, childHeightSpec);
    } else {
        cleanupLayoutState(child);
    }
    int w = child.getMeasuredWidth();
    int h = child.getMeasuredHeight();
    int childLeft = flowDown ? x : x - w;
    if (needToMeasure) {
        child.layout(childLeft, childrenTop, childLeft + w, childrenTop + h);
    } else {
        child.offsetLeftAndRight(childLeft - child.getLeft());
        child.offsetTopAndBottom(childrenTop - child.getTop());
    }
    if (this.mCachingStarted && !child.isDrawingCacheEnabled()) {
        child.setDrawingCacheEnabled(true);
    }
    if (VERSION.SDK_INT >= 11 && recycled && ((LayoutParams) child.getLayoutParams()).scrappedFromPosition != position) {
        child.jumpDrawablesToCurrentState();
    }
}
项目:MultiSelecter    文件:BaseViewHolder.java   
/**
 * Sets the checked status of a checkable.
 *
 * @param viewId The view id.
 * @param checked The checked status;
 * @return The BaseViewHolder for chaining.
 */
public BaseViewHolder setChecked(@IdRes int viewId, boolean checked) {
    View view = getView(viewId);
    // View unable cast to Checkable
    if (view instanceof Checkable) {
        ((Checkable) view).setChecked(checked);
    }
    return this;
}
项目:aos-Video    文件:TVMenu.java   
public void unCheckAll(){
    for (View v : ti){
        if(v instanceof Checkable){
            ((Checkable)v).setChecked(false);
        }
    }
}
项目:aos-Video    文件:TVMenuItem.java   
@Override
public void setChecked(boolean checked) {
    if(slaveView!=null)
        slaveView.setChecked(checked);
    if(findViewById(R.id.info_text)!=null && findViewById(R.id.info_text) instanceof Checkable)
        ((Checkable)findViewById(R.id.info_text)).setChecked(checked);
}
项目:aos-Video    文件:TVMenuItem.java   
@Override
public void toggle() {

    if(findViewById(R.id.info_text)!=null && findViewById(R.id.info_text) instanceof Checkable){
        setChecked(!((Checkable)(findViewById(R.id.info_text))).isChecked());
    }

}
项目:SimpleDialogFragments    文件:AdvancedAdapter.java   
@Override
public View getView(int position, View convertView, ViewGroup parent) {

    // apply checked state
    if (convertView instanceof Checkable){
        ((Checkable) convertView).setChecked(isItemChecked(position));
        if (mNoAnimations){ // suppresses the check animation when filtering
            convertView.jumpDrawablesToCurrentState();
        }
    }

    return convertView;
}
项目:data-mediator    文件:AndroidBinder.java   
@Override
public Binder<T> bindCheckable(String property, Object view){
    if(!(view instanceof Checkable) || !(view instanceof View)){
        throw new IllegalArgumentException("must be Checkable View");
    }
    bind(property, new CheckableBinderCallback<T>((View) view, getPropertyInterceptor()));
    return this;
}
项目:Advanced_Android_Development_Wear    文件:ItemChoiceManager.java   
public void onBindViewHolder(RecyclerView.ViewHolder vh, int position) {
    boolean checked = isItemChecked(position);
    if (vh.itemView instanceof Checkable) {
        ((Checkable) vh.itemView).setChecked(checked);
    }
    ViewCompat.setActivated(vh.itemView, checked);
}
项目:AnimatorDurationTile    文件:SelectAnimatorDuration.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.select_scale_dialog);
    float scale = AnimatorDurationScaler.getAnimatorScale(getContentResolver());
    ((Checkable) findViewById(getScaleItemId(scale))).setChecked(true);
}
项目:AnimatorDurationTile    文件:SelectAnimatorDuration.java   
private void uncheckAllChildren(@NonNull ViewGroup vg) {
    for (int i = vg.getChildCount() - 1; i >= 0; i--) {
        View child = vg.getChildAt(i);
        if (child instanceof Checkable) {
            ((Checkable) child).setChecked(false);
        }
    }
}