Revision 9276dced
Added by Leszek Koltunski over 2 years ago
src/main/java/org/distorted/objectlib/main/ObjectControl.java | ||
---|---|---|
21 | 21 |
|
22 | 22 |
import java.lang.ref.WeakReference; |
23 | 23 |
|
24 |
import android.content.SharedPreferences; |
|
24 | 25 |
import android.util.DisplayMetrics; |
25 | 26 |
import android.view.MotionEvent; |
26 | 27 |
|
... | ... | |
28 | 29 |
import org.distorted.library.type.Static2D; |
29 | 30 |
import org.distorted.library.type.Static4D; |
30 | 31 |
|
32 |
import org.distorted.objectlib.helpers.MovesFinished; |
|
31 | 33 |
import org.distorted.objectlib.helpers.ObjectStateActioner; |
32 | 34 |
import org.distorted.objectlib.helpers.TwistyActivity; |
33 | 35 |
|
... | ... | |
486 | 488 |
} |
487 | 489 |
} |
488 | 490 |
|
491 |
|
|
492 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
493 |
// INTERNAL API (for AutomaticControl) |
|
494 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
495 |
|
|
496 |
public ObjectPreRender getPreRender() |
|
497 |
{ |
|
498 |
return mPreRender; |
|
499 |
} |
|
500 |
|
|
489 | 501 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
490 | 502 |
// PUBLIC API |
491 | 503 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
519 | 531 |
{ |
520 | 532 |
mScreenWidth = width; |
521 | 533 |
mScreenHeight= height; |
522 |
|
|
523 | 534 |
mScreenMin = Math.min(width, height); |
535 |
mPreRender.setScreenSize(width); |
|
524 | 536 |
} |
525 | 537 |
|
526 | 538 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
554 | 566 |
|
555 | 567 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
556 | 568 |
|
557 |
public ObjectPreRender getPreRender()
|
|
569 |
public void preRender()
|
|
558 | 570 |
{ |
559 |
return mPreRender; |
|
571 |
mPreRender.preRender(); |
|
572 |
} |
|
573 |
|
|
574 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
575 |
|
|
576 |
public void blockEverything(int place) |
|
577 |
{ |
|
578 |
mPreRender.blockEverything(place); |
|
579 |
} |
|
580 |
|
|
581 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
582 |
|
|
583 |
public void blockTouch(int place) |
|
584 |
{ |
|
585 |
mPreRender.blockTouch(place); |
|
586 |
} |
|
587 |
|
|
588 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
589 |
|
|
590 |
public void unblockEverything() |
|
591 |
{ |
|
592 |
mPreRender.unblockEverything(); |
|
593 |
} |
|
594 |
|
|
595 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
596 |
|
|
597 |
public void unblockTouch() |
|
598 |
{ |
|
599 |
mPreRender.unblockTouch(); |
|
600 |
} |
|
601 |
|
|
602 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
603 |
|
|
604 |
public void unblockUI() |
|
605 |
{ |
|
606 |
mPreRender.unblockUI(); |
|
607 |
} |
|
608 |
|
|
609 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
610 |
|
|
611 |
public boolean isTouchBlocked() |
|
612 |
{ |
|
613 |
return mPreRender.isTouchBlocked(); |
|
614 |
} |
|
615 |
|
|
616 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
617 |
|
|
618 |
public boolean isUINotBlocked() |
|
619 |
{ |
|
620 |
return mPreRender.isUINotBlocked(); |
|
621 |
} |
|
622 |
|
|
623 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
624 |
|
|
625 |
public void initializeObject(int[][] moves) |
|
626 |
{ |
|
627 |
mPreRender.initializeObject(moves); |
|
628 |
} |
|
629 |
|
|
630 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
631 |
|
|
632 |
public void changeObject(ObjectType object) |
|
633 |
{ |
|
634 |
mPreRender.changeObject(object); |
|
635 |
} |
|
636 |
|
|
637 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
638 |
|
|
639 |
public void setupObject(ObjectType object, int[][] moves) |
|
640 |
{ |
|
641 |
mPreRender.setupObject(object,moves); |
|
642 |
} |
|
643 |
|
|
644 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
645 |
|
|
646 |
public void scrambleObject(int num) |
|
647 |
{ |
|
648 |
mPreRender.scrambleObject(num); |
|
649 |
} |
|
650 |
|
|
651 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
652 |
|
|
653 |
public void solveObject() |
|
654 |
{ |
|
655 |
mPreRender.solveObject(); |
|
656 |
} |
|
657 |
|
|
658 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
659 |
|
|
660 |
public void addRotation(MovesFinished listener, int axis, int rowBitmap, int angle, long duration) |
|
661 |
{ |
|
662 |
mPreRender.addRotation(listener,axis,rowBitmap,angle,duration); |
|
663 |
} |
|
664 |
|
|
665 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
666 |
|
|
667 |
public void resetAllTextureMaps() |
|
668 |
{ |
|
669 |
mPreRender.resetAllTextureMaps(); |
|
670 |
} |
|
671 |
|
|
672 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
673 |
|
|
674 |
public TwistyObject getObject() |
|
675 |
{ |
|
676 |
return mPreRender.getObject(); |
|
677 |
} |
|
678 |
|
|
679 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
680 |
|
|
681 |
public void savePreferences(SharedPreferences.Editor editor) |
|
682 |
{ |
|
683 |
mPreRender.savePreferences(editor); |
|
684 |
} |
|
685 |
|
|
686 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
687 |
|
|
688 |
public void restorePreferences(SharedPreferences preferences) |
|
689 |
{ |
|
690 |
mPreRender.restorePreferences(preferences); |
|
560 | 691 |
} |
561 | 692 |
|
562 | 693 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
Move RubikControl to objectlib (as 'ObjectAutomator')
Hide ObjectPreRender inside objectlib and move its APi to ObjectControl.