Here are the examples of the java api class com.google.blockly.android.ui.InputView taken from open source projects.
1. BlocklyController#connectAsInput()
Project: blockly-android
File: BlocklyController.java
File: BlocklyController.java
/** * Connect a block or block group to an input on another block and update views as necessary. If * the input was already connected, splice the child block or group in. * * @param parentConn The {@link Connection} on the superior block to connect to. Must be an * input. * @param childConn The {@link Connection} on the inferior block. Must be an output or previous * connection. */ private void connectAsInput(Connection parentConn, Connection childConn) { InputView parentInputView = parentConn.getInputView(); Block child = childConn.getBlock(); BlockGroup childBlockGroup = mHelper.getParentBlockGroup(child); Connection previousTargetConnection = null; if (parentConn.isConnected()) { previousTargetConnection = parentConn.getTargetConnection(); // If there was a shadow block here delete it from the hierarchy and forget about it. if (previousTargetConnection.getBlock().isShadow()) { removeBlockTree(previousTargetConnection.getBlock()); previousTargetConnection = null; } else { // Otherwise just disconnect for now parentConn.disconnect(); if (parentInputView != null) { parentInputView.setConnectedBlockGroup(null); } } } // Connect the new block to its parent. parentConn.connect(childConn); // Try to reconnect the old block at the end. if (previousTargetConnection != null) { Block previousTargetBlock = previousTargetConnection.getBlock(); // Traverse the tree to ensure it doesn't branch. We only reconnect if there's a // single place it could be reconnected to. The previousTarget will replace a shadow if // one was present. Connection lastInputConnection = child.getLastUnconnectedInputConnection(); if (lastInputConnection == null) { // Bump and add back to root. BlockGroup previousTargetGroup = mHelper.getParentBlockGroup(previousTargetBlock); addRootBlock(previousTargetBlock, previousTargetGroup, false); bumpBlock(parentConn, previousTargetConnection); } else { // Connect the previous part connectAsInput(lastInputConnection, previousTargetConnection); } } if (mWorkspaceView != null && parentInputView != null) { if (childBlockGroup == null) { childBlockGroup = mViewFactory.buildBlockGroupTree(child, mWorkspace.getConnectionManager(), mTouchHandler); } parentInputView.setConnectedBlockGroup(childBlockGroup); } }