Blame view

app/src/main/java/tonio/noa/MyPlayActivity.java 1.36 KB
d55d5943   aarnaude   resolution Bravo
1
2
3
4
  package tonio.noa;
  
  import android.app.Activity;
  import android.content.Intent;
2db7566f   aarnaude   modification de M...
5
6
  import android.os.Bundle;
  import android.speech.tts.TextToSpeech;
d55d5943   aarnaude   resolution Bravo
7
8
9
10
11
12
13
14
15
16
17
  import android.view.View;
  import android.widget.Toast;
  
  
  /**
   * Created by psyk on 09/01/18.
   */
  
  public abstract class MyPlayActivity extends Activity {
  
      public static final int REQUEST_CODE = 1;
2db7566f   aarnaude   modification de M...
18
      protected TextToSpeech tts;
d55d5943   aarnaude   resolution Bravo
19
20
21
  
      protected abstract void next();
  
2db7566f   aarnaude   modification de M...
22
      protected void bravoPage(View view) {
d55d5943   aarnaude   resolution Bravo
23
24
          startActivityForResult(new Intent(this, BravoActivity.class), REQUEST_CODE);
      }
2db7566f   aarnaude   modification de M...
25
26
27
28
29
30
31
32
  
      protected void lanceConsigne(String cons) {
          Intent i = new Intent(this, ConsigneActivity.class);
          i.putExtra("keyConsigne", cons);
          int requestCode = 0;
          startActivityForResult(i, requestCode);
      }
  
d55d5943   aarnaude   resolution Bravo
33
      @Override
2db7566f   aarnaude   modification de M...
34
      protected void onActivityResult(int requestCode, int resultCode, Intent data) {
d55d5943   aarnaude   resolution Bravo
35
36
37
          try {
              super.onActivityResult(requestCode, resultCode, data);
  
2db7566f   aarnaude   modification de M...
38
              if (requestCode == REQUEST_CODE && resultCode == RESULT_OK) {
d55d5943   aarnaude   resolution Bravo
39
40
41
42
43
44
45
46
47
48
49
50
51
52
                  this.next();
                  finish();
              }
          } catch (Exception ex) {
              Toast.makeText(MyPlayActivity.this, ex.toString(),
                      Toast.LENGTH_SHORT).show();
          }
      }
  
      public void backHome(View view) {
  
          startActivity(new Intent(this, MainActivity.class));
          finish();
      }
2db7566f   aarnaude   modification de M...
53
  
d55d5943   aarnaude   resolution Bravo
54
  }