From 652ffe7ded91cd62d9f0329ac9340d38fa3ef9e6 Mon Sep 17 00:00:00 2001 From: "pro.boooooo" Date: Mon, 27 Mar 2023 22:34:20 +0200 Subject: [PATCH] $ --- src/.idea/workspace.xml | 58 ++++--------------- .../com/example/tamere/Events/MenuEvent.java | 32 ++++++++++ .../java/com/example/tamere/GameRobot.java | 29 ++++++++++ .../java/com/example/tamere/MainActivity.java | 19 ++---- 4 files changed, 76 insertions(+), 62 deletions(-) create mode 100644 src/app/src/main/java/com/example/tamere/Events/MenuEvent.java create mode 100644 src/app/src/main/java/com/example/tamere/GameRobot.java diff --git a/src/.idea/workspace.xml b/src/.idea/workspace.xml index 6edbc9d..637e805 100644 --- a/src/.idea/workspace.xml +++ b/src/.idea/workspace.xml @@ -10,43 +10,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { + "keyToString": { + "RunOnceActivity.OpenProjectViewOnStart": "true", + "RunOnceActivity.ShowReadmeOnStart": "true", + "RunOnceActivity.cidr.known.project.marker": "true", + "cidr.known.project.marker": "true", + "project.structure.last.edited": "Modules", + "project.structure.proportion": "0.17", + "project.structure.side.proportion": "0.2", + "settings.editor.selected.configurable": "terminal" } -}]]> +} diff --git a/src/app/src/main/java/com/example/tamere/Events/MenuEvent.java b/src/app/src/main/java/com/example/tamere/Events/MenuEvent.java new file mode 100644 index 0000000..94f19df --- /dev/null +++ b/src/app/src/main/java/com/example/tamere/Events/MenuEvent.java @@ -0,0 +1,32 @@ +package com.example.tamere.Events; + +import android.content.Intent; +import android.view.View; +import android.widget.Button; + +import androidx.appcompat.app.AppCompatActivity; +import com.example.tamere.GameRobot; + +public class MenuEvent implements View.OnClickListener { + private AppCompatActivity ac; + + public MenuEvent(AppCompatActivity ac) { + this.ac = ac; + } + + @Override + public void onClick(View view) { + Button b = (Button) view; + Intent i = null; + + if(b.getText().equals("jcr")) { + i = new Intent(this.ac, GameRobot.class); + } else if(b.getText().equals("jcj")) { + + } else if(b.getText().equals("rules")) { + + } + + this.ac.startActivity(i); + } +} diff --git a/src/app/src/main/java/com/example/tamere/GameRobot.java b/src/app/src/main/java/com/example/tamere/GameRobot.java new file mode 100644 index 0000000..330b555 --- /dev/null +++ b/src/app/src/main/java/com/example/tamere/GameRobot.java @@ -0,0 +1,29 @@ +package com.example.tamere; + +import android.content.Context; +import android.os.Bundle; + +import androidx.annotation.Nullable; +import androidx.appcompat.app.AppCompatActivity; + +import java.util.LinkedHashMap; +import java.util.Map; + +public class GameRobot extends AppCompatActivity { + @Override + protected void onCreate(@Nullable Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.game); + + /** + * Liste des references vers certains container + * */ + Map containers = new LinkedHashMap<>(); + containers.put("colorsChooser", findViewById(R.id.colorsChooser)); + containers.put("trayColors", findViewById(R.id.trayColors)); + containers.put("counter", findViewById(R.id.counter)); + + Context context = getApplicationContext(); + new JMController(context, containers); + } +} diff --git a/src/app/src/main/java/com/example/tamere/MainActivity.java b/src/app/src/main/java/com/example/tamere/MainActivity.java index 2a42485..0f817e3 100644 --- a/src/app/src/main/java/com/example/tamere/MainActivity.java +++ b/src/app/src/main/java/com/example/tamere/MainActivity.java @@ -1,12 +1,9 @@ package com.example.tamere; import androidx.appcompat.app.AppCompatActivity; - -import android.content.Context; import android.os.Bundle; -import java.util.LinkedHashMap; -import java.util.Map; - +import android.widget.Button; +import com.example.tamere.Events.MenuEvent; public class MainActivity extends AppCompatActivity { @Override @@ -14,15 +11,7 @@ public class MainActivity extends AppCompatActivity { super.onCreate(savedInstanceState); setContentView(R.layout.menu); -// /** -// * Liste des references vers certains container -// * */ -// Map containers = new LinkedHashMap<>(); -// containers.put("colorsChooser", findViewById(R.id.colorsChooser)); -// containers.put("trayColors", findViewById(R.id.trayColors)); -// containers.put("counter", findViewById(R.id.counter)); - -// Context context = getApplicationContext(); -// new JMController(context, containers); + Button btn = (Button) findViewById(R.id.robotselect); + btn.setOnClickListener(new MenuEvent(this)); } } \ No newline at end of file