From 245d497fb08fee0d6d526feb8534005d59bf1b1f Mon Sep 17 00:00:00 2001 From: ligi Date: Sun, 10 Feb 2013 14:15:57 +0100 Subject: [PATCH] support more pass-types --- src/org/ligi/ticketviewer/TicketListActivity.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/org/ligi/ticketviewer/TicketListActivity.java b/src/org/ligi/ticketviewer/TicketListActivity.java index 30f33032..20768e34 100644 --- a/src/org/ligi/ticketviewer/TicketListActivity.java +++ b/src/org/ligi/ticketviewer/TicketListActivity.java @@ -288,8 +288,19 @@ public class TicketListActivity extends SherlockListActivity { JSONObject pass_json = new JSONObject(FileHelper.file2String(new File(mPath + "/pass.json"))); tv.setText(pass_json.getString("description")); String more_str = ""; - if (pass_json.has("eventTicket")) { - JSONObject eventTicket = pass_json.getJSONObject("eventTicket"); + + String ticket_kind = null; + + String[] types = {"coupon", "eventTicket", "boardingPass", "generic", "storeCard"}; + + for (String type : types) { + if (pass_json.has(type)) + ticket_kind = type; + + } + + if (ticket_kind != null) { + JSONObject eventTicket = pass_json.getJSONObject(ticket_kind); if (eventTicket.has("primaryFields")) { JSONArray pri_arr = eventTicket.getJSONArray("primaryFields");