New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature - CircularFlow by Rodrigo Dominguez #129
Conversation
All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the ℹ️ Googlers: Go here for more info. |
1 similar comment
All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the ℹ️ Googlers: Go here for more info. |
@googlebot I consent |
All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the ℹ️ Googlers: Go here for more info. |
1 similar comment
All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the ℹ️ Googlers: Go here for more info. |
@googlebot I consent. |
...out/constraintlayout/src/main/java/androidx/constraintlayout/helper/widget/CircularFlow.java
Show resolved
Hide resolved
...out/constraintlayout/src/main/java/androidx/constraintlayout/helper/widget/CircularFlow.java
Show resolved
Hide resolved
/** | ||
* @hide | ||
*/ | ||
protected float[] mAngles = new float[32]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
those added variables should be in CircularFlow, not in ConstraintHelper (mAngles, mRadius, etc.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done ✅
@@ -112,6 +138,12 @@ protected void init(AttributeSet attrs) { | |||
} else if (attr == R.styleable.ConstraintLayout_Layout_constraint_referenced_tags) { | |||
mReferenceTags = a.getString(attr); | |||
setReferenceTags(mReferenceTags); | |||
} else if (attr == R.styleable.ConstraintLayout_Layout_circularflow_angles) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar -- you should add that in CircularFlow
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done ✅
...out/constraintlayout/src/main/java/androidx/constraintlayout/helper/widget/CircularFlow.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good! if you can address the minor comments I added we can submit this. Thanks!
@@ -0,0 +1,252 @@ | |||
/* | |||
* Copyright (C) 2019 The Android Open Source Project |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably want 2021 :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done ✅
...out/constraintlayout/src/main/java/androidx/constraintlayout/helper/widget/CircularFlow.java
Show resolved
Hide resolved
...out/constraintlayout/src/main/java/androidx/constraintlayout/helper/widget/CircularFlow.java
Show resolved
Hide resolved
|| index >= angles.length) { | ||
return angles; | ||
} | ||
float[] anotherArray = new float[32]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
er -- you probably want to size this array according to the current size of the angles array, which technically could be more than 32 no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done ✅
|| index >= radius.length) { | ||
return radius; | ||
} | ||
int[] anotherArray = new int[32]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same comment as above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done ✅
Thanks for your review Nicolas 🚀 |
* | ||
* @param view | ||
*/ | ||
public void removeViewFromCircularFlow(View view){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor nit, but if there's no additional arguments, why not override removeView() ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactor done ✅
CircularFlow
I add a class called CircularFlow which allows us to group views with circular references.
constraint_referenced_ids
: It receives id's of the views that will add the references (Eg."view2, view3, view4,view5,view6"
).circularflow_viewCenter
: It receives the id of the view of the center where the views received in constraint_referenced_ids (Eg."view1"
)circularflow_angles
: Receive the angles that you will assign to each view (Eg."45,90,135,180,225"
)circularflow_radiusInDP
: Receive the radios in DP that you will assign to each view (Eg."90,100,110,120,130"
)How add a view at runtime?
With method
addViewToCircularFlow
you can add new views to CircularFlow.Eg.
Demo add view in emulator
AddViewToCircularFlow.mp4
How remove a view at runtime?
With method
removeViewFromCircularFlow
you can remove a view from CircularFlow.Eg.
Demo remove view in emulator
Demo_removeView.mp4
Demos in AS:
Grabacion.de.pantalla.2021-02-02.a.la.s.16.33.48.mov
Grabacion.de.pantalla.2021-02-02.a.la.s.16.37.50.mov