Commit 0d481251 authored by donia's avatar donia

detailScreen ver4

parent 9247b977
package com.example.tpleboncoin.ui; package com.example.tpleboncoin.ui;
import static android.text.Layout.JUSTIFICATION_MODE_INTER_WORD;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import com.example.tpleboncoin.databinding.ActivityDetailScreenBinding; import com.example.tpleboncoin.databinding.ActivityDetailScreenBinding;
import android.content.Intent; import android.content.Intent;
import android.graphics.text.LineBreaker;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.view.View; import android.view.View;
import android.widget.Button; import android.widget.Button;
...@@ -25,10 +30,13 @@ public class DetailScreen extends AppCompatActivity { ...@@ -25,10 +30,13 @@ public class DetailScreen extends AppCompatActivity {
Annonce annonce = intent.getParcelableExtra("annonce"); Annonce annonce = intent.getParcelableExtra("annonce");
binding.adresseTextView.setText(annonce.getAdresse()); binding.adresseTextView.setText(annonce.getAdresse());
binding.prixTextView.setText( Double.toString(annonce.getPrix()) + " €"); binding.prixTextView.setText( String.format("%,.2f €", annonce.getPrix())) ;
binding.imageView.setImageResource(R.drawable.ic_account_circle_black_24dp);
binding.descriptionTextView4.setText(annonce.getDescription()); binding.descriptionTextView4.setText(annonce.getDescription());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
binding.descriptionTextView4.setJustificationMode(LineBreaker.JUSTIFICATION_MODE_INTER_WORD);
}
binding.titreTextView.setText(annonce.getTitre()); binding.titreTextView.setText(annonce.getTitre());
binding.imageView.setImageURI(Uri.parse("https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQuN0ilDzXue08UjwoRi4jiqj0Y9FWs7jDhYY949clvcVYpoCUZzH1OkTKv5-FqBHDwKG0&usqp=CAU"));
} }
binding.smsButton.setOnClickListener(new View.OnClickListener() { binding.smsButton.setOnClickListener(new View.OnClickListener() {
@Override @Override
......
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