FBReader and package features

Introduction to the

Project official website: fbreader.org/android

FBReader is an open source ebook reader that is now available on many devices. It is available not only for PC, but also for OPERATING systems such as GNU/Linux,MicrosoftWindows, and mobile devices such as NokiaInternetTablets. As of April 13, 2008, there is an Android version, known as FBReaderJ.

Has the following features:

  • Supported ebook formats: ePub, Kindle (Mobipocket), FB2, RTF, HTML, Microsoft Doc, Plain Text, PDF(requires PDF plug-in), DJVU(requires DJVU plug-in), CBR and CBZ comic (requires Comic plug-in)
  • Extensibility: Provides a programmatic API with additional features available through third-party plug-ins. For example, the popular plug-in text-to-speech
  • Supports direct reading of zip files
  • Provides direct access to many online ebook libraries and stores
  • Supports adding custom OPDS directories
  • Integrate with popular dictionaries like ColorDict, SlovoEd, Fora, etc
  • External TrueType/OpenType fonts can be used
  • Localization in 29 languages
  • Hyphenation patterns for 16 languages
  • Organize user libraries by title, author, series, etc
  • Book collections, reading locations, bookmarks and more can be synchronized with Google Drive™ -based FBReader cloud services

I. Import the project and run it

The project address

Github.com/geometer/FB…

The import

The project is written in Eclipse, so the first step is to change the project into an AS project and import AS to create the AIDL directory, put the AIDL files used in the FBReader project here, be sure not to change the project package name, otherwise it will be a disaster!!

run

If FB is used as a dependency in the project so file, you also need to change the package name constant DEFAULT_PACKAGE in FBReaderIntents to the package name of your application

Second, the project source code structure

Source code structure

The source file structure of FBReader is as follows:

folder instructions
src JAVA source code
asset There’s the default book, background images, etc
docs There is a PDF that explains how to install Cygwin
icons Some ICONS, such as Menu, small icon for text search
jni C/C ++ library file, more content
libs The generated so file is here
ojb . A file
obsolete abandoned
res resources
scripts Use an unknown
third-party The three references
AndroidManiffest.xml The manifest file

For the source code of each package function analysis

The package name instructions
com/paragon/dictionary/fbreader The dictionary query
org.amse.ys.zip This package is decompressed to use, epub itself is a compressed file, so to decompress
org.fbreader.util Comparison sort
org.geometerplus Core code package
org.vimgadgets.linebreak Break out a word, such as “Hello, goodbye! , hyphenation results are “you” “ok” “see you” “see you”

Org. geometerplus.android for core code package features

The package name instructions
org.geometerplus.android.fbreader.api This package is an API interface implemented by FBReader via AIDL for installing plug-ins, etc
org.geometerplus.android.fbreader.bookmark FB has its own bookmark page, edit page and edit tool class
org.geometerplus.android.fbreader.config Various FB related configurations, and the corresponding service and SQLite are defined
org.geometerplus.android.fbreader.convers Book cover related cache
org.geometerplus.android.fbreader.crash Catalogue related restoration
org.geometerplus.android.fbreader.dict Dictionary-related tools that contain definitions for opening dictionary activities
org.geometerplus.android.fbreader.error The Activity that starts when something goes wrong while reading a book
org.geometerplus.android.fbreader.formatPlugin Generate related intEnts for a specific plug-in that can be used to install the plug-in
org.geometerplus.android.fbreader.httpd Defines dataservice and DataServer (providing cover and video retrieval services)
org.geometerplus.android.fbreader.image There is only one ImageViewActivity, long press to show the image
org.geometerplus.android.fbreader.library Initialize the books.db database, as well as the book information activity
org.geometerplus.android.fbreader.libraryService Libraryservice is defined to manage books and obtain and query real books according to file paths or specific IDS
org.geometerplus.android.fbreader.network Here is FBReader network connection related, such as downloading books, library authorization, OPDS related
org.geometerplus.android.fbreader.preferences Configuration information, such as background, text size, page-turning animation speed, and color
org.geometerplus.android.fbreader.sync SyncService is defined for synchronization of bookmarks and so on
org.geometerplus.android.fbreader.sync TipsActivity
org.geometerplus.android.fbreader.tree TreeActivity and TreeAdapter, which define the base class of the tree structure Activity and Adapter
org.geometerplus.android.fbreader.util Image synchronization and simple Dialog activities
org.geometerplus.android.util Package utility class, database, and update UI, file tools and so on

