Code Monkey home page Code Monkey logo

android-pageflip's Introduction

Android Arsenal

PageFlip

This project is aimed to implement 3D style page flip on Android system based on OpenGL 2.0.

For JNI version, please visit: android-PageFlip-JNI

Table of Contents

Preview

SinglePage DoublePages

Installation

Gradle

Add it to your build.gradle with:

allprojects {
    repositories {
        maven { url "https://jitpack.io" }
    }
}

and:

dependencies {
    compile 'com.github.eschao:android-PageFlip:1.0.2'
}

Android Version Support

The following versions have been tested on emulator:

Android version API version Support
3.2 API 13 x
4.1 API 16
4.2 API 17
4.3 API 18
4.4 API 19
5.0 API 21
5.1 API 22
6.0 API 23
7.0 API 24
7.1.1 API 25
7.+ API 26

Usage

I. Simple steps for introducing PageFlip into your project

  • Creates a surface view class extending from GLSurfaceView

  • Implements android Renderer interface to draw your content on a bitmap and set it as a texture of PageFlip

  • Instanitiates a PageFlip object in the constructor of your surface view

  • Configures PageFlip, For example: set animating duration, page mode or mesh pixels

  • Handles the below android events:

    • onFingerDown: notify PageFlip object to prepare flip
    • onFingerMove: notify PageFlip object to compute data for drawing flip frame
    • onFingerUp: notify PageFlip object to determine whether or not launching a flip animation
    • onSurfaceCreated: notify PageFlip object to handle usreface creating event
    • onSurfaceChanged: notify PageFlip object to handle surface changing event
  • You may need a message handler to send/receive an drawing message. Please refer to PageFlipView in sample application.

  • You may need a lock to avoid conflicts between main thread and OpenGL rendering thread. Please refer to PageFlipView in sample application.

More details, please take a look PageFlipView in sample application.

II. Configure PageFlip

PageFlip library provides some configurations for customizing its behaviors. For example: shadow color and alpha, mesh pixels and page mode.

1. Page Mode

There are two page modes provided by PageFlip:

  • 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.
  • Single Page Mode: No matter screen is portait or landscape mode, PageFlip always use single page to show content

You can use enableAutoPage to enable auto page mode or disable it(equally enable single page mode).

Example:

  // enable auto page mode
  mPageFlip.enableAutopage(true); 

2. Click screen to flip

You can enable/disable clicking screen to flip

Example:

  // enable clicking to flip
  mPageFlip.enableClickToFlip(true);

3. Area of clicking to flip

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.

Example:

  // set ratio with 0.3
  mPageFlip.setWidthRatioOfClickToFlip(0.3f);

4. PageFlip listener

You can set a listener to tell PageFlip if the forward flip or backward flip could happen.

Example:

  mPageFlip.setListener(mListener);

5. Mesh pixels

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.

Example:

  mPageFlip.setPixelsOfMesh(5);

6. Ratio of semi-peremeter

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.

  +----------------+
  |   touchP       |
  |       .        | 
  |        \       |
  |         + p0   |
  |          \     |
  |           \    |
  |        p1  +   |
  |              \ |
  +----------------+
              original point, that means you drag the page from here to touch point(touchP)

  The length from p0 to p1 is peremeter of semi-cylinder and determined by ratio your giving

Example:

  mPageFlip.setSemiPerimeterRatio(0.6f);

7. Mask alpha for the back of fold page

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.

Example:

  mPageFlip.setMaskAlphaOfFold(0.5f);

8. Edge shadow color/alpha of fold page

You can set start/end color and start/end alpha for edge shadow of fold page.

Example:

  // set start color with 0.1f, start alpha with 0.2f, end color with 0.5f
  // and end alpha with 1f
  mPageFlip.setShadowColorOfFoldBase(0.1f, 0.2f, 0.5f, 1f);

9. Base shadow color/alpha of fold page

You can set start/end color and start/end alpha for base shadow of fold page.

Example:

  mPageFlip.setShadowColorOfFoldBase(0.05f, 0.2f, 0.5f, 1f);

10. Edge shadow width of fold page

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.

Example:

  // set the minimal width is 5 pixels and maximum width is 40 pixels.
  // set the ratio is 0.3f which means the width will be firstly computed by formula: 
  // width = diameter of semi-cylinder * 0.3f, and then compare it with minimal
  // and maximal value to make sure the width is in range.
  mPageFlip.setShadowWidthOfFoldEdges(5, 40, 0.3f);

11. Base shadow width of fold page

Like Edge shadow width of fold page, You can set an appropriate width range for base shadow of fold page.

Example:

  // see {@link #setShadowWidthOfFoldEdges} function
  mPageFlip.setShadowWidthOfFoldBase(5, 40, 0.4f);

12. Duration of flip animating

You can give a duration for flip animating when you call onFingerUp function to handle the finger up event.

Example:

  // the last parameter is duration with millisecond unit, here we set it with 2 seconds.
  mPageFlip.onFingerUp(x, y, 2000);

License

This project is licensed under the Apache License Version 2.0.

android-pageflip's People

Contributors

eschao avatar hiteshsahu avatar unarch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

android-pageflip's Issues

backward flipping taking second image

I need to render pages sequence wise....
with singlepagerender i just changed getrandombitmap with pagenumber....

forward flipping working fine rendering next image.

but backward flipping not taking previous image its showing nextimage

How to maintain the sequence of the page flip.

Hey its a wonderful library . I am trying to implement it, but the library does not the show pages in sequence I declared in array. And when i go to previous page their is some other random page. I want to maintain the sequence just like a book. Can you help on this.

how put text in page

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

How to get this working for Custom Layouts?

Please guide me how would i be able to play a .gif file in this example. As you are only dealing with Bitmaps. Is there any way to have the same effect on Custom .xml Layouts?

适配 api15 成功

手机参数:
API 15;480x800;中兴。。。
修改过程:

  1. 把 drawable 目录下的图片分别放到 hdpi、xhdpi、xxhdpi 目录下。
  2. 源码还没细看,所以把 #19 中提到的问题用很粗鲁的方式修改了,该修改方法并不可靠。如下
public void set(int w, int h, int maxCached) {
        pageWidth = w;
        pageHeight = h;

        int newIndex = LARGE_BG;
        if ((w <= 480 && h <= 854) ||
            (w <= 854 && h <= 480)) {
            mBGSizeIndex = SMALL_BG;
        }
        else if ((w <= 800 && h <= 1280) ||
                 (h <= 800 && w <= 1280)) {
            mBGSizeIndex = MEDIUM_BG;
        } else {
            mBGSizeIndex = LARGE_BG;
        }

        mIsLandscape = w > h;

        if (maxCached != mQueueMaxSize) {
            mQueueMaxSize = maxCached;
        }

        if (newIndex != mBGSizeIndex) {
//            mBGSizeIndex = newIndex;
            synchronized (this) {
                cleanQueue();
                notify();
            }
        }
    }
  1. 参考 android_page_curl 中的一部分逻辑,即计算最邻近的 2 的指数部分,修改了 createBitmap 的宽高参数。

说明:
1 和 2 主要是为了节省内存,担心老手机带不动,3 是因为刚开始在手机上调试的时候,图片加载不出来,故尝试使用该方法。没想到居然成了==。

Demo not working in landscape mode

I am using this library in a sample app and found that the page flip doeant work in landscape mode. I tried the semo app on play store and found that portrait mode works but landscape mode shows black screen as earlier reported. I am stuck here. I wish i could fix it. Can someone please help me. Many many thanks in advance.

Zooming functionality

Is it possible to add pinch-zoom functionality without breaking existing touch listeners?

One page's left to right curl

I'm using the library to present Arabic's book, left to right curl is a necessity. I saw it on two pages mode, but is there any way I can use it for one page mode? Much like a reversed version of the default one page's curl. Regards.

Sample not working in the Emulator

