package fr.iutfbleau.dev45.ex04liste.ex04liste;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.Spinner;

public class MainActivity extends AppCompatActivity {

    Spinner menuDeroulant;
    Dessin dessin;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        this.menuDeroulant = findViewById(R.id.formes_spinner);
        ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.formes_array, android.R.layout.simple_spinner_item);
        adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        this.menuDeroulant.setAdapter(adapter);

        this.dessin = findViewById(R.id.zoneDeDessin);
        EcouteurForme evenement = new EcouteurForme(dessin);
        this.menuDeroulant.setOnItemSelectedListener(evenement);
    }
}