Project

General

Profile

« Previous | Next » 

Revision 7f9c3cce

Added by Leszek Koltunski over 2 years ago

IAP part 6: new 'Present' object effect.

View differences:

src/main/java/org/distorted/purchase/PurchaseObjectLibInterface.java
30 30
  public void onFinishRotation(int axis, int row, int angle) { }
31 31
  public void failedToDrag() { }
32 32
  public void reportJSONError(String error, int ordinal) { }
33
  public void reportBlockProblem(int type, int place, long pause, long resume, long time) { }
33 34

  
34 35
///////////////////////////////////////////////////////////////////////////////////////////////////
35 36

  
......
55 56
        }
56 57
      }
57 58
    }
58

  
59
///////////////////////////////////////////////////////////////////////////////////////////////////
60

  
61
  private void reportUIProblem(int place, long pause, long resume, long time)
62
    {
63
    String error = "UI BLOCK "+place+" blocked for "+time;
64

  
65
    if( BuildConfig.DEBUG )
66
       {
67
       android.util.Log.e("D", error);
68
       }
69
    else
70
      {
71
      Exception ex = new Exception(error);
72
      FirebaseCrashlytics crashlytics = FirebaseCrashlytics.getInstance();
73
      crashlytics.setCustomKey("pause" , pause );
74
      crashlytics.setCustomKey("resume", resume );
75
      crashlytics.recordException(ex);
76
      }
77
    }
78

  
79
///////////////////////////////////////////////////////////////////////////////////////////////////
80

  
81
  private void reportTouchProblem(int place, long pause, long resume, long time)
82
    {
83
    String error = "TOUCH BLOCK "+place+" blocked for "+time;
84

  
85
    if( BuildConfig.DEBUG )
86
       {
87
       android.util.Log.e("D", error);
88
       }
89
    else
90
      {
91
      Exception ex = new Exception(error);
92
      FirebaseCrashlytics crashlytics = FirebaseCrashlytics.getInstance();
93
      crashlytics.setCustomKey("pause" , pause );
94
      crashlytics.setCustomKey("resume", resume);
95
      crashlytics.recordException(ex);
96
      }
97
    }
98

  
99
///////////////////////////////////////////////////////////////////////////////////////////////////
100

  
101
  private void reportThreadProblem(int place, long pause, long resume, long time)
102
    {
103
    String error = EffectMessageSender.reportState();
104

  
105
    if( BuildConfig.DEBUG )
106
       {
107
       android.util.Log.e("D", error);
108
       }
109
    else
110
      {
111
      Exception ex = new Exception(error);
112
      FirebaseCrashlytics crashlytics = FirebaseCrashlytics.getInstance();
113
      crashlytics.setCustomKey("pause" , pause  );
114
      crashlytics.setCustomKey("resume", resume );
115
      crashlytics.recordException(ex);
116
      }
117
    }
118

  
119
///////////////////////////////////////////////////////////////////////////////////////////////////
120

  
121
  public void reportBlockProblem(int type, int place, long pause, long resume, long time)
122
    {
123
    switch(type)
124
      {
125
      case BlockController.TYPE_UI    : reportUIProblem(place,pause,resume,time); break;
126
      case BlockController.TYPE_TOUCH : reportTouchProblem(place,pause,resume,time); break;
127
      case BlockController.TYPE_THREAD: reportThreadProblem(place,pause,resume,time); break;
128
      }
129
    }
130 59
}
src/main/java/org/distorted/purchase/PurchaseRenderer.java
26 26

  
27 27
public class PurchaseRenderer implements GLSurfaceView.Renderer, DistortedLibrary.ExceptionListener
28 28
{
29
   private static final int NUM_SCRAMBLES = 5;
30

  
29 31
   private final PurchaseSurfaceView mView;
30 32
   private final DistortedScreen mScreen;
31 33

  
34
   private boolean mFirstRender;
35

  
32 36
///////////////////////////////////////////////////////////////////////////////////////////////////
33 37

  
34 38
   PurchaseRenderer(PurchaseSurfaceView v)
35 39
     {
36 40
     final float BRIGHTNESS = 0.333f;
37 41

  
42
     mFirstRender = true;
38 43
     mView = v;
39 44
     mScreen = new DistortedScreen();
40 45
     mScreen.glClearColor(BRIGHTNESS, BRIGHTNESS, BRIGHTNESS, 1.0f);
......
48 53
     long time = System.currentTimeMillis();
49 54
     mView.getObjectControl().preRender();
50 55
     mScreen.render(time);
56

  
57
     if( mFirstRender )
58
       {
59
       mFirstRender=false;
60
       mView.getObjectControl().presentObject(NUM_SCRAMBLES);
61
       }
51 62
     }
52 63

  
53 64
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff