com.google.blockly.android.ui.fieldview.FieldView

Here are the examples of the java api class com.google.blockly.android.ui.fieldview.FieldView taken from open source projects.

1. VerticalBlockViewFactory#buildFieldView()

View license
/** Implements {@link BlockViewFactory#buildFieldView}. */
@Override
protected FieldView buildFieldView(Field field) {
    @Field.FieldType int type = field.getType();
    int layoutResId = getLayoutForField(type);
    FieldView fieldView = null;
    // If we have a layout for this field type load that and return it
    if (layoutResId != 0) {
        fieldView = (FieldView) mLayoutInflater.inflate(layoutResId, null);
        fieldView.setField(field);
    }
    // Field specific configuration can be done here.
    switch(type) {
        case Field.TYPE_COLOR:
            {
                FieldColorView colorView = (FieldColorView) fieldView;
                colorView.setWorkspaceHelper(mHelper);
                break;
            }
        case Field.TYPE_VARIABLE:
            {
                BasicFieldVariableView varView = (BasicFieldVariableView) fieldView;
                varView.setAdapter(getVariableAdapter());
            }
        default:
            if (fieldView == null) {
                fieldView = super.buildFieldView(field);
            }
            break;
    }
    return fieldView;
}