Book reader page turning method and device

By obtaining and modifying the coordinates of the reading page in the e-reader, combined with smooth sliding judgment and line-by-line drawing technology, it solves the problems of unsmooth sliding and high delay in traditional e-readers, achieves fast and smooth page turning, and improves user experience. experience.

CN118585104APending Publication Date: 2024-09-03BEIJING RANDI MEDIA TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410696086.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-31
Publication Date
2024-09-03

AI Technical Summary

Technical Problem

Traditional e-readers have problems such as unsmooth sliding, high latency, and slow response, which affects the user experience.

Method used

By obtaining the original coordinates of the reading page and modifying the coordinates of the reading page according to the offset of the user's sliding, smooth sliding judgment and page turning operations are achieved. Three pages are arranged horizontally and text is drawn line by line to ensure that the page turns within 100ms. Finish.

Benefits of technology

It improves the smoothness and efficiency of page turning in electronic books and enhances the user's reading experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118585104A
    Figure CN118585104A
Patent Text Reader

Abstract

The invention discloses a book reader page turning method and device, and the method comprises the steps: S100, obtaining a reading page, and initializing the reading page to obtain an original coordinate of the reading page, the reading page comprising a current page, a previous page and a next page; s200, based on the sliding coordinates of the user on the current page, when the sliding of the user on the current page is judged to be smooth sliding, executing the step S300; s300, modifying the original coordinates of the reading page according to the sliding offset of the user on the current page, and drawing characters on the reading page line by line; and S400, executing whether to turn pages or not based on the final coordinates when the user finishes sliding and leaves the current page. According to the method, the three reading pages are transversely arranged, so that when the user reads the electronic book, page turning is very smooth, and the reading experience of the user is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to a page turning method, and in particular to a page turning method and device for a book reader. Background Art

[0002] With the rapid development of mobile Internet and mobile phone performance, e-readers have become one of the important tools for people to acquire knowledge and read books. In traditional e-readers, there are problems such as unsmooth sliding, high latency, and slow response. Therefore, in order to improve user experience, the development of a high-performance sliding method has become an urgent need for technological development. Summary of the invention

[0003] In view of the deficiencies in the prior art, the present invention aims to provide a page turning method for a book reader, which can improve the page turning efficiency and thus enhance the user's reading experience.

[0004] To achieve the above objectives, the present disclosure provides the following technical solutions:

[0005] A page turning method for a book reader comprises the following steps:

[0006] S100: Acquire a reading page and initialize to acquire original coordinates of the reading page, the reading page including a current page, a previous page and a next page;

[0007] S200: When the sliding of the user on the current page is determined to be a smooth sliding based on the sliding coordinates of the user on the current page, executing step S300;

[0008] S300: modifying the original coordinates of the reading page according to the offset of the user sliding on the current page, and drawing text on the reading page line by line;

[0009] S400: Execute whether to turn the page based on the final coordinates when the user completes sliding and leaves the current page;

[0010] Preferably, step S200 includes the following steps:

[0011] S201: Obtain the coordinates of the user before and after sliding on the current page;

[0012] S202: Calculate the offset between the coordinates after sliding and the coordinates before sliding;

[0013] S203: Determine whether the sliding of the user on the current page is a smooth sliding based on the offset between the coordinates after sliding and the coordinates before sliding and the minimum sliding touchslop.

[0014] Preferably, step S400 includes the following steps:

[0015] S401: Obtain the final coordinates of the user after the user completes sliding on the current page and leaves the current page;

[0016] S402: Calculate the offset between the final coordinate and the coordinate before sliding;

[0017] S403: Execute whether to turn the page based on the offset between the final coordinate and the coordinate before sliding and the minimum value minPage of whether the page can be turned.

[0018] The present disclosure also provides a book reader page turning device, comprising:

[0019] An initialization module, used to obtain a reading page and initialize to obtain the original coordinates of the reading page, wherein the reading page includes a current page, a previous page, and a next page;

[0020] A sliding module, used to determine whether the user's sliding on the current page is a smooth sliding based on the sliding coordinates of the user on the current page;

[0021] A drawing module, used to modify the original coordinates of the reading page according to the offset of the user sliding on the current page, and to draw text on the reading page line by line;

[0022] The page turning execution module is used to execute whether to turn the page based on the final coordinates when the user completes sliding and leaves the current page.

[0023] The present disclosure also provides an electronic device, comprising:

[0024] A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein:

[0025] When the processor executes the program, any of the above methods is implemented.

[0026] The present disclosure also provides a computer storage medium storing computer executable instructions for executing any of the above methods.

[0027] Compared with the prior art, the present invention has the following beneficial effects:

[0028] The present disclosure adopts a method of arranging three reading pages horizontally, so that when users read electronic books, page turning is very smooth, and page turning can basically be completed within 100ms, thereby improving the user's reading experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] Figure 1 is a flow chart of a page turning method of a book reader provided by an embodiment of the present disclosure;

[0030] Figure 2is a schematic diagram of the arrangement of reading pages provided by another embodiment of the present disclosure;

[0031] Figure 3 is a schematic diagram of a smooth sliding process provided by another embodiment of the present disclosure;

[0032] Figure 4 This is a schematic diagram after page turning is completed provided by another embodiment of the present disclosure. DETAILED DESCRIPTION

[0033] The following will refer to the attached Figures 1 to 4 Specific embodiments of the present disclosure are described in detail. Although specific embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments described herein. On the contrary, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.

[0034] It should be noted that certain words are used in the specification and claims to refer to specific components. Those skilled in the art should understand that technicians may use different nouns to refer to the same component. This specification and claims do not use the difference in nouns as a way to distinguish components, but use the difference in the functions of the components as the criterion for distinction. As mentioned throughout the specification and claims, "including" or "comprising" is an open term, so it should be interpreted as "including but not limited to". The subsequent description of the specification is a preferred embodiment of the present disclosure, but the description is based on the general principles of the specification and is not used to limit the scope of the present disclosure. The scope of protection of the present disclosure shall be determined by the attached claims.

[0035] To facilitate understanding of the embodiments of the present disclosure, further explanation will be given below using specific embodiments as examples in conjunction with the accompanying drawings, and each of the accompanying drawings does not constitute a limitation on the embodiments of the present disclosure.

[0036] In one embodiment, if Figure 1 As shown, the present disclosure provides a page turning method for a book reader, comprising the following steps:

[0037] S100: Acquire a reading page and initialize to acquire original coordinates of the reading page, the reading page including a current page, a previous page and a next page;

[0038] In this step, you first need to obtain the reading page resource. Specifically, you can obtain the original data of the reading page, such as documents in HTML, XML, JSON and other formats, through HTTP / HTTPS requests, local file reading, etc.; then use the corresponding parsing library or tools (such as HTML / DOM parser, XML parser, etc.) to parse the obtained raw data into structured data, such as DOM tree, XML node tree, etc.

[0039] Next, you need to initialize the reading environment for the obtained reading page, including:

[0040] Set page layout, font, font size, color theme, spacing, margins and other style attributes according to the reader's design specifications and user preferences, and ensure that these style settings do not affect the extracted original coordinate values;

[0041] Initialize and display the reader's user interface elements, such as page numbers, chapter navigation, table of contents, search box, settings panel, share button, bookmark function, etc., to prevent these interface elements from blocking or affecting the interaction or layout based on the original coordinates.

[0042] After completing the initialization of the reading environment, obtain the width screenwidth and height screenheight of the current screen window of the reader, and construct the following Figure 2 The three reading pages shown are arranged horizontally with a width of screenwidth and a height of screenheight. The three reading pages are defined as the previous page, the current page and the next page respectively, where the original coordinates of the previous page are defined as (-screenwidth, 0), the original coordinates of the current page are defined as (0, 0), and the original coordinates of the next page are defined as (screenwidth, 0).

[0043] S200: When the sliding of the user on the current page is determined to be a smooth sliding based on the sliding coordinates of the user on the current page, executing step S300;

[0044] In this step, when the user needs to turn the page after reading the content displayed on the current page, he or she first needs to place the finger on the display screen of the reader. When the finger touches the display screen and no sliding action is performed to slide the current page in any direction, the coordinates of the current touch point of the finger and the display screen are marked as the coordinates before sliding, expressed as startPoint(x1,y1).

[0045] Further, such as Figure 3 As shown, when the finger slides a certain distance in any direction on the display screen, the current coordinates of the finger after sliding on the display screen are obtained and recorded as the coordinates after sliding, which are expressed as movePoint(x2, y2).

[0046] Furthermore, after obtaining the coordinates startPoint(x1, y1) before sliding and movePoint(x2, y2) after sliding, the offset between the coordinates startPoint(x1, y1) before sliding and movePoint(x2, y2) after sliding can be calculated, and then the offset is compared with the minimum sliding touchSlop to determine whether the above sliding is smooth sliding. The specific calculation process of the offset is as follows:

[0047] 1. Calculate the offset offsetX1 of the coordinates startPoint(x1,y1) before sliding and the coordinates movePoint(x2,y2) after sliding along the X-axis direction, that is, offsetX1=x1-x2;

[0048] 2. Calculate the offset Y1 of the coordinates startPoint(x1, y1) before sliding and movePoint(x2, y2) after sliding, that is, offsetY1 = y1 - y2;

[0049] 3. If offsetX1 is greater than offsetY1 and greater than the minimum touchSlop, the above sliding is considered to be smooth sliding. It should be noted that the minimum touchSlop is a fixed value, the specific size of which is related to the terminal device itself and can be obtained through ViewContfiguration.get(getConetxt()).getScaledTouchSlop() of the terminal device.

[0050] S300: modifying the original coordinates of the reading page according to the offset of the user sliding on the current page, and drawing text on the reading page line by line;

[0051] In this step, modifying the original coordinates of the reading page according to the offset of the user sliding on the current page specifically includes the following steps:

[0052] 1. Receive sliding events and offsets;

[0053] Set a slide gesture listener in the reader user interface to capture the user's horizontal slide behavior on the current page; and in the slide event callback function, get the offset offsetX generated by the slide.

[0054] In the Android system, you can use GestureDetector to set the sliding gesture listener. The specific setting steps are as follows:

[0055] 1.1 In Activity or Fragment, introduce

[0056] The androidx.core.view.GestureDetectorCompat library can be implemented by the following code:

[0057] import androidx.core.view.GestureDetectorCompat;

[0058] 1.2 Create GestureDetector: Define a

[0059] GestureDetectorCompat instance, and pass an anonymous class or custom class that implements the GestureDetector.SimpleOnGestureListener interface into its constructor. This can be achieved through the following code:

[0060]

[0061]

[0062] 1.3 Set an onTouchEvent listener on the view of the reader interface (such as RecyclerView, ScrollView, or custom view) and pass the touch event to gestureDetector for processing. This can be achieved through the following code:

[0063]

[0064] 2. Modify the reading page coordinates;

[0065] The original coordinates of the reading page can be modified according to the offset offsetX1. The specific modification method is as follows:

[0066] Change the original coordinates of the previous page (-screenwidth, 0) to (-screenwidth-offsetX, 0) in real time;

[0067] Change the original coordinates (0,0) of the current page to (-offsetX,0) in real time;

[0068] Modify the original coordinates of the next page (screenwidth, 0) to (screenwidth-offsetX, 0) in real time.

[0069] Furthermore, drawing text line by line on the reading page includes the following steps:

[0070] 1. Carry out text layout;

[0071] In this step, the width, height and starting position of each line of text are first calculated based on the text content and typesetting rules of the current page (such as font, font size, line spacing, alignment, etc.). If the page content is loaded dynamically, ensure that the text data of the current page has been obtained and parsed during the sliding process.

[0072] 2. Draw text;

[0073] 2.1 Use a drawing library (such as HTML5 Canvas, WebGL, custom rendering engine, etc.) to draw text line by line in sequence starting from the first line according to the new coordinates of the current page (ie -offsetX, 0). For each line, the absolute position of the line relative to the screen at the current offset should be calculated (considering the page coordinates and sliding offset).

[0074] 2.2 Use the text drawing function to draw text at the corresponding position.

[0075] In this step, the inventors developed a variety of text drawing functions using Python, Java and JavaScript languages ​​to achieve text drawing, among which:

[0076] 2.2.1 An example of a text drawing function developed in Python is as follows:

[0077]

[0078]

[0079] The above code uses the matplotlib.pyplot library to create a new plot window (figure) and obtains a subplot (axes) object through the subplots() function. Then, the ax.text() method is used to add text at the specified coordinates (x, y) of the subplot, and the font size, color, and horizontal and vertical alignment of the text are set. Finally, the drawn figure is displayed through plt.show().

[0080] 2.2.2 An example of a drawing function developed in Java is as follows:

[0081] import javafx.scene.canvas.Canvas;

[0082] import javafx.scene.canvas.GraphicsContext;

[0083] import javafx.scene.paint.Color;

[0084] / / Create a new Canvas object, specifying its width and height

[0085] Canvas canvas=new Canvas(width,height);

[0086] / / Get the GraphicsContext object of the Canvas object to draw graphics and text

[0087] GraphicsContext gc=canvas.getGraphicsContext2D();

[0088] / / Set the fill color to black. The graphics drawn using the fillXXX method will be filled with this color.

[0089] gc.setFill(Color.BLACK);

[0090] / / Set the font to Arial and the font size to 16

[0091] gc.setFont(new Font("Arial",16));

[0092] / / Set the text alignment to center

[0093] gc.setTextAlign(TextAlignment.CENTER);

[0094] / / Draw text on Canvas, specify text content and center point coordinates (centerX, centerY)

[0095] gc.fillText("Your Text Here",centerX,centerY);

[0096] The above code creates a Canvas object using the JavaFX library and draws text through its GraphicsContext interface.

[0097] First, a Canvas object with specified width and height is created, which is the basic component for drawing graphics in JavaFX.

[0098] Then, by calling canvas.getGraphicsContext2D() method, you can get the GraphicsContext object associated with the Canvas, which is the actual executor of all drawing operations.

[0099] Next, use the gc.setFill() method to set the current fill color to black. The graphics drawn using the fillXXX series of methods will be filled with this color.

[0100] Set the font style and size. Here we use Arial font with a font size of 16 pixels, which is implemented through the gc.setFont() method.

[0101] Use the gc.setTextAlign() method to set the text alignment. Here, TextAlignment.CENTER is specified, which means that the text drawn subsequently will be aligned horizontally in the center.

[0102] Finally, call the gc.fillText() method to draw the text on the Canvas. It accepts three parameters: the text content to be drawn ("Your Text Here"), the x-coordinate (centerX) and y-coordinate (centerY) of the center point of the text. According to the previously set center alignment, the text will be drawn with these two coordinates as the center.

[0103] 2.2.3 An example of a drawing function developed using JavaScript is as follows:

[0104] / / Get the HTML document with id 'myCanvas' <canvas>element

[0105] const canvas=document.getElementById('myCanvas');

[0106] / / Get the 2D rendering context from the acquired canvas element

[0107] const ctx=canvas.getContext('2d');

[0108] / / Set font properties, including font size (16 pixels) and font type (Arial)

[0109] ctx.font = '16px Arial';

[0110] / / Set the fill color to black. The graphics or text filled with fillStyle will use this color.