When I open the Sample in the Android Emulator(API 25), it displays a black screen and this error is displayed in the Run tab of the Android Studio.
distrib/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glDeleteShader:622 error 0x501
and this in logcat

  EGL_emulation  E  tid 5175: eglSurfaceAttrib(1174): error 0x3009 (EGL_BAD_MATCH)
 OpenGLRenderer  W  Failed to set EGL_SWAP_BEHAVIOR on surface 0xa13fd320, error=EGL_BAD_MATCH
       GLShader  E  Can'top compile shader for type: 35632Error: 0
                 E  Compile shader error: ERROR: 0:3: '' : No precision specified for (float)
   PageFlipView  E  Failed to run PageFlipFlipRender:onSurfaceCreated
 LoadBitmapTask  D  Load Queue:0 in background!
                 D  Load Queue:0 in background!
emuglGLESv2_enc  E  device/generic/goldfish-opengl/system/GLESv2_enc/GL2Encoder.cpp:s_glUseProgram:1083 GL error 0x501
                 E  device/generic/goldfish-opengl/system/GLESv2_enc/GL2Encoder.cpp:s_glVertexAttribPointer:290 GL error 0x501
                 E  device/generic/goldfish-opengl/system/GLESv2_enc/GL2Encoder.cpp:s_glEnableVertexAttribArray:469 GL error 0x501
                 E  device/generic/goldfish-opengl/system/GLESv2_enc/GL2Encoder.cpp:s_glVertexAttribPointer:290 GL error 0x501
                 E  device/generic/goldfish-opengl/system/GLESv2_enc/GL2Encoder.cpp:s_glEnableVertexAttribArray:469 GL error 0x501
                 E  device/generic/goldfish-opengl/system/GLESv2_enc/GL2Encoder.cpp:s_glUseProgram:1083 GL error 0x501
                 E  device/generic/goldfish-opengl/system/GLESv2_enc/GL2Encoder.cpp:s_glVertexAttribPointer:290 GL error 0x501
                 E  device/generic/goldfish-opengl/system/GLESv2_enc/GL2Encoder.cpp:s_glEnableVertexAttribArray:469 GL error 0x501
                 E  device/generic/goldfish-opengl/system/GLESv2_enc/GL2Encoder.cpp:s_glVertexAttribPointer:290 GL error 0x501
                 E  device/generic/goldfish-opengl/system/GLESv2_enc/GL2Encoder.cpp:s_glEnableVertexAttribArray:469 GL error 0x501
  Choreographer  I  Skipped 34 frames!  The application may be doing too much work on its main thread.
emuglGLESv2_enc  E  device/generic/goldfish-opengl/system/GLESv2_enc/GL2Encoder.cpp:s_glUseProgram:1083 GL error 0x501
                 E  device/generic/goldfish-opengl/system/GLESv2_enc/GL2Encoder.cpp:s_glVertexAttribPointer:290 GL error 0x501
                 E  device/generic/goldfish-opengl/system/GLESv2_enc/GL2Encoder.cpp:s_glEnableVertexAttribArray:469 GL error 0x501
                 E  device/generic/goldfish-opengl/system/GLESv2_enc/GL2Encoder.cpp:s_glVertexAttribPointer:290 GL error 0x501
                 E  device/generic/goldfish-opengl/system/GLESv2_enc/GL2Encoder.cpp:s_glEnableVertexAttribArray:469 GL error 0x501

How can I modify the current page?

We found that the drawPage method, located inside the SinglePageRender on the sample app, displays the current page in text.

If the current page is three, the text will show three.

I would like to change the number on the current page without flip it.

What should I do?

Zoom in Page Flip

Hi i'm a newbie with open gl. I use your example and want to zoom with two fingers a picture. I have add in code ScaleGestureDetector and Listener. Where should i change scale ? Thanks.

AsyncPageRenderer?

Hi, first of all amazing for, however I need to customize bitmap loading logic.
Can you please give me pointers as how to implement if bitmap wants to be loaded asynchronously, say from network, I see that LoadbitmapTask.getBitmap is synchronous. (not thinking about decoding)

  • maybe some callback to request ahead bitmaps so they can get preloaded?

