Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import android.util.SparseArray;
import android.view.Display;
import android.view.DisplayCutout;
import android.view.InputDevice;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.PointerIcon;
Expand Down Expand Up @@ -846,6 +847,20 @@ public InputConnection onCreateInputConnection(@NonNull EditorInfo outAttrs) {
return textInputPlugin.createInputConnection(this, keyboardManager, outAttrs);
}

@Override
public PointerIcon onResolvePointerIcon(MotionEvent event, int pointerIndex) {
// TODO(justinmc): Also need to check if over a valid field and if stylus
// input is supported.
// Maybe have to do this in the framework and show a Flutter icon?
final int toolType = event.getToolType(pointerIndex);
if (!event.isFromSource(InputDevice.SOURCE_MOUSE)
&& event.isFromSource(InputDevice.SOURCE_STYLUS)
&& toolType == MotionEvent.TOOL_TYPE_STYLUS) {
return PointerIcon.getSystemIcon(getContext(), PointerIcon.TYPE_HANDWRITING);
}
return super.onResolvePointerIcon(event, pointerIndex);
}

/**
* Allows a {@code View} that is not currently the input connection target to invoke commands on
* the {@link android.view.inputmethod.InputMethodManager}, which is otherwise disallowed.
Expand Down
Loading