kandi background
Explore Kits

BookReader | "任阅" 网络小说阅读器,3D翻页效果、txt/pdf/epub书籍阅读、Wifi传书 | Media library

 by   smuyyh Java Version: Current License: Apache-2.0

 by   smuyyh Java Version: Current License: Apache-2.0

Download this library from

kandi X-RAY | BookReader Summary

BookReader is a Java library typically used in Media applications. BookReader has no bugs, it has no vulnerabilities, it has build file available, it has a Permissive License and it has medium support. You can download it from GitHub.
:closed_book: "任阅" 网络小说阅读器,3D翻页效果、txt/pdf/epub书籍阅读、Wifi传书~
Support
Support
Quality
Quality
Security
Security
License
License
Reuse
Reuse

kandi-support Support

  • BookReader has a medium active ecosystem.
  • It has 5964 star(s) with 1807 fork(s). There are 262 watchers for this library.
  • It had no major release in the last 12 months.
  • There are 34 open issues and 200 have been closed. On average issues are closed in 103 days. There are no pull requests.
  • It has a neutral sentiment in the developer community.
  • The latest version of BookReader is current.
BookReader Support
Best in #Media
Average in #Media
BookReader Support
Best in #Media
Average in #Media

quality kandi Quality

  • BookReader has 0 bugs and 0 code smells.
BookReader Quality
Best in #Media
Average in #Media
BookReader Quality
Best in #Media
Average in #Media

securitySecurity

  • BookReader has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
  • BookReader code analysis shows 0 unresolved vulnerabilities.
  • There are 0 security hotspots that need review.
BookReader Security
Best in #Media
Average in #Media
BookReader Security
Best in #Media
Average in #Media

license License

  • BookReader is licensed under the Apache-2.0 License. This license is Permissive.
  • Permissive licenses have the least restrictions, and you can use them in most projects.
BookReader License
Best in #Media
Average in #Media
BookReader License
Best in #Media
Average in #Media

buildReuse

  • BookReader releases are not available. You will need to build from source code and install.
  • Build file is available. You can build the component from source.
  • Installation instructions are not available. Examples and code snippets are available.
  • BookReader saves you 17344 person hours of effort in developing the same functionality from scratch.
  • It has 34404 lines of code, 2564 functions and 441 files.
  • It has medium code complexity. Code complexity directly impacts maintainability of the code.
BookReader Reuse
Best in #Media
Average in #Media
BookReader Reuse
Best in #Media
Average in #Media
Top functions reviewed by kandi - BETA

kandi has reviewed BookReader and discovered the below as its top functions. This is intended to give you an instant insight into BookReader implemented functionality, and help decide if they suit your requirements.

  • Populates this view with the specified new item .
  • Inflates the specified stream .
  • Loads the map .
  • Parses the content of a file into an array of strings .
  • Initialize vwe view .
  • Initialize web view .
  • start touch event
  • Renders the http request .
  • Draw shadow .
  • Setup the animations for the ring .

BookReader Key Features

:closed_book: "任阅" 网络小说阅读器,3D翻页效果、txt/pdf/epub书籍阅读、Wifi传书~

LICENSE

copy iconCopydownload iconDownload
Copyright 2016 JustWayward Team, All right reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Unable to display html file from local storage in webview

copy iconCopydownload iconDownload
  Future<String> _loadHtmlFromAssets(int n) async {
    final file = File(urls[n]);
    String fileText = await file.readAsString();
    final base64 = base64Encode(utf8.encode(fileText));
    return "data:text/html;base64,$base64";
  }
return WebView(
    initialUrl: snapshot.data.toString(),
    javascriptMode: JavascriptMode.unrestricted,
  );
-----------------------
  Future<String> _loadHtmlFromAssets(int n) async {
    final file = File(urls[n]);
    String fileText = await file.readAsString();
    final base64 = base64Encode(utf8.encode(fileText));
    return "data:text/html;base64,$base64";
  }
return WebView(
    initialUrl: snapshot.data.toString(),
    javascriptMode: JavascriptMode.unrestricted,
  );