Thanks you

Modify current page./redraw current page.

Hi I am trying to update the text of my current page when a button is clicked.

I have the button working but I can't get the page to redraw with the new changes.
How can I redraw the current page on screen? Thank you.

How to click a button to flip page?

Hi There,

It's so nice to see your library. I'm trying to customized it. After research couple day, I still have some questions:

  1. How to determine which page that user move finger in (left page or right page)?
  2. How is clickToFlip() works?, I want to know that because I want to detect the action click to flip the page.
  3. Can I use the pageFlipView as a customize view in layout? It's seem wrong Point X Y when I'm trying to do that.

Getting input event consistency errors

On api level 19 I'm constantly getting

InputEventConsistencyVerifier: TouchEvent: ACTION_DOWN but pointers are already down.  Probably missing ACTION_UP from previous gesture.
  in android.view.GestureDetector@ad008e20

this causes some onDawn events not to register, so screen does not respond.

RTL Support

I need to provide RTL support for LEFT to RIGHT page flipping. Would you please help?

possible implement it into React Native?

I'm searching some of page flip animation recently, and found your great work in android 👍

but I'm not familiar with native code and also new in Opengl... :(

just curious is it possible to implement it into React Native (with gl-react-native-v2)?

if it is possible, I might need to learn native code and try to implement it into React Native

again thanks for your great work 👍

How to get Bitmaps in an order other than displaying Randomly ?

Hi

Could you please let me know how can I get the bitmaps in an order ?
In the LoadBitmapTask class there is a method getRandomBitmap() which is generating bitmaps randomly.
How the code should be written if I want to display them in a specific order ? (like the pages in book, which has an order).

What About loading image remotely

Hii eschao,
thanks for wonderful library .but what about loading image from server not from local can we do this.
if we can then how to do please provide some directions.

thanks

how to move particular page?

Hello.
First of all, thank you for making this open-source.

I would like to have a way to navigate to a particular page.
When analyzing source, page movement seems to be possible only through touch.
how to move particular page?

Unnecessary steps (?)

By the end of this method, variable mBGSizeIndex will always have value equals to LARGE_BG. Is this by intention? If it is, we could rewrite this method like below:

public void set(int w, int h, int maxCached) {
    mIsLandscape = w > h;

    if (maxCached != mQueueMaxSize) {
        mQueueMaxSize = maxCached;
    }

    mBGSizeIndex = LARGE_BG;
    synchronized (this) {
        cleanQueue();
        notify();
    }
}

Regards.

How to expand?

How to expand? smoothing pages, scrolling pages, and so on

Is it really to highlight the text on pages?

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?

Build failed at :Sample:transformClassesWithDexForDebug

When I imported your project into my Android Studio and built it, it got the following error in :Sample:transformClassesWithDexForDebug

