Giter VIP home page Giter VIP logo

mdict-jni-query-library's Introduction

mdict-jni-query-library

mdict (*.mdx) file reader based on dictlab/mdict-cpp written by terasum.

Several changes have been made with respect to the original work and some bugs have been fixed. The JNI layer, which the original library doesn't provided, is implemented by me.

Usage

  1. Making sure you have both NDK and cmake in Android studio, the query wouldn't work without them as they are the prerequisites of JNI.

  2. Import this Gradle project with Android Studio and connect your phone to the computer, make sure USB debugging is enabled.

  3. run the APP on your phone, usually, the APP will fail to run properly at the first attempt, this is because the mdx file has not been put into the scoped storage of the APP yet.

  4. put the mdx file into the scoped storage of the APP, in my case, I have put the mdx into /storage/emulated/0/Android/data/com.example.mdictjnilibrary/files/

  5. check the MainActivity file in the project, you should modify the global variable path and the global variable word. The path is your mdx file name and the word is the search item. Run the APP again you will see that the returned HTML string is successful rendered.

Note

Due to unknown reasons, for some mdx file, if the webview of Android renders the HTML passed from the jni layer directly, only a partial of the HTML will shown in the webview. I have circumvented this bug by writing the HTML that comes from the jni layer to local storage and then access the local HTML file through webview.

Acknowledgment

Many thanks to terasum for helping me understand his library and the consultation he provided.

Reference

https://bitbucket.org/xwang/mdict-analysis/src/master/

https://github.com/zhansliu/writemdict

https://github.com/terasum/js-mdict

https://github.com/dictlab/mdict-cpp

mdict-jni-query-library's People

Contributors

tuo-zhang avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

chminsc

mdict-jni-query-library's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.