Skip to content

Commit

Permalink
version 1.5 - updated mupdf library to 1.7 which fixes various memory…
Browse files Browse the repository at this point in the history
… leak and crashes
  • Loading branch information
Manoj Kumar committed May 2, 2015
1 parent a67374b commit ff115b7
Show file tree
Hide file tree
Showing 128 changed files with 3,908 additions and 11,565 deletions.
Binary file removed android/dist/com.mykingdom.mupdf-android-1.4.zip
Binary file not shown.
Binary file modified android/dist/mupdf.jar
Binary file not shown.
56 changes: 33 additions & 23 deletions android/example/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,14 @@ if (!file.exists()) {

console.log(">>EXISTS>>>" + file.exists());

var pdfReader = READER_MODULE.createPDFReader({
var processDialog = Ti.UI.Android.createProgressIndicator({
message : 'Searching...',
location : Ti.UI.Android.PROGRESS_INDICATOR_DIALOG,
type : Ti.UI.Android.PROGRESS_INDICATOR_INDETERMINANT,
cancelable : false
});

var pdfReader = READER_MODULE.createView({
file : file
});

Expand Down Expand Up @@ -60,13 +67,17 @@ win.addEventListener("open", function(e) {
});
searchItem.addEventListener("click", function(e) {
var toast = Ti.UI.createNotification({
message : "Search for the keyword 'for' in the entire pdf",
message : "Search for the total occurences of keyword 'for' in the entire pdf. Note : Touch events will be disabled during search",
duration : Ti.UI.NOTIFICATION_DURATION_LONG
});
toast.show();
count = 0;
processDialog.show();
pdfReader.touchEnabled = false;
pdfReader.onSearch(searchResult);
pdfReader.search("for", 0);
//start search from page no. 1.
//third parameter is optional, defaults to false. Disable the rendering of the search. If true the page will be rendered with results highlighted
pdfReader.search("for", 1, false);
});
var previousItem = e.menu.add({
title : "Previous",
Expand All @@ -88,53 +99,52 @@ win.addEventListener("open", function(e) {
});
searchPreviousItem.addEventListener("click", function(e) {
pdfReader.onSearch(logSearch);
pdfReader.search("for", -1);
pdfReader.search("for", pdfReader.getCurrentPage() - 1, true);
});
var searchNextItem = e.menu.add({
title : "Search Next",
showAsAction : Ti.Android.SHOW_AS_ACTION_IF_ROOM
});
searchNextItem.addEventListener("click", function(e) {
pdfReader.onSearch(logSearch);
pdfReader.search("for", 1);
pdfReader.search("for", pdfReader.getCurrentPage() + 1, true);
});
var toggleHightLight = e.menu.add({
title : "Toggle highlight",
showAsAction : Ti.Android.SHOW_AS_ACTION_IF_ROOM
});
toggleHightLight.addEventListener("click", function(e) {
enabled = !enabled;
pdfReader.setHighlightColor( enabled ? "#0000FF" : "transparent");
pdfReader.setHighlightColor( enabled ? "#500000FF" : "transparent");
pdfReader.onSearch(logSearch);
pdfReader.search("for", 0);
//search and render results for the current page
pdfReader.search("for", pdfReader.getCurrentPage(), true);
enabled = !enabled;
});
};
activity.invalidateOptionsMenu();
});

function logSearch(evt) {
console.log(evt);
}

function searchResult(result) {
console.log(result);
if (count == 0 && result.error) {
if (result.code == READER_MODULE.ERROR_TEXT_NOT_FOUND) {
alert("No matches found");
} else if (result.code == READER_MODULE.ERROR_NO_FURTHER_OCCURRENCES_FOUND) {
alert("No more occurrences on the given direction");
}
return;
}
count += result.count;
if (result.success && result.currentPage < pdfReader.getPageCount()) {
pdfReader.search("for", 1);
// search for next page until end of the pdf
pdfReader.search("for", result.currentPage + 1);
} else {
pdfReader.setCurrentPage(1);
alert("Total occurence : " + count);
processDialog.hide();
pdfReader.touchEnabled = true;
if (count == 0) {
alert("No matches found");
} else {
alert("Total occurence : " + count);
}
}
}

function logSearch(evt) {
console.log(evt);
}

Ti.Gesture.addEventListener("orientationchange", function() {
pdfReader.setCurrentPage(pdfReader.getCurrentPage());
});
Expand Down
Binary file modified android/libs/armeabi-v7a/libcom.mykingdom.mupdf.so
Binary file not shown.
Binary file modified android/libs/armeabi-v7a/libmupdf.so
100644 → 100755
Binary file not shown.
Binary file modified android/libs/armeabi/libcom.mykingdom.mupdf.so
Binary file not shown.
Binary file modified android/libs/armeabi/libmupdf.so
100644 → 100755
Binary file not shown.
Binary file modified android/libs/x86/libcom.mykingdom.mupdf.so
Binary file not shown.
Binary file modified android/libs/x86/libmupdf.so
100644 → 100755
Binary file not shown.
2 changes: 1 addition & 1 deletion android/manifest
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# this is your module manifest and used by Titanium
# during compilation, packaging, distribution, etc.
#
version: 1.4
version: 1.5
apiversion: 2
architectures: armeabi armeabi-v7a x86
description: mupdf
Expand Down
20 changes: 0 additions & 20 deletions android/platform/android/res/anim/info.xml

This file was deleted.

20 changes: 20 additions & 0 deletions android/platform/android/res/animator/info.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:ordering="sequentially" >

<objectAnimator
android:propertyName="alpha"
android:valueFrom="0.0"
android:valueTo="1.0"
android:duration="200" />

<objectAnimator
android:propertyName="alpha"
android:valueTo="1.0"
android:duration="800" />

<objectAnimator
android:propertyName="alpha"
android:valueTo="0.0"
android:duration="400" />
</set>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 0 additions & 9 deletions android/platform/android/res/drawable-hdpi/slider.xml

This file was deleted.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 7 additions & 7 deletions android/platform/android/res/drawable/busy.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="12dp" />
<padding android:left="16dp"
android:right="16dp"
android:top="16dp"
android:bottom="16dp" />
<solid android:color="@color/busy_indicator" />
android:shape="rectangle">
<corners android:radius="12dp" />
<padding android:left="16dp"
android:right="16dp"
android:top="16dp"
android:bottom="16dp" />
<solid android:color="@color/busy_indicator" />
</shape>
38 changes: 19 additions & 19 deletions android/platform/android/res/drawable/button.xml
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>

<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<shape>
<solid android:color="@color/button_pressed" />
<padding android:left="8dp" android:top="8dp" android:right="8dp" android:bottom="8dp" />
</shape>
</item>
<item android:state_focused="true">
<shape>
<solid android:color="@color/button_normal" />
<stroke android:width="4dp" android:color="@color/button_pressed" />
<padding android:left="8dp" android:top="8dp" android:right="8dp" android:bottom="8dp" />
</shape>
</item>
<item>
<shape>
<solid android:color="@color/button_normal" />
<padding android:left="8dp" android:top="8dp" android:right="8dp" android:bottom="8dp" />
</shape>
</item>
<item android:state_pressed="true">
<shape>
<solid android:color="@color/button_pressed" />
<padding android:left="8dp" android:top="8dp" android:right="8dp" android:bottom="8dp" />
</shape>
</item>
<item android:state_focused="true">
<shape>
<solid android:color="@color/button_normal" />
<stroke android:width="4dp" android:color="@color/button_pressed" />
<padding android:left="8dp" android:top="8dp" android:right="8dp" android:bottom="8dp" />
</shape>
</item>
<item>
<shape>
<solid android:color="@color/button_normal" />
<padding android:left="8dp" android:top="8dp" android:right="8dp" android:bottom="8dp" />
</shape>
</item>
</selector>
14 changes: 7 additions & 7 deletions android/platform/android/res/drawable/page_num.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<padding android:left="8dp"
android:right="8dp"
android:top="1dp"
android:bottom="2dp" />
<solid android:color="@color/page_indicator" />
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<padding android:left="8dp"
android:right="8dp"
android:top="1dp"
android:bottom="2dp" />
<solid android:color="@color/page_indicator" />
</shape>
66 changes: 33 additions & 33 deletions android/platform/android/res/drawable/search.xml
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>

<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<shape android:shape="rectangle">
<solid android:color="@color/text_pressed" />
<stroke android:width="4dp" android:color="@color/text_border_pressed" />
<padding
android:left="12dp"
android:right="12dp"
android:top="8dp"
android:bottom="8dp" />
</shape>
</item>
<item android:state_focused="true">
<shape>
<solid android:color="@color/text_normal" />
<stroke android:width="4dp" android:color="@color/text_border_focused" />
<padding
android:left="12dp"
android:right="12dp"
android:top="8dp"
android:bottom="8dp" />
</shape>
</item>
<item>
<shape>
<solid android:color="@color/text_normal" />
<stroke android:width="4dp" android:color="@color/text_border_normal" />
<padding
android:left="12dp"
android:right="12dp"
android:top="8dp"
android:bottom="8dp" />
</shape>
</item>
<item android:state_pressed="true">
<shape android:shape="rectangle">
<solid android:color="@color/text_pressed" />
<stroke android:width="4dp" android:color="@color/text_border_pressed" />
<padding
android:left="12dp"
android:right="12dp"
android:top="8dp"
android:bottom="8dp" />
</shape>
</item>
<item android:state_focused="true">
<shape>
<solid android:color="@color/text_normal" />
<stroke android:width="4dp" android:color="@color/text_border_focused" />
<padding
android:left="12dp"
android:right="12dp"
android:top="8dp"
android:bottom="8dp" />
</shape>
</item>
<item>
<shape>
<solid android:color="@color/text_normal" />
<stroke android:width="4dp" android:color="@color/text_border_normal" />
<padding
android:left="12dp"
android:right="12dp"
android:top="8dp"
android:bottom="8dp" />
</shape>
</item>
</selector>
4 changes: 2 additions & 2 deletions android/platform/android/res/drawable/seek_progress.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>

<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="line" >
<stroke android:width="6dp" android:color="@color/seek_progress" />
android:shape="line" >
<stroke android:width="6dp" android:color="@color/seek_progress" />
</shape>
6 changes: 3 additions & 3 deletions android/platform/android/res/drawable/seek_thumb.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>

<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval" >
<size android:width="28dp" android:height="28dp" />
<solid android:color="@color/seek_thumb" />
android:shape="oval" >
<size android:width="28dp" android:height="28dp" />
<solid android:color="@color/seek_thumb" />
</shape>
4 changes: 0 additions & 4 deletions android/platform/android/res/drawable/tiled_background.xml

This file was deleted.

Loading

0 comments on commit ff115b7

Please sign in to comment.