org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':Sample:transformClassesWithDexForDebug'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:84)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:55)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:62)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:88)
at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:46)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:51)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.execute(DefaultTaskGraphExecuter.java:236)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.execute(DefaultTaskGraphExecuter.java:228)
at org.gradle.internal.Transformers$4.transform(Transformers.java:169)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:106)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:61)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:228)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:215)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:77)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:58)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:32)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:113)
at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
at org.gradle.execution.DefaultBuildExecuter.access$000(DefaultBuildExecuter.java:23)
at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:43)
at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:30)
at org.gradle.initialization.DefaultGradleLauncher$3.execute(DefaultGradleLauncher.java:196)
at org.gradle.initialization.DefaultGradleLauncher$3.execute(DefaultGradleLauncher.java:193)
at org.gradle.internal.Transformers$4.transform(Transformers.java:169)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:106)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:56)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:193)
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:119)
at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:102)
at org.gradle.launcher.exec.GradleBuildController.run(GradleBuildController.java:71)
at org.gradle.tooling.internal.provider.runner.BuildModelActionRunner.run(BuildModelActionRunner.java:50)
at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
at org.gradle.tooling.internal.provider.runner.RunAsBuildOperationBuildActionRunner$1.execute(RunAsBuildOperationBuildActionRunner.java:43)
at org.gradle.tooling.internal.provider.runner.RunAsBuildOperationBuildActionRunner$1.execute(RunAsBuildOperationBuildActionRunner.java:40)
at org.gradle.internal.Transformers$4.transform(Transformers.java:169)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:106)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:56)
at org.gradle.tooling.internal.provider.runner.RunAsBuildOperationBuildActionRunner.run(RunAsBuildOperationBuildActionRunner.java:40)
at org.gradle.tooling.internal.provider.runner.SubscribableBuildActionRunner.run(SubscribableBuildActionRunner.java:75)
at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:41)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:26)
at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:75)
at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:49)
at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:44)
at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:29)
at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:67)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:47)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72)
at org.gradle.util.Swapper.swap(Swapper.java:38)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:55)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:60)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:72)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)
at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:297)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.RuntimeException: com.android.build.api.transform.TransformException: java.lang.RuntimeException: java.lang.RuntimeException: Unable to pre-dex 'C:\Users\Pavilion Notebook 14.android\build-cache\6206aacd3ab69cef7072c587c0256735db1e2847\output\jars\classes.jar' to 'C:\Users\Pavilion Notebook 14\Desktop\android-PageFlip-master\android-PageFlip-master\Sample\build\intermediates\pre-dexed\debug\classes_ab235f8160567846bef21b613df9803cb4858c5e.jar'
at com.android.builder.profile.Recorder$Block.handleException(Recorder.java:55)
at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:104)
at com.android.build.gradle.internal.pipeline.TransformTask.transform(TransformTask.java:176)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$IncrementalTaskAction.doExecute(DefaultTaskClassInfoStore.java:163)
at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:134)
at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:123)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:95)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:76)
... 81 more
Caused by: com.android.build.api.transform.TransformException: java.lang.RuntimeException: java.lang.RuntimeException: Unable to pre-dex 'C:\Users\Pavilion Notebook 14.android\build-cache\6206aacd3ab69cef7072c587c0256735db1e2847\output\jars\classes.jar' to 'C:\Users\Pavilion Notebook 14\Desktop\android-PageFlip-master\android-PageFlip-master\Sample\build\intermediates\pre-dexed\debug\classes_ab235f8160567846bef21b613df9803cb4858c5e.jar'
at com.android.build.gradle.internal.transforms.DexTransform.transform(DexTransform.java:453)
at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:185)
at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:181)
at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:102)
... 92 more
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: Unable to pre-dex 'C:\Users\Pavilion Notebook 14.android\build-cache\6206aacd3ab69cef7072c587c0256735db1e2847\output\jars\classes.jar' to 'C:\Users\Pavilion Notebook 14\Desktop\android-PageFlip-master\android-PageFlip-master\Sample\build\intermediates\pre-dexed\debug\classes_ab235f8160567846bef21b613df9803cb4858c5e.jar'
at com.android.ide.common.internal.WaitableExecutor.waitForTasksWithQuickFail(WaitableExecutor.java:147)
at com.android.build.gradle.internal.transforms.DexTransform.transform(DexTransform.java:408)
... 95 more
Caused by: java.lang.RuntimeException: Unable to pre-dex 'C:\Users\Pavilion Notebook 14.android\build-cache\6206aacd3ab69cef7072c587c0256735db1e2847\output\jars\classes.jar' to 'C:\Users\Pavilion Notebook 14\Desktop\android-PageFlip-master\android-PageFlip-master\Sample\build\intermediates\pre-dexed\debug\classes_ab235f8160567846bef21b613df9803cb4858c5e.jar'
at com.android.build.gradle.internal.transforms.DexTransform$PreDexTask.call(DexTransform.java:521)
at com.android.build.gradle.internal.transforms.DexTransform$PreDexTask.call(DexTransform.java:457)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
... 3 more
Caused by: java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: com.android.builder.utils.FileCache$FileCreatorException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Error while executing java process with main class com.android.dx.command.Main with arguments {--dex --num-threads=4 --output C:\Users\Pavilion Notebook 14\Desktop\android-PageFlip-master\android-PageFlip-master\Sample\build\intermediates\pre-dexed\debug\classes_ab235f8160567846bef21b613df9803cb4858c5e.jar C:\Users\Pavilion Notebook 14.android\build-cache\6206aacd3ab69cef7072c587c0256735db1e2847\output\jars\classes.jar}
at com.android.builder.utils.FileCache.doInterProcessLocked(FileCache.java:680)
at com.android.builder.utils.FileCache.doLocked(FileCache.java:639)
at com.android.builder.utils.FileCache.queryCacheEntry(FileCache.java:395)
at com.android.builder.utils.FileCache.createFile(FileCache.java:290)
at com.android.build.gradle.internal.transforms.DexTransform$PreDexTask.call(DexTransform.java:518)
... 7 more
Caused by: java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: com.android.builder.utils.FileCache$FileCreatorException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Error while executing java process with main class com.android.dx.command.Main with arguments {--dex --num-threads=4 --output C:\Users\Pavilion Notebook 14\Desktop\android-PageFlip-master\android-PageFlip-master\Sample\build\intermediates\pre-dexed\debug\classes_ab235f8160567846bef21b613df9803cb4858c5e.jar C:\Users\Pavilion Notebook 14.android\build-cache\6206aacd3ab69cef7072c587c0256735db1e2847\output\jars\classes.jar}
at com.android.builder.utils.FileCache.doInterProcessLocked(FileCache.java:680)
at com.android.builder.utils.FileCache.doLocked(FileCache.java:639)
at com.android.builder.utils.FileCache.lambda$queryCacheEntry$10(FileCache.java:419)
at com.android.builder.utils.FileCache.doInterProcessLocked(FileCache.java:678)
... 11 more
Caused by: java.util.concurrent.ExecutionException: com.android.builder.utils.FileCache$FileCreatorException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Error while executing java process with main class com.android.dx.command.Main with arguments {--dex --num-threads=4 --output C:\Users\Pavilion Notebook 14\Desktop\android-PageFlip-master\android-PageFlip-master\Sample\build\intermediates\pre-dexed\debug\classes_ab235f8160567846bef21b613df9803cb4858c5e.jar C:\Users\Pavilion Notebook 14.android\build-cache\6206aacd3ab69cef7072c587c0256735db1e2847\output\jars\classes.jar}
at com.android.builder.utils.FileCache.doInterProcessLocked(FileCache.java:680)
at com.android.builder.utils.FileCache.doLocked(FileCache.java:639)
at com.android.builder.utils.FileCache.lambda$createFile$5(FileCache.java:282)
at com.android.builder.utils.FileCache.lambda$null$9(FileCache.java:440)
at com.android.builder.utils.FileCache.doInterProcessLocked(FileCache.java:678)
... 14 more
Caused by: com.android.builder.utils.FileCache$FileCreatorException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Error while executing java process with main class com.android.dx.command.Main with arguments {--dex --num-threads=4 --output C:\Users\Pavilion Notebook 14\Desktop\android-PageFlip-master\android-PageFlip-master\Sample\build\intermediates\pre-dexed\debug\classes_ab235f8160567846bef21b613df9803cb4858c5e.jar C:\Users\Pavilion Notebook 14.android\build-cache\6206aacd3ab69cef7072c587c0256735db1e2847\output\jars\classes.jar}
at com.android.builder.utils.FileCache.lambda$createFile$0(FileCache.java:241)
at com.android.builder.utils.FileCache.lambda$null$4(FileCache.java:285)
at com.android.builder.utils.FileCache.doInterProcessLocked(FileCache.java:678)
... 18 more
Caused by: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Error while executing java process with main class com.android.dx.command.Main with arguments {--dex --num-threads=4 --output C:\Users\Pavilion Notebook 14\Desktop\android-PageFlip-master\android-PageFlip-master\Sample\build\intermediates\pre-dexed\debug\classes_ab235f8160567846bef21b613df9803cb4858c5e.jar C:\Users\Pavilion Notebook 14.android\build-cache\6206aacd3ab69cef7072c587c0256735db1e2847\output\jars\classes.jar}
at com.android.builder.core.DexByteCodeConverter.dexOutOfProcess(DexByteCodeConverter.java:211)
at com.android.builder.core.DexByteCodeConverter.runDexer(DexByteCodeConverter.java:160)
at com.android.builder.core.AndroidBuilder.preDexLibraryNoCache(AndroidBuilder.java:1464)
at com.android.builder.internal.compiler.PreDexCache.preDexLibrary(PreDexCache.java:129)
at com.android.builder.core.AndroidBuilder.preDexLibrary(AndroidBuilder.java:1415)
at com.android.build.gradle.internal.transforms.DexTransform$PreDexTask.lambda$call$0(DexTransform.java:503)
at com.android.builder.utils.FileCache.lambda$createFile$0(FileCache.java:239)
... 20 more
Caused by: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Error while executing java process with main class com.android.dx.command.Main with arguments {--dex --num-threads=4 --output C:\Users\Pavilion Notebook 14\Desktop\android-PageFlip-master\android-PageFlip-master\Sample\build\intermediates\pre-dexed\debug\classes_ab235f8160567846bef21b613df9803cb4858c5e.jar C:\Users\Pavilion Notebook 14.android\build-cache\6206aacd3ab69cef7072c587c0256735db1e2847\output\jars\classes.jar}
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:192)
at com.android.builder.core.DexByteCodeConverter.dexOutOfProcess(DexByteCodeConverter.java:207)
... 26 more
Caused by: com.android.ide.common.process.ProcessException: Error while executing java process with main class com.android.dx.command.Main with arguments {--dex --num-threads=4 --output C:\Users\Pavilion Notebook 14\Desktop\android-PageFlip-master\android-PageFlip-master\Sample\build\intermediates\pre-dexed\debug\classes_ab235f8160567846bef21b613df9803cb4858c5e.jar C:\Users\Pavilion Notebook 14.android\build-cache\6206aacd3ab69cef7072c587c0256735db1e2847\output\jars\classes.jar}
at com.android.build.gradle.internal.process.GradleProcessResult.buildProcessException(GradleProcessResult.java:74)
at com.android.build.gradle.internal.process.GradleProcessResult.assertNormalExitValue(GradleProcessResult.java:49)
at com.android.builder.core.DexByteCodeConverter.lambda$dexOutOfProcess$1(DexByteCodeConverter.java:197)
... 4 more
Caused by: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Android\Android Studio\jre\bin\java.exe'' finished with non-zero exit value 1
at org.gradle.process.internal.DefaultExecHandle$ExecResultImpl.assertNormalExitValue(DefaultExecHandle.java:369)
at com.android.build.gradle.internal.process.GradleProcessResult.assertNormalExitValue(GradleProcessResult.java:47)
... 5 more

Thanks in advance.

Update firstTexture

Is threre any way to update firstTexture if it is already set and pafeFlip is doesn't done yet?

I try with getFirstPage().deleteAllTextures(); but it produces memory leak and after many pafeFlip memory app increase a lot.

Implement JNI version of PageFlip

Current version is pure Java, although its performance is good enough for most popular android devices, I still want to implement a JNI version to see how much performance we can improve from native codes!

xiaomi 3 black screen

Big Brother ,This project in Xiao mi 3 phone is black Screen,I don't know to how find the bug, Can you
help me?

How to custom page layout by xml

I'm using the library to create "video book". I want to show the custom view (page) by custom xml. The layout contain videoView object. I try override drawPage() and add video object , but throw the exception [java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare() ] . how can change to page[Canvas+bitmap] to video object?

How to add SupportMapFragment to Canvas

I having trouble to add supportmapfragment to canvas in this library.
To add view such as TextView or Button is not problem, but when i define supportMapFragment in mainActivity and try to insert to canvas, i always getting error no view found for id.

how to do that actually?

Thanks in advance

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.