Skip to content

Commit

Permalink
[ETAT Appli Au 20/02/2019 ] Le graphique est fonctionnel pour deux va…
Browse files Browse the repository at this point in the history
…leurs, cependant je ne parviens pas à ordonner mon tableau à deux dimensions donc les points sont mal reliés.
  • Loading branch information
nimrodfmc committed Feb 20, 2019
1 parent 538908d commit a478ea2
Show file tree
Hide file tree
Showing 10 changed files with 174 additions and 220 deletions.
2 changes: 1 addition & 1 deletion app/src/main/java/com/example/maximeglod/fbta/DAO.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public long ajoutePersonne(Inscription inscription) {
v.put("poids", inscription.getPoids());
v.put("activité", inscription.getSport());
v.put("objectif", inscription.getObjectif());
return maBase.insert("personne", null, v);
return maBase.insert("personne", null, v);
}

}
222 changes: 131 additions & 91 deletions app/src/main/java/com/example/maximeglod/fbta/Evolution.java

Large diffs are not rendered by default.

55 changes: 23 additions & 32 deletions app/src/main/java/com/example/maximeglod/fbta/Inscription.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ protected void onCreate(Bundle savedInstanceState) {
liste.add("Détente");
liste.add("Modéré");
liste.add("Intense");
ArrayAdapter adapter = new ArrayAdapter(this,android.R.layout.simple_spinner_item,liste);
ArrayAdapter adapter = new ArrayAdapter(this, android.R.layout.simple_spinner_item, liste);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(adapter);
this.sport = spinner.getSelectedItem().toString();
Expand All @@ -92,39 +92,30 @@ public void onClick(View v) {
Intent i = new Intent(getApplicationContext(), validInscription.class);

if (et_prenom.getText().toString().length() < 1) {
Toast.makeText(getApplicationContext(),"Veuillez renseigner votre prénom", Toast.LENGTH_LONG).show();
}
else {
Toast.makeText(getApplicationContext(), "Veuillez renseigner votre prénom", Toast.LENGTH_LONG).show();
} else {
if (et_nom.getText().toString().length() < 1) {
Toast.makeText(getApplicationContext(),"Veuillez renseigner votre nom", Toast.LENGTH_LONG).show();
}
else {
Toast.makeText(getApplicationContext(), "Veuillez renseigner votre nom", Toast.LENGTH_LONG).show();
} else {
if (et_age.getText().toString().length() < 1) {
Toast.makeText(getApplicationContext(),"Veuillez renseigner votre date de naissance", Toast.LENGTH_LONG).show();
}
else if (et_age.getText().toString().length() < 10) {
Toast.makeText(getApplicationContext(), "Veuillez renseigner votre date de naissance", Toast.LENGTH_LONG).show();
} else if (et_age.getText().toString().length() < 10) {
Toast.makeText(getApplicationContext(), "Veuillez renseigner correctement votre date de naissance", Toast.LENGTH_LONG).show();
}
else {
} else {
if (et_sexe.getText().toString().length() < 1) {
Toast.makeText(getApplicationContext(),"Veuillez renseigner votre sexe", Toast.LENGTH_LONG).show();
}
else if (et_sexe.getText().toString().equals("M") || et_sexe.getText().toString().equals("F")) {
Toast.makeText(getApplicationContext(), "Veuillez renseigner votre sexe", Toast.LENGTH_LONG).show();
} else if (et_sexe.getText().toString().equals("M") || et_sexe.getText().toString().equals("F")) {
if (et_taille.getText().toString().length() < 1) {
Toast.makeText(getApplicationContext(),"Veuillez renseigner votre taille", Toast.LENGTH_LONG).show();
}
else if (et_taille.getText().toString().length() == 3) {
Toast.makeText(getApplicationContext(),"Veuillez renseigner votre taille en m", Toast.LENGTH_LONG).show();
}
else {
Toast.makeText(getApplicationContext(), "Veuillez renseigner votre taille", Toast.LENGTH_LONG).show();
} else if (et_taille.getText().toString().length() == 3) {
Toast.makeText(getApplicationContext(), "Veuillez renseigner votre taille en m", Toast.LENGTH_LONG).show();
} else {
if (et_poids.getText().toString().length() < 1) {
Toast.makeText(getApplicationContext(),"Veuillez renseigner votre poids", Toast.LENGTH_LONG).show();
}
else {
Toast.makeText(getApplicationContext(), "Veuillez renseigner votre poids", Toast.LENGTH_LONG).show();
} else {
if (et_objectif.getText().toString().length() < 1) {
Toast.makeText(getApplicationContext(),"Veuillez renseigner votre objectif de poids", Toast.LENGTH_LONG).show();
}
else {
Toast.makeText(getApplicationContext(), "Veuillez renseigner votre objectif de poids", Toast.LENGTH_LONG).show();
} else {
i.putExtra("Prénom", et_prenom.getText().toString());
i.putExtra("Nom", et_nom.getText().toString());
i.putExtra("Naissance", et_age.getText().toString());
Expand All @@ -137,9 +128,8 @@ else if (et_taille.getText().toString().length() == 3) {
}
}
}
}
else {
Toast.makeText(getApplicationContext(),"Veuillez renseigner correctement votre sexe", Toast.LENGTH_LONG).show();
} else {
Toast.makeText(getApplicationContext(), "Veuillez renseigner correctement votre sexe", Toast.LENGTH_LONG).show();
}
}
}
Expand All @@ -152,7 +142,6 @@ else if (et_taille.getText().toString().length() == 3) {
}



public String getPoids() {
return this.poids;
}
Expand Down Expand Up @@ -181,5 +170,7 @@ public String getSport() {
return this.sport;
}

public String getObjectif() {return this.objectif;}
public String getObjectif() {
return this.objectif;
}
}
55 changes: 0 additions & 55 deletions app/src/main/java/com/example/maximeglod/fbta/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -212,61 +212,6 @@ public void onClick(View view) {

}

// } private Handler myHandler;
// private final Runnable myRunnable = new Runnable() {
// @Override
// public void run() {
// // Code à éxécuter de façon périodique
//
// //initialisation de la somme
// //Parcours du Hashmap pour sommer toutes les valeurs caloriques et ainsi récupérer le totalcalorique
// //dans la variable sum
// //récupération du champ de date
// TextView dateView2 = (TextView) findViewById(R.id.currentdate);
// final String heures3 = dateView2.getText().toString();
// int sum = 0;
// for (int f : (caltolMap.get(heures3)).values()) {
// sum += f;
// }
//
// //On récupère le champ totalcalories de la vue
// TextView totalcalories = (TextView) findViewById(R.id.totalcalories);
// String sumtotal = Integer.toString(sum);
// //On met à jour le text de totalcalories avec la valeur calculée
// totalcalories.setText(sumtotal);
//
// //Changement de la couleur d'un élément si l'objectif n'est pas respecté
// TextView objectifcalories = (TextView) findViewById(R.id.objectif);
// int objectif = Integer.parseInt(objectifcalories.getText().toString());
//
// if (sum <= objectif) {
// Button b1 = (Button) findViewById(R.id.verif);
// b1.setBackgroundResource(R.drawable.rounded_button_ok);
// b1.setText("V");
// b1.setTextColor(Color.BLACK);
// } else {
//
// //On tolère une marge de 5% par rapport à l'objectif (Changement de couleur)
// if (sum <= objectif + (objectif * 0.05)) {
// Button b2 = (Button) findViewById(R.id.verif);
// b2.setBackgroundResource(R.drawable.rounded_button_mid);
// b2.setText("~");
// b2.setTextColor(Color.WHITE);
// } else {
// Button b1 = (Button) findViewById(R.id.verif);
// b1.setBackgroundResource(R.drawable.rounded_button_false);
// b1.setText("X");
// b1.setTextColor(Color.WHITE);
// }
//
// }
//
//
// myHandler.postDelayed(this, 5);
//
// }
// };


public static Map<String, Map<Integer, Integer>> caltolMap = new HashMap<>();
}

This file was deleted.

3 changes: 1 addition & 2 deletions app/src/main/java/com/example/maximeglod/fbta/Personne.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,10 @@ public String getSport() {
}

public int getObjectifs() {
return objectif ;
return objectif;
}



Inscription i = new Inscription();


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public void onClick(View v) {
Intent myIntent = new Intent(getBaseContext(), MainActivity.class);
Toast.makeText(getApplicationContext(), "La saisie de votre poids a bien été sauvegardée", Toast.LENGTH_LONG).show();
Integer poidscurrent = Integer.parseInt(poids.getText().toString());
//On va plutôt stocker dans le hashmap la différence entre la date sélectionné et la date actuelle car on ne peut pas mettre de string pour l'axe des x dans evolution
//Stockage du poids dans un hashmap
poidsMap.put(recup_date, poidscurrent);
poidsMap.get(recup_date);
startActivityForResult(myIntent, 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ protected void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.activity_splash);




//Code qui commence avec le timer et lance les actions ensuite
new Handler().postDelayed(new Runnable() {
@Override
Expand Down
25 changes: 13 additions & 12 deletions app/src/main/java/com/example/maximeglod/fbta/validInscription.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ protected void onCreate(Bundle savedInstanceState) {
@Override
public void onClick(View v) {
Intent e = new Intent(getApplicationContext(), MainActivity.class);
Toast.makeText(getApplicationContext(), lePrenom + " " + leNom + " enregistré",Toast.LENGTH_LONG).show();
Toast.makeText(getApplicationContext(), lePrenom + " " + leNom + " enregistré", Toast.LENGTH_LONG).show();
startActivity(e);
}

Expand All @@ -85,6 +85,7 @@ public void onClick(View v) {
AddData();

}

// AJOUT DES DONNEES DANS LA BASE DE DONNEES SUR LE CLIC DU BOUTON DE VALIDINSCRIPTION
public void AddData() {
btn_inscrire.setOnClickListener(new View.OnClickListener() {
Expand All @@ -94,24 +95,24 @@ public void onClick(View view) {
BDHelper bdHelper = new BDHelper(getBaseContext(), "fbta", null, 1);

//LISTE DES PARAMETRES A AJOUTER A LA BDD
HashMap<String,String> params = new HashMap<>();
params.put(BDD.TABLE_NAME_COL_2,lePrenom);
params.put(BDD.TABLE_NAME_COL_3,leNom);
params.put(BDD.TABLE_NAME_COL_4,laNaissance);
params.put(BDD.TABLE_NAME_COL_5,leSexe);
params.put(BDD.TABLE_NAME_COL_6,laTaille);
params.put(BDD.TABLE_NAME_COL_7,lePoids);
params.put(BDD.TABLE_NAME_COL_8,lActivite);
params.put(BDD.TABLE_NAME_COL_9,lObjectif);
HashMap<String, String> params = new HashMap<>();
params.put(BDD.TABLE_NAME_COL_2, lePrenom);
params.put(BDD.TABLE_NAME_COL_3, leNom);
params.put(BDD.TABLE_NAME_COL_4, laNaissance);
params.put(BDD.TABLE_NAME_COL_5, leSexe);
params.put(BDD.TABLE_NAME_COL_6, laTaille);
params.put(BDD.TABLE_NAME_COL_7, lePoids);
params.put(BDD.TABLE_NAME_COL_8, lActivite);
params.put(BDD.TABLE_NAME_COL_9, lObjectif);

//OUVERTURE DE LA BDD
bdHelper.open();
boolean retour = bdHelper.insert(TABLE_NAME, params);

//AFFICHAGE RAPIDE
//LES DONNEES NE SONT PAS MISE DANS LA BDD
if (!retour){
Toast.makeText(validInscription.this,"SA MARCHE PAS", Toast.LENGTH_LONG).show();
if (!retour) {
Toast.makeText(validInscription.this, "SA MARCHE PAS", Toast.LENGTH_LONG).show();
}
bdHelper.close();
}
Expand Down
7 changes: 4 additions & 3 deletions app/src/main/res/layout/activity_saisie_poids.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".SaisiePoids"
android:background="@color/colorDark">
android:background="@color/colorDark"
tools:context=".SaisiePoids">

<TextView
android:id="@+id/currentdate"
Expand All @@ -16,7 +16,8 @@
android:text="@string/affdate"
app:layout_column="0"
app:layout_row="0" />
<TextView

<TextView
android:id="@+id/tvSaisie"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
Expand Down

0 comments on commit a478ea2

Please sign in to comment.