diff --git a/.idea/modules.xml b/.idea/modules.xml index d92c38d..2cc43fc 100644 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -2,7 +2,7 @@ - + diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 981a7f6..f880dfd 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -46,7 +46,7 @@ + + + + diff --git a/app/src/main/java/tonio/noa/BravoActivity.java b/app/src/main/java/tonio/noa/BravoActivity.java index 538e520..4cba385 100644 --- a/app/src/main/java/tonio/noa/BravoActivity.java +++ b/app/src/main/java/tonio/noa/BravoActivity.java @@ -1,20 +1,32 @@ package tonio.noa; import android.app.Activity; +import android.content.Intent; import android.os.Bundle; +import android.view.MotionEvent; +import android.view.View; /** * Created by tonio on 23/11/17. */ -class BravoActivity extends Activity{ +public class BravoActivity extends Activity{ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + final Intent intent = getIntent(); setContentView(R.layout.bravo_display); - } - + View view = findViewById(R.id.bravo_view); + view.setOnTouchListener(new View.OnTouchListener() { + @Override + public boolean onTouch(View view,MotionEvent event) { + setResult(RESULT_OK,intent); + finish(); + return true; + } + }); + } } diff --git a/app/src/main/java/tonio/noa/MainActivity.java b/app/src/main/java/tonio/noa/MainActivity.java index bf82201..0b30f6f 100644 --- a/app/src/main/java/tonio/noa/MainActivity.java +++ b/app/src/main/java/tonio/noa/MainActivity.java @@ -28,7 +28,7 @@ public class MainActivity extends Activity { public void tutorialPage(View view){ - startActivity(new Intent(this, TutorialActivity.class)); + startActivity(new Intent(this, TutorialScene1Activity.class)); finish(); } } diff --git a/app/src/main/java/tonio/noa/MyPlayActivity.java b/app/src/main/java/tonio/noa/MyPlayActivity.java new file mode 100644 index 0000000..a7edabb --- /dev/null +++ b/app/src/main/java/tonio/noa/MyPlayActivity.java @@ -0,0 +1,42 @@ +package tonio.noa; + +import android.app.Activity; +import android.content.Intent; +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; + + protected abstract void next(); + + protected void bravoPage(View view){ + startActivityForResult(new Intent(this, BravoActivity.class), REQUEST_CODE); + } + @Override + protected void onActivityResult(int requestCode, int resultCode, Intent data){ + try { + super.onActivityResult(requestCode, resultCode, data); + + if (requestCode == REQUEST_CODE && resultCode == RESULT_OK) { + 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(); + } +} diff --git a/app/src/main/java/tonio/noa/TutorialActivity.java b/app/src/main/java/tonio/noa/TutorialActivity.java deleted file mode 100644 index f8a8497..0000000 --- a/app/src/main/java/tonio/noa/TutorialActivity.java +++ /dev/null @@ -1,29 +0,0 @@ -package tonio.noa; - -import android.app.Activity; -import android.content.Intent; -import android.os.Bundle; -import android.view.View; - -/** - * Created by tonio on 22/11/17. - */ - -public class TutorialActivity extends Activity { - - @Override - protected void onCreate(Bundle savedInstanceState) { - - super.onCreate(savedInstanceState); - setContentView(R.layout.tutorial_display); - } - - public void backHome(View view) { - - startActivity(new Intent(this, MainActivity.class)); - } - - public void bravoPage(View view){ - startActivity(new Intent(this, BravoActivity.class)); - } -} \ No newline at end of file diff --git a/app/src/main/java/tonio/noa/TutorialScene1Activity.java b/app/src/main/java/tonio/noa/TutorialScene1Activity.java new file mode 100644 index 0000000..882bfe0 --- /dev/null +++ b/app/src/main/java/tonio/noa/TutorialScene1Activity.java @@ -0,0 +1,25 @@ +package tonio.noa; + +import android.content.Intent; +import android.os.Bundle; +import android.view.View; + +/** + * Created by tonio on 22/11/17. + */ + +public class TutorialScene1Activity extends MyPlayActivity{ + + @Override + protected void next() { + startActivity(new Intent(this, TutorialScene2Activity.class)); + finish(); + } + + @Override + protected void onCreate(Bundle savedInstanceState) { + + super.onCreate(savedInstanceState); + setContentView(R.layout.tutorial1_display); + } +} \ No newline at end of file diff --git a/app/src/main/java/tonio/noa/TutorialScene2Activity.java b/app/src/main/java/tonio/noa/TutorialScene2Activity.java new file mode 100644 index 0000000..cf672d7 --- /dev/null +++ b/app/src/main/java/tonio/noa/TutorialScene2Activity.java @@ -0,0 +1,23 @@ +package tonio.noa; + +import android.os.Bundle; +import android.view.View; + +/** + * Created by psyk on 09/01/18. + */ + +public class TutorialScene2Activity extends MyPlayActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + + super.onCreate(savedInstanceState); + setContentView(R.layout.tutorial2_display); + } + + @Override + protected void next() { + finish(); + } +} diff --git a/app/src/main/res/layout/bravo_display.xml b/app/src/main/res/layout/bravo_display.xml index 4fcc0c7..a106dfa 100644 --- a/app/src/main/res/layout/bravo_display.xml +++ b/app/src/main/res/layout/bravo_display.xml @@ -2,6 +2,10 @@ \ No newline at end of file diff --git a/app/src/main/res/layout/tutorial1_display.xml b/app/src/main/res/layout/tutorial1_display.xml new file mode 100644 index 0000000..f8459e1 --- /dev/null +++ b/app/src/main/res/layout/tutorial1_display.xml @@ -0,0 +1,31 @@ + + + + + + + +