Skip to content

Commit ac3167d

Browse files
Fix progress bar colors, recipe deletion, maybe crash due to footerview
1 parent 7a7f4cc commit ac3167d

File tree

5 files changed

+23
-11
lines changed

5 files changed

+23
-11
lines changed

AndroidManifest.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<manifest
22
package="com.biermacht.brews"
33
xmlns:android="http://schemas.android.com/apk/res/android"
4-
android:versionCode="29"
5-
android:versionName="1.4.2">
4+
android:versionCode="30"
5+
android:versionName="1.4.3">
66

77
<uses-sdk
88
android:minSdkVersion="15"

src/com/biermacht/brews/database/DatabaseAPI.java

+14-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import com.biermacht.brews.frontend.MainActivity;
88
import com.biermacht.brews.ingredient.Ingredient;
99
import com.biermacht.brews.recipe.MashProfile;
10+
import com.biermacht.brews.recipe.MashStep;
1011
import com.biermacht.brews.recipe.Recipe;
1112
import com.biermacht.brews.utils.Constants;
1213
import com.biermacht.brews.utils.comparators.RecipeComparator;
@@ -68,6 +69,14 @@ public boolean updateIngredient(Ingredient i, long dbid) {
6869

6970
// Deletes the given recipe if it exists in the database.
7071
public boolean deleteRecipe(Recipe r) {
72+
// Delete all ingredients for this recipe.
73+
for (Ingredient i : r.getIngredientList()) {
74+
this.deleteIngredientWithId(i.getId(), i.getDatabaseId());
75+
}
76+
77+
// Delete the MashProfile.
78+
this.deleteMashProfileFromDatabase(r.getMashProfile(), Constants.DATABASE_DEFAULT);
79+
7180
return this.databaseInterface.deleteRecipeIfExists(r.getId());
7281
}
7382

@@ -155,7 +164,10 @@ public ArrayList<MashProfile> getMashProfiles(long dbid) {
155164
}
156165

157166
// Deletes the given mash profile
158-
public boolean deleteMashProfileFromDatabase(long id, long dbid) {
159-
return this.databaseInterface.deleteMashProfile(id, dbid);
167+
public boolean deleteMashProfileFromDatabase(MashProfile p, long dbid) {
168+
for (MashStep s : p.getMashStepList()) {
169+
this.databaseInterface.deleteMashStep(s.getId());
170+
}
171+
return this.databaseInterface.deleteMashProfile(p.getId(), dbid);
160172
}
161173
}

src/com/biermacht/brews/frontend/adapters/DetailArrayAdapter.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ else if (this.isOk) {
140140
}
141141
else {
142142
this.vs.progressBar.getProgressDrawable().setColorFilter(
143-
Color.RED, android.graphics.PorterDuff.Mode.SRC_IN);
143+
color, android.graphics.PorterDuff.Mode.SRC_IN);
144144
}
145145
}
146146

src/com/biermacht/brews/frontend/fragments/DetailsViewFragment.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -208,12 +208,8 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
208208
this.detailList.add(this.eff);
209209
}
210210

211-
// Create a new DetailArrayAdapter and set it on the listView.
212-
this.mAdapter = new DetailArrayAdapter(getActivity(), this.detailList);
213-
this.listView.setAdapter(this.mAdapter);
214-
215211
// Set up the notes footer.
216-
notesFooter = inflater.inflate(R.layout.notes_list_footer, container, false);
212+
notesFooter = inflater.inflate(R.layout.notes_list_footer, null);
217213
TextView notesText = (TextView) notesFooter.findViewById(R.id.notes);
218214
TextView tasteNotesText = (TextView) notesFooter.findViewById(R.id.taste_notes);
219215

@@ -247,6 +243,10 @@ public void onClick(View view) {
247243
startActivity(i); }
248244
});
249245

246+
// Create a new DetailArrayAdapter and set it on the listView.
247+
this.mAdapter = new DetailArrayAdapter(getActivity(), this.detailList);
248+
this.listView.setAdapter(this.mAdapter);
249+
250250
return this.pageView;
251251
}
252252

src/com/biermacht/brews/recipe/MashProfile.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,6 @@ public void save(Context c, long database) {
428428
}
429429

430430
public void delete(Context c, long database) {
431-
new DatabaseAPI(c).deleteMashProfileFromDatabase(this.getId(), database);
431+
new DatabaseAPI(c).deleteMashProfileFromDatabase(this, database);
432432
}
433433
}

0 commit comments

Comments
 (0)