Skip to content
Snippets Groups Projects
Commit 70b06b2f authored by Louis Deloffre's avatar Louis Deloffre
Browse files

Q5

parent 1c671075
No related branches found
No related tags found
No related merge requests found
......@@ -4,6 +4,7 @@ import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.Spinner;
......@@ -20,7 +21,7 @@ public class VueGenerale extends Fragment {
// TODO Q1
private String salle;
private String poste;
private final String DISTANCIEL = "DISTANCIEL";
private final String DISTANCIEL = "Distanciel";
// TODO Q2.c
private SuiviViewModel modele;
......@@ -49,7 +50,6 @@ public class VueGenerale extends Fragment {
// Apply the adapter to the spinner
spSalle.setAdapter(adapter);
view.findViewById(R.id.btnToListe).setOnClickListener(view1 -> {
// TODO Q3
TextView textUsername = getActivity().findViewById(R.id.tvLogin);
......@@ -61,9 +61,33 @@ public class VueGenerale extends Fragment {
});
// TODO Q5.b
// TODO Q9
this.salle = spSalle.getPrompt().toString();
this.poste = ((Spinner) getActivity().findViewById(R.id.spPoste)).toString();
update();
spSalle.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int position, long id) {
update();
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
});
// TODO Q9
}
// TODO Q5.a
public void update(){
Spinner spPoste = (Spinner) getActivity().findViewById(R.id.spPoste);
if( DISTANCIEL.equals(this.salle)) {
spPoste.setVisibility(View.INVISIBLE);
spPoste.setEnabled(false);
modele.setLocalisation(DISTANCIEL);
} else {
spPoste.setVisibility(View.VISIBLE);
spPoste.setEnabled(true);
modele.setLocalisation(this.poste +" : "+ this.salle);
}
}
// TODO Q9
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment