Skip to content
Snippets Groups Projects
Commit 57b7d097 authored by SCHILLING Juliette's avatar SCHILLING Juliette
Browse files

affichage date photo ok

parent baa125bd
Branches
No related tags found
No related merge requests found
...@@ -22,6 +22,9 @@ import org.json.JSONObject; ...@@ -22,6 +22,9 @@ import org.json.JSONObject;
import outils.GestionnaireEditHabitat; import outils.GestionnaireEditHabitat;
import java.io.*; import java.io.*;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
public class ModeConceptionActivity extends AppCompatActivity { public class ModeConceptionActivity extends AppCompatActivity {
private Habitat habitat; private Habitat habitat;
...@@ -87,6 +90,13 @@ public class ModeConceptionActivity extends AppCompatActivity { ...@@ -87,6 +90,13 @@ public class ModeConceptionActivity extends AppCompatActivity {
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
//On récupère la date de prise de la photo
Calendar calendar = Calendar.getInstance();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd/MM/yyyy");
String date = simpleDateFormat.format(calendar.getTime());
murAssocie.setDate(date);
Toast.makeText(getBaseContext(), murAssocie.getDate(), Toast.LENGTH_SHORT).show();
Log.i("testDateJSON", habitat.toJSON().toString());
} }
affichePieces(); affichePieces();
} }
...@@ -240,6 +250,7 @@ public class ModeConceptionActivity extends AppCompatActivity { ...@@ -240,6 +250,7 @@ public class ModeConceptionActivity extends AppCompatActivity {
* @param view * @param view
*/ */
public void confirmer(View view) { public void confirmer(View view) {
enregistrement();
finish(); finish();
} }
......
...@@ -97,8 +97,8 @@ public class ModeImmersionActivity extends AppCompatActivity implements SensorEv ...@@ -97,8 +97,8 @@ public class ModeImmersionActivity extends AppCompatActivity implements SensorEv
} }
} }
if(res && r!=null){ if(res && r!=null){
Log.i("testTouchRect", "je touche rect="+r.toString()); //Log.i("testTouchRect", "je touche rect="+r.toString());
Log.i("testHM", pieceArriveeRect+""); //Log.i("testHM", pieceArriveeRect+"");
pieceEnCours = pieceArriveeRect.get(r); pieceEnCours = pieceArriveeRect.get(r);
afficheMur(); afficheMur();
} }
...@@ -122,8 +122,6 @@ public class ModeImmersionActivity extends AppCompatActivity implements SensorEv ...@@ -122,8 +122,6 @@ public class ModeImmersionActivity extends AppCompatActivity implements SensorEv
menu.getItem(i).setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { menu.getItem(i).setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
@Override @Override
public boolean onMenuItemClick(MenuItem item) { public boolean onMenuItemClick(MenuItem item) {
Log.i("testImmersion", "J'ouvre " + item.getTitle());
Toast.makeText(getBaseContext(), item.getTitle(), Toast.LENGTH_SHORT).show();
affichePiece(piece); affichePiece(piece);
return false; return false;
} }
...@@ -151,7 +149,8 @@ public class ModeImmersionActivity extends AppCompatActivity implements SensorEv ...@@ -151,7 +149,8 @@ public class ModeImmersionActivity extends AppCompatActivity implements SensorEv
*/ */
public void afficheMur(){ public void afficheMur(){
textViewPiece = findViewById(R.id.textViewPiece); textViewPiece = findViewById(R.id.textViewPiece);
textViewPiece.setText("piece="+pieceEnCours.getNom()); textViewPiece.setTextSize(25);
textViewPiece.setText(pieceEnCours.getNom());
//On récupère la photo //On récupère la photo
FileInputStream fis = null; FileInputStream fis = null;
try { try {
...@@ -166,6 +165,10 @@ public class ModeImmersionActivity extends AppCompatActivity implements SensorEv ...@@ -166,6 +165,10 @@ public class ModeImmersionActivity extends AppCompatActivity implements SensorEv
//Log.i("testDrawable", "pas de photo"); //Log.i("testDrawable", "pas de photo");
imageViewMur.setImageDrawable(getDrawable(R.drawable.imagemur)); imageViewMur.setImageDrawable(getDrawable(R.drawable.imagemur));
} }
//Log.i("testDate", murEnCours.getDate()+"test");
TextView textViewDate = findViewById(R.id.textViewDate);
textViewDate.setText(murEnCours.getDate());
afficheOuvertures(); afficheOuvertures();
} }
...@@ -175,7 +178,7 @@ public class ModeImmersionActivity extends AppCompatActivity implements SensorEv ...@@ -175,7 +178,7 @@ public class ModeImmersionActivity extends AppCompatActivity implements SensorEv
*/ */
public void afficheOuvertures(){ public void afficheOuvertures(){
ArrayList<Ouverture> ouvertures = habitat.getOuvertureDeMur(murEnCours); ArrayList<Ouverture> ouvertures = habitat.getOuvertureDeMur(murEnCours);
Log.i("testOuvertures", ouvertures+""); //Log.i("testOuvertures", ouvertures+"");
rectangles.clear(); rectangles.clear();
pieceArriveeRect.clear(); pieceArriveeRect.clear();
...@@ -198,7 +201,7 @@ public class ModeImmersionActivity extends AppCompatActivity implements SensorEv ...@@ -198,7 +201,7 @@ public class ModeImmersionActivity extends AppCompatActivity implements SensorEv
//Si mur de depart //Si mur de depart
if (murEnCours.getId() == ouverture.getMurDepart().getId()) { if (murEnCours.getId() == ouverture.getMurDepart().getId()) {
rectangles.add(ouverture.getRectDepart()); rectangles.add(ouverture.getRectDepart());
Log.i("testGetPiece", ouverture.getMurArrivee()+""); //Log.i("testGetPiece", ouverture.getMurArrivee()+"");
pieceArriveeRect.put(ouverture.getRectDepart(), ouverture.getMurArrivee().getPiece()); pieceArriveeRect.put(ouverture.getRectDepart(), ouverture.getMurArrivee().getPiece());
} else { } else {
//Si mur d'arrivee //Si mur d'arrivee
...@@ -233,7 +236,7 @@ public class ModeImmersionActivity extends AppCompatActivity implements SensorEv ...@@ -233,7 +236,7 @@ public class ModeImmersionActivity extends AppCompatActivity implements SensorEv
public void onSensorChanged(SensorEvent event) { public void onSensorChanged(SensorEvent event) {
// On récupère l'angle // On récupère l'angle
float angle = -(Math.round(event.values[0])); float angle = -(Math.round(event.values[0]))-50;
//On créé l'animation de rotation //On créé l'animation de rotation
RotateAnimation rotateAnimation = new RotateAnimation(debut, angle, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); RotateAnimation rotateAnimation = new RotateAnimation(debut, angle, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
......
...@@ -25,6 +25,8 @@ public class Mur implements Parcelable { ...@@ -25,6 +25,8 @@ public class Mur implements Parcelable {
*/ */
private int id; private int id;
private String date = "dd/MM/yyyy";;
/** /**
* Constructeur de Mur avec la piece et l'orientation associes * Constructeur de Mur avec la piece et l'orientation associes
* @param piece * @param piece
...@@ -61,6 +63,7 @@ public class Mur implements Parcelable { ...@@ -61,6 +63,7 @@ public class Mur implements Parcelable {
orientation = Orientation.SUD; //Par défaut orientation = Orientation.SUD; //Par défaut
break; break;
} }
date = (String) jsonObjectMur.get("Date");
} catch (JSONException e) { } catch (JSONException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
...@@ -74,6 +77,7 @@ public class Mur implements Parcelable { ...@@ -74,6 +77,7 @@ public class Mur implements Parcelable {
orientation = (Orientation) in.readSerializable(); orientation = (Orientation) in.readSerializable();
id = in.readInt(); id = in.readInt();
piece = new Piece(""); piece = new Piece("");
date = in.readString();
} }
/** /**
...@@ -139,6 +143,14 @@ public class Mur implements Parcelable { ...@@ -139,6 +143,14 @@ public class Mur implements Parcelable {
this.id = id; this.id = id;
} }
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date;
}
/** /**
* Fonction toString du mur * Fonction toString du mur
* @return le toString du mur * @return le toString du mur
...@@ -173,6 +185,7 @@ public class Mur implements Parcelable { ...@@ -173,6 +185,7 @@ public class Mur implements Parcelable {
public void writeToParcel(Parcel dest, int flags) { public void writeToParcel(Parcel dest, int flags) {
dest.writeSerializable(orientation); dest.writeSerializable(orientation);
dest.writeInt(id); dest.writeInt(id);
dest.writeString(date);
} }
/** /**
...@@ -184,6 +197,7 @@ public class Mur implements Parcelable { ...@@ -184,6 +197,7 @@ public class Mur implements Parcelable {
try { try {
jsonObject.put("Orientation", orientation); jsonObject.put("Orientation", orientation);
jsonObject.put("Id", id); jsonObject.put("Id", id);
jsonObject.put("Date", date);
} catch (JSONException e) { } catch (JSONException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
......
...@@ -47,8 +47,21 @@ ...@@ -47,8 +47,21 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/textViewPiece" android:id="@+id/textViewPiece"
tools:layout_editor_absoluteX="176dp" app:layout_constraintTop_toBottomOf="@+id/imageViewBoussole"
app:layout_constraintTop_toBottomOf="@+id/imageViewMur" tools:ignore="MissingConstraints"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent"
tools:ignore="MissingConstraints"/> app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.498"
app:layout_constraintVertical_bias="0.58"
app:layout_constraintBottom_toTopOf="@+id/imageViewMur"/>
<TextView
android:text="TextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/textViewDate"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="@+id/imageViewMur"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintHorizontal_bias="0.498"/>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment