package fr.iutfbleau.wamster.dev45.tp05ex01_reticule;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;

public class MainActivity extends AppCompatActivity {
    private Dessin dessin;

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

        this.dessin = findViewById(R.id.zoneDeDessin);
        Evenement ecouteurDoigt = new Evenement(this.dessin);
        this.dessin.setOnTouchListener(ecouteurDoigt);
    }

    @Override
    protected void onSaveInstanceState(Bundle outState) {
        super.onSaveInstanceState(outState);
        outState.putFloat("x",this.dessin.getX());
        outState.putFloat("y",this.dessin.getY());
    }

    @Override
    protected void onRestoreInstanceState(Bundle inState) {
        super.onSaveInstanceState(inState);
        this.dessin.setCoordonnee(inState.getFloat("x",-1), inState.getFloat("y",-1));
    }
}