Project

General

Profile

« Previous | Next » 

Revision d7de3072

Added by Leszek Koltunski about 4 years ago

More support for using the library from more than one activity

View differences:

src/main/java/org/distorted/main/RubikActivity.java
94 94
    protected void onCreate(Bundle savedState)
95 95
      {
96 96
      super.onCreate(savedState);
97
      DistortedLibrary.onCreate(0);
98

  
97 99
      setTheme(R.style.CustomActivityThemeNoActionBar);
98 100
      setContentView(R.layout.main);
99 101

  
......
223 225
      super.onPause();
224 226
      RubikSurfaceView view = findViewById(R.id.rubikSurfaceView);
225 227
      view.onPause();
226
      DistortedLibrary.onPause();
228
      DistortedLibrary.onPause(0);
227 229
      RubikScoresDownloader.onPause();
228 230
      savePreferences();
229 231
      }
......
234 236
    protected void onResume() 
235 237
      {
236 238
      super.onResume();
239
      DistortedLibrary.onResume(0);
237 240
      RubikSurfaceView view = findViewById(R.id.rubikSurfaceView);
238 241
      view.onResume();
239 242
      view.initialize();
......
283 286
    @Override
284 287
    protected void onDestroy() 
285 288
      {
286
      DistortedLibrary.onDestroy();
289
      DistortedLibrary.onDestroy(0);
287 290
      super.onDestroy();
288 291
      }
289 292

  
......
554 557

  
555 558
    public void switchTutorial()
556 559
      {
557
     // DistortedLibrary.onPause();
558
     // DistortedLibrary.onDestroy();
559

  
560 560
      Intent myIntent = new Intent(this, TutorialActivity.class);
561 561
    //myIntent.putExtra("", value); //Optional parameters
562 562
      startActivity(myIntent);
src/main/java/org/distorted/main/RubikRenderer.java
127 127
      VertexEffectQuaternion.enable();
128 128
      BaseEffect.Type.enableEffects();
129 129

  
130
      DistortedLibrary.onCreate(mView.getContext(),this,1);
130
      DistortedLibrary.onSurfaceCreated(mView.getContext(),this,1);
131

  
132
android.util.Log.e("ren", "onSurfaceCreated");
131 133
      }
132 134

  
133 135
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/tutorial/TutorialActivity.java
68 68
    protected void onCreate(Bundle savedState)
69 69
      {
70 70
      super.onCreate(savedState);
71
      DistortedLibrary.onCreate(1);
71 72
      setTheme(R.style.CustomActivityThemeNoActionBar);
72 73
      setContentView(R.layout.tutorial);
73 74

  
......
156 157
      super.onPause();
157 158
      TutorialSurfaceView view = findViewById(R.id.tutorialSurfaceView);
158 159
      view.onPause();
159
      DistortedLibrary.onPause();
160
      DistortedLibrary.onPause(1);
160 161
      }
161 162

  
162 163
///////////////////////////////////////////////////////////////////////////////////////////////////
......
165 166
    protected void onResume() 
166 167
      {
167 168
      super.onResume();
169
      DistortedLibrary.onResume(1);
168 170
      TutorialSurfaceView view = findViewById(R.id.tutorialSurfaceView);
169 171
      view.onResume();
170 172
      view.initialize();
......
204 206
    protected void onDestroy() 
205 207
      {
206 208
      super.onDestroy();
209
      DistortedLibrary.onDestroy(1);
207 210
      }
208 211

  
209 212
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/tutorial/TutorialRenderer.java
79 79
      VertexEffectQuaternion.enable();
80 80
      BaseEffect.Type.enableEffects();
81 81

  
82
      DistortedLibrary.onCreate(mView.getContext(),this,1);
82
      DistortedLibrary.onSurfaceCreated(mView.getContext(),this,1);
83

  
84
android.util.Log.e("tut", "onSurfaceCreated");
83 85
      }
84 86

  
85 87
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff