summaryrefslogtreecommitdiff
path: root/android
AgeCommit message (Collapse)Author
2013-01-30Fix Android build after rect/bbox changes.Robin Watts
2013-01-30Eliminate fz_bbox in favor of fz_rect everywhere.Tor Andersson
2013-01-26Android: Fix NullPointerException seen on Google PlayRobin Watts
According to Google Plays automated crash detection, we get a NullPointerException when trying to parse a null string as a Uri. This turns out to be caused by us trying to open a PDF attachment from gmail. This is because MuPDF is invoked with a content:// URL that does not have a file associated with it. Instead we can open that URL as an InputStream. Here we amend MuPDF to spot that case, and to open the InputStream, suck the data into a byteArray, and then to use that to open the file from.
2013-01-25Android: Refine Smart Motion to avoid tiny scrolls at end of pagesRobin Watts
Tor observes that when advancing down a page, it's annoying to have a tiny scroll at the end to expose the last pixel. To avoid this, he suggests making the amount we scroll dynamic; rather than always moving by 90% of the screen height, we allow ourselves to move between 80% and 95% of the screen height if it means that we'll exactly meet the end of the page. This seems to work well.
2013-01-24Android: Smart Motion fix.Robin Watts
Moving backwards from the top of a zoomed out page was taking us back to the top of the previous page, not the bottom. Fixed here. Thanks to Tor for spotting this.
2013-01-24android: Tint the icon in the file picker.Tor Andersson
Use setImageResource instead of setBackgroundResource!
2013-01-24Android: Show path in file picker title.Robin Watts
Also, replace ".." with "[Up one level]".
2013-01-24Android: Implement 'Smart Motion'.Robin Watts
Currently, when the edges of the screen are tapped, we move just enough to bring the next/previous page onto the screen. When we are zoomed out, this is exactly what we want. When we are zoomed in, however, it rarely is, as 1) it doesn't allow for their being more content on the same page that we might want to view, and 2) it doesn't take us the the same region of the next page, but rather to the 'nearest edge' of the next page at the same zoom. This is particularly annoying as if we accidentally hit 'right', we can't then hit 'left' to go back to where we were. Smart Motion is an attempt to more neatly advance/retreat through the document in a logical fashion. When we are asked to 'advance', we try to advance down the page by 90% of the screen height; this will bring the next pageful of information into view, allowing for lines that might have been split over the edge of the screen before. If that would take us past the bottom of the page, we just move to the bottom of the page. If we are already at the bottom of the page, however, we consider advancing to the next 'column' of content on this page (i.e. we look to see if we have another screenful of content to the right of this one). If we do, we move to the top of the same page, at the top. If we don't, we move to the next page. When we move to the next page, we always move to the top, but our X position is chosen to match the first column of text (as calculated from the current screen position) on the next page. We assign the right hand side and bottom edges of the screen to 'advance', and the left and top edges to 'retreat'. Common use cases: * When the screen is zoomed out, left/right act precisely as they always have. * When the screen is zoomed in to avoid the margins of the page, left/right jump to the next/previous pages, with the same zoom, an improvement on the current mechanism. * When the screen is zoomed in to view a portrait file in landscape mode so that a line of text just fills the screen, left/right move nicely down the page a screenful at a time, and advances to do the same on the next page. We had no way of doing this before. * When the page is in 2 (or more) columns, and the user zooms to fit a single column in, advance nicely follows the flow across multiple pages. We had no way to do this before.
2013-01-22Android: Fix clipboard operation on older androids.Robin Watts
ClipboardManager changed its API at Honeycomb, AnimatorInflater only appeared at Honeycomb. Both of these are used by the clipboard code. Add fallback code to work with the older systems on older devices.
2013-01-22Android: Make the 'tap to skip page' regions more smartly sized.Robin Watts
Rather than always using 20% of the screen for the tap region (which can be excessive and confusing on a large tablet), instead try to use just the left/right inch. We do this by reading the dpi of the screen. As (apparently) some devices lie about the dpi of the screen we arrange first to always use at least 100 pixels, and then never to use more than 1/5 of the screen.
2013-01-22Android: Update clipboard icons and resize doc icons.Robin Watts
Update clipboard icons to ones that make the intent clearer (but probably aren't as pretty as I drew them). Resize doc items to be the same width as dir icons so the file list looks nicer.
2013-01-22More work on android bitmap recycling.Robin Watts
After much discussion and investigation, Paul and I have realised that we do in fact (in the current scheme at least) need to hold the existing bitmap in memory while drawing the next one (as the existing bitmap is still in an ImageView and being used for any foreground render requests). As such remove a 'setBm(null)' in drawPage. Also, in the onPostExecute for the patch redraw, we cannot recycle the bitmap in a bitmap holder due to it still potentially being in use. We therefore add a 'drop' method to the BitmapHolder class that sets the reference to null without recycling. This is not ideal, but is better than recycling too early and causing crashes.
2013-01-21Rename app.Robin Watts
Due to a clash on Google Play, we need to rename the apps main class from com.artifex.mupdf to something else. We choose com.artifex.mupdfdemo. Any user of the code in their own app should rename it similarly. To simplify this process we add some macros in the C. Various renames and lots of tedious package name editing is still required in the Java though.
2013-01-21Android: fix crashes due to attempts to draw recycled bitmapsPaul Gardiner
Move BitmapHolder setBm call to the main thread and after the ImageView's setImageBitmap call.
2013-01-21Android: fix intermittent loss of HQ render after searchPaul Gardiner
2013-01-11Bug 693547: Android external hyperlink supportRobin Watts
Paul had written code before to detect clicks on hyperlinks, but we hadn't actually done anything with these clicks once detected. Andre Ferreira supplied a couple of lines of Android magic to form the Intent from the URL and execute it. Incorporate that here. (Andre should have é but this upsets git/my editor, sorry) As part of this patch, we now respond to links at a higher priority than the left/right clicks to flip pages (but only if link following mode is enabled).
2013-01-11Bug 693546: Improve Bitmap recycling in Android app.Robin Watts
Thanks to Andre Ferreira for bringing this up and submitting a patch. (Andre should have &eacute, but this upsets git/my editor, sorry!) Change BitmapHolder handling so that we explicitly recycle bitmaps. Old versions of Android need this to avoid bitmaps 'sticking' in memory, and it doesn't hurt on new versions. Also, explicitly empty the bitmap holder before creating a new bitmap. This avoids us holding more than one copy of the (potentially large) bitmaps.
2013-01-11Android: implement copying of selected text to clipboardPaul Gardiner
2013-01-10Android: implement text selection in separate class for future reusePaul Gardiner
Also invalidate search view on every select box change and avoid creating multiple get-text tasks
2013-01-10Android: add text selectionPaul Gardiner
although not actually do anything with the selection yet
2013-01-10Android: add core method returning the words on a pagePaul Gardiner
2012-12-19Android: maintain the scroll position within the file picker between viewsPaul Gardiner
Also removed the split between onCreate and onResume. No idea why I introduced that in the first place.
2012-12-18Android: avoid null exceptions when visiting protected directoriesPaul Gardiner
2012-12-18Android: add directory navigation to the file pickerPaul Gardiner
2012-12-13Android: add hooks to the app to handle GoToR linksPaul Gardiner
2012-12-05Android: fix opening the wrong document from the file pickerPaul Gardiner
Sort the file list rather than the list adapter, so that the onclick position can validly be used to index the file list
2012-12-05Android: rework link handlingPaul Gardiner
Remove unnecessary hitPageLink method from MuPDFCore and extend the handling of external links to the java classes
2012-12-04Android: allow app to be moved to sd cardPaul Gardiner
2012-11-29Android: sort file names in the file chooserPaul Gardiner
Also remove unnecessary initialisation of the adapter on creation
2012-11-29Fix a couple of leaksPaul Gardiner
2012-11-28Avoid calling interactive functions with a NULL idoc.Robin Watts
This solves the android build SEGVing on xps files such as ECMA-288.xps.
2012-11-28Android: fix null exception when viewing calc.pdfPaul Gardiner
2012-11-28Android: add support for listbox and combobox form fieldsPaul Gardiner
2012-11-28Android: Allow multiple instances of MuPDF to run simultaneously.Robin Watts
Previously, we had assumed that we'd only ever have one MuPDFActivity running at once; this meant that we only had a single MuPDFCore, and that it was safe to hold the native libraries state in global variables. Unfortunately, it seems that if you launch MuPDF from the apps list, and open a file, then return to the home screen using 'Home' rather than 'Back', MuPDF is kept running in the background. Launching a PDF file from a file manager then starts a new MuPDFActivity and things get very confused. The solution implemented here is first to move all the MuPDF global variables into a 'globals' structure, and update the code to use this. Next, we allocate this structure on 'openFile', and free it on 'destroying'. Finally, we return the pointer to this structure as a java long from openFile, and store it in a private data pointer, globals. Each MuPDFCore native method can then retrieve the value of 'globals' and get the global state back. This means that every MuPDFCore native method must now be non-static (except isJavascriptSupported).
2012-11-27android: Use custom styles for widgets.Tor Andersson
2012-11-27android: Re-enable highlight button and use tinting for button states.Tor Andersson
2012-11-27android: Use fullscreen activities for page and outline views.Tor Andersson
2012-11-27android: Update cancel icon to be the same size as the other icons.Tor Andersson
2012-11-27Android: fix accidently swapped title and message in alert dialogPaul Gardiner
2012-11-27Android: implement saving of form dataPaul Gardiner
2012-11-26Move xps_xml.c to base_xml.c in Android makefiles.Robin Watts
Missed from previous commit.
2012-11-22Hardwire AA_BITS to 8 on android build.Robin Watts
2012-11-21Android: Move draw_simple_scale.c back into Core.mkRobin Watts
By manually inserting a literal pool, we can avoid the need to split draw_simple_scale.c out.
2012-11-20Android: fix problem if screen timesout during alert displayPaul Gardiner
2012-11-20Android: remove SafeAsyncTaskPaul Gardiner
No longer needed because apparently the lastest AsyncTask implementation, that we've included from the android source, has an unbounded queue. This wont lead to us doing unbounded renders before the one we actually want because we cancel all but the ones we want.
2012-11-20Android: use AsyncTask from android sourcePaul Gardiner
We need this because only later version of AsyncTask supported executeOnExecutor. We have one task that must not be sequentialised with others, so we need to be able to garantee it gets its own thread
2012-11-20Missed Core2.mk in the profiler commit.Robin Watts
Forgot to add a new file to git.
2012-11-19Enable android profiler build.Robin Watts
Requires android-ndk-profiler to be copied into android and android/jni. Also requires r8c of the NDK.
2012-11-19Android: implement alert dialogPaul Gardiner
2012-11-16Move text searching function into fitz.Tor Andersson