[0111] ctx.fillStyle = 'black';

[0112] / / Set the horizontal alignment of the text to center

[0113] ctx.textAlign = 'center';

[0114] / / Draw text on canvas, specify text content, center point coordinates (half of canvas width, half of canvas height)

[0115] ctx.fillText('Your Text Here',canvas.width / 2,canvas.height / 2);

[0116] The above code uses the HTML DOM API to obtain the Canvas object on the page with the id myCanvas. <canvas>Element and obtain its 2D rendering context for graphics and text drawing.

[0117] Use document.getElementById('myCanvas') to retrieve the element with id myCanvas from the HTML document. <canvas>Element. This element is the host for graphics drawing.

[0118] Call canvas.getContext('2d') to get the 2D rendering context object (usually referred to as ctx) of the canvas element, which is the interface used to perform all 2D drawing operations.

[0119] Use the ctx.font property to set the font style and size. Here, the font is set to Arial and the size is set to 16 pixels.

[0120] Set the current fill color to black, which is implemented through the ctx.fillStyle property. The graphics or text drawn by subsequent methods such as fillRect and fillText will be filled with this color.

[0121] Specify the horizontal alignment of the text as center alignment, and use the ctx.textAlign property to set it. This will affect the horizontal layout position of the text drawn later.

[0122] Finally, use the ctx.fillText method to draw text on the canvas. The parameters passed in are: the text content to be drawn ("Your Text Here"), the x coordinate of the center point of the text (canvas.width / 2, which is half of the canvas width, to ensure that the text is horizontally centered) and the y coordinate (canvas.height / 2, which is half of the canvas height, to ensure that the text is vertically centered). In this way, the text will be drawn centered based on the center point of the canvas.

[0123] In addition, it should be noted that in order to prevent the user from sliding excessively and causing the page content to exceed the visible range, when sliding to a critical point (such as about to slide to the next page or previous page), the sliding can be locked, the page turning animation can be triggered, or the adjacent page content can be automatically loaded.

[0124] It should be further explained that for long reading content with a large amount of text, in order to improve drawing efficiency, text caching technology can be used, that is, the text is drawn into an off-screen Canvas or texture in advance, and these pre-drawn textures are directly reused when sliding, rather than recalculating and drawing the text every time.

[0125] S400: Execute whether to turn the page based on the final coordinates when the user completes sliding and leaves the current page;

[0126] In this step, the final coordinates of the user after completing the sliding of the current page and leaving the current page are recorded as endPoint(x3,y3). The offset between endPoint(x3,y3) and the coordinates before sliding startPoint(x1,y1) is calculated through the following steps, and the offset is compared with the minimum value minPage of whether the page can be turned to determine whether to turn the page and the direction of turning the page:

[0127] 1. Calculate the offset offsetX2 between the final coordinate endPoint(x3,y3) and the coordinate startPoint(x1,y1) before sliding along the X-axis direction, that is, offsetX2 = x1-x3;

[0128] 2. Calculate the offset Y2 between the final coordinate endPoint(x3, y3) and the coordinate startPoint(x1, y1) before sliding, that is, offsetY2 = y1-y3;

