Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 22 additions & 4 deletions kegtab/src/main/java/org/kegbot/app/TapStatusFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,8 @@ private void updateTapDetails() {

final TextView title = ButterKnife.findById(mView, R.id.tapTitle);
final TextView subtitle = ButterKnife.findById(mView, R.id.tapSubtitle);
final TextView abvText = ButterKnife.findById(mView, R.id.tapAbv);
final TextView ibuText = ButterKnife.findById(mView, R.id.tapIbu);
final TextView tapNotes = ButterKnife.findById(mView, R.id.tapNotes);
final ViewFlipper flipper = ButterKnife.findById(mView, R.id.tapStatusFlipper);

Expand Down Expand Up @@ -256,6 +258,21 @@ public void onClick(View v) {
description = tap.getDescription();
}

// Find ABV and IBU values
final String abv = String.valueOf(keg.getBeverage().getAbvPercent());
if(keg.getBeverage().getAbvPercent() == 0 && !mCore.getConfiguration().getAbvVisibleWhenZero()) {
abvText.setVisibility(View.GONE);
} else {
abvText.setText(abv + "% ABV");
}

final String ibu = String.valueOf(Math.round(keg.getBeverage().getIbu()));
if(keg.getBeverage().getIbu() == 0 && !mCore.getConfiguration().getIbuVisibleWhenZero()){
ibuText.setVisibility(View.GONE);
} else{
ibuText.setText(ibu + " IBUs");
}

final ImageView tapImage = (ImageView) mView.findViewById(R.id.tapImage);
final ImageView tapIllustration = (ImageView) mView.findViewById(R.id.tapIllustration);

Expand Down Expand Up @@ -291,14 +308,15 @@ public void onClick(View v) {
final Image image = keg.getBeverage().getPicture();
final String imageUrl = image.getUrl();
mImageDownloader.download(imageUrl, tapImage);
} else if (!Strings.isNullOrEmpty(description)) {
tapImage.setVisibility(View.GONE);
}

showIllustration(!keg.getBeverage().hasPicture());

if (!Strings.isNullOrEmpty(description) && mCore.getConfiguration().getDisplayTapNotes()) {
tapNotes.setVisibility(View.VISIBLE);
tapNotes.setText(description);
}

showIllustration(true);

// TODO(mikey): proper units support
// Badge 1: Pints Poured
final BadgeView badge1 = (BadgeView) mView.findViewById(R.id.tapStatsBadge1);
Expand Down
12 changes: 12 additions & 0 deletions kegtab/src/main/java/org/kegbot/app/config/AppConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,18 @@ public boolean getTemperaturesCelsius() {
return getBoolean(ConfigKey.TEMPERATURE_UNITS_CELSIUS);
}

public boolean getAbvVisibleWhenZero() {
return getBoolean(ConfigKey.ABV_DISPLAY_WHEN_ZERO);
}

public boolean getIbuVisibleWhenZero() {
return getBoolean(ConfigKey.IBU_DISPLAY_WHEN_ZERO);
}

public boolean getDisplayTapNotes() {
return getBoolean(ConfigKey.DISPLAY_TAP_NOTES);
}

public boolean stayAwake() {
return getBoolean(ConfigKey.STAY_AWAKE);
}
Expand Down
5 changes: 5 additions & 0 deletions kegtab/src/main/java/org/kegbot/app/config/ConfigKey.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ enum ConfigKey {
VOLUME_UNITS_METRIC(FALSE),
TEMPERATURE_UNITS_CELSIUS(FALSE),

ABV_DISPLAY_WHEN_ZERO(FALSE),
IBU_DISPLAY_WHEN_ZERO(FALSE),

DISPLAY_TAP_NOTES(TRUE),

STAY_AWAKE(TRUE),
KEEP_SCREEN_ON(TRUE),
WAKE_DURING_POUR(FALSE),
Expand Down
8 changes: 4 additions & 4 deletions kegtab/src/main/res/layout/pour_in_progress_activity.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

<!-- Right box: Camera Preview & Controls -->

<LinearLayout
<RelativeLayout
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This change hide the Done Pouring button.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Aligned camera view to bottom but reverted changes to Done Button/Image/Shout text to maintain visibility on smaller tablet screens.

android:id="@+id/pourInProgressRightCol"
android:layout_width="0dip"
android:layout_height="match_parent"
Expand Down Expand Up @@ -115,16 +115,16 @@

</LinearLayout>

</ViewFlipper>

</ViewFlipper>

<fragment
android:id="@+id/camera"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
class="org.kegbot.app.camera.CameraFragment"
tools:layout="@layout/camera_fragment_layout">
</fragment>
</LinearLayout>
</RelativeLayout>

</LinearLayout>
12 changes: 12 additions & 0 deletions kegtab/src/main/res/layout/tap_detail.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,18 @@
android:layout_toRightOf="@+id/tapTitle"
android:layout_alignBaseline="@+id/tapTitle"/>

<TextView
style="@style/beverageDetails"
android:id="@+id/tapAbv"
android:layout_alignParentRight="true"/>

<TextView
style="@style/beverageDetails"
android:id="@+id/tapIbu"
android:layout_alignBaseline="@id/tapTitle"
android:layout_alignParentRight="true"
android:layout_below="@id/tapAbv"/>

<View
android:id="@+id/tap_detail_divider"
android:layout_width="match_parent"
Expand Down
34 changes: 15 additions & 19 deletions kegtab/src/main/res/layout/tap_detail_loaded.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,24 @@
</org.kegbot.app.view.BadgeView>
</LinearLayout>

<TextView
android:id="@+id/tapNotes"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/tapStatsBadges"
android:layout_centerHorizontal="true"
android:textAlignment="center"
android:textColor="#888"
android:textSize="24dp"
android:textStyle="italic"
android:gravity="center_horizontal" />

<ViewFlipper
android:id="@+id/illustrationFlipper"
android:layout_width="fill_parent"
android:layout_below="@id/tapStatsBadges"
android:layout_below="@id/tapNotes"
android:layout_centerHorizontal="true"
android:layout_margin="16dip"
android:layout_margin="5dip"
android:layout_height="fill_parent">

<ImageView
Expand All @@ -72,22 +84,6 @@
android:id="@+id/tapIllustration"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>

</ViewFlipper>

<TextView
android:id="@+id/tapNotes"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:layout_alignParentBottom="true"
android:layout_below="@+id/tapStatsBadges"
android:layout_centerHorizontal="true"
android:layout_margin="16dp"
android:layout_marginTop="5dip"
android:padding="16dp"
android:textAlignment="center"
android:textColor="#888"
android:textSize="24dp"
android:textStyle="italic"/>

</RelativeLayout>
</RelativeLayout>
4 changes: 2 additions & 2 deletions kegtab/src/main/res/values-sw700dp/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,15 @@
</style>

<style name="badgeValue">
<item name="android:textSize">64sp</item>
<item name="android:textSize">50sp</item>
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:textStyle">bold</item>
<item name="android:textIsSelectable">false</item>
</style>

<style name="badgeCaption">
<item name="android:textSize">18sp</item>
<item name="android:textSize">16sp</item>
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:textIsSelectable">false</item>
Expand Down
9 changes: 9 additions & 0 deletions kegtab/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,15 @@
<item name="android:textColor">@color/muted</item>
</style>

<style name="beverageDetails">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:ellipsize">end</item>
<item name="android:singleLine">true</item>
<item name="android:textSize">20sp</item>
<item name="android:textStyle">bold</item>
</style>

<style name="jumboText">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
Expand Down
21 changes: 21 additions & 0 deletions kegtab/src/main/res/xml/settings_kegerator.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,27 @@
android:summaryOn="Kegbot will cycle taps on the main screen when idle"
android:title="Rotate Taps">
</CheckBoxPreference>
<CheckBoxPreference
android:title="Show ABV when zero"
android:key="config:ABV_DISPLAY_WHEN_ZERO"
android:summaryOn="ABV will be displayed even when zero"
android:summaryOff="ABV will not be displayed when zero"
android:defaultValue="false">
</CheckBoxPreference>
<CheckBoxPreference
android:title="Show IBU when zero"
android:key="config:IBU_DISPLAY_WHEN_ZERO"
android:summaryOn="IBU will be displayed even when zero"
android:summaryOff="IBU will not be displayed when zero"
android:defaultValue="false">
</CheckBoxPreference>
<CheckBoxPreference
android:title="Show Tap Notes"
android:key="config:DISPLAY_TAP_NOTES"
android:summaryOn="Tap Notes will be displayed if available"
android:summaryOff="Tap Notes will not be displayed"
android:defaultValue="true">
</CheckBoxPreference>
</PreferenceCategory>
<PreferenceCategory android:title="Advanced">
<CheckBoxPreference
Expand Down