Skip to content

Commit

Permalink
A whole lot of mash profile / step fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
caseydavenport committed May 22, 2015
1 parent a8f76fc commit bec8737
Show file tree
Hide file tree
Showing 12 changed files with 223 additions and 112 deletions.
4 changes: 2 additions & 2 deletions AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<manifest package="com.biermacht.brews"
xmlns:android="http://schemas.android.com/apk/res/android"
android:versionCode="6"
android:versionName="1.0.3">
android:versionCode="7"
android:versionName="1.0.4">

<uses-sdk
android:minSdkVersion="15"
Expand Down
25 changes: 18 additions & 7 deletions BACKLOG
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@ be recorded here
//////////////////////////////////////////////
// Issues required for next release. /////////
//////////////////////////////////////////////
* Mash profile sparge type does not save
* Mash profiles have weird default water-to-grain ratio
* Creating a new mash profile
* Commas not supported in Mash Step activities.
* Crash when saving a recipe mash profile to custom when it has been edited but not saved.


//////////////////////////////////////////////
// Backlog ///////////////////////////////////
Expand Down Expand Up @@ -38,13 +34,28 @@ be recorded here
* Handle actually setting the amount of yeast.
* Should consider mash temp in ABV calc.
* Add support for more custom fields to XML import / export.
* Brewer profiles, social features. This is a big task.
* Brewer profiles, social features? This is a big task.
* Support measured gravities < 1
* Can choose where to export recipes.
* Better integration with Dropbox / Google Drive

//////////////////////////////////////////////
// Changelog for release 1.0.1 ///////////////
// Changelog for release 1.0.4 ///////////////
//////////////////////////////////////////////
* Mash profile sparge type does not save.
* Crash when saving a recipe mash profile to custom when it has been edited but not saved.
* Mash profile can mysteriously disappear.
* Auto-calculations not performed when step-type changes.
* Can't manually set mash step amounts.

//////////////////////////////////////////////
// Changelog for release 1.0.3 ///////////////
//////////////////////////////////////////////
* Mash profiles have weird default water-to-grain ratio.
* Commas not supported in Mash Step activities.

//////////////////////////////////////////////
// Changelog for release 1.0.2 ///////////////
//////////////////////////////////////////////
* Fix crashing when trying to add new custom yeast.

Expand Down
4 changes: 2 additions & 2 deletions src/com/biermacht/brews/DragDropList/DragSortListView.java
Original file line number Diff line number Diff line change
Expand Up @@ -2197,8 +2197,8 @@ private void invalidateFloatView() {

/**
* Start a drag of item at <code>position</code> using the registered FloatViewManager. Calls
* through to {@link #startDrag(int, android.view.View, int, int, int)} after obtaining the floating
* View from the FloatViewManager.
* through to {@link #startDrag(int, android.view.View, int, int, int)} after obtaining the
* floating View from the FloatViewManager.
*
* @param position
* Item to drag.
Expand Down
30 changes: 27 additions & 3 deletions src/com/biermacht/brews/frontend/AddMashProfileActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,10 @@ public void onCreate(Bundle savedInstanceState) {
mashStepTitleViewText = (TextView) mashStepTitleView.findViewById(R.id.title);
mashStepTitleViewText.setText("Mash Steps");

// Add mash step button
// Listener for mash step list. When a MashStep is clicked, this listener
// starts the AddMashStepActivity, passing the current Profile / Recipe. The
// AddMashStepActivity will, upon completion, return an updated Recipe object which includes
// the most up-to-date MashProfile and MashStep list (with any new MashStep, if one was created)
addMashStepButton = (ImageButton) mashStepTitleView.findViewById(R.id.button);
addMashStepButton.setOnClickListener(new View.OnClickListener() {
@Override
Expand All @@ -163,7 +166,6 @@ public void onClick(View v) {
mainView.removeView(spinnerView);

// Add views that we want
//mainView.addView(mashTypeSpinner);
mainView.addView(spargeTypeSpinner);
mainView.addView(spargeTempView);
mainView.addView(tunTempView);
Expand All @@ -173,7 +175,10 @@ public void onClick(View v) {
mainView.addView(mashStepTitleView);
mainView.addView(dragDropListView);

// Listener for mash step list
// Listener for mash step list. When a MashStep is clicked, this listener
// starts the EditMashStepActivity, passing the current Profile / Recipe, as well as the
// Mash Step which was clicked. The EditMashStepActivity will, upon completion, return
// an updated Recipe object which includes the most up-to-date MashProfile and MashStep list.
dragDropListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int pos, long id) {
Expand Down Expand Up @@ -217,6 +222,11 @@ else if (v.equals(spargeVolumeView)) {
alert.show();
}

/**
* Creates an Activity-wide callback object which can be called whenever values change which
* require a mash step list update, or require setting values on the active MashProfile
* (mProfile)
*/
public void createCallback() {
callback = new Callback() {
@Override
Expand Down Expand Up @@ -358,6 +368,7 @@ public boolean onOptionsItemSelected(MenuItem item) {

@Override
public void onFinished() {
Log.d("AddMashProfileActivity", "Saving MashProfile");
mProfile.save(Constants.DATABASE_CUSTOM);
finish();
}
Expand All @@ -377,6 +388,7 @@ public void acquireValues() throws Exception {

@Override
public void onCancelPressed() {
Log.d("AddMashProfileActivity", "Cancel Pressed.");
finish();
}

Expand All @@ -385,6 +397,17 @@ public void onDeletePressed() {

}

/**
* Called when the User completes an a call to Add or Edit a MashStep in the list of this
* MashProfile. Upon return, this method will receive an updated MashProfile, or NULL (if the
* user canceled the activity). This method updates the current active MashProfile (mProfile), and
* sets the profile for the active Recipe (mRecipe). Or, if NULL is returned, this method does
* nothing.
*
* @param requestCode
* @param resultCode
* @param data
*/
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
MashProfile p;
Expand Down Expand Up @@ -414,6 +437,7 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {

// Set the new profile.
mProfile = p;
mRecipe.setMashProfile(mProfile);
updateMashStepList();
super.onActivityResult(requestCode, resultCode, data);
}
Expand Down
Loading

0 comments on commit bec8737

Please sign in to comment.