Skip to content
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

Port of Spruce #12

Merged
merged 1 commit into from
Mar 1, 2017
Merged

Port of Spruce #12

merged 1 commit into from
Mar 1, 2017

Conversation

bret-fears
Copy link
Collaborator

@bret-fears bret-fears commented Feb 27, 2017

Port of SortFunction:

  • Create Spruce main class with builder pattern API
  • Add base class for SortFunction to be extended

Refactor:

  • provide a builder pattern that takes a view group with the option of adding a sort function and an animator
  • Add java docs and comments
  • Remove redundant interfaces

@bret-fears bret-fears self-assigned this Feb 27, 2017
Copy link
Collaborator

@evant evant left a comment

Choose a reason for hiding this comment

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

Might be better to come together and whiteboard an api design.

/**
* SpruceView
* <p>
* Copyright (c) 2017 WillowTree, Inc.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should go at top of file. You can create a Copyright Profile in AS to auto-add these.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I was trying to do that under File and Code Templates . I've added a Spruce copyright that now does the right thing. Thanks for calling that out.

* THE SOFTWARE.
**/

public interface SortFunctionImpl {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Don't really get the impl distinction, why not just have the abstract class?

I'm also curious how often this recursive depth param comes up in practice, it will really complicate the implementations.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

My initial thought was to use the Impl as a sort of class schema but I can do without it.

* THE SOFTWARE.
**/

public class SpruceView extends View implements SpruceViewImpl {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we really need to subclass a specific view? That's going to be really hard to do in practice.

Copy link

@tylerjromeo tylerjromeo left a comment

Choose a reason for hiding this comment

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

I think these view could definitely use javadocs and usage examples because I'm having trouble telling from the outside how to use a "SpruceView" or what it is supposed to do

<component name="Encoding">
<file url="PROJECT" charset="UTF-8" />
</component>
</project>

Choose a reason for hiding this comment

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

good to remove this, but is .idea in your gitignore?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

it is in the gitignore as well. not sure how they still ended up getting added


import java.util.List;

public interface SortFunctionImpl {

Choose a reason for hiding this comment

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

the Impl suffix usually implies that this is the implementation in java. If you want this to be the interface I'd use ISortFunction

* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*/

Choose a reason for hiding this comment

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

Isn't this usually in like... a LICENSE.txt instead of every file? If you want to change the LICENSE this is gonna be a HUGE pain

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It is. @jacksontaylor13 has it as headers for his files as well so I was copying him. You're right though, changing many is far more difficult than changing one.

Choose a reason for hiding this comment

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

@tylerjromeo @bret-fears I was told by biz-dev that when releasing this publicly we would need to add the license to the header of each document. This is something that Apple has always done and a lot of open source iOS projects.

public abstract class SortFunction implements SortFunctionImpl {

public List<SpruceTimedView> getTimeOffsets(SpruceView view) {
return getTimeOffsets(view, /*recursiveDepth=*/0);

Choose a reason for hiding this comment

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

cool named param

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I can't take credit for that. I saw @evant doing it before and adopted it since. I think he got it from AOSP


import java.util.List;

public abstract class SortFunction implements SortFunctionImpl {

Choose a reason for hiding this comment

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

Why use an abstract class with no abstract functions?

@bret-fears bret-fears force-pushed the sort-function branch 2 times, most recently from ab4d7d0 to 35f0883 Compare February 28, 2017 20:30
@bret-fears bret-fears changed the title Port of SpruceView and pairing interface Port of SpruceView Feb 28, 2017
@bret-fears bret-fears force-pushed the sort-function branch 3 times, most recently from e338129 to d1f984e Compare March 1, 2017 14:12
@bret-fears
Copy link
Collaborator Author

I git rm --cached -r .idea on the last commit

@bret-fears bret-fears force-pushed the sort-function branch 2 times, most recently from 42db7bf to 9dedc97 Compare March 1, 2017 14:27
* @param timeOffset (long) time offset in milliseconds
* @return List of SpruceTimedView objects that contain the view and it's offset
*/
public abstract List<SpruceTimedView> getTimeOffsets(View view, long timeOffset);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't this take a ViewGroup since it's returning a list of it's children?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, that's a good point.

Port of SortFunction and it's dependency of SpruceView
-Create Spruce main class with build pattern API
-Add base class for SortFunction to be extended

Refactor
- provide a builder pattern that takes a view group with the option of adding a sort function and an animator
- Add java docs and comments
- Remove redundant interfaces
@bret-fears bret-fears changed the title Port of SpruceView Port of Spruce Mar 1, 2017
@bret-fears bret-fears merged commit 52d9625 into develop Mar 1, 2017
@bret-fears bret-fears deleted the sort-function branch March 3, 2017 18:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants