add support for the strip image - we need that as there was one vendor which uses this image to put the barcode in there - not that there is a dedicated field for that ...
This commit is contained in:
parent
c94139bd7c
commit
508d868bfe
5 changed files with 27 additions and 0 deletions
|
@ -50,6 +50,7 @@ public class AppleStylePassReader {
|
|||
pass.setIconBitmapFile(findBitmapFile(path, localized_path, "icon"));
|
||||
pass.setLogoBitmapFile(findBitmapFile(path, localized_path, "logo"));
|
||||
pass.setThumbnailBitmapFile(findBitmapFile(path, localized_path, "thumbnail"));
|
||||
pass.setStripBitmapFile(findBitmapFile(path, localized_path, "strip"));
|
||||
|
||||
final File file = new File(path + "/pass.json");
|
||||
|
||||
|
|
|
@ -56,4 +56,6 @@ public interface Pass extends Serializable {
|
|||
Optional<String> getSource();
|
||||
|
||||
Optional<BarCode> getBarCode();
|
||||
|
||||
Optional<Bitmap> getStripImage();
|
||||
}
|
||||
|
|
|
@ -39,9 +39,11 @@ public class PassImpl implements Pass, Serializable {
|
|||
private Optional<String> iconBitmapFile;
|
||||
private Optional<String> thumbnailBitmapFile;
|
||||
private Optional<String> logoBitmapFile;
|
||||
private Optional<String> stripBitmapFile;
|
||||
|
||||
public static final String[] TYPES = new String[]{"coupon", "eventTicket", "boardingPass", "generic", "storeCard"};
|
||||
|
||||
|
||||
@Override
|
||||
public Optional<String> getOrganisation() {
|
||||
return organisation;
|
||||
|
@ -133,6 +135,10 @@ public class PassImpl implements Pass, Serializable {
|
|||
this.thumbnailBitmapFile = Optional.fromNullable(thumbnailBitmapFile);
|
||||
}
|
||||
|
||||
public void setStripBitmapFile(String stripBitmapFile) {
|
||||
this.stripBitmapFile = Optional.fromNullable(stripBitmapFile);
|
||||
}
|
||||
|
||||
private Optional<Bitmap> getBitmapFromOptionalString(Optional<String> in) {
|
||||
if (in == null || !in.isPresent()) {
|
||||
return Optional.absent();
|
||||
|
@ -149,6 +155,12 @@ public class PassImpl implements Pass, Serializable {
|
|||
return getBitmapFromOptionalString(thumbnailBitmapFile);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Bitmap> getStripImage() {
|
||||
return getBitmapFromOptionalString(stripBitmapFile);
|
||||
}
|
||||
|
||||
|
||||
public Optional<Bitmap> getLogoBitmap() {
|
||||
return getBitmapFromOptionalString(logoBitmapFile);
|
||||
}
|
||||
|
|
|
@ -64,6 +64,9 @@ public class PassViewActivity extends PassViewActivityBase {
|
|||
@InjectView(R.id.thumbnail_img)
|
||||
ImageView thumbnail_img;
|
||||
|
||||
@InjectView(R.id.strip_img)
|
||||
ImageView strip_img;
|
||||
|
||||
@InjectView(R.id.back_fields)
|
||||
TextView back_tv;
|
||||
|
||||
|
@ -133,6 +136,7 @@ public class PassViewActivity extends PassViewActivityBase {
|
|||
logo_img.setBackgroundColor(pass.getBackGroundColor());
|
||||
|
||||
setBitmapSafe(thumbnail_img, pass.getThumbnailImage());
|
||||
setBitmapSafe(strip_img, pass.getStripImage());
|
||||
|
||||
if (findViewById(R.id.map_container) != null) {
|
||||
if (!(pass.getLocations().size() > 0 && PassbookMapsFacade.init(this))) {
|
||||
|
|
|
@ -12,6 +12,14 @@
|
|||
android:contentDescription="@string/logo"
|
||||
android:paddingBottom="10dp" />
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/strip_img"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:paddingBottom="10dp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
Loading…
Reference in a new issue