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

BeerXML Support #20

Merged
merged 17 commits into from
Nov 23, 2014
Merged

BeerXML Support #20

merged 17 commits into from
Nov 23, 2014

Conversation

DougEdey
Copy link
Contributor

This is the first set of commits, I'll be doing some tidying up tonight to sort some things out, but I figured I'd push this so you can take a look first.

  • Add a Quantity class which supports conversion between different weight types
  • Allow Weight to use a string constructor which creates a Quantity class then converts this back to ounces as the Weight default.
  • Add a basic BeerXML parser that uses XPath lookup (there's no DTD for BeerXML that I can find)
    ** Returns an array of recipes
  • Add an "Open" option to the RecipeListFragment that will allow XML files to be selected
    • This will determine that the file is a BeerXML file then opens the BeerXML parser.
    • This allows us to support more filetypes in the future.
  • Add a ParseXML class that has a helper that identifies the recipe type (either via File path or InputStream)
  • If a list of recipes comes back, add them all to the Datastore.
  • if one recipe comes back, show it, otherwise just refresh the list.


double size = Double.parseDouble(sections[0]);
String unit = sections[1];
quantity = new Quantity();
Copy link
Owner

Choose a reason for hiding this comment

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

Can we make 'quantity' a method variable? Otherwise I think GSON will try to serialize the 'quantity' member variable to storage.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I made it into a member variable since it is a more convertable friendly class. I would prefer to use it instead of Weight (or bring the same functionality to Weight) that allows conversions between units (i.e. allows you to convert a value from Ounces to grams or to pounds or whatever you want.

@edrews
Copy link
Owner

edrews commented Nov 22, 2014

Hey, just a couple of comments above. The BeerXML branch looks awesome. I'm ready to merge just this in if that's cool.

@DougEdey
Copy link
Contributor Author

Updated as per the comments. You can merge this whenever you want, I'll add BeerXML export later.

edrews added a commit that referenced this pull request Nov 23, 2014
@edrews edrews merged commit fc84686 into edrews:master Nov 23, 2014
@edrews
Copy link
Owner

edrews commented Nov 23, 2014

I do like the Quanity class better than the Weight class. I have no problem replacing it provided it doesn't break support for already-created recipes.

@DougEdey DougEdey deleted the BeerXML branch November 23, 2014 15:19
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.

2 participants