Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

@chunhtai
Copy link
Contributor

@chunhtai chunhtai commented Mar 7, 2019

This PR is part of the change flutter/flutter#28972

@chunhtai chunhtai requested a review from goderbauer March 7, 2019 01:08
@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and have the pull request author add another comment and the bot will run again. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

1 similar comment
@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and have the pull request author add another comment and the bot will run again. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@googlebot
Copy link

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@googlebot googlebot removed the cla: no label Mar 7, 2019
@googlebot
Copy link

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.


int maskedAction = event.getActionMasked();
int pointerChange = getPointerChangeForAction(event.getActionMasked());
List<PointerAction> requiredActions = new ArrayList<PointerAction>();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I'd rename this. It's unclear what they are required for. Maybe just actions, or actionsForFramework.


// ACTION_HOVER_MOVE always applies to a single pointer only.
addPointerForIndex(event, event.getActionIndex(), pointerChange, 0, packet);
List<PointerAction> requiredActions = expandActions(event, event.getActionIndex(), pointerChange, 0);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here about the name.

pressed = true;
}
}
private class PointerAction {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: add blank line above this line.

private long device;
private double dx;
private double dy;
private boolean pressed;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

call this "down" since that what it is?

this.dy = dy;
}

public boolean isDown() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should pressed just be non-private instead of having this getter and the two setter?

state.setLastLocation(dx, dy);
break;
default:
// unknown action
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably throw or assert?

}

private void addToPacket(MotionEvent event, int pointerIndex, int pointerChange,
int pointerData, ByteBuffer packet) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix the indentation on this line.

}

private void addPointerForIndex(MotionEvent event, int pointerIndex, int pointerChange,
private List<PointerAction> expandActions(MotionEvent event, int pointerIndex, int pointerChange,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you factor out expandActions into its own class (just like it was in the framework in converter.dart) - could you write simple unit tests then where you pass in face MotionEvents and assert that you get the expected List of PointerActions out?

private final int actionType;
private final int batched;

public PointerAction(int pointerIndex, int actionType, int batched) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd maybe call this FrameworkPointerEvent since this is going to be something the framework understands?

return requiredAction;
}

private void addToPacket(MotionEvent event, int pointerIndex, int pointerChange,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be a method on PainterAction that gets passed the packet and adds itself to it?

@cbracken cbracken requested a review from chinmaygarde April 8, 2019 18:12
@cbracken
Copy link
Member

cbracken commented Apr 8, 2019

Same question as with the iOS side of this change: after discussion with @chinmaygarde is the plan to continue with this PR as-is, or should we implement the subset not implemented in the core engine state machine, or close?

@cbracken
Copy link
Member

Closed after talking to @chunhtai

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants