I am working on an android application where I have to add a build-in txt reader which can parse and display the content of a txt file for any kind of encoding.
I know there are some opensource solutions like FBReaderJ, CoolReader and etc, however almost all of them are heavy with a lot of features which I do not need. And it is hard to extract the core library. And the FBReaderJ use jni which is unfamiliar to me.
I just need features:
- Open a specified txt file in the local storage.
- Display the current progress(page and percentage) of the whole book.
- Jump to specified progress
That's all I need.
I tried to build it on my own, but I am not sure the general practice for this kind of application, I have some raw ideas:
1 Read the content by part.
For example a whole txt file may contain 10K words, we do not need to load all of them, we only need the content which can fill the screen.
I dot not know how to calculate them.
2 Render the content
I can create a textview and put the content on it or I can create a custom view to draw the cotnent by a canvas. I do not which is preferred.
I hope someone can give me suggestion. Thanks.