Commit 0c4e3ba4 authored by Martin LOISEAU's avatar Martin LOISEAU 🎄
Browse files

Add title screen logic

parent 93ba988b
......@@ -55,7 +55,7 @@ public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
setContentView(R.layout.title_screen);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
tts = new TextToSpeech(this, new TextToSpeech.OnInitListener() {
......@@ -73,8 +73,6 @@ public class MainActivity extends AppCompatActivity {
Dialog errorDia = m_gga.getErrorDialog(this,status, GOOGLE_SERVICES_REQUEST);
errorDia.show();
}
initializeListeners();
}
private void initializeListeners() {
......@@ -125,6 +123,11 @@ public class MainActivity extends AppCompatActivity {
});
}
public void LaunchGame(View v) // called when the "play" button is pressed on title screen
{
setContentView(R.layout.activity_main);
initializeListeners();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
......
......@@ -7,7 +7,7 @@
android:layout_height="match_parent">
<Button
android:id="@+id/button2"
android:id="@+id/play"
android:layout_width="167dp"
android:layout_height="64dp"
android:layout_marginStart="32dp"
......@@ -17,6 +17,7 @@
android:layout_marginRight="32dp"
android:layout_marginBottom="32dp"
android:text="Jouer"
android:onClick="LaunchGame"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
......@@ -31,7 +32,7 @@
android:layout_marginLeft="32dp"
android:layout_marginEnd="32dp"
android:layout_marginRight="32dp"
app:layout_constraintBottom_toTopOf="@+id/button2"
app:layout_constraintBottom_toTopOf="@+id/play"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:srcCompat="@drawable/template_logo" />
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment