use of android.widget.Checkable in project FastDev4Android by jiangqqlmj.
the class BaseAdapterHelper method setChecked.
/**
* Sets the checked status of a checkable.
* @param viewId The view id.
* @param checked The checked status;
* @return The BaseAdapterHelper for chaining.
*/
public BaseAdapterHelper setChecked(int viewId, boolean checked) {
Checkable view = (Checkable) retrieveView(viewId);
view.setChecked(checked);
return this;
}
use of android.widget.Checkable in project Klyph by jonathangerbaud.
the class AbsHListView method updateOnScreenCheckedViews.
/**
* 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));
} else if (useActivated) {
child.setActivated(mCheckStates.get(position));
}
}
}
use of android.widget.Checkable in project Klyph by jonathangerbaud.
the class FriendPickerAdapter method mergeViewWithData.
@Override
protected void mergeViewWithData(View view, GraphObject data) {
super.mergeViewWithData(view, data);
setData(view, data);
FriendPickerHolder holder = (FriendPickerHolder) getHolder(view);
// holder.getFriendPicture().setImageDrawable(null);
Friend friend = (Friend) data;
holder.getFriendName().setText(friend.getName());
// holder.getCheckbox().setSelected(user.isSelected());
((Checkable) view).setChecked(friend.isSelected());
if (placeHolder == -1)
placeHolder = AttrUtil.getResourceId(getContext(holder.getFriendPicture()), R.attr.squarePlaceHolderIcon);
loadImage(holder.getFriendPicture(), friend.getPic(), placeHolder, data);
}
use of android.widget.Checkable in project baseAdapter by hongyangAndroid.
the class ViewHolder method setChecked.
public ViewHolder setChecked(int viewId, boolean checked) {
Checkable view = (Checkable) getView(viewId);
view.setChecked(checked);
return this;
}
use of android.widget.Checkable in project android_frameworks_base by ParanoidAndroid.
the class BaseAdapter method fillView.
private void fillView(BridgeContext context, View view, AdapterItem item, AdapterItem parentItem) {
if (view instanceof ViewGroup) {
ViewGroup group = (ViewGroup) view;
final int count = group.getChildCount();
for (int i = 0; i < count; i++) {
fillView(context, group.getChildAt(i), item, parentItem);
}
} else {
int id = view.getId();
if (id != 0) {
ResourceReference resolvedRef = context.resolveId(id);
if (resolvedRef != null) {
int fullPosition = item.getFullPosition();
int positionPerType = item.getPositionPerType();
int fullParentPosition = parentItem != null ? parentItem.getFullPosition() : 0;
int parentPositionPerType = parentItem != null ? parentItem.getPositionPerType() : 0;
if (view instanceof TextView) {
TextView tv = (TextView) view;
Object value = mCallback.getAdapterItemValue(mAdapterRef, context.getViewKey(view), item.getDataBindingItem().getViewReference(), fullPosition, positionPerType, fullParentPosition, parentPositionPerType, resolvedRef, ViewAttribute.TEXT, tv.getText().toString());
if (value != null) {
if (value.getClass() != ViewAttribute.TEXT.getAttributeClass()) {
Bridge.getLog().error(LayoutLog.TAG_BROKEN, String.format("Wrong Adapter Item value class for TEXT. Expected String, got %s", value.getClass().getName()), null);
} else {
tv.setText((String) value);
}
}
}
if (view instanceof Checkable) {
Checkable cb = (Checkable) view;
Object value = mCallback.getAdapterItemValue(mAdapterRef, context.getViewKey(view), item.getDataBindingItem().getViewReference(), fullPosition, positionPerType, fullParentPosition, parentPositionPerType, resolvedRef, ViewAttribute.IS_CHECKED, cb.isChecked());
if (value != null) {
if (value.getClass() != ViewAttribute.IS_CHECKED.getAttributeClass()) {
Bridge.getLog().error(LayoutLog.TAG_BROKEN, String.format("Wrong Adapter Item value class for TEXT. Expected Boolean, got %s", value.getClass().getName()), null);
} else {
cb.setChecked((Boolean) value);
}
}
}
if (view instanceof ImageView) {
ImageView iv = (ImageView) view;
Object value = mCallback.getAdapterItemValue(mAdapterRef, context.getViewKey(view), item.getDataBindingItem().getViewReference(), fullPosition, positionPerType, fullParentPosition, parentPositionPerType, resolvedRef, ViewAttribute.SRC, iv.getDrawable());
if (value != null) {
if (value.getClass() != ViewAttribute.SRC.getAttributeClass()) {
Bridge.getLog().error(LayoutLog.TAG_BROKEN, String.format("Wrong Adapter Item value class for TEXT. Expected Boolean, got %s", value.getClass().getName()), null);
} else {
// FIXME
}
}
}
}
}
}
}
Aggregations