Convert Figma logo to code with AI

FolioReader logoFolioReader-Android

A Java ePub reader and parser framework for Android.

2,252
718
2,252
268

Top Related Projects

📚 A Swift ePub reader and parser framework for iOS.

1,043

a java library for reading and writing epub files

Quick Overview

FolioReader-Android is an open-source EPUB reader and parser for Android devices. It provides a customizable reading experience with features like text highlighting, search functionality, and night mode. The library is designed to be easily integrated into Android applications, offering a robust solution for developers looking to incorporate e-book reading capabilities.

Pros

  • Rich feature set including text highlighting, search, and night mode
  • Customizable user interface to match app design
  • Support for various EPUB formats and DRM-free books
  • Active community and ongoing development

Cons

  • Limited support for other e-book formats (primarily focused on EPUB)
  • Some reported issues with performance on larger books
  • Dependency on external libraries may increase app size
  • Documentation could be more comprehensive for advanced use cases

Code Examples

  1. Initializing FolioReader:
val folioReader = FolioReader.get()
folioReader.openBook("/path/to/epub/book.epub")
  1. Customizing reader configuration:
val config = Config()
    .setAllowedDirection(Config.AllowedDirection.VERTICAL_AND_HORIZONTAL)
    .setThemeColorInt(ContextCompat.getColor(this, R.color.app_green))
    .setShowTts(true)
folioReader.setConfig(config, true)
  1. Handling reader events:
folioReader.setOnHighlightListener(object : OnHighlightListener {
    override fun onHighlight(highlight: Highlight?, type: HighlightImpl.HighLightAction) {
        // Handle highlight action
    }
})

Getting Started

To integrate FolioReader into your Android project:

  1. Add the JitPack repository to your project's build.gradle:
allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}
  1. Add the dependency to your app's build.gradle:
dependencies {
    implementation 'com.github.FolioReader:FolioReader-Android:0.5.4'
}
  1. Initialize and use FolioReader in your activity:
class MainActivity : AppCompatActivity() {
    private lateinit var folioReader: FolioReader

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        folioReader = FolioReader.get()
        folioReader.openBook("/path/to/epub/book.epub")
    }
}

Competitor Comparisons

📚 A Swift ePub reader and parser framework for iOS.

Pros of FolioReaderKit

  • Written in Swift, providing better performance and safety features for iOS development
  • More actively maintained with recent updates and contributions
  • Offers a more native iOS experience with Cocoa Touch framework integration

Cons of FolioReaderKit

  • Limited to iOS platform, reducing cross-platform development possibilities
  • Smaller community and fewer contributors compared to the Android version
  • May require more iOS-specific knowledge for customization and integration

Code Comparison

FolioReaderKit (Swift):

let config = FolioReaderConfig()
config.tintColor = UIColor.blue
let folioReader = FolioReader()
folioReader.presentReader(parentViewController: self, withEpubPath: epubPath, andConfig: config)

FolioReader-Android (Java):

FolioReader folioReader = FolioReader.get()
    .setOnHighlightListener(this)
    .setReadPositionListener(this);
folioReader.openBook(epubPath);

The code snippets demonstrate the initialization and basic usage of both libraries. FolioReaderKit uses Swift syntax and iOS-specific classes, while FolioReader-Android uses Java and Android components. Both provide similar functionality for opening and configuring an EPUB reader, but with platform-specific implementations.

1,043

a java library for reading and writing epub files

Pros of epublib

  • Lightweight library focused specifically on EPUB parsing and creation
  • Provides low-level control over EPUB structure and metadata
  • Can be integrated into various Java projects, not limited to Android

Cons of epublib

  • Lacks built-in UI components for EPUB rendering
  • Requires more development effort to create a full-featured e-reader application
  • Less active maintenance and community support compared to FolioReader-Android

Code Comparison

epublib:

Book book = new Book();
book.getMetadata().addTitle("My Book");
book.addSection("Chapter 1", new Resource("chapter1.html", "content".getBytes()));
EpubWriter epubWriter = new EpubWriter();
epubWriter.write(book, new FileOutputStream("book.epub"));

FolioReader-Android:

FolioReader folioReader = FolioReader.get();
folioReader.setOnHighlightListener(this);
folioReader.openBook("file:///android_asset/TheSilverChair.epub");

The code snippets demonstrate that epublib focuses on EPUB manipulation, while FolioReader-Android provides a higher-level API for reading EPUB files with built-in UI components. epublib requires more code to create and manipulate EPUB files, whereas FolioReader-Android simplifies the process of opening and displaying EPUB content in an Android application.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

FolioReader logo

Build Status

FolioReader-Android is an EPUB reader written in Java and Kotlin.

Features

  • Custom Fonts
  • Custom Text Size
  • Themes / Day mode / Night mode
  • Text Highlighting
  • List / Edit / Delete Highlights
  • Handle Internal and External Links
  • Portrait / Landscape
  • Reading Time Left / Pages left
  • In-App Dictionary
  • Media Overlays (Sync text rendering with audio playback)
  • TTS - Text to Speech Support
  • Parse epub cover image
  • PDF support
  • Book Search
  • Add Notes to a Highlight
  • Better Documentation
  • Last Read Locator
  • Horizontal Reading
  • Distraction Free Reading

Demo

Custom Fonts

Custom fonts

Day and Night Mode

Day night mode

Text Highlighting

Highlight

Media Overlays

Media Overlay

Gradle

Add following dependency to your root project build.gradle file:

allprojects {
    repositories {
        ...
        jcenter()
        maven { url "https://jitpack.io" }
        ...
    }
}

Add following dependency to your app module build.gradle file:

dependencies {
    ...
    implementation "com.folioreader:folioreader:0.5.4"
    ...
}

Enable Multidex support

Enable Multidex support as explained in this Android Doc

Usage

Get singleton object of FolioReader:

FolioReader folioReader = FolioReader.get();

Call the function openBook():

opening book from assets -
folioReader.openBook("file:///android_asset/TheSilverChair.epub");
opening book from raw -
folioReader.openBook(R.raw.accessible_epub_3);

WIKI

Reporting Issue

See KNOWN_ISSUES and CHANGELOG first before reporting any issue.
Please follow Issue Template to report any issue.

Share your application

If you are using FolioReader in your application, share your application link in this issue

Credits

  1. SwipeLayout
  2. r2-streamer-kotlin
  3. Pearson Dictionaries
  4. rangy

Author

Heberti Almeida

CodeToArt Technology

Donations

This project needs you! If you would like to support this project's further development, the creator of this project or the continuous maintenance of this project, feel free to donate. Your donation is highly appreciated. Thank you!

PayPal

  • Donate 5 $: Thank's for creating this project, here's a tea (or some juice) for you!
  • Donate 10 $: Wow, I am stunned. Let me take you to the movies!
  • Donate 15 $: I really appreciate your work, let's grab some lunch!
  • Donate 25 $: That's some awesome stuff you did right there, dinner is on me!
  • Donate 50 $: I really really want to support this project, great job!
  • Donate 100 $: You are the man! This project saved me hours (if not days) of struggle and hard work, simply awesome!
  • Of course, you can also choose what you want to donate, all donations are awesome!

License

FolioReaderKit is available under the BSD license. See the LICENSE file.