├── .idea
├── .name
├── compiler.xml
├── copyright
│ └── profiles_settings.xml
├── encodings.xml
├── misc.xml
├── modules.xml
├── scopes
│ └── scope_settings.xml
├── vcs.xml
└── workspace.xml
├── AndroidManifest.xml
├── CurlRollaway.iml
├── README.md
├── ant.properties
├── build.xml
├── gen
└── com
│ └── example
│ └── curlRollaway
│ ├── BuildConfig.java
│ ├── Manifest.java
│ └── R.java
├── local.properties
├── out
└── production
│ └── CurlRollaway
│ ├── CurlRollaway.apk
│ ├── CurlRollaway.unaligned.apk
│ └── com
│ └── example
│ └── curlRollaway
│ ├── BuildConfig.class
│ ├── MyActivity$1.class
│ ├── MyActivity.class
│ ├── Pager$1.class
│ ├── Pager$ImagePiece.class
│ ├── Pager.class
│ ├── PagerFactory.class
│ ├── R$attr.class
│ ├── R$drawable.class
│ ├── R$layout.class
│ ├── R$string.class
│ └── R.class
├── proguard-project.txt
├── project.properties
├── res
├── drawable-hdpi
│ └── ic_launcher.png
├── drawable-ldpi
│ └── ic_launcher.png
├── drawable-mdpi
│ ├── ic_launcher.png
│ ├── one.jpg
│ ├── three.jpg
│ └── two.jpg
├── drawable-xhdpi
│ └── ic_launcher.png
├── layout
│ └── main.xml
└── values
│ └── strings.xml
├── src
└── com
│ └── example
│ └── curlRollaway
│ ├── MyActivity.java
│ ├── Pager.java
│ └── PagerFactory.java
└── wiki
└── result.gif
/.idea/.name:
--------------------------------------------------------------------------------
1 | CurlRollaway
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/.idea/scopes/scope_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/workspace.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
84 |
85 |
86 | true
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 |
232 |
233 |
234 |
235 |
236 |
237 |
238 |
239 |
240 |
241 |
242 |
243 |
244 |
245 |
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
260 |
261 |
262 |
263 |
264 |
265 |
266 |
267 |
268 |
269 |
270 |
271 |
272 |
273 |
274 |
275 |
276 |
277 |
278 |
279 |
280 |
281 |
282 |
283 |
284 |
285 |
286 |
287 |
288 |
289 |
290 |
291 |
292 |
293 |
294 |
295 |
296 |
297 |
298 |
299 |
300 |
301 |
302 |
303 |
304 |
305 |
306 |
307 |
308 |
309 |
310 |
311 |
312 |
313 |
314 |
315 |
316 |
317 |
318 |
319 |
320 |
321 |
322 |
323 |
324 |
325 |
326 |
327 |
328 |
329 |
330 |
331 |
332 |
333 |
334 |
335 |
336 |
337 |
338 |
339 |
340 |
341 |
342 |
343 |
344 |
345 |
346 |
347 |
348 |
349 | true
350 |
351 |
352 |
353 |
354 |
355 |
356 |
357 |
358 |
359 |
360 |
361 |
362 |
363 |
364 |
365 |
366 |
367 |
368 |
369 |
370 |
371 |
372 |
373 |
374 |
375 |
376 |
377 |
378 |
379 |
380 |
381 |
382 |
383 |
384 |
385 |
386 |
387 |
388 |
389 |
390 |
391 |
392 |
393 |
394 |
395 |
396 |
397 |
398 |
399 |
400 |
401 |
402 |
403 |
404 |
405 |
406 |
407 |
408 |
409 |
410 |
411 |
412 |
413 |
414 |
415 |
416 |
417 |
418 |
419 |
420 |
421 |
422 |
423 |
424 |
425 |
426 |
427 |
428 |
429 |
430 |
431 |
432 |
433 |
434 |
435 |
436 |
437 |
438 |
439 |
440 |
441 |
442 |
443 |
444 |
445 |
446 |
447 |
448 |
449 |
450 |
451 |
452 |
453 |
454 |
455 |
456 |
457 |
458 |
459 |
460 |
461 |
462 |
463 |
464 |
465 |
466 |
467 |
468 |
469 |
470 |
471 |
472 |
473 |
474 |
475 |
476 |
477 |
478 |
479 |
480 |
481 |
482 |
483 |
484 |
485 |
486 |
487 |
488 |
489 |
490 |
491 |
492 |
493 |
494 |
495 |
496 |
497 |
498 |
499 |
500 |
501 |
502 |
503 |
504 |
505 |
506 |
507 |
508 |
509 |
510 |
511 |
512 | 1439174009134
513 |
514 | 1439174009134
515 |
516 |
517 |
518 |
519 |
520 |
521 |
522 |
523 |
524 |
525 |
526 |
527 |
528 |
529 |
530 |
531 |
532 |
533 |
534 |
535 |
536 |
537 |
538 |
539 |
540 |
541 |
542 |
543 |
544 |
545 |
546 |
547 |
548 |
549 |
550 |
551 |
552 |
553 |
554 |
555 |
556 |
557 |
558 |
559 |
560 |
561 |
562 |
563 |
564 |
565 |
566 |
567 |
568 |
569 |
570 |
571 |
572 |
573 |
574 |
575 |
576 |
577 |
578 |
579 |
580 |
581 |
582 |
583 |
584 |
585 |
586 |
587 |
588 |
589 |
590 |
591 |
592 |
593 |
594 |
595 |
596 |
597 |
598 |
599 |
600 |
601 |
602 |
603 |
604 |
605 |
606 |
607 |
608 |
609 |
610 |
611 |
612 |
613 |
614 |
615 |
616 |
617 |
618 |
619 |
620 |
621 |
622 |
623 |
624 |
625 |
626 |
627 |
628 |
629 |
630 |
631 |
632 |
633 |
634 |
635 |
636 |
637 |
638 |
639 |
640 |
641 |
642 |
643 |
644 |
645 |
646 |
647 |
648 |
649 |
650 |
651 |
652 |
653 |
654 |
655 |
656 |
657 |
658 |
659 |
660 |
661 |
662 |
663 |
664 |
665 |
666 |
667 |
668 |
669 |
670 |
671 |
672 |
673 |
674 |
675 |
676 |
677 |
678 |
679 |
680 |
681 |
682 |
683 |
684 |
685 |
686 |
687 |
688 |
689 |
690 |
691 |
692 |
693 |
694 |
695 |
696 |
697 |
698 |
699 |
700 |
701 |
702 |
703 |
704 |
705 |
706 |
707 |
708 |
709 |
710 |
711 |
712 |
713 |
714 |
715 |
716 |
717 |
718 |
719 |
720 |
721 |
722 |
723 |
724 |
725 |
726 |
727 |
728 |
729 |
730 |
731 |
732 |
733 |
734 |
735 |
736 |
737 |
738 |
739 |
740 |
741 |
742 |
743 |
744 |
745 |
746 |
747 |
748 |
749 |
750 |
751 |
752 |
753 |
754 |
755 |
756 |
757 |
758 |
759 |
760 |
761 |
762 |
763 |
764 |
765 |
766 |
767 |
768 |
769 |
770 |
771 |
772 |
773 |
774 |
775 |
776 |
777 |
778 |
779 |
780 |
781 |
782 |
783 |
784 |
785 |
786 |
787 |
788 |
789 |
790 |
791 |
792 |
793 |
794 |
795 |
796 |
797 |
798 |
799 |
800 |
801 |
802 |
803 |
804 |
805 |
806 |
807 |
808 |
809 |
810 |
811 |
812 |
813 |
814 |
815 |
816 |
817 |
818 |
819 |
820 |
821 |
822 |
823 |
824 |
825 |
826 |
827 |
828 |
829 |
830 |
831 |
832 |
833 |
834 |
835 |
836 |
837 |
838 |
839 |
840 |
841 |
842 |
843 |
844 |
845 |
846 |
847 |
848 |
849 |
850 |
851 |
852 |
853 |
854 |
855 |
856 |
857 |
858 |
859 |
860 |
861 |
862 |
863 |
864 |
865 |
--------------------------------------------------------------------------------
/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/CurlRollaway.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ### **成果物**
2 |
3 | 
4 |
--------------------------------------------------------------------------------
/ant.properties:
--------------------------------------------------------------------------------
1 | # This file is used to override default values used by the Ant build system.
2 | #
3 | # This file must be checked into Version Control Systems, as it is
4 | # integral to the build system of your project.
5 |
6 | # This file is only used by the Ant script.
7 |
8 | # You can use this to override default values such as
9 | # 'source.dir' for the location of your java source folder and
10 | # 'out.dir' for the location of your output folder.
11 |
12 | # You can also use it define how the release builds are signed by declaring
13 | # the following properties:
14 | # 'key.store' for the location of your keystore and
15 | # 'key.alias' for the name of the key to use.
16 | # The password will be asked during the build when you use the 'release' target.
17 |
18 |
--------------------------------------------------------------------------------
/build.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
9 |
29 |
30 |
31 |
35 |
36 |
37 |
38 |
39 |
40 |
49 |
50 |
51 |
52 |
56 |
57 |
69 |
70 |
71 |
89 |
90 |
91 |
92 |
93 |
--------------------------------------------------------------------------------
/gen/com/example/curlRollaway/BuildConfig.java:
--------------------------------------------------------------------------------
1 | /*___Generated_by_IDEA___*/
2 |
3 | package com.example.curlRollaway;
4 |
5 | /* This stub is only used by the IDE. It is NOT the BuildConfig class actually packed into the APK */
6 | public final class BuildConfig {
7 | public final static boolean DEBUG = Boolean.parseBoolean(null);
8 | }
--------------------------------------------------------------------------------
/gen/com/example/curlRollaway/Manifest.java:
--------------------------------------------------------------------------------
1 | /*___Generated_by_IDEA___*/
2 |
3 | package com.example.curlRollaway;
4 |
5 | /* This stub is only used by the IDE. It is NOT the Manifest class actually packed into the APK */
6 | public final class Manifest {
7 | }
--------------------------------------------------------------------------------
/gen/com/example/curlRollaway/R.java:
--------------------------------------------------------------------------------
1 | /*___Generated_by_IDEA___*/
2 |
3 | package com.example.curlRollaway;
4 |
5 | /* This stub is only used by the IDE. It is NOT the R class actually packed into the APK */
6 | public final class R {
7 | }
--------------------------------------------------------------------------------
/local.properties:
--------------------------------------------------------------------------------
1 | # This file is automatically generated by Android Tools.
2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 | #
4 | # This file must *NOT* be checked into Version Control Systems,
5 | # as it contains information specific to your local configuration.
6 |
7 | # location of the SDK. This is only used by Ant
8 | # For customization when using a Version Control System, please read the
9 | # header note.
10 | sdk.dir=F:\\android_eclipse_sdk\\adt-bundle-windows-x86_64-20140702\\sdk
11 |
--------------------------------------------------------------------------------
/out/production/CurlRollaway/CurlRollaway.apk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skypanda100/CurlRollAway/3364b722e6cba349ac5a263159063a0ddc6037ae/out/production/CurlRollaway/CurlRollaway.apk
--------------------------------------------------------------------------------
/out/production/CurlRollaway/CurlRollaway.unaligned.apk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skypanda100/CurlRollAway/3364b722e6cba349ac5a263159063a0ddc6037ae/out/production/CurlRollaway/CurlRollaway.unaligned.apk
--------------------------------------------------------------------------------
/out/production/CurlRollaway/com/example/curlRollaway/BuildConfig.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skypanda100/CurlRollAway/3364b722e6cba349ac5a263159063a0ddc6037ae/out/production/CurlRollaway/com/example/curlRollaway/BuildConfig.class
--------------------------------------------------------------------------------
/out/production/CurlRollaway/com/example/curlRollaway/MyActivity$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skypanda100/CurlRollAway/3364b722e6cba349ac5a263159063a0ddc6037ae/out/production/CurlRollaway/com/example/curlRollaway/MyActivity$1.class
--------------------------------------------------------------------------------
/out/production/CurlRollaway/com/example/curlRollaway/MyActivity.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skypanda100/CurlRollAway/3364b722e6cba349ac5a263159063a0ddc6037ae/out/production/CurlRollaway/com/example/curlRollaway/MyActivity.class
--------------------------------------------------------------------------------
/out/production/CurlRollaway/com/example/curlRollaway/Pager$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skypanda100/CurlRollAway/3364b722e6cba349ac5a263159063a0ddc6037ae/out/production/CurlRollaway/com/example/curlRollaway/Pager$1.class
--------------------------------------------------------------------------------
/out/production/CurlRollaway/com/example/curlRollaway/Pager$ImagePiece.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skypanda100/CurlRollAway/3364b722e6cba349ac5a263159063a0ddc6037ae/out/production/CurlRollaway/com/example/curlRollaway/Pager$ImagePiece.class
--------------------------------------------------------------------------------
/out/production/CurlRollaway/com/example/curlRollaway/Pager.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skypanda100/CurlRollAway/3364b722e6cba349ac5a263159063a0ddc6037ae/out/production/CurlRollaway/com/example/curlRollaway/Pager.class
--------------------------------------------------------------------------------
/out/production/CurlRollaway/com/example/curlRollaway/PagerFactory.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skypanda100/CurlRollAway/3364b722e6cba349ac5a263159063a0ddc6037ae/out/production/CurlRollaway/com/example/curlRollaway/PagerFactory.class
--------------------------------------------------------------------------------
/out/production/CurlRollaway/com/example/curlRollaway/R$attr.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skypanda100/CurlRollAway/3364b722e6cba349ac5a263159063a0ddc6037ae/out/production/CurlRollaway/com/example/curlRollaway/R$attr.class
--------------------------------------------------------------------------------
/out/production/CurlRollaway/com/example/curlRollaway/R$drawable.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skypanda100/CurlRollAway/3364b722e6cba349ac5a263159063a0ddc6037ae/out/production/CurlRollaway/com/example/curlRollaway/R$drawable.class
--------------------------------------------------------------------------------
/out/production/CurlRollaway/com/example/curlRollaway/R$layout.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skypanda100/CurlRollAway/3364b722e6cba349ac5a263159063a0ddc6037ae/out/production/CurlRollaway/com/example/curlRollaway/R$layout.class
--------------------------------------------------------------------------------
/out/production/CurlRollaway/com/example/curlRollaway/R$string.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skypanda100/CurlRollAway/3364b722e6cba349ac5a263159063a0ddc6037ae/out/production/CurlRollaway/com/example/curlRollaway/R$string.class
--------------------------------------------------------------------------------
/out/production/CurlRollaway/com/example/curlRollaway/R.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skypanda100/CurlRollAway/3364b722e6cba349ac5a263159063a0ddc6037ae/out/production/CurlRollaway/com/example/curlRollaway/R.class
--------------------------------------------------------------------------------
/proguard-project.txt:
--------------------------------------------------------------------------------
1 | # To enable ProGuard in your project, edit project.properties
2 | # to define the proguard.config property as described in that file.
3 | #
4 | # Add project specific ProGuard rules here.
5 | # By default, the flags in this file are appended to flags specified
6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt
7 | # You can edit the include path and order by changing the ProGuard
8 | # include property in project.properties.
9 | #
10 | # For more details, see
11 | # http://developer.android.com/guide/developing/tools/proguard.html
12 |
13 | # Add any project specific keep options here:
14 |
15 | # If your project uses WebView with JS, uncomment the following
16 | # and specify the fully qualified class name to the JavaScript interface
17 | # class:
18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
19 | # public *;
20 | #}
21 |
--------------------------------------------------------------------------------
/project.properties:
--------------------------------------------------------------------------------
1 | # This file is automatically generated by Android Tools.
2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 | #
4 | # This file must be checked in Version Control Systems.
5 | #
6 | # To customize properties used by the Ant build system edit
7 | # "ant.properties", and override values to adapt the script to your
8 | # project structure.
9 | #
10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
12 |
13 | # Project target.
14 | target=android-20
15 |
--------------------------------------------------------------------------------
/res/drawable-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skypanda100/CurlRollAway/3364b722e6cba349ac5a263159063a0ddc6037ae/res/drawable-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/res/drawable-ldpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skypanda100/CurlRollAway/3364b722e6cba349ac5a263159063a0ddc6037ae/res/drawable-ldpi/ic_launcher.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skypanda100/CurlRollAway/3364b722e6cba349ac5a263159063a0ddc6037ae/res/drawable-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/one.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skypanda100/CurlRollAway/3364b722e6cba349ac5a263159063a0ddc6037ae/res/drawable-mdpi/one.jpg
--------------------------------------------------------------------------------
/res/drawable-mdpi/three.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skypanda100/CurlRollAway/3364b722e6cba349ac5a263159063a0ddc6037ae/res/drawable-mdpi/three.jpg
--------------------------------------------------------------------------------
/res/drawable-mdpi/two.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skypanda100/CurlRollAway/3364b722e6cba349ac5a263159063a0ddc6037ae/res/drawable-mdpi/two.jpg
--------------------------------------------------------------------------------
/res/drawable-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skypanda100/CurlRollAway/3364b722e6cba349ac5a263159063a0ddc6037ae/res/drawable-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/res/layout/main.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | curlRollaway
4 |
5 |
--------------------------------------------------------------------------------
/src/com/example/curlRollaway/MyActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.curlRollaway;
2 |
3 | import android.annotation.TargetApi;
4 | import android.app.Activity;
5 | import android.content.pm.ApplicationInfo;
6 | import android.graphics.*;
7 | import android.os.Build;
8 | import android.os.Bundle;
9 | import android.util.DisplayMetrics;
10 | import android.view.MotionEvent;
11 | import android.view.View;
12 | import android.view.ViewGroup;
13 | import android.widget.FrameLayout;
14 |
15 | import java.io.InputStream;
16 |
17 | public class MyActivity extends Activity {
18 | private static final String[] pages = {"one", "two", "three"};
19 | private Pager pager;
20 | private PagerFactory pagerFactory;
21 | private Bitmap mCurPageBitmap, mRightPageBitmap, mLeftPageBitmap;
22 | private Canvas mCurPageCanvas, mRightPageCanvas, mLeftPageCanvas;
23 | private int screenWidth;
24 | private int screenHeight;
25 | //第一次拖拽的点
26 | PointF mFirstTouch = new PointF();
27 | /**
28 | * Called when the activity is first created.
29 | */
30 | @Override
31 | public void onCreate(Bundle savedInstanceState) {
32 | super.onCreate(savedInstanceState);
33 | setContentView(R.layout.main);
34 |
35 | initData();
36 | initView();
37 | }
38 |
39 | private void initData(){
40 | DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
41 | screenWidth = displayMetrics.widthPixels;
42 | screenHeight = displayMetrics.heightPixels;
43 | }
44 |
45 | private void initView(){
46 | pager = new Pager(this, screenWidth, screenHeight);
47 | manageLayer(pager, true);
48 |
49 | FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
50 | addContentView(pager, layoutParams);
51 |
52 | initCanvas();
53 | pagerFactory = new PagerFactory(getApplicationContext());
54 |
55 | loadImage(mCurPageCanvas, 0);
56 | pager.setBitmaps(mCurPageBitmap, null);
57 |
58 | pager.setOnTouchListener(new View.OnTouchListener() {
59 |
60 | private int count = pages.length;
61 | private int currentIndex = 0;
62 | private int lastIndex = 0;
63 | private boolean canSetLeftBitmap = true;
64 | private boolean canSetRightBitmap = true;
65 |
66 | @Override
67 | public boolean onTouch(View v, MotionEvent e) {
68 | boolean ret = false;
69 | if (v == pager) {
70 | if (e.getAction() == MotionEvent.ACTION_DOWN) {
71 | if(pager.isAnimationRunning()) return false;
72 |
73 | mFirstTouch.x = e.getX();
74 | mFirstTouch.y = e.getY();
75 |
76 | loadImage(mCurPageCanvas, currentIndex);
77 | pager.setBitmaps(mCurPageBitmap, null);
78 |
79 | lastIndex = currentIndex;
80 | if(currentIndex == 0){
81 | if(count > 1){
82 | loadImage(mRightPageCanvas, currentIndex + 1);
83 | }
84 | }else if(currentIndex + 1 == count){
85 | loadImage(mLeftPageCanvas, currentIndex - 1);
86 | }else{
87 | loadImage(mLeftPageCanvas, currentIndex - 1);
88 | loadImage(mRightPageCanvas, currentIndex + 1);
89 | }
90 | } else if (e.getAction() == MotionEvent.ACTION_MOVE) {
91 | if((e.getX() - mFirstTouch.x) > 0){
92 | if(currentIndex == 0){
93 | return false;
94 | }else{
95 | if(canSetLeftBitmap){
96 | canSetLeftBitmap = false;
97 | canSetRightBitmap = true;
98 | pager.setBitmaps(mCurPageBitmap, mLeftPageBitmap);
99 | }
100 | }
101 | }else{
102 | if(currentIndex + 1 == count){
103 | return false;
104 | }else{
105 | if(canSetRightBitmap) {
106 | canSetRightBitmap = false;
107 | canSetLeftBitmap = true;
108 | pager.setBitmaps(mCurPageBitmap, mRightPageBitmap);
109 | }
110 | }
111 | }
112 | } else if (e.getAction() == MotionEvent.ACTION_UP) {
113 | canSetLeftBitmap = true;
114 | canSetRightBitmap = true;
115 | if (!pager.canDragOver()) {
116 | currentIndex = lastIndex;
117 | }else{
118 | if((e.getX() - mFirstTouch.x) > 0){
119 | if(currentIndex > 0){
120 | currentIndex--;
121 | }
122 | }else{
123 | if(currentIndex < count - 1){
124 | currentIndex++;
125 | }
126 | }
127 | }
128 | }
129 |
130 | ret = pager.doTouchEvent(e);
131 | return ret;
132 | }
133 | return false;
134 | }
135 | });
136 | }
137 |
138 | private void initCanvas(){
139 | mCurPageBitmap = Bitmap.createBitmap(screenWidth, screenHeight, Bitmap.Config.ARGB_8888);
140 | mRightPageBitmap = Bitmap.createBitmap(screenWidth, screenHeight, Bitmap.Config.ARGB_8888);
141 | mLeftPageBitmap = Bitmap.createBitmap(screenWidth, screenHeight, Bitmap.Config.ARGB_8888);
142 |
143 | mCurPageCanvas = new Canvas(mCurPageBitmap);
144 | mRightPageCanvas = new Canvas(mRightPageBitmap);
145 | mLeftPageCanvas = new Canvas(mLeftPageBitmap);
146 | }
147 |
148 | private void loadImage(final Canvas canvas, int index) {
149 | Bitmap bitmap = getBitmap(pages[index]);
150 | pagerFactory.onDraw(canvas, bitmap);
151 | }
152 |
153 | private Bitmap getBitmap(String name) {
154 | BitmapFactory.Options opt = new BitmapFactory.Options();
155 | opt.inPreferredConfig = Bitmap.Config.RGB_565;
156 | opt.inPurgeable = true;
157 | opt.inInputShareable = true;
158 | ApplicationInfo appInfo = getApplicationInfo();
159 | int resID = getResources().getIdentifier(name, "drawable", appInfo.packageName);
160 | InputStream is = getResources().openRawResource(resID);
161 | Bitmap tempBitmap = BitmapFactory.decodeStream(is, null, opt);
162 | int width = tempBitmap.getWidth();
163 | int height = tempBitmap.getHeight();
164 | Matrix matrix = new Matrix();
165 | matrix.postScale(((float)screenWidth)/width, ((float)screenHeight)/height);
166 | Bitmap bitmap = Bitmap.createBitmap(tempBitmap, 0, 0, width, height, matrix, true);
167 | return bitmap;
168 | }
169 |
170 | @TargetApi(Build.VERSION_CODES.HONEYCOMB)
171 | private void manageLayer(View v, boolean enableHardware) {
172 | int layerType = enableHardware ? View.LAYER_TYPE_HARDWARE
173 | : View.LAYER_TYPE_NONE;
174 | if (layerType != v.getLayerType())
175 | v.setLayerType(layerType, null);
176 | }
177 | }
178 |
--------------------------------------------------------------------------------
/src/com/example/curlRollaway/Pager.java:
--------------------------------------------------------------------------------
1 | package com.example.curlRollaway;
2 |
3 | import android.content.Context;
4 | import android.graphics.*;
5 | import android.view.MotionEvent;
6 | import android.view.View;
7 | import android.widget.Scroller;
8 |
9 | import java.util.ArrayList;
10 | import java.util.List;
11 |
12 | public class Pager extends View {
13 | private int mWidth = 1280;
14 | private int mHeight = 768;
15 | private float mRadius = 0;
16 | private List curImagePieces;
17 | private boolean isSplitCurImage = true;
18 | private List nextImagePieces;
19 | private boolean isSplitNextImage = true;
20 | private int mRows = 4;
21 | private int mColumns = 6;
22 | private boolean isSetCoord = false;
23 | private float[] oldCoordX;
24 | private float[] oldCoordY;
25 | private float[] coordX;
26 | private float[] coordY;
27 | private float deltaDistance;
28 | private int mRotate = 180;
29 | //拖拽点
30 | PointF mTouch = new PointF();
31 | //第一次拖拽的点
32 | PointF mFirstTouch = new PointF();
33 |
34 | Bitmap mCurPageBitmap = null;
35 | Bitmap mNextPageBitmap = null;
36 |
37 | Scroller mScroller;
38 | public Pager(Context context, int screenWidth, int screenHeight) {
39 | super(context);
40 | this.mWidth = screenWidth;
41 | this.mHeight = screenHeight;
42 | mScroller = new Scroller(getContext());
43 | }
44 |
45 | /**
46 | * bitmap单位
47 | */
48 | private class ImagePiece {
49 | public int index = 0;
50 | public Bitmap bitmap = null;
51 | }
52 |
53 | /**
54 | * 切割bitmap
55 | *
56 | * @param bitmap
57 | * @param row
58 | * @param column
59 | * @return
60 | */
61 | private List split(Bitmap bitmap, int row, int column) {
62 |
63 | List pieces = new ArrayList(row * column);
64 |
65 | int width = bitmap.getWidth();
66 | int height = bitmap.getHeight();
67 |
68 | int pieceWidth = width / column;
69 | int pieceHeight = height / row;
70 |
71 | for (int i = 0; i < row; i++) {
72 | for (int j = 0; j < column; j++) {
73 | ImagePiece imagePiece = new ImagePiece();
74 | imagePiece.index = j + i * column;
75 |
76 | int xValue = j * pieceWidth;
77 | int yValue = i * pieceHeight;
78 |
79 | imagePiece.bitmap = Bitmap.createBitmap(bitmap, xValue, yValue,
80 | pieceWidth, pieceHeight);
81 | pieces.add(imagePiece);
82 | }
83 | }
84 | return pieces;
85 | }
86 |
87 | /**
88 | * 计算bitmap现在位于的坐标以及将要位于的坐标
89 | */
90 | private void setCoordinate() {
91 | oldCoordX = new float[mRows * mColumns];
92 | oldCoordY = new float[mRows * mColumns];
93 | coordX = new float[mRows * mColumns];
94 | coordY = new float[mRows * mColumns];
95 |
96 | /**
97 | * 计算bitmap将要位于的坐标
98 | */
99 | double angle = 360.0f / mRows / mColumns * Math.PI / 180;
100 | float centerX = getMeasuredWidth() / 2.0f - getMeasuredWidth() / mColumns / 2.0f;
101 | float centerY = (getMeasuredHeight() - getMeasuredHeight() / mRows) / 2.0f;
102 | float radius = (getMeasuredHeight() - getMeasuredHeight() / mRows) / 2.0f;
103 | mRadius = radius;
104 | for (int i = 0; i < mRows; i++) {
105 | for (int j = 0; j < mColumns; j++) {
106 | /**
107 | * x1 = dx * cos(a) + dy * sin(a);
108 | * y1 = dy * cos(a) - dx * sin(a);
109 | */
110 | double diffAngel = (i * mColumns + j) * angle;
111 | coordX[i * mColumns + j] = (float) (radius * Math.sin(diffAngel) + centerX);
112 | coordY[i * mColumns + j] = (float) (centerY - radius * Math.cos(diffAngel));
113 | }
114 | }
115 |
116 | /**
117 | * 计算bitmap现在所处的坐标
118 | */
119 | if (curImagePieces != null && curImagePieces.size() > 0) {
120 | for (int i = 0; i < mRows; i++) {
121 | for (int j = 0; j < mColumns; j++) {
122 | oldCoordX[i * mColumns + j] = getPieceBitmapX(i, j);
123 | oldCoordY[i * mColumns + j] = getPieceBitmapY(i, j);
124 | }
125 | }
126 | }
127 | }
128 |
129 | private float getPieceBitmapX(int row, int col) {
130 | float x = 0.0f;
131 | for (int i = 0; i < col; i++) {
132 | x += curImagePieces.get(row * mColumns + i).bitmap.getWidth();
133 | }
134 | return x;
135 | }
136 |
137 | private float getPieceBitmapY(int row, int col) {
138 | float y = 0.0f;
139 | for (int i = 0; i < row; i++) {
140 | y += curImagePieces.get(i * mColumns + col).bitmap.getHeight();
141 | }
142 | return y;
143 | }
144 |
145 | private void drawCurPageArea(Canvas canvas, Bitmap bitmap) {
146 | /**
147 | * 将图片切成mColumn*mColumn份
148 | */
149 | if (isSplitCurImage) {
150 | isSplitCurImage = false;
151 | curImagePieces = split(bitmap, mRows, mColumns);
152 | if(!isSetCoord){
153 | setCoordinate();
154 | isSetCoord = true;
155 | }
156 |
157 | }
158 | float transformRatio = Math.abs(deltaDistance) / (mWidth / 4);
159 | if (transformRatio <= 1.0f) {
160 | for (int i = 0; i < mRows * mColumns; i++) {
161 | float x = (coordX[i] - oldCoordX[i]) * transformRatio + oldCoordX[i] + mWidth / 2 * (deltaDistance < 0? -1: 1) * transformRatio;
162 | float y = (coordY[i] - oldCoordY[i]) * transformRatio + oldCoordY[i];
163 |
164 | canvas.save();
165 | float rotateAngle = 360 / (mRows * mColumns) * i * transformRatio;
166 | Matrix matrix = new Matrix();
167 | matrix.postTranslate(x, y);
168 | matrix.postRotate(rotateAngle, x + curImagePieces.get(i).bitmap.getWidth() / 2, y + curImagePieces.get(i).bitmap.getHeight() / 2);
169 | canvas.drawBitmap(curImagePieces.get(i).bitmap, matrix, null);
170 | canvas.restore();
171 | }
172 | }else{
173 | transformRatio = (Math.abs(deltaDistance) - mWidth * 1 / 4)/ (mWidth * 1 / 4);
174 | transformRatio = transformRatio > 1.0f?1.0f:transformRatio;
175 | if(deltaDistance < 0){
176 | transformRatio = -transformRatio;
177 | }
178 | for (int i = 0; i < mRows * mColumns; i++) {
179 | float x = coordX[i] + mWidth / 2 * (deltaDistance < 0? -1: 1) + mWidth / 2 * transformRatio;
180 | float y = coordY[i];
181 |
182 | canvas.save();
183 | float rotateAngle = 360 / (mRows * mColumns) * i;
184 | Matrix matrix = new Matrix();
185 | matrix.postTranslate(x, y);
186 | matrix.postRotate(rotateAngle, x + curImagePieces.get(i).bitmap.getWidth() / 2, y + curImagePieces.get(i).bitmap.getHeight() / 2);
187 | matrix.postRotate(transformRatio * mRotate, (deltaDistance < 0? 0: mWidth) + mWidth / 2 * transformRatio, mHeight / 2);
188 | canvas.drawBitmap(curImagePieces.get(i).bitmap, matrix, null);
189 | canvas.restore();
190 | }
191 | }
192 | }
193 |
194 | private void drawNextPageArea(Canvas canvas, Bitmap bitmap) {
195 | /**
196 | * 将图片切成mColumn*mColumn份
197 | */
198 | if (isSplitNextImage) {
199 | isSplitNextImage = false;
200 | nextImagePieces = split(bitmap, mRows, mColumns);
201 | }
202 | float distance = mWidth / 2 - mRadius;
203 | float transformRatio = Math.abs(deltaDistance) / (mWidth / 8);
204 | float startX = 0;
205 | if(deltaDistance < 0){
206 | startX = mWidth;
207 | }else{
208 | startX = -mWidth;
209 | }
210 | if (transformRatio <= 1.0f) {
211 | for (int i = 0; i < mRows * mColumns; i++) {
212 | float x = (coordX[i] - oldCoordX[i]) * transformRatio + oldCoordX[i] + distance * (deltaDistance < 0? -1: 1) * transformRatio + startX;
213 | float y = (coordY[i] - oldCoordY[i]) * transformRatio + oldCoordY[i];
214 |
215 | canvas.save();
216 | float rotateAngle = 360 / (mRows * mColumns) * i * transformRatio;
217 | Matrix matrix = new Matrix();
218 | matrix.postTranslate(x, y);
219 | matrix.postRotate(rotateAngle, x + nextImagePieces.get(i).bitmap.getWidth() / 2, y + nextImagePieces.get(i).bitmap.getHeight() / 2);
220 | canvas.drawBitmap(nextImagePieces.get(i).bitmap, matrix, null);
221 | canvas.restore();
222 | }
223 | }else if(transformRatio > 1.0f && transformRatio <= 2.0f){
224 | transformRatio = (Math.abs(deltaDistance) - mWidth * 1 / 8)/ (mWidth * 1 / 8);
225 | if(deltaDistance < 0){
226 | transformRatio = -transformRatio;
227 | }
228 | for (int i = 0; i < mRows * mColumns; i++) {
229 | float x = coordX[i] + distance * (deltaDistance < 0?-1: 1) + (mWidth / 2 - distance) * transformRatio + startX;
230 | float y = coordY[i];
231 |
232 | canvas.save();
233 | float rotateAngle = 360 / (mRows * mColumns) * i;
234 | Matrix matrix = new Matrix();
235 | matrix.postTranslate(x, y);
236 | matrix.postRotate(rotateAngle, x + nextImagePieces.get(i).bitmap.getWidth() / 2, y + nextImagePieces.get(i).bitmap.getHeight() / 2);
237 | matrix.postRotate(360 - mRotate, mWidth / 2 + distance * (deltaDistance < 0?-1: 1) + (mWidth / 2 - distance) * transformRatio + startX, mHeight / 2);
238 | matrix.postRotate(transformRatio * mRotate, mWidth / 2 + distance * (deltaDistance < 0?-1: 1) + (mWidth / 2 - distance) * transformRatio + startX, mHeight / 2);
239 | canvas.drawBitmap(nextImagePieces.get(i).bitmap, matrix, null);
240 | canvas.restore();
241 | }
242 | }else{
243 | transformRatio = (Math.abs(deltaDistance) - mWidth * 1 / 4)/ (mWidth * 1 / 4);
244 | transformRatio = transformRatio > 1.0f?1.0f:transformRatio;
245 | transformRatio = 1 - transformRatio;
246 | for (int i = 0; i < mRows * mColumns; i++) {
247 | float x = (coordX[i] - oldCoordX[i]) * transformRatio + oldCoordX[i] + mWidth / 2 * (deltaDistance > 0? -1: 1) * transformRatio;
248 | float y = (coordY[i] - oldCoordY[i]) * transformRatio + oldCoordY[i];
249 |
250 | canvas.save();
251 | float rotateAngle = 360 / (mRows * mColumns) * i * transformRatio;
252 | Matrix matrix = new Matrix();
253 | matrix.preTranslate(x, y);
254 | matrix.postRotate(rotateAngle, x + nextImagePieces.get(i).bitmap.getWidth() / 2, y + nextImagePieces.get(i).bitmap.getHeight() / 2);
255 | canvas.drawBitmap(nextImagePieces.get(i).bitmap, matrix, null);
256 | canvas.restore();
257 | }
258 |
259 | if(transformRatio == 0.0f){
260 | mScroller.abortAnimation();
261 | }
262 | }
263 | }
264 |
265 | public void setBitmaps(Bitmap bm1, Bitmap bm2) {
266 | mCurPageBitmap = bm1;
267 | mNextPageBitmap = bm2;
268 | isSplitCurImage = true;
269 | isSplitNextImage = true;
270 | this.postInvalidate();
271 | }
272 |
273 | public boolean doTouchEvent(MotionEvent event) {
274 | if (event.getAction() == MotionEvent.ACTION_MOVE) {
275 | mTouch.x = (float) Math.ceil(event.getX());
276 | mTouch.y = (float) Math.ceil(event.getY());
277 | this.postInvalidate();
278 | }
279 | if (event.getAction() == MotionEvent.ACTION_DOWN) {
280 | mFirstTouch.x = (float) Math.ceil(event.getX());
281 | mFirstTouch.y = (float) Math.ceil(event.getY());
282 | mTouch.x = (float) Math.ceil(event.getX());
283 | mTouch.y = (float) Math.ceil(event.getY());
284 | deltaDistance = 0.0f;
285 | this.postInvalidate();
286 | }
287 | if (event.getAction() == MotionEvent.ACTION_UP) {
288 | if (canDragOver()) {
289 | startAnimation(2000);
290 | }else{
291 | startAnimation(1500);
292 | }
293 | this.postInvalidate();
294 | }
295 | return true;
296 | }
297 |
298 | @Override
299 | protected void onDraw(Canvas canvas) {
300 | canvas.drawColor(0xFFAAAAAA);
301 | deltaDistance = mTouch.x - mFirstTouch.x;
302 | if(deltaDistance < 0.0f){
303 | if(deltaDistance > -2.0f) {
304 | deltaDistance = 0.0f;
305 | }
306 | }else{
307 | if(deltaDistance < 2.0f) {
308 | deltaDistance = 0.0f;
309 | }
310 | }
311 | drawCurPageArea(canvas, mCurPageBitmap);
312 | if(mNextPageBitmap != null){
313 | drawNextPageArea(canvas, mNextPageBitmap);
314 | }
315 | }
316 |
317 | public void computeScroll() {
318 | super.computeScroll();
319 | if (mScroller.computeScrollOffset()) {
320 | float x = mScroller.getCurrX();
321 | float y = mScroller.getCurrY();
322 | mTouch.x = x;
323 | mTouch.y = y;
324 | postInvalidate();
325 | }
326 | }
327 |
328 | private void startAnimation(int delayMillis) {
329 | int dx;
330 | float tmpDeltaDistance = mTouch.x - mFirstTouch.x;
331 | if (tmpDeltaDistance < 0) {
332 | if(Math.abs(tmpDeltaDistance) > mWidth / 4){
333 | dx = -(int) (mWidth/2 + tmpDeltaDistance + 10);
334 | }else{
335 | dx = (int) Math.abs(tmpDeltaDistance);
336 | }
337 | } else {
338 | if(tmpDeltaDistance > mWidth / 4){
339 | dx = (int) (mWidth/2 - tmpDeltaDistance + 10);
340 | }else{
341 | dx = (int) -tmpDeltaDistance;
342 | }
343 | }
344 | mScroller.startScroll((int) mTouch.x, 0, dx, 0, delayMillis);
345 | }
346 |
347 | public void abortAnimation() {
348 | if (!mScroller.isFinished()) {
349 | mScroller.abortAnimation();
350 | }
351 | }
352 |
353 | public boolean isAnimationRunning(){
354 | return !mScroller.isFinished();
355 | }
356 |
357 | public boolean canDragOver() {
358 | if (Math.abs(deltaDistance) >= mWidth / 4)
359 | return true;
360 | return false;
361 | }
362 | }
363 |
--------------------------------------------------------------------------------
/src/com/example/curlRollaway/PagerFactory.java:
--------------------------------------------------------------------------------
1 | package com.example.curlRollaway;
2 |
3 | import android.content.Context;
4 | import android.graphics.Bitmap;
5 | import android.graphics.Canvas;
6 | import android.graphics.Paint;
7 | import android.graphics.Paint.Align;
8 |
9 |
10 | public class PagerFactory {
11 | private Context mContext;
12 | private Bitmap m_book_bg = null;
13 |
14 | private int m_backColor = 0xffff9e85; // 背景颜色
15 |
16 | private boolean m_isfirstPage,m_islastPage;
17 |
18 | private Paint mPaint;
19 |
20 | public PagerFactory(Context context) {
21 | mContext = context;
22 | mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
23 | mPaint.setColor(m_backColor);
24 | }
25 |
26 | public void onDraw(Canvas c) {
27 | if (m_book_bg == null)
28 | c.drawColor(m_backColor);
29 | else
30 | c.drawBitmap(m_book_bg, 0, 0, null);
31 | }
32 |
33 | public void onDraw(Canvas c, Bitmap bitmap){
34 | c.drawBitmap(bitmap, 0, 0, null);
35 | }
36 |
37 |
38 | public void setBgBitmap(Bitmap BG) {
39 | m_book_bg = BG;
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/wiki/result.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/skypanda100/CurlRollAway/3364b722e6cba349ac5a263159063a0ddc6037ae/wiki/result.gif
--------------------------------------------------------------------------------