Commit 9d66263d authored by donia's avatar donia

detailActivity

parent 9dfa0733
package com.example.tpleboncoin.ui;
import androidx.appcompat.app.AppCompatActivity;
import com.example.tpleboncoin.databinding.ActivityDetailScreenBinding;
import android.content.Intent;
import android.os.Bundle;
import com.example.tpleboncoin.R;
public class DetailScreen extends AppCompatActivity {
ActivityDetailScreenBinding binding;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//setContentView(R.layout.activity_detail_screen);
binding = ActivityDetailScreenBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot());
Intent intent = this.getIntent();
if (intent != null){
String titre = intent.getStringExtra("titre");
String adresse = intent.getStringExtra("adresse");
String description = intent.getStringExtra("description");
Double prix = intent.getDoubleExtra("prix",999);
binding.adresseTextView.setText(adresse);
binding.prixTextView.setText(prix.toString()+" €");
binding.imageView.setImageResource(R.drawable.ic_account_circle_black_24dp);
binding.descriptionTextView4.setText(description);
binding.titreTextView.setText(titre);
}
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.detailScreen">
<ImageView
android:id="@+id/imageView"
android:layout_width="0dp"
android:layout_height="282dp"
android:layout_marginStart="33dp"
app:layout_constraintStart_toStartOf="parent"
tools:layout_editor_absoluteY="96dp" />
<TextView
android:id="@+id/titreTextView"
android:layout_width="0dp"
android:layout_height="42dp"
android:layout_marginTop="52dp"
android:text="Titre"
android:textSize="34sp"
app:layout_constraintStart_toStartOf="@+id/descriptionTextView4"
app:layout_constraintTop_toBottomOf="@+id/imageView" />
<TextView
android:id="@+id/prixTextView"
android:layout_width="107dp"
android:layout_height="0dp"
android:layout_marginTop="143dp"
android:layout_marginEnd="28dp"
android:text="10,33€"
android:textAlignment="textStart"
android:textSize="34sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/adresseTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="22dp"
android:layout_marginTop="28dp"
android:text="TextView"
android:textSize="16sp"
android:textStyle="italic"
app:layout_constraintStart_toStartOf="@+id/titreTextView"
app:layout_constraintTop_toBottomOf="@+id/titreTextView" />
<TextView
android:id="@+id/descriptionTextView4"
android:layout_width="0dp"
android:layout_height="130dp"
android:layout_marginStart="54dp"
android:layout_marginTop="32dp"
android:layout_marginEnd="54dp"
android:text="TextView"
android:textAlignment="center"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/adresseTextView" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment