voir thermostat ok

This commit is contained in:
NonoL3Robot
2022-03-14 15:00:13 +01:00
parent 533ceaaeb2
commit e4af8192da
4 changed files with 38 additions and 10 deletions
@@ -6,6 +6,7 @@
package com.example.outilcuisson; package com.example.outilcuisson;
import android.app.AlertDialog;
import android.os.Bundle; import android.os.Bundle;
import android.view.ContextMenu; import android.view.ContextMenu;
import android.view.LayoutInflater; import android.view.LayoutInflater;
@@ -156,13 +157,27 @@ public class AfficherFragment extends Fragment {
switch (item.getItemId()) { switch (item.getItemId()) {
case R.id.supprContext: case R.id.supprContext:
// TODO // TODO
// cuissonAffichees.remove(information.position);
break; break;
case R.id.thermosContext: case R.id.thermosContext:
// TODO afficherThermos(cuissonAffichees.get(information.position));
break; break;
case R.id.cancelContext: case R.id.cancelContext:
break; break;
} }
return super.onContextItemSelected(item); return super.onContextItemSelected(item);
} }
public void afficherThermos(String cuisson) {
String content = getString(R.string.alert_content_thermos,
Cuisson.extrairePlat(cuisson),
Cuisson.extraireTemperature(cuisson),
Cuisson.thermostat(Cuisson.extraireTemperature(cuisson)));
new AlertDialog.Builder(getContext()).setTitle(R.string.alert_title_thermos)
.setMessage(content)
.setNeutralButton(
R.string.alert_neutral_button,
null)
.show();
}
} }
@@ -107,10 +107,10 @@ public class AjouterFragment extends Fragment {
new Cuisson(txtPlat, hDuree, mDuree, temperature)); new Cuisson(txtPlat, hDuree, mDuree, temperature));
Toast.makeText(getContext(), R.string.toast_ajout_ok, Toast.LENGTH_SHORT).show(); Toast.makeText(getContext(), R.string.toast_ajout_ok, Toast.LENGTH_SHORT).show();
} catch (Exception e) { } catch (Exception e) {
new AlertDialog.Builder(getContext()).setTitle(R.string.alert_error) new AlertDialog.Builder(getContext()).setTitle(R.string.alert_title_error)
.setMessage(e.getMessage()) .setMessage(R.string.alert_content_error)
.setPositiveButton( .setNeutralButton(
R.string.alert_positive_button, R.string.alert_neutral_button,
null) null)
.show(); .show();
System.out.println(e.getMessage()); System.out.println(e.getMessage());
@@ -181,7 +181,7 @@ public class Cuisson implements Serializable {
} }
/** /**
* Renvoie le thermostat correspondant à la temperature arguemnt * Renvoie le thermostat correspondant à la temperature argument
* (celle-ci doit être inférieure à TEMPERATURE_MAX) * (celle-ci doit être inférieure à TEMPERATURE_MAX)
* *
* @param temperature température à convertir * @param temperature température à convertir
+17 -4
View File
@@ -13,11 +13,24 @@
<string name="context_thermos">"Voir thermostat"</string> <string name="context_thermos">"Voir thermostat"</string>
<string name="context_cancel">"Annuler"</string> <string name="context_cancel">"Annuler"</string>
<!-- AlertDialog Erreur Ajout --> <!-- AlertDialog -->
<string name="alert_positive_button">"OK"</string> <string name="alert_title_error">"Erreur de saisie"</string>
<string name="alert_error">"Erreur"</string> <string name="alert_content_error">L\'une des informations saisies est
incorrecte :
\n- nom du plat vide ou contient \"|\"
\n- durée de cuisson nulle ou trop élevée (> 9h)
\n- température nulle ou trop élevée \n(> 300°C)
\n\n
Vérifiez les valeurs saisies !</string>
<string name="alert_neutral_button">"Retour"</string>
<!-- Toast Ajout OK --> <string name="alert_title_thermos">"Equivalent thermostat"</string>
<string name="alert_content_thermos">Cuisson du plat : %s
\n\nPour obtenir la température de %d°, vous devez régler votre
four sur le thermostat %d</string>
<!-- Toast -->
<string name="toast_ajout_ok">"Cuisson ajoutée avec succès"</string> <string name="toast_ajout_ok">"Cuisson ajoutée avec succès"</string>
<!-- Tabs --> <!-- Tabs -->