Skip to content

Commit 2bdc1a3

Browse files
committed
This is Customized Embeded PDF viewr for android.
Signed-off-by: diamond94618 <[email protected]>
0 parents  commit 2bdc1a3

File tree

877 files changed

+68220
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

877 files changed

+68220
-0
lines changed

.classpath

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="src" path="src"/>
4+
<classpathentry kind="src" path="gen"/>
5+
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
6+
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
7+
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
8+
<classpathentry kind="lib" path="libs/sun.misc.jar"/>
9+
<classpathentry kind="output" path="bin/classes"/>
10+
</classpath>

.project

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>MyReader</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
<buildCommand>
14+
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
15+
<arguments>
16+
</arguments>
17+
</buildCommand>
18+
<buildCommand>
19+
<name>org.eclipse.jdt.core.javabuilder</name>
20+
<arguments>
21+
</arguments>
22+
</buildCommand>
23+
<buildCommand>
24+
<name>com.android.ide.eclipse.adt.ApkBuilder</name>
25+
<arguments>
26+
</arguments>
27+
</buildCommand>
28+
</buildSpec>
29+
<natures>
30+
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
31+
<nature>org.eclipse.jdt.core.javanature</nature>
32+
</natures>
33+
</projectDescription>

.settings/org.eclipse.jdt.core.prefs

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
eclipse.preferences.version=1
2+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
3+
org.eclipse.jdt.core.compiler.compliance=1.6
4+
org.eclipse.jdt.core.compiler.source=1.6

AndroidManifest.xml

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="com.artifex.mupdfdemo">
4+
<supports-screens
5+
android:smallScreens="true"
6+
android:normalScreens="true"
7+
android:largeScreens="true"
8+
android:anyDensity="true" />
9+
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="16"/>
10+
<application
11+
android:label="@string/app_name"
12+
android:icon="@drawable/icon"
13+
android:hardwareAccelerated="true">
14+
<activity
15+
android:name="MuPDFActivity"
16+
android:theme="@style/AppBaseTheme"
17+
android:label="@string/app_name">
18+
<intent-filter>
19+
<action android:name="android.intent.action.MAIN"/>
20+
<category android:name="android.intent.category.LAUNCHER"/>
21+
</intent-filter>
22+
</activity>
23+
<activity android:name="DataListActivity"></activity>
24+
<activity android:name="DataDelActivity"></activity>
25+
<activity android:name="ChapterActivity"></activity>
26+
</application>
27+
</manifest>

ClassStructure.txt