[0129] 3. When the offset offsetX2 is greater than minPage (minPage is calculated based on the screen width screenwidth, that is, minPage = screenwidth / 4) and greater than the offset offsetY2, the page turning operation is performed. If the offset offsetX2 is a positive number, the current page is left and the next page is entered (such as Figure 4 Otherwise, return to the previous page.

[0130] In addition, when the user performs page turning by smooth sliding, although the user performs the above-mentioned smooth sliding operation, the sliding distance on the current page is not enough, resulting in the offset offsetX2 being difficult to meet the above-mentioned page turning requirement. At this time, a substitute solution needs to be executed to assist in completing the page turning. The substitute solution is specifically:

[0131] 1. Calculate the distance between the final coordinate endPoint(x3,y3) before the page is turned and the coordinate startPoint(x1,y1) before sliding, that is, distance = screenwidth – offsetX2.

[0132] 2. Modify the coordinates of the current page, the previous page, and the next page within 100ms according to the distance when the page turning is not completed, and draw text line by line on the reading page, so as to complete the page turning operation.

[0133] In another embodiment, after turning the current page based on the above steps, a new reading page can be obtained, which includes a new current page, a new previous page and a new next page. At this time, the turning operation of the new reading page can be completed by repeating steps S100 to S400.

[0134] In this embodiment, when the user completes the page turning operation of the current page by smooth sliding, the original coordinates of the reading page need to be modified to obtain a new reading page. The specific operation steps are as follows:

[0135] 1. If you turn to the next page by smooth sliding, the original coordinates of the previous page (-screenwidth, 0) are changed to (screenwidth, 0), and the information of the previous page is copied to the new variable swap. The original current page is changed to the previous page, the original next page is changed to the current page, and the next page is changed to swap. After the swap is completed, the rendering is refreshed and the new content is rendered to the next page.

[0136] 2. If you turn to the previous page by sliding smoothly, change the original coordinates of the next page (screenwidth, 0) to (-screenwidth, 0), and copy the information of the next page to the new variable swap, change the original current page to the next page, change the original previous page to the current page, change the previous page to swap, complete the swap, and then refresh the rendering, and render the new content to the previous page.

[0137] In another embodiment, the present disclosure further provides a page turning device for a book reader, comprising:

[0138] An initialization module, used to obtain a reading page and initialize to obtain the original coordinates of the reading page, wherein the reading page includes a current page, a previous page, and a next page;

[0139] A sliding module, used to determine whether the user's sliding on the current page is a smooth sliding based on the sliding coordinates of the user on the current page;

[0140] A drawing module, used to modify the original coordinates of the reading page according to the offset of the user sliding on the current page, and to draw text on the reading page line by line;

[0141] The page turning execution module is used to execute whether to turn the page based on the final coordinates when the user completes sliding and leaves the current page.

[0142] The present disclosure also provides an electronic device, comprising:

[0143] A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein:

[0144] When the processor executes the program, any of the above methods is implemented.

[0145] The present disclosure also provides a computer storage medium storing computer executable instructions for executing any of the above methods.

[0146] The above embodiments are only for illustrating the technical concept and features of the present invention, and their purpose is to enable people familiar with the technology to understand the content of the present invention and implement it accordingly, and they cannot be used to limit the protection scope of the present invention. Any equivalent changes or modifications made according to the spirit of the present invention should be included in the protection scope of the present invention.< / canvas> < / canvas> < / canvas>

Claims

1. A page turning method of a book reader, comprising the following steps: S100: Obtain and initialize a reading page, wherein the reading page includes a current page, a previous page, and a next page; S200: When the sliding of the user on the current page is determined to be a smooth sliding, executing step S300; S300: drawing text line by line on the reading page; S400: Whether to turn the page based on the user completing the sliding execution.

2. The method according to claim 1, wherein: Preferably, step S200 includes the following steps: S201: Obtain the coordinates of the user before and after sliding on the current page.

3. The method according to claim 1, wherein: Step S400 includes the following steps: S401: Obtain the final coordinates of the user after the user completes sliding on the current page and leaves the current page.

4. A page turning device for a book reader, comprising: An initialization module, used to obtain and initialize a reading page, wherein the reading page includes a current page, a previous page, and a next page; A sliding module, configured to execute step S300 when the sliding of the user on the current page is determined to be a smooth sliding; A drawing module, used for drawing text line by line on the reading page; The page turning execution module is used to determine whether to turn the page based on the user completing the sliding execution.

5. An electronic device comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the method according to any one of claims 1 to 3 is implemented.

6. A computer storage medium storing computer executable instructions for executing the method according to any one of claims 1 to 3.