Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it really to highlight the text on pages? #35

Closed
acuna-public opened this issue Mar 14, 2018 · 9 comments
Closed

Is it really to highlight the text on pages? #35

acuna-public opened this issue Mar 14, 2018 · 9 comments

Comments

@acuna-public
Copy link

I need to implement the text highlight on pages to copy it (for example). I'm clicking on text (eg "First page" which is default) and hold it, but have no action. Is it really to use a TextView rather than Bitmap or I missing something?

@eschao
Copy link
Owner

eschao commented Mar 15, 2018

@acuna-pro No, you can't use TextView on it since pageflip only accepts a bitmap as a screen content to show. I'm not sure why you need that. Suppose you want to implement a pageflip animation when swap two views. I think android animation library should be responsible for it, but unfortunately, pageflip doesn't support android animation layer.

@acuna-public
Copy link
Author

Because I'm looking for the way to implement the text hightlight in books (e. g. like in learning manuals and synopsis). Any known bookreaders like MoonReader, eReader, etc have similar page flips, but with normal text which can be highlighted. Seems that they've found the way to implement it, and not so known readers are too, so seems that it's really, but don't know how...

@eschao
Copy link
Owner

eschao commented Mar 16, 2018

@acuna-pro Firstly, you need to understand the principle of the PageFlip lib. It is just aimed to implement a 3D style flipping effect with OpenGL. This is only what it is responsible for. Except that, all the functions what you need should be implemented by yourself or other 3rd library.
Given that your requirement, I think you can follow the below steps to reach:

  1. Draw normal text of one page on a bitmap, pass the bitmap to PageFlip to show.
  2. Intercept gesture before PageFlip handle them to turn page. For example: long click a word. you need to recognize the long click action and find out which word is chosen by (x, y) coordinate.
  3. Redraw the selected word with highlight style on a bitmap, normally, you need to redraw the whole page with the different style for choosing word. and then pass it to PageFlip to show it on screen.

As you see in the above steps, you have to be responsible for drawing text with different style. The PageFlip only help you to show a prepared bitmap on screen and play a flip animation when trigger a page turning.
Hope my answer can help address your problem.

@mahdimzf2015
Copy link

I want to write text in every page. please guide how I put to each page the text

@acuna-public
Copy link
Author

@eschao Wow, thanks a lot for your adviсes. Seems that I need to implement it by myself... But I still can't believe that all not most known readers have this implemented yet but there's no any open-source libraries for this...

@mahdimzf2015
Copy link

please help me.I want to write text in every page. please guide how I put to each page the text

@acuna-public
Copy link
Author

@mahdimzf2015 What is your problem? You can find the "First page" text in the code and edit it for your purposes, but it will be an image only, but with text.

@eschao
Copy link
Owner

eschao commented Mar 22, 2018

@acuna-pro I created a reader application on Android before(not open source project), that's why I know this responsibility is not in PageFlip's scope and that is also why I created PageFlip library. :)

@eschao eschao closed this as completed Mar 22, 2018
@acuna-public
Copy link
Author

Ah, wait, I don't understand you) You've created a reader which is supported the plain text, but created a PageFlip in open-source which do not? Can't imagine where it can be useful to use images instead of plain text) But after that, I have some thoughts about its implementation (but now I making another project), but how do you think, can I put it to open-source afterwards? There's some... some... ethic moment in this all :/ Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants