Skip to content

Commit

Permalink
Merge pull request #134 from readium/feature/packageRenditionMetadata
Browse files Browse the repository at this point in the history
Feature/package rendition metadata
  • Loading branch information
danielweck committed Dec 12, 2014
2 parents ba80704 + 2c5a2ce commit 01c94e3
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 12 deletions.
35 changes: 33 additions & 2 deletions Platform/Android/src/org/readium/sdk/android/Package.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ public class Package {
private String authors;
private String modificationDate;
private String pageProgressionDirection;
private String rendition_layout;
private String rendition_flow;
private String rendition_orientation;
private String rendition_spread;
private String smilDataJson;
private List<String> authorList;
private List<String> subjects;
Expand Down Expand Up @@ -161,6 +165,10 @@ private void loadData() {
spineItems = nativeGetSpineItems(__nativePtr);
manifestTable = nativeGetManifestTable(__nativePtr);
smilDataJson = nativeGetSmilDataAsJson(__nativePtr);
rendition_layout = nativeGetProperty(__nativePtr, "layout", "rendition");
rendition_flow = nativeGetProperty(__nativePtr, "flow", "rendition");
rendition_orientation = nativeGetProperty(__nativePtr, "orientation", "rendition");
rendition_spread = nativeGetProperty(__nativePtr, "spread", "rendition");
Log.i(TAG, "package nativePtr: " + __nativePtr);
Log.i(TAG, "title: "+title);
Log.i(TAG, "subtitle: "+subtitle);
Expand All @@ -186,6 +194,10 @@ private void loadData() {
Log.i(TAG, "subjects: "+subjects);
Log.i(TAG, "spineItems: "+spineItems.size());
Log.i(TAG, "manifestTable: "+manifestTable.size());
Log.i(TAG, "rendition_layout: "+rendition_layout);
Log.i(TAG, "rendition_flow: "+rendition_flow);
Log.i(TAG, "rendition_orientation: "+rendition_orientation);
Log.i(TAG, "rendition_spread: "+rendition_spread);
//Log.i(TAG, "smilDataJson: "+ smilDataJson);
}

Expand Down Expand Up @@ -277,6 +289,22 @@ public String getPageProgressionDirection() {
return pageProgressionDirection;
}

public String getRenditionLayout() {
return rendition_layout;
}

public String getRenditionFlow() {
return rendition_flow;
}

public String getRenditionOrientation() {
return rendition_orientation;
}

public String getRenditionSpread() {
return rendition_spread;
}

public List<String> getSubjects() {
return subjects;
}
Expand Down Expand Up @@ -419,8 +447,11 @@ public JSONObject toJSON() {

//EpubServer.HTTP_HOST /// EpubServer.HTTP_PORT
o.put("rootUrlMO", "http://localhost:8080/");

o.put("rendition_layout", nativeGetProperty(__nativePtr, "layout", "rendition"));

o.put("rendition_layout", rendition_layout);
o.put("rendition_flow", rendition_flow);
o.put("rendition_orientation", rendition_orientation);
o.put("rendition_spread", rendition_spread);
JSONArray spineArray = new JSONArray();
for (SpineItem item : spineItems) {
spineArray.put(item.toJSON());
Expand Down
37 changes: 27 additions & 10 deletions Platform/Android/src/org/readium/sdk/android/SpineItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,28 +70,45 @@ public String getPageSpread() {
return pageSpread;
}

public String getRenditionLayout() {
return renditionLayout;
public String getRenditionLayout(Package pack) {
String layout = renditionLayout;
if (pack != null && (layout == null || layout.length() == 0)) {
layout = pack.getRenditionLayout();
}
return layout;
}

public String getRenditionFlow() {
return renditionFlow;
public String getRenditionFlow(Package pack) {
String flow = renditionFlow;
if (pack != null && (flow == null || flow.length() == 0)) {
flow = pack.getRenditionFlow();
}
return flow;
}

public String getRenditionOrientation() {
return renditionOrientation;
public String getRenditionOrientation(Package pack) {
String orientation = renditionOrientation;
if (pack != null && (orientation == null || orientation.length() == 0)) {
orientation = pack.getRenditionOrientation();
}
return orientation;
}

public String getRenditionSpread() {
return renditionSpread;
public String getRenditionSpread(Package pack) {
String spread = renditionSpread;
if (pack != null && (spread == null || spread.length() == 0)) {
spread = pack.getRenditionSpread();
}
return spread;
}

public boolean isLinear() {
return linear;
}

public boolean isFixedLayout() {
return "pre-paginated".equals(renditionLayout);
public boolean isFixedLayout(Package pack) {
String layout = getRenditionLayout(pack);
return "pre-paginated".equals(layout);
}

public JSONObject toJSON() throws JSONException {
Expand Down

0 comments on commit 01c94e3

Please sign in to comment.