diff --git a/src/androidTest/java/org/ligi/passandroid/TheFullscreenBarcodeActivity.java b/src/androidTest/java/org/ligi/passandroid/TheFullscreenBarcodeActivity.java index dbe09ceb..7ee53090 100644 --- a/src/androidTest/java/org/ligi/passandroid/TheFullscreenBarcodeActivity.java +++ b/src/androidTest/java/org/ligi/passandroid/TheFullscreenBarcodeActivity.java @@ -75,9 +75,9 @@ public class TheFullscreenBarcodeActivity extends BaseIntegration { getActivity(); onView(withId(R.id.barcode_img)).perform(click()); - onView(withId(R.id.fullscreen_image)).check(matches(isDisplayed())); + onView(withId(R.id.fullscreen_barcode)).check(matches(isDisplayed())); } diff --git a/src/main/java/org/ligi/passandroid/ui/FullscreenBarcodeActivity.java b/src/main/java/org/ligi/passandroid/ui/FullscreenBarcodeActivity.java index 0494006a..b7160826 100644 --- a/src/main/java/org/ligi/passandroid/ui/FullscreenBarcodeActivity.java +++ b/src/main/java/org/ligi/passandroid/ui/FullscreenBarcodeActivity.java @@ -4,31 +4,51 @@ import android.content.pm.ActivityInfo; import android.content.res.Configuration; import android.os.Bundle; import android.view.Menu; +import android.view.View; import android.view.WindowManager; import android.widget.ImageView; +import android.widget.TextView; import com.google.zxing.BarcodeFormat; import org.ligi.axt.AXT; import org.ligi.passandroid.R; -import static butterknife.ButterKnife.findById; +import butterknife.ButterKnife; +import butterknife.InjectView; public class FullscreenBarcodeActivity extends PassViewActivityBase { + @InjectView(R.id.fullscreen_barcode) + ImageView barcodeImageView; + + @InjectView(R.id.alternativeBarcodeText) + TextView alternativeBarcodeText; + + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (optionalPass.isPresent()) { setContentView(R.layout.fullscreen_image); - final ImageView iv = findById(this, R.id.fullscreen_image); - int smallestSize = AXT.at(getWindowManager()).getSmallestSide(); + ButterKnife.inject(this); + + final int smallestSize = AXT.at(getWindowManager()).getSmallestSide(); setBestFittingOrientationForBarCode(); - iv.setImageBitmap(optionalPass.get().getBarCode().get().getBitmap(smallestSize)); + barcodeImageView.setImageBitmap(optionalPass.get().getBarCode().get().getBitmap(smallestSize)); + + if (optionalPass.get().getBarCode().get().getAlternativeText().isPresent()) { + alternativeBarcodeText.setVisibility(View.VISIBLE); + alternativeBarcodeText.setText(optionalPass.get().getBarCode().get().getAlternativeText().get()); + } else { + alternativeBarcodeText.setVisibility(View.GONE); + } + } else { + finish(); // this should never happen, but better safe than sorry } } diff --git a/src/main/res/layout/fullscreen_image.xml b/src/main/res/layout/fullscreen_image.xml index b274feb3..dfac58fe 100644 --- a/src/main/res/layout/fullscreen_image.xml +++ b/src/main/res/layout/fullscreen_image.xml @@ -1,9 +1,21 @@ + - + android:layout_height="0dip" + android:layout_weight="1" + android:background="@android:color/white" /> + + + +