+187
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,187 @@
1+
MuPDFActivity
2+
~~~~~~~~~~~~~
3+
4+
MuPDFActivity is the main activity used when displaying and interacting with a
5+
document. This class is responsible for creating the view hierarchy and the
6+
menus.
7+
8+
9+
Main view classes
10+
~~~~~~~~~~~~~~~~~
11+
12+
ReaderView
13+
~~~~~~~~~~
14+
MuPDF uses Android's standard Adapter/AdapterView paradigm, where a subclass of
15+
BaseAdapter supplies multiple views that have their motion on screen
16+
choreographed by a subclass of AdapterView. There are several standard
17+
AdapterView subclasses, but none support zooming into a specific subview and
18+
then panning within it, so MuPDF has its own AdapterView subclass, namely
19+
ReaderView. The class is intended to be general purpose and usable within any
20+
document-viewing application. During page viewing, ReaderView handles all touch
21+
events, recognises gestures and positions the displayed document pages
22+
accordingly. ReaderView needs to handle positioning slightly differently
23+
depending on whether MuPDF is reflowing text or not, and so it has two slightly
24+
different modes of operation.
25+
26+
MuPDFReaderView
27+
~~~~~~~~~~~~~~~
28+
MuPDFReaderView subclasses ReaderView, so as to provide some of the
29+
page-positioning behaviour that is specific to MuPDF. It overrides some of the
30+
gesture recognition methods of ReaderView, so that it can perform special
31+
handling of (e.g.) tapping on the side of the screen for page progression, and
32+
tapping on links or form fields. It also handles the disabling of scrolling
33+
during text-selection and annotation-drawing, and it performs the setup
34+
operations needed by the individual page views as each newly appears.
35+
36+
MuPDFView
37+
~~~~~~~~~
38+
Document viewing uses different View subclasses to display the individual pages
39+
depending on whether reflowing text or displaying pages unaltered. MuPDFView is
40+
the common interface to the two view subclasses.
41+
42+
PageView
43+
~~~~~~~~
44+
PageView is the main View class used for non-reflow display of a page. Like
45+
ReaderView, it is intended to be, as much as is possible, independent of the
46+
specifics of MuPDF and usable in general document display apps. It is a
47+
subclass of ViewGroup because page displays are built from several layers. The
48+
lowest layer is a rendering of the page at a resolution that matches the screen
49+
exactly when maximally zoomed out so that the page fits the screen. As the user
50+
zooms in, this layer maintains a visible appearance of the page, but one that
51+
becomes more blurred as zooming in progresses. A second layer provides a higher
52+
resolution rendering of just the area of the page that is visible on screen,
53+
and at a resolution that matches the screen. As the user pans, this layer is
54+
updated on a background thread, so parts of the blurred layer will temporarily
55+
become visible, but only momentarily later to be replaced by the high-quality
56+
rendering. There is one further layer that is used to draw transparent shapes
57+
for highlighting and the like.
58+
59+
MuPDFPageView
60+
~~~~~~~~~~~~~
61+
MuPDFPageView is a subclass of PageView, which handles some of the specifics of
62+
MuPDF's behaviour, such as taps on links and form fields, text selection, and
63+
annotation drawing. It also handles its parent class's bitmap rendering calls.
64+
This is the class used to display pages in non-reflow mode. It implements the
65+
MuPDFView interface.
66+
67+
MuPDFReflowView
68+
~~~~~~~~~~~~~~~
69+
This is the class used to display pages in reflow mode. Like MuPDFPageView it
70+
implements the MuPDFView interface. It is a subclass of WebView, and achieves
71+
reflowing by loading an HTML version of the page, which the MuPDF core
72+
constructs.
73+
74+
MuPDFPageAdapter and MuPDFReflowAdapter
75+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
76+
As with any AdapterView subclass, ReaderView needs an Adapter subclass to
77+
supply, on demand, the subviews for the pages currently displayed. These are
78+
the two Adapter subclasses, supplying the subviews as MuPDFPageView and
79+
MuPDFReflowView objects respectively. The former is a little more complex than
80+
the latter, since it caches the sizes of the pages corresponding to the views
81+
it supplies. It does so, so that page views, on their second and subsequent
82+
appearances, can take on their correct size immediately. (The determining of
83+
page size is not a completely trivial operation and is performed on a
84+
background thread, as is all interaction with the core MuPDF library).
85+
86+
87+
C library wrapper
88+
~~~~~~~~~~~~~~~~~
89+
90+
MuPDFCore
91+
~~~~~~~~~
92+
This class is the interface to the MuPDF C library. It is used to render bitmap
93+
versions of the page for display in the view classes mentioned above. It also
94+
provides for interaction with objects within the page, such as the individual
95+
text objects and annotations. Many of the methods take too long an execution
96+
time to be run on the UI thread, hence they need to be run in the background,
97+
and because even the fast methods have to be synchronised with the slower
98+
methods, (almost) all methods should be called in the background. There are a
99+
few non synchronised ones that have special purposes.
100+
101+
102+
Link handling
103+
~~~~~~~~~~~~~
104+
There are three types of PDF links, each entailing different information and
105+
requiring different handling. There are five classes involved in their
106+
representation.
107+
108+
LinkInfo is the base class representing any one of the three
109+
110+
LinkInfoExternal, LinkInfoInternal and LinkInfoRemote are the three subclasses
111+
representing the specific cases.
112+
113+
LinkInfoVisitor is a class implementing a common Java paradigm which allows
114+
case analysis on the three different types of link, executing different methods
115+
for each.
116+
117+
BitmapHolder
118+
~~~~~~~~~~~~
119+
BitmapHolder is the solution to a problem in allocating the Bitmaps to which
120+
rendering is performed by background tasks. Renderings for the purpose of
121+
update have to be passed a Bitmap with the current page state. During frenetic
122+
page flicking a large number of rendering tasks can be queued, each holding
123+
reference to a Bitmap. Rather than pass the Bitmap directly, we pass a
124+
BitmapHolder containing a reference to the Bitmap. When a page view transitions
125+
off screen, the BitmapHolder's reference to the Bitmap can be nulled to release
126+
it.
127+
128+
SearchTask and SearchTaskResult
129+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
130+
SearchTask encapsulates the process of searching for a text string within a
131+
document. The class uses an AsyncTask internally to perform the search in the
132+
background and reports the result by calling onTextFound. A SearchTaskResult
133+
object is used to return the result of the search.
134+
135+
SafeAnimatorInflator
136+
~~~~~~~~~~~~~~~~~~~~
137+
This class is a simple wrapper around AnimatorInflator. AnimatorInflator
138+
doesn't exist in some of the Android API levels MuPDF supports, and the wrapper
139+
allows for a test of API-level before the point at which the class would be
140+
loaded.
141+
142+
MuPDFAlert and MuPDFAlertInternal
143+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
144+
This class represents the information issued by a javascript app.alert call.
145+
MuPDFAlertInternal represents the same information, but with Java enums
146+
replaced by ints, which are easier to return from JNI code.
147+
148+
TextChar and TextWord
149+
~~~~~~~~~~~~~~~~~~~~~
150+
TextChar is used when processing the individual characters of the page. Each
151+
TextChar object contains the character and the rectangular area of the page at
152+
which it appears. TextWord is used to gather TextChars into words.
153+
154+
Annotation
155+
~~~~~~~~~~
156+
This class represents the type and position on page of a PDF annotation.
157+
158+
Other activities
159+
~~~~~~~~~~~~~~~~
160+
The app has three activities other than document-viewing.
161+
162+
ChoosePDFActivity
163+
~~~~~~~~~~~~~~~~~
164+
ChoosePDFActivity allows the user to navigate local disc directories and view a
165+
list of loadable files, from which one can be chosen. It derives off
166+
ListActivity, and so displays the files in a standard ListView. ChoosePDFItem
167+
represents the various types of list entry: up-one, directory or file.
168+
ChoosePDFAdapter populates the list view.
169+
170+
OutlineActivity
171+
~~~~~~~~~~~~~~~
172+
OutlineActivity displays a PDF document's outline as a list of selectable
173+
section titles. OutlineActivityData represents the current state of the
174+
activity. OutlineItem represents the individual items, and OutlineAdapter
175+
populates the list view.
176+
177+
PrintDialogActivity
178+
~~~~~~~~~~~~~~~~~~~
179+
This activity allows the user to print documents via Google Cloud Print.
180+
181+
182+
Copied system classes
183+
~~~~~~~~~~~~~~~~~~~~~
184+
AsyncTask has had improvements made to it since issuing at the lowest android
185+
API level we support, and so we include the improved version as part of the
186+
MuPDF app. We also include Deque and ArrayDeque, which are used my AsyncTask.
187+

Icons.txt

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
The icons are from http://somerandomdude.com/work/iconic/
2+
They are covered by the CC-BY-SA license: http://creativecommons.org/licenses/by-sa/3.0/us/

0 commit comments

Comments
 (0)