{"id":15030964,"url":"https://github.com/eschao/android-pageflip","last_synced_at":"2025-05-15T17:01:42.853Z","repository":{"id":39170457,"uuid":"67930104","full_name":"eschao/android-PageFlip","owner":"eschao","description":"3D Style Page Flip on Android","archived":false,"fork":false,"pushed_at":"2024-04-11T03:07:41.000Z","size":17096,"stargazers_count":1744,"open_issues_count":21,"forks_count":264,"subscribers_count":41,"default_branch":"master","last_synced_at":"2025-04-07T21:15:21.956Z","etag":null,"topics":["android","flip-animating","java","opengl-es","pageflip","pageturnning","reading-program"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eschao.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-09-11T13:02:12.000Z","updated_at":"2025-03-29T15:06:40.000Z","dependencies_parsed_at":"2024-04-11T04:29:08.785Z","dependency_job_id":"83a8c249-d301-4243-9920-47599ca58603","html_url":"https://github.com/eschao/android-PageFlip","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eschao%2Fandroid-PageFlip","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eschao%2Fandroid-PageFlip/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eschao%2Fandroid-PageFlip/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eschao%2Fandroid-PageFlip/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eschao","download_url":"https://codeload.github.com/eschao/android-PageFlip/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247730070,"owners_count":20986404,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","flip-animating","java","opengl-es","pageflip","pageturnning","reading-program"],"created_at":"2024-09-24T20:14:37.694Z","updated_at":"2025-04-07T21:15:38.528Z","avatar_url":"https://github.com/eschao.png","language":"Java","readme":"[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-3D%20Style%20PageFlip-brightgreen.svg?style=flat)]()\n\n# PageFlip\nThis project is aimed to implement 3D style page flip on Android system based on OpenGL 2.0.\n\nFor **JNI** version, please visit: [**android-PageFlip-JNI**](https://github.com/eschao/android-PageFlip-JNI)\n\n## Table of Contents\n \n * [Preview](#preview)\n * [Installation](#installation)\n   - [Gradle](#gradle)\n * [Android Version Support](#android-version-support)\n * [Usage](#usage)\n   - [Introduce PageFlip Into Your Project](#i-simple-steps-for-introducing-pageflip-into-your-project)\n   - [Configure PageFilp](#ii-configure-pageflip)\n     + [Page Mode](#1-page-mode)\n     + [Click Screen To Flip](#2-click-screen-to-flip)\n     + [Area Of Clicking To Flip](#3-area-of-clicking-to-flip)\n     + [PageFlip Listener](#4-pageflip-listener)\n     + [Mesh Pixels](#5-mesh-pixels)\n     + [Ratio Of Semi-peremeter](#6-ratio-of-semi-peremeter)\n     + [Mask Alpha For The Back Of Fold Page](#7-mask-alpha-for-the-back-of-fold-page)\n     + [Edge Shadow Color/Alpha Of Fold Page](#8-edge-shadow-coloralpha-of-fold-page)\n     + [Base Shadow Color/Alpha Of Fold Page](#9-base-shadow-coloralpha-of-fold-page)\n     + [Edge Shadow Width Of Fold Page](#10-edge-shadow-width-of-fold-page)\n     + [Base Shadow Width Of Fold Page](#11-base-shadow-width-of-fold-page)\n     + [Duration Of Flip Animating](#12-duration-of-flip-animating)\n     \n * [License](#license)\n \n## Preview\n\n![SinglePage](https://cloud.githubusercontent.com/assets/20178358/20646678/df7c6ba4-b4ba-11e6-8753-6f764f825cc2.png)    ![DoublePages](https://cloud.githubusercontent.com/assets/20178358/20646731/20f6ebc6-b4bc-11e6-9857-efd8367db80c.png)\n\n## Installation\n\n#### Gradle\n\nAdd it to your build.gradle with:\n```gradle\nallprojects {\n    repositories {\n        maven { url \"https://jitpack.io\" }\n    }\n}\n```\nand:\n\n```gradle\ndependencies {\n    compile 'com.github.eschao:android-PageFlip:1.0.2'\n}\n```\n## Android Version Support\n\nThe following versions have been tested on emulator:\n\nAndroid version | API version | Support |\n----------------|-------------|---------|\n3.2   | API 13 | x |\n4.1   | API 16 | √ |\n4.2   | API 17 | √ |\n4.3   | API 18 | √ |\n4.4   | API 19 | √ |\n5.0   | API 21 | √ |\n5.1   | API 22 | √ |\n6.0   | API 23 | √ |\n7.0   | API 24 | √ |\n7.1.1 | API 25 | √ |\n7.+   | API 26 | √ |\n\n## Usage\n\n### I. Simple steps for introducing PageFlip into your project\n\n* Creates a surface view class extending from **GLSurfaceView**\n* Implements android **Renderer** interface to draw your content on a bitmap and set it as a texture of **PageFlip**\n* Instanitiates a **PageFlip** object in the constructor of your surface view\n* Configures **PageFlip**, For example: set animating duration, page mode or mesh pixels\n* Handles the below android events:\n\n  * **onFingerDown**: notify *PageFlip* object to prepare flip \n  * **onFingerMove**: notify *PageFlip* object to compute data for drawing flip frame\n  * **onFingerUp**: notify *PageFlip* object to determine whether or not launching a flip animation\n  * **onSurfaceCreated**: notify *PageFlip* object to handle usreface creating event\n  * **onSurfaceChanged**: notify *PageFlip* object to handle surface changing event\n  \n* You may need a message handler to send/receive an drawing message. Please refer to **PageFlipView** in sample application.\n* You may need a lock to avoid conflicts between main thread and OpenGL rendering thread. Please refer to **PageFlipView** in sample application.\n\nMore details, please take a look **PageFlipView** in sample application.\n\n### II. Configure PageFlip\n\n**PageFlip** library provides some configurations for customizing its behaviors. For example: shadow color and alpha, mesh pixels and page mode. \n\n#### 1. Page Mode\n\n  There are two page modes provided by **PageFlip**:\n  \n  * **Auto Page Mode**: In this mode, **PageFlip** will automatically decide to use single page or double pages to present content on screen. That means single page is used for portrait mode and double pages is used for lanscape mode.\n  * **Single Page Mode**: No matter screen is portait or landscape mode, **PageFlip** always use single page to show content\n\n\nYou can use **enableAutoPage** to enable auto page mode or disable it(equally enable single page mode).\n\n  Example:\n  ```java\n    // enable auto page mode\n    mPageFlip.enableAutopage(true); \n  ```\n  \n#### 2. Click screen to flip\n  \n  You can enable/disable clicking screen to flip\n  \n  Example:\n  ```java\n    // enable clicking to flip\n    mPageFlip.enableClickToFlip(true);\n  ```\n  \n#### 3. Area of clicking to flip\n  \n  You can give a ratio of page width from 0 to 0.5f to set an area for reponsing click event to trigger a page flip. The default value is **0.5f**, which means the backfward flip will happen if you click the left half of screen and forward flip will start if you click the right half of screen in single page mode.\n  \n  Example:\n  ```java\n    // set ratio with 0.3\n    mPageFlip.setWidthRatioOfClickToFlip(0.3f);\n  ```\n\n#### 4. PageFlip listener\n\n  You can set a listener to tell **PageFlip** if the forward flip or backward flip could happen.\n   \n  Example:\n  ```java\n    mPageFlip.setListener(mListener);\n  ```\n \n#### 5. Mesh pixels\n\n  Set how many pixels are used for a mesh. The less pxiels the mesh uses, the more fine the drawing is and the lower the  performance is. The default value is 10 pixels.\n  \n  Example:\n  ```java\n    mPageFlip.setPixelsOfMesh(5);\n  ```\n  \n#### 6. Ratio of semi-peremeter\n\n  When page is curled, it is actually tackled as a semi-cylinder by **PageFlip**. You can set size of the semi-cylinder to change the flip shap. Since the semi-cylinder dependeds on the line length from the touch point to original point(see the below illustration), you need to provide a ratio of this line length to tell **PageFlip** the peremeter of the semi-cylinder. The default value is 0.8f.\n  \n  ```\n    +----------------+\n    |   touchP       |\n    |       .        | \n    |        \\       |\n    |         + p0   |\n    |          \\     |\n    |           \\    |\n    |        p1  +   |\n    |              \\ |\n    +----------------+\n                original point, that means you drag the page from here to touch point(touchP)\n  \n    The length from p0 to p1 is peremeter of semi-cylinder and determined by ratio your giving\n  ```\n  \n  Example:\n  ```java\n    mPageFlip.setSemiPerimeterRatio(0.6f);\n  ```\n  \n#### 7. Mask alpha for the back of fold page\n\n  You can set the mask alpha for the back of fold page when page is curled in single page mode. The default value is 0.6f.\n  \n  Example:\n  ```java\n    mPageFlip.setMaskAlphaOfFold(0.5f);\n  ```\n  \n#### 8. Edge shadow color/alpha of fold page\n\n  You can set start/end color and start/end alpha for edge shadow of fold page.\n  \n  Example:\n  ```java\n    // set start color with 0.1f, start alpha with 0.2f, end color with 0.5f\n    // and end alpha with 1f\n    mPageFlip.setShadowColorOfFoldBase(0.1f, 0.2f, 0.5f, 1f);\n  ```\n\n#### 9. Base shadow color/alpha of fold page\n\n  You can set start/end color and start/end alpha for base shadow of fold page.\n  \n  Example:\n  ```java\n    mPageFlip.setShadowColorOfFoldBase(0.05f, 0.2f, 0.5f, 1f);\n  ```\n  \n#### 10. Edge shadow width of fold page\n\n  When page is curled, the size of fold page will follow the finger movement to be changed and its edge shadow width should be changed accordingly. You can set an appropriate width range for shadow width.\n  \n  Example:\n  ```java\n    // set the minimal width is 5 pixels and maximum width is 40 pixels.\n    // set the ratio is 0.3f which means the width will be firstly computed by formula: \n    // width = diameter of semi-cylinder * 0.3f, and then compare it with minimal\n    // and maximal value to make sure the width is in range.\n    mPageFlip.setShadowWidthOfFoldEdges(5, 40, 0.3f);\n  ```\n\n#### 11. Base shadow width of fold page\n\n  Like **[Edge shadow width of fold page](10-edge-shadow-width-of-fold-page)**, You can set an appropriate width range for base shadow of fold page.\n  \n  Example:\n  ```java\n    // see {@link #setShadowWidthOfFoldEdges} function\n    mPageFlip.setShadowWidthOfFoldBase(5, 40, 0.4f);\n  ```\n\n#### 12. Duration of flip animating\n\n  You can give a duration for flip animating when you call **onFingerUp** function to handle the finger up event.\n  \n  Example:\n  ```java\n    // the last parameter is duration with millisecond unit, here we set it with 2 seconds.\n    mPageFlip.onFingerUp(x, y, 2000);\n  ```\n  \n## License\nThis project is licensed under the Apache License Version 2.0.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feschao%2Fandroid-pageflip","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feschao%2Fandroid-pageflip","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feschao%2Fandroid-pageflip/lists"}