The FBReader in this package is the program’s main Actitiy and also the reading activity. Other classes, such as those with an Action ending, are the execution classes for the various FBReader operations, whose core is the Action behavior defined inside the run method. There are also some specific operations such as popup and Notifier.

The function of the core code package org. Geometerplus. Fbreader

The package name instructions
org.geometerplus.fbreader.book Books, bookmarks and other related models, databases, tool classes
org.geometerplus.fbreader.bookmodel FBReader data, which generates bookModels containing both Java models and locally returned models
org.geometerplus.fbreader.fbreader Mainly FBView of books display, and some Action to select text, page turning Action
org.geometerplus.fbreader.formats Plug-in entry, FBReader to ePUB parsing, TXT parsing and so on as a plug-in
org.geometerplus.fbreader.library This package has a book author class, book information class, file class, and path generated tree structure
org.geometerplus.fbreader.network Network related
org.geometerplus.fbreader.sort The sorting
org.geometerplus.fbreader.tips Network-related behaviors
org.geometerplus.fbreader.tree Custom book structure, FBTree
org.geometerplus.fbreader.util Gets the text fragment based on the starting position passed in

The package also contains a Paths class that is path-related for the entire FBReader project.

The function of the core code package org. Geometerplus. Zlibrary. Core

The package name instructions
org.geometerplus.zlibrary.core.application Not the Application in Android, but the author’s custom management Application
org.geometerplus.zlibrary.core.constants Namespaces are just url links
org.geometerplus.zlibrary.core.drm Encryption related
org.geometerplus.zlibrary.core.encodings Used to read the encoding in encoding/ encodings.xml
org.geometerplus.zlibrary.core.filesystem There are various File classes, such as compressed File, resource File, local File and so on
org.geometerplus.zlibrary.core.filetypes The file type
org.geometerplus.zlibrary.core.fonts Font information
org.geometerplus.zlibrary.core.image Image loading, image processing related package
org.geometerplus.zlibrary.core.language Code check packet
org.geometerplus.zlibrary.core.library ZLibrary gets FBReader version, system information, DPI, adjust screen brightness, etc
org.geometerplus.zlibrary.core.money Money model and exception
org.geometerplus.zlibrary.core.network Cookie database setup, network request, network management related package
org.geometerplus.zlibrary.core.options FBReader custom data types, such as ZLBoolean3Option ZLColorOption
org.geometerplus.zlibrary.core.resources Local Resource file
org.geometerplus.zlibrary.core.tree ZLTree tree structure data base class, book catalog data for this kind of subclass
org.geometerplus.zlibrary.core.util Various tool classes
org.geometerplus.zlibrary.core.view Custom view class, is the reading interface display of the highest abstract class, as well as event listening, processing
org.geometerplus.zlibrary.core.xml To parse the XML

The function of the core code package org. Geometerplus. Zlibrary. Text

The package name instructions
org.geometerplus.zlibrary.text.hyphenation Decide which language it is based on hyphenation
org.geometerplus.zlibrary.text.model An abstract class package, with processing for text, and processing for paragraphs, save text to the cache
org.geometerplus.zlibrary.text.view The text is structured, the text block, the line of text, the paragraph of text, the page, all processed under this package, and the view displayed

The function of the core code package org. Geometerplus. Zlibrary. UI. The android

The package name instructions
org.geometerplus.zlibrary.ui.android.error Bug reports
org.geometerplus.zlibrary.ui.android.image Image acquisition and management
org.geometerplus.zlibrary.ui.android.library Error reporting, the program’s main Activity, and the Application are abstracted again
org.geometerplus.zlibrary.ui.android.network Cookie database operation
org.geometerplus.zlibrary.ui.android.util Color manipulation tool class
org.geometerplus.zlibrary.ui.android.view Various page-turning effects

At this point, FBReader core code structure and analysis has been completed, of course, due to the limited contact time inevitably there are mistakes or unclear description of the place, but also hope that you can give correction. The next article will discuss how FBReader opens a book and some subsequent analysis of the processing logic.