Multithreading should close the whole process but doesn't

copy iconCopydownload iconDownload
import pyttsx3
from pyttsx3.drivers import sapi5
from PyPDF2 import PdfFileReader
from threading import Thread
from psutil import process_iter
from easygui import enterbox,fileopenbox,msgbox,choicebox
import os
import signal

class Audiobook():

    def readbook(self,title,page=0):
        book = open(title, 'rb')
        pdfReader = PdfFileReader(book)
        pages = pdfReader.numPages
        speaker = pyttsx3.init()

        speaker.setProperty('rate',150)

        for num in range(page-1,pages):
            page = pdfReader.getPage(num)
            text = page.extractText()
            speaker.say(text)
            speaker.runAndWait()
            speaker.say("You arrived to page" + str(num+1))

    def title(self):
        title = fileopenbox(default="*.pdf",filetypes=["*.pdf"])
        if title:
            page = enterbox("From which page would you like to read? ",'Choose the page')
            page = 1 if page=="" else int(page)
        else:
            return
        self.readbook(title,page)

    def killprocess(self):
        kill = msgbox("Click here to stop reading","Close the Application?")
        if kill is not None:
            os.kill(os.getpid(),signal.SIGTERM)

bookreader = Audiobook()
process1 = Thread(target=bookreader.title)
process2 = Thread(target=bookreader.killprocess)
process2.start()
process1.start()

Connected Router - newly routed page contains additional data

copy iconCopydownload iconDownload
<Provider>
  <ConnectedRouter history={history}>
    <Switch>
      <Route path="/read" component={BookReader} />
      <Route path="/">
        <AppContainer>
          <Route A />
          <Route B />
          <Route C />
        </AppContainer>
      </Route>
    </Switch>
  </ConnectedRouter>
</Provider>

     <Router history={history}>
        <Switch>
          <Route path="/read" component={BookReader} />
          <Route path="/" component={AppContainer} />
        </Switch>
      </Router>
-----------------------
<Provider>
  <ConnectedRouter history={history}>
    <Switch>
      <Route path="/read" component={BookReader} />
      <Route path="/">
        <AppContainer>
          <Route A />
          <Route B />
          <Route C />
        </AppContainer>
      </Route>
    </Switch>
  </ConnectedRouter>
</Provider>

     <Router history={history}>
        <Switch>
          <Route path="/read" component={BookReader} />
          <Route path="/" component={AppContainer} />
        </Switch>
      </Router>

Can't retrive data in view of an one to one polymorphic realation

copy iconCopydownload iconDownload
@isset ($book->image)
    <img src="{{$book->image->getImage()}}" alt="product image">
@endisset
<img src="{{optional($book->image)->getImage() ?? 'default_image_path.png'}}" alt="product image">
@if (isset($book->image))
    <img src="{{$book->image->getImage()}}" alt="product image">
@else
    <img src="default_image_path.png" alt="product image">
@endif
-----------------------
@isset ($book->image)
    <img src="{{$book->image->getImage()}}" alt="product image">
@endisset
<img src="{{optional($book->image)->getImage() ?? 'default_image_path.png'}}" alt="product image">
@if (isset($book->image))
    <img src="{{$book->image->getImage()}}" alt="product image">
@else
    <img src="default_image_path.png" alt="product image">
@endif
-----------------------
@isset ($book->image)
    <img src="{{$book->image->getImage()}}" alt="product image">
@endisset
<img src="{{optional($book->image)->getImage() ?? 'default_image_path.png'}}" alt="product image">
@if (isset($book->image))
    <img src="{{$book->image->getImage()}}" alt="product image">
@else
    <img src="default_image_path.png" alt="product image">
@endif

MongoDB - embedding, inserting one collection into another

copy iconCopydownload iconDownload
db.people.aggregate([
    {
        $lookup: {
            from: "addresses",
            pipeline: [ ],
            as: "addresses"
        }
    }
])
db.people.aggregate([
    {
        $lookup: {
            from: "addresses",
            pipeline: [ { $match: { street: "123 Fake Street" } } ],
            as: "addresses"
        }
    }
])
-----------------------
db.people.aggregate([
    {
        $lookup: {
            from: "addresses",
            pipeline: [ ],
            as: "addresses"
        }
    }
])
db.people.aggregate([
    {
        $lookup: {
            from: "addresses",
            pipeline: [ { $match: { street: "123 Fake Street" } } ],
            as: "addresses"
        }
    }
])

Dagger2 not finding provided instance

copy iconCopydownload iconDownload
@Module(includes = {RepositoriesModule.class})
class {

    @Provides
    @Singleton
    fun provideGetRandomBookUseCase(booksRepository: BooksRepository) =
        GetRandomBookUseCase(booksRepository)
}
@Component(
    modules = [GetRandomBookUseCaseModule::class]
)
interface UseCasesComponent {
    GetRandomBookUseCase getRandomBookUseCase();
}
-----------------------
@Module(includes = {RepositoriesModule.class})
class {

    @Provides
    @Singleton
    fun provideGetRandomBookUseCase(booksRepository: BooksRepository) =
        GetRandomBookUseCase(booksRepository)
}
@Component(
    modules = [GetRandomBookUseCaseModule::class]
)
interface UseCasesComponent {
    GetRandomBookUseCase getRandomBookUseCase();
}
-----------------------
@Component(
    modules = [GetRandomBookUseCaseModule::class]
)
@Singleton
interface UseCasesComponent {

    val getRandomBookUseCase: GetRandomBookUseCase
}
@Component(
    dependencies = [UseCasesComponent::class],
    modules = [BookReaderModule::class]
)
@PrototypeScope
interface BookReaderFragmentComponent {

    val bookReader: BookReader
}
class BookReaderFragment : Fragment() {
    lateinit var bookReader: BookReader
    val component: BookReaderFragmentComponent by lazy {
        DaggerBookReaderFragmentComponent
            .builder()
            .useCasesComponent(DaggerUseCasesComponent.create())
            .bookReaderModule(BookReaderModule(context!!))
            .build()
    }

    override fun onActivityCreated(savedInstanceState: Bundle?) {
        super.onActivityCreated(savedInstanceState)
        bookReader = component.bookReader
        ...
    }

    ...
}
-----------------------
@Component(
    modules = [GetRandomBookUseCaseModule::class]
)
@Singleton
interface UseCasesComponent {

    val getRandomBookUseCase: GetRandomBookUseCase
}
@Component(
    dependencies = [UseCasesComponent::class],
    modules = [BookReaderModule::class]
)
@PrototypeScope
interface BookReaderFragmentComponent {

    val bookReader: BookReader
}
class BookReaderFragment : Fragment() {
    lateinit var bookReader: BookReader
    val component: BookReaderFragmentComponent by lazy {
        DaggerBookReaderFragmentComponent
            .builder()
            .useCasesComponent(DaggerUseCasesComponent.create())
            .bookReaderModule(BookReaderModule(context!!))
            .build()
    }

    override fun onActivityCreated(savedInstanceState: Bundle?) {
        super.onActivityCreated(savedInstanceState)
        bookReader = component.bookReader
        ...
    }

    ...
}
-----------------------
@Component(
    modules = [GetRandomBookUseCaseModule::class]
)
@Singleton
interface UseCasesComponent {

    val getRandomBookUseCase: GetRandomBookUseCase
}
@Component(
    dependencies = [UseCasesComponent::class],
    modules = [BookReaderModule::class]
)
@PrototypeScope
interface BookReaderFragmentComponent {

    val bookReader: BookReader
}
class BookReaderFragment : Fragment() {
    lateinit var bookReader: BookReader
    val component: BookReaderFragmentComponent by lazy {
        DaggerBookReaderFragmentComponent
            .builder()
            .useCasesComponent(DaggerUseCasesComponent.create())
            .bookReaderModule(BookReaderModule(context!!))
            .build()
    }

    override fun onActivityCreated(savedInstanceState: Bundle?) {
        super.onActivityCreated(savedInstanceState)
        bookReader = component.bookReader
        ...
    }

    ...
}

Community Discussions

Trending Discussions on BookReader
  • Unable to display html file from local storage in webview
  • Multithreading should close the whole process but doesn't
  • Connected Router - newly routed page contains additional data
  • Can't retrive data in view of an one to one polymorphic realation
  • MongoDB - embedding, inserting one collection into another
  • Dagger2 not finding provided instance
Trending Discussions on BookReader

QUESTION

Unable to display html file from local storage in webview

Asked 2021-Jun-10 at 11:53

I have a Flutter project in which I am:

  • Downloading the zip file (full of html files)
  • Extracting the html files to a new directory (ebooks/02)
  • Saving the local file urls in a List
  • Displaying the urls in Webview & iterate through List for back & forth.

However, in the web view all I get is "Unable to load asset..."

enter image description here

Though any standard http url works fine in webview.

I tried from these two answers but no result: Answer1 & Answer2

The exception I get is :

E/flutter (10963): [ERROR:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception: Unable to load asset: /data/user/0/com.pts.school_ebook_reader_app_prag/app_flutter/ebooks/04/00.html

I need to understand how to make the local html at the given path display in webview.

Any help would be appreciated.

Edit:

The webview code (currently trying to display only 1st url in list):

 class _BookReaderState extends State<BookReader> {
  List<String> urls = UserData.ebook;

  WebViewController web;
  final _key = UniqueKey();
  String _url;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          automaticallyImplyLeading: false,
          title: Text(
            "Book Title Here",
            style: GoogleFonts.roboto(
                fontWeight: FontWeight.w900,
                fontSize: 25.0,
                color: Colors.white),
            textAlign: TextAlign.center,
          ),
          actions: [
            Padding(
              padding: EdgeInsets.only(right: 50),
              child: IconButton(
                  icon: Image.asset('images/04_mobile-menu.png'),
                  color: Colors.red,
                  alignment: Alignment.centerLeft,
                  onPressed: () {
                    Navigator.push(
                        context,
                        MaterialPageRoute(
                            builder: (context) => MyLibrary_Screen()));
                  }),
            ),
            Padding(
              padding: const EdgeInsets.only(left: 1.0),
              child: IconButton(
                  icon: Image.asset('images/05_mobile-close.png'),
                  color: Colors.red,
                  alignment: Alignment.centerRight,
                  onPressed: () {
                    Navigator.push(
                        context,
                        MaterialPageRoute(
                            builder: (context) => MyLibrary_Screen()));
                  }),
            ),
          ],
        ),
        body: Column(
          children: [
            Padding(
              padding: EdgeInsets.symmetric(horizontal: 10, vertical: 10),
              child: Container(
                  width: 700,
                  height: 490,
                  child: FutureBuilder<String>(
                      future: _loadHtmlFromAssets(0),
                      builder: (context, snapshot) {
                        if (snapshot.hasData) {
                          return WebView(
                            initialUrl: new Uri.dataFromString(snapshot.data,
                                    mimeType: 'text/html')
                                .toString(),
                            javascriptMode: JavascriptMode.unrestricted,
                          );
                        } else if (snapshot.hasError) {
                          return Text("${snapshot.error}");
                        }
                        return CircularProgressIndicator();
                      })),
            ),
            Padding(
              padding: EdgeInsets.only(top: 85),
              child: Container(
                height: 70,
                color: Colors.blue,
                child: RowSuper(
                  innerDistance: 50,
                  children: [
                    InkWell(
                      child: Image.asset(
                        "images/05_mobile-arrow-left.png",
                        alignment: Alignment.bottomLeft,
                        height: 170,
                        width: 90,
                      ),
                      onTap: () => pageIncDec(1),
                    ),
                    Text('Page ${urls.indexOf(_url) + 1} of ${urls.length}',
                        style: GoogleFonts.roboto(
                            fontWeight: FontWeight.w900,
                            fontSize: 33.0,
                            color: Colors.white)),
                    InkWell(
                      child: Image.asset(
                        "images/05_mobile-arrow-right.png",
                        alignment: Alignment.bottomRight,
                        height: 270,
                        width: 90,
                      ),
                      onTap: () => pageIncDec(2),
                    ),
                  ],
                ),
              ),
            ),
          ],
        ));
  }

  pageIncDec(int i) async {
    int n;
    if (i == 1) {
      setState(() {
        urls.indexOf(_url) > 0 ? n = urls.indexOf(_url) - 1 : n = 0;
      });
    } else {
      setState(() {
        urls.indexOf(_url) < urls.length
            ? n = urls.indexOf(_url) + 1
            : n = urls.length - 1;
      });
    }

     _url = await _loadHtmlFromAssets(n);

    web.loadUrl(_url);
    print(_url);
  }

  Future<String> _loadHtmlFromAssets(int n) async {
    String fileText = await rootBundle.loadString(urls[n]);
    print(fileText);
    String r = (Uri.dataFromString(fileText,
            mimeType: 'text/html', encoding: Encoding.getByName('utf-8'))
        .toString());
    print(r);
    return r;
  }

Code to add files :

Directory dir =
        Directory('${_appDocDir.path}/$folderName/${item.key_name}');
    List<FileSystemEntity> listOfAllFolderAndFiles =
        await dir.list(recursive: false).toList();

    if (UserData.ebook != null) UserData.ebook.clear();

    listOfAllFolderAndFiles.forEach((element) {
      if (element.toString().contains("html")) {
        String url = element.toString().replaceAll("File: ", "");
        url = url.replaceAll("'", "");
        UserData.ebook.add(url.toString());
      }
      UserData.eBookTitle = item.title;
    });

    print(UserData.ebook);

And result of printing UserData.ebook :

I/flutter ( 3465): [/data/user/0/com.pts.school_ebook_reader_app_prag/app_flutter/ebooks/02/00.html, /data/user/0/com.pts.school_ebook_reader_app_prag/app_flutter/ebooks/02/01.html, /data/user/0/com.pts.school_ebook_reader_app_prag/app_flutter/ebooks/02/02.html, /data/user/0/com.pts.school_ebook_reader_app_prag/app_flutter/ebooks/02/03.html, /data/user/0/com.pts.school_ebook_reader_app_prag/app_flutter/ebooks/02/04.html, /data/user/0/com.pts.school_ebook_reader_app_prag/app_flutter/ebooks/02/05.html, /data/user/0/com.pts.school_ebook_reader_app_prag/app_flutter/ebooks/02/06.html]

Checking:

//Checking if file exists
      print("File ${UserData.ebook[0]} exists ? " +
          File(UserData.ebook[0]).existsSync().toString());

Result:

I/flutter ( 3465): File /data/user/0/com.pts.school_ebook_reader_app_prag/app_flutter/ebooks/02/00.html exists ? true

ANSWER

Answered 2021-Jun-09 at 06:43

I think you should load html as normal file, not like asset, because it's not located in Assets directory and convert it to base64:

  Future<String> _loadHtmlFromAssets(int n) async {
    final file = File(urls[n]);
    String fileText = await file.readAsString();
    final base64 = base64Encode(utf8.encode(fileText));
    return "data:text/html;base64,$base64";
  }

Then show it like:

return WebView(
    initialUrl: snapshot.data.toString(),
    javascriptMode: JavascriptMode.unrestricted,
  );

Source https://stackoverflow.com/questions/67895785

Community Discussions, Code Snippets contain sources that include Stack Exchange Network

Vulnerabilities

No vulnerabilities reported

Install BookReader

You can download it from GitHub.
You can use BookReader like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the BookReader component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .

Support

For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .

DOWNLOAD this Library from

Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 430 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases

Save this library and start creating your kit

Explore Related Topics

Share this Page

share link
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 430 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases

Save this library and start creating your kit

  • © 2022 Open Weaver Inc.