diff --git a/build.gradle b/build.gradle
index 2d7da83..e83eb8d 100644
--- a/build.gradle
+++ b/build.gradle
@@ -47,9 +47,11 @@ dependencies {
implementation 'com.android.support:recyclerview-v7:26.1.0'
implementation 'com.squareup.picasso:picasso:2.71828'
- implementation 'com.squareup.retrofit2:retrofit:2.7.2'
+ implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.7.2'
implementation 'com.squareup.okhttp3:okhttp:3.6.0'
implementation 'com.jakewharton.picasso:picasso2-okhttp3-downloader:1.1.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.0.1'
+ implementation 'com.squareup.okhttp3:logging-interceptor:3.12.1'
+ //implementation 'com.google.android.material:material:1.4.0'
}
\ No newline at end of file
diff --git a/src/main/AndroidManifest.xml b/src/main/AndroidManifest.xml
index d744fdd..3c9dbbc 100644
--- a/src/main/AndroidManifest.xml
+++ b/src/main/AndroidManifest.xml
@@ -3,6 +3,7 @@
package="com.example.gproduitfront">
+
produitList = new ArrayList<>();
List categoriesList = new ArrayList<>();
ArrayList categories = new ArrayList<>() ;
+ String category_item ;
public static String selecteCategorie ="test";
@Override
@@ -63,7 +70,9 @@ protected void onCreate(Bundle savedInstanceState) {
progressDoalog.show();
setContentView(R.layout.activity_main);
recycler_view = findViewById(R.id.recycler_view);
- myspinner = (Spinner) findViewById(R.id.spinner);
+ myspinner = (Spinner) findViewById(R.id.spinner);
+ nbr_tv =findViewById(R.id.nbr);
+ moyenne_tv = findViewById(R.id.moyenne);
ArrayList values = new ArrayList<>();
values.add(0,"TV");
@@ -77,16 +86,26 @@ protected void onCreate(Bundle savedInstanceState) {
@Override
public void onItemSelected(AdapterView> parent, View view, int position, long id) {
selecteCategorie = parent.getItemAtPosition(position).toString();
+
+ String idCat = getIdCat();
Toast.makeText(MainActivity.this,selecteCategorie, Toast.LENGTH_LONG).show();
+ getListProduits(idCat);
+
}
+
@Override
public void onNothingSelected(AdapterView> parent) {
+ getAllProduits();
}
});
- //View v = (View) findViewById(R.layout.activity_main2) ;
+
+ // set value selected in spinner
+ category_item = getIntent().getStringExtra("category");
+
+
btn = (Button) findViewById(R.id.button);
btn.setOnClickListener(new View.OnClickListener() {
@@ -94,18 +113,111 @@ public void onNothingSelected(AdapterView> parent) {
public void onClick(View v) {
Intent i = new Intent(MainActivity.this,MainActivity2.class);
i.putExtra("category" , selecteCategorie);
+ i.putExtra("mode" , "mode_add");
// startActivity(i);
startActivityForResult(i, 0);
}
});
+ getListProduits(selecteCategorie);
+ String nbr1 = getIntent().getStringExtra("nbr_produit1");
+ String moyenne1 = getIntent().getStringExtra("moyenne1");
+
+ // get statistic after delete product
+ LocalBroadcastManager.getInstance(this).registerReceiver(mMessageReceiver,
+ new IntentFilter("statistic"));
+
+ }
+
+ private int getIndex(Spinner myspinner, String category_item) {
+
+ for(int i =0 ; i < myspinner.getCount() ; i++){
+ if(myspinner.getItemAtPosition(i).toString().equals(category_item)){
+ //System.out.println(" index of category selected "+i);
+ return i;
+ }
+ }
+ return 0;
+ }
+
+ public BroadcastReceiver mMessageReceiver = new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+
+ // Get extra data included in the Intent
+ String nbr = intent.getStringExtra("nbr_produit");
+ String moyenne = intent.getStringExtra("moyenne");
- getAllProduits();
+ nbr_tv.setText(String.valueOf(nbr));
+ moyenne_tv.setText(moyenne);
+ }
+ };
+
+ private void getStatistic(List produitList) {
+ Double somme_prix =0.0;
+ Double moyenne = 0.0;
+ int nbr_produit =produitList.size();
+ nbr_tv.setText(String.valueOf(nbr_produit) );
+ for (RetroProduit p : produitList){
+ somme_prix += p.getPu();
+ }
+ moyenne = somme_prix/nbr_produit;
+ moyenne = (double)((int)(moyenne*100))/100;
+ Log.d("moyenne","moyenne : "+moyenne);
+ moyenne_tv.setText(String.valueOf(moyenne));
+ }
+
+ private String getIdCat() {
+ String id_cat = null;
+ for(Categorie c:categoriesList){
+ if(c.getDesignation().equals(selecteCategorie)){
+ id_cat = c.getId();
+
+ }
+ }
+ return id_cat;
+ }
+
+ private void getAllProduits() {
+
+ GetDataService service = RetrofitClientInstance.getRetrofitInstance().create(GetDataService.class);
+ Call> call = service.getAllProduits();
+
+ call.enqueue(new Callback>() {
+ @Override
+ public void onResponse(Call> call, Response> response) {
+ progressDoalog.dismiss();
+ produitList = response.body();
+ generateDataList(response.body());
+ setRecycleview();
+
+ if (!response.isSuccessful()){
+ try {
+ Toast.makeText(MainActivity.this, "Server returned error : "+response.errorBody().string(), Toast.LENGTH_LONG).show();
+ } catch (IOException e) {
+ e.printStackTrace();
+ Toast.makeText(MainActivity.this, "Server returned error : unknown error ", Toast.LENGTH_LONG).show();
+ }
+ }
+ //response.body();
+
+ }
+
+ @Override
+ public void onFailure(Call> call, Throwable t) {
+ progressDoalog.dismiss();
+ Toast.makeText(getApplicationContext(), call.toString(), Toast.LENGTH_LONG).show();
+ System.out.println("onFailure=======>"+t.getMessage());
+ Toast.makeText(MainActivity.this, "Something went wrong...Please try later!", Toast.LENGTH_SHORT).show();
+
+ }
+ });
+
}
private void getAllCategories() {
@@ -133,6 +245,9 @@ public void onResponse(Call> call, Response> res
myspinner.setAdapter(adapter);
adapter.notifyDataSetChanged();
System.out.println("adapter is here"+categories.size());
+ int index = getIndex(myspinner,category_item);
+ System.out.println("index of category selected"+index);
+ myspinner.setSelection(index);
//System.out.println("response.body =======>"+response.body().toString());
if (!response.isSuccessful()){
try {
@@ -158,10 +273,10 @@ public void onFailure(Call> call, Throwable t) {
}
- private void getAllProduits() {
+ private void getListProduits(String cat) {
/*Create handle for the RetrofitInstance interface*/
GetDataService service = RetrofitClientInstance.getRetrofitInstance().create(GetDataService.class);
- Call> call = service.getAllProduits();
+ Call> call = service.getListProduits(cat);
call.enqueue(new Callback>() {
@Override
@@ -170,8 +285,8 @@ public void onResponse(Call> call, Response"+response.body().toString());
if (!response.isSuccessful()){
try {
Toast.makeText(MainActivity.this, "Server returned error : "+response.errorBody().string(), Toast.LENGTH_LONG).show();
@@ -212,7 +327,7 @@ private void generateDataList(List produitList) {
String content ="";
String libelle = p.getLabel();
Double pu = p.getPu();
- content += "libellé :"+libelle+"\n";
+ content += "3------libellé :"+libelle+"\n";
content += "prix unitaire :"+pu+"\n\n";
System.out.println("produit :"+content);
// textReselt.append(content);
diff --git a/src/main/java/com/example/gproduitfront/MainActivity2.java b/src/main/java/com/example/gproduitfront/MainActivity2.java
index 47d6749..3bfc24f 100644
--- a/src/main/java/com/example/gproduitfront/MainActivity2.java
+++ b/src/main/java/com/example/gproduitfront/MainActivity2.java
@@ -38,7 +38,6 @@ public class MainActivity2 extends AppCompatActivity {
ListView superListView;
EditText label ;
EditText pu;
- TextView message ;
Button btn;
Button btn1;
ProgressDialog progressDoalog;
@@ -46,6 +45,8 @@ public class MainActivity2 extends AppCompatActivity {
ArrayList categories = new ArrayList<>() ;
String cat;
String id_cat;
+ String mode = "";
+ String id;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -57,7 +58,7 @@ protected void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.activity_main2);
binding = ActivityMain2Binding.inflate(getLayoutInflater());
- setContentView(binding.getRoot());
+ setContentView(binding.getRoot());
final Intent intent = getIntent();
cat = getIntent().getStringExtra("category");
@@ -65,9 +66,17 @@ protected void onCreate(Bundle savedInstanceState) {
tv1.setText( cat );
System.out.println("categorie=====>"+cat);
- message =(TextView) findViewById(R.id.message);
+ id = getIntent().getStringExtra("id");
+ String libele_item = getIntent().getStringExtra("label");
+ String pu_item = getIntent().getStringExtra("pu");
+
+ mode = getIntent().getStringExtra("mode");
+ id_cat = getIntent().getStringExtra("category");
+ System.out.println("id_produit:"+id+ "\n"+"mode : "+mode);
label = findViewById(R.id.label);
pu = findViewById(R.id.pu);
+ label.setText(libele_item);
+ pu.setText(pu_item);
String content = "label :"+label+"\n"+"prix : "+pu;
@@ -82,10 +91,24 @@ public void onClick(View v) {
Toast.makeText(getApplicationContext(), "Remlissez les champs vides ", Toast.LENGTH_LONG).show();
}
else{
- System.out.println("********Enregister nouveau produit");
- RetroProduit p = new RetroProduit(label.getText().toString(),Double.valueOf(pu.getText().toString()),id_cat);
- message.setText(content);
- createProduit(p);
+
+
+
+ if(mode.equals("mode_update")){
+ System.out.println("********modifier produit");
+ RetroProduit p1 = new RetroProduit(label.getText().toString(),Double.valueOf(pu.getText().toString()));
+ updateProduct(id,p1);
+
+
+ }
+ if(mode.equals("mode_add")){
+
+ RetroProduit p = new RetroProduit(label.getText().toString(),Double.valueOf(pu.getText().toString()),id_cat);
+ System.out.println("********Enregister nouveau produit");
+ createProduit(p);
+
+ }
+
}
}
});
@@ -104,6 +127,38 @@ public void onClick(View v) {
}
+ private void updateProduct(String id,RetroProduit p1) {
+ GetDataService service = RetrofitClientInstance.getRetrofitInstance().create(GetDataService.class);
+ Call call = service.updateProduct(id, p1);
+ call.enqueue(new Callback() {
+ @Override
+ public void onResponse(Call call, Response response) {
+ if(!response.isSuccessful()){
+ Toast.makeText(MainActivity2.this, "code "+response.code(), Toast.LENGTH_SHORT).show();
+
+ }else{
+ RetroProduit p = response.body();
+ String content = "";
+ content += "id :"+p.getId()+"label :"+p.getLabel()+"\n"+"prix : "+p.getPu();
+ Toast.makeText(MainActivity2.this, "Produit modifié avec succès!", Toast.LENGTH_SHORT).show();
+ Intent i = new Intent(MainActivity2.this, MainActivity.class);
+ startActivity(i);
+ }
+ }
+
+ @Override
+ public void onFailure(Call call, Throwable t) {
+ progressDoalog.dismiss();
+ Toast.makeText(getApplicationContext(), call.toString(), Toast.LENGTH_LONG).show();
+ System.out.println("onFailure=======>"+t.getMessage());
+ Toast.makeText(MainActivity2.this, "Something went wrong...Please try later!", Toast.LENGTH_SHORT).show();
+
+ }
+ });
+
+
+ }
+
private void getAllCategories() {
GetDataService service = RetrofitClientInstance.getRetrofitInstance().create(GetDataService.class);
@@ -123,7 +178,7 @@ public void onResponse(Call> call, Response> res
//System.out.println("3-----id categorie =======>"+id_cat);
}
categories.add(categoriesList.indexOf(c),c.getDesignation());
- System.out.println("3-----id categorie =======>"+id_cat);
+ //System.out.println("3-----id categorie =======>"+id_cat);
}
/* if (categoriesList.contains(cat)) {
@@ -146,7 +201,7 @@ public void onResponse(Call> call, Response> res
Toast.makeText(MainActivity2.this, "Server returned error : unknown error ", Toast.LENGTH_LONG).show();
}
}
- //response.body();
+
}
@@ -161,42 +216,6 @@ public void onFailure(Call> call, Throwable t) {
});
}
- private void getAllProduits() {
-
- GetDataService service = RetrofitClientInstance.getRetrofitInstance().create(GetDataService.class);
- Call> call = service.getAllProduits();
-
- call.enqueue(new Callback>() {
-
- @Override
- public void onResponse(Call> call, Response> response) {
-
- if(response.isSuccessful()){
- List productList = response.body();
- String[] oneHeroes = new String[productList.size()];
- // HashMap,?> productList = response.body.contains(data);
- for (int i = 0; i < productList.size(); i++) {
- oneHeroes[i] = productList.get(i).getLabel();
- System.out.println("labels======>"+ oneHeroes[i]);
- }
- Toast.makeText(getApplicationContext(), "success", Toast.LENGTH_LONG).show();
-
- }
- else{
- Toast.makeText(getApplicationContext(), "server returned error", Toast.LENGTH_LONG).show();
- }
-
- }
-
- @Override
- public void onFailure(Call> call, Throwable t) {
- Toast.makeText(getApplicationContext(), "An error has occurred", Toast.LENGTH_LONG).show();
- System.out.println("error de récupération des données");
- }
-
-
- });
- }
private void createProduit(RetroProduit p) {
GetDataService service = RetrofitClientInstance.getRetrofitInstance().create(GetDataService.class);
@@ -207,21 +226,28 @@ private void createProduit(RetroProduit p) {
@Override
public void onResponse(Call call, Response response) {
if(!response.isSuccessful()){
- message.setText("code :"+response.code());
+ Toast.makeText(MainActivity2.this, "code "+response.code(), Toast.LENGTH_SHORT).show();
+
}else{
RetroProduit p = response.body();
String content = "";
content += "id :"+p.getId()+"label :"+p.getLabel()+"\n"+"prix : "+p.getPu();
- message.setText(content);
+
Toast.makeText(MainActivity2.this, "Produit ajouté avec succès!", Toast.LENGTH_SHORT).show();
Intent i = new Intent(MainActivity2.this, MainActivity.class);
- startActivity(i);
+ i.putExtra("category" , cat);
+ startActivityForResult(i, 0);
+ //startActivity(i);
}
}
@Override
public void onFailure(Call call, Throwable t) {
// message.setText(t.getMessage());
+ progressDoalog.dismiss();
+ Toast.makeText(getApplicationContext(), call.toString(), Toast.LENGTH_LONG).show();
+ System.out.println("onFailure=======>"+t.getMessage());
+ Toast.makeText(MainActivity2.this, "Something went wrong...Please try later!", Toast.LENGTH_SHORT).show();
}
});
diff --git a/src/main/java/com/example/gproduitfront/Model/ProduitAdapter.java b/src/main/java/com/example/gproduitfront/Model/ProduitAdapter.java
index 7ae696f..9e7dc55 100644
--- a/src/main/java/com/example/gproduitfront/Model/ProduitAdapter.java
+++ b/src/main/java/com/example/gproduitfront/Model/ProduitAdapter.java
@@ -1,21 +1,40 @@
package com.example.gproduitfront.Model;
+import android.app.ProgressDialog;
+import android.content.ClipData;
import android.content.Context;
+import android.content.Intent;
import android.support.annotation.NonNull;
+import android.support.v4.content.LocalBroadcastManager;
import android.support.v7.widget.RecyclerView;
+import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
+import android.widget.Button;
import android.widget.TextView;
+import android.widget.Toast;
+import com.example.gproduitfront.MainActivity;
+import com.example.gproduitfront.MainActivity2;
+import com.example.gproduitfront.Network.GetDataService;
+import com.example.gproduitfront.Network.RetrofitClientInstance;
import com.example.gproduitfront.R;
+import java.io.IOException;
+import java.nio.Buffer;
import java.util.List;
-public class ProduitAdapter extends RecyclerView.Adapter {
+import retrofit2.Call;
+import retrofit2.Callback;
+import retrofit2.Response;
+public class ProduitAdapter extends RecyclerView.Adapter implements View.OnClickListener{
+ ProgressDialog progressDoalog;
Context context;
List produitList;
+ Button btnDelete ;
+
public ProduitAdapter(Context context , List list ){
this.context = context;
this.produitList = list;
@@ -25,16 +44,22 @@ public ProduitAdapter(Context context , List list ){
@Override
public ProduitAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
View view = LayoutInflater.from(context).inflate(R.layout.item_layout,viewGroup,false);
+ progressDoalog = new ProgressDialog(context);
+
return new ViewHolder(view);
}
+ RetroProduit produit;
@Override
public void onBindViewHolder(@NonNull ProduitAdapter.ViewHolder viewHolder, int i) {
if (produitList != null && produitList.size() > 0){
- RetroProduit produit = produitList.get(i);
+ produit = produitList.get(i);
viewHolder.libele_tv.setText(produit.getLabel());
viewHolder.pu_tv.setText(String.valueOf(produit.getPu()));
+ //viewHolder.get = produit;
+ int position = viewHolder.getAdapterPosition();
+
}
else {
return;
@@ -45,12 +70,116 @@ public void onBindViewHolder(@NonNull ProduitAdapter.ViewHolder viewHolder, int
public int getItemCount() {
return produitList.size();
}
+
+ @Override
+ public void onClick(View v) {
+ RetroProduit produit = new RetroProduit();
+ //String id = produitList.get(getAdapterPosition()).getId();
+
+ }
+
public class ViewHolder extends RecyclerView.ViewHolder {
+ int nbr_produit;
+ Double moyenne = 0.0;
TextView libele_tv , pu_tv;
- public ViewHolder(@NonNull View itemView) {
+ public ViewHolder(@NonNull View itemView ) {
super(itemView);
libele_tv = itemView.findViewById(R.id.libele_tv);
pu_tv = itemView.findViewById(R.id.pu_tv);
+ btnDelete = itemView.findViewById(R.id.deletebtn);
+
+ ViewHolder holder = (ViewHolder) itemView.getTag();
+ // int position = holder.getAdapterPosition();
+
+ itemView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ int position = getAdapterPosition();
+ RetroProduit p = produitList.get(position);
+
+ String mode = "mode_update";
+ Intent i = new Intent(context , MainActivity2.class);
+ i.putExtra("id" , p.getId());
+ i.putExtra("label" , p.getLabel());
+ i.putExtra("pu" , String.valueOf(p.getPu()));
+ i.putExtra("id_cat" , p.getId_cat());
+ i.putExtra("mode" , mode);
+ //startActivityForResult(i, 0);
+
+ context.startActivity(i);
+ }
+ });
+
+ btnDelete.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ int position = getAdapterPosition();
+
+ RetroProduit p = produitList.get(position);
+ Log.d("demo","product id : "+p.getId());
+ String id = p.getId();
+
+ delete_product(id,position);
+
+
+
+ }
+
+
+ });
+
+
+ }
+ private void delete_product(String id, int position) {
+ Intent i1 = new Intent(context,MainActivity.class);
+ Intent i= new Intent("statistic");
+ GetDataService service = RetrofitClientInstance.getRetrofitInstance().create(GetDataService.class);
+ Call call = service.deleteProduct(id);
+ call.enqueue(new Callback() {
+ @Override
+ public void onResponse(Call call, Response response) {
+ Toast.makeText(context ,"Produit est supprimé", Toast.LENGTH_LONG).show();
+ produitList.remove(position);
+ notifyItemRemoved(position);
+ notifyItemRangeChanged(position, produitList.size());
+ getStatistic(produitList);
+
+ i.putExtra("nbr_produit" ,String.valueOf(nbr_produit) );
+ i.putExtra("moyenne" ,String.valueOf(moyenne) );
+ LocalBroadcastManager.getInstance(context).sendBroadcast(i);
+
+ if (!response.isSuccessful()){
+ try {
+ Toast.makeText(context, "Server returned error : "+response.errorBody().string(), Toast.LENGTH_LONG).show();
+ } catch (IOException e) {
+ e.printStackTrace();
+ Toast.makeText(context, "Server returned error : unknown error ", Toast.LENGTH_LONG).show();
+ }
+ }
+
+ }
+
+ @Override
+ public void onFailure(Call call, Throwable t) {
+ progressDoalog.dismiss();
+ System.out.println("onFailure=======>"+t.getMessage());
+ Toast.makeText(context, "Something went wrong...Please try later!", Toast.LENGTH_SHORT).show();
+
+ }
+ });
+ }
+
+ private void getStatistic(List produitList) {
+ Double somme_prix =0.0;
+
+ nbr_produit =produitList.size();
+
+ for (RetroProduit p : produitList){
+ somme_prix += p.getPu();
+ }
+ moyenne = somme_prix/nbr_produit;
+ moyenne = (double)((int)(moyenne*100))/100;
+ Log.d("moyenne","1---moyenne : "+moyenne);
}
}
diff --git a/src/main/java/com/example/gproduitfront/Model/RetroProduit.java b/src/main/java/com/example/gproduitfront/Model/RetroProduit.java
index 9f9f350..890e0a5 100644
--- a/src/main/java/com/example/gproduitfront/Model/RetroProduit.java
+++ b/src/main/java/com/example/gproduitfront/Model/RetroProduit.java
@@ -20,14 +20,14 @@ public class RetroProduit {
@Expose
private Double pu;
- @SerializedName("id_cat")
+ @SerializedName("idCat")
@Expose
- private String id_cat;
+ private String idCat;
public RetroProduit(String label, Double pu, String id_cat) {
this.label = label;
this.pu = pu;
- this.id_cat = id_cat;
+ this.idCat = id_cat;
}
public RetroProduit(String label, Double pu) {
@@ -41,11 +41,11 @@ public RetroProduit() {
}
public String getId_cat() {
- return id_cat;
+ return idCat;
}
public void setId_cat(String id_cat) {
- this.id_cat = id_cat;
+ this.idCat = id_cat;
}
public String getId() {
diff --git a/src/main/java/com/example/gproduitfront/Network/GetDataService.java b/src/main/java/com/example/gproduitfront/Network/GetDataService.java
index 485adfd..a0a8fa2 100644
--- a/src/main/java/com/example/gproduitfront/Network/GetDataService.java
+++ b/src/main/java/com/example/gproduitfront/Network/GetDataService.java
@@ -10,26 +10,43 @@
import retrofit2.Call;
import retrofit2.http.Body;
+import retrofit2.http.DELETE;
import retrofit2.http.Field;
import retrofit2.http.GET;
import retrofit2.http.Headers;
import retrofit2.http.POST;
+import retrofit2.http.PUT;
+import retrofit2.http.Path;
public interface GetDataService {
- @GET("produit/getall")
+ @GET("produit/getall/")
Call> getAllProduits() ;
+ @GET("produit/getlist/{id_cat}")
+ Call> getListProduits(@Path("id_cat") String cat) ;
+
@GET("produit/list/10")
Call> getlistProduits();
+ @Headers({"content-type: application/json"})
+ @PUT("produit/update/{id}")
+ Call updateProduct(@Path("id") String id ,@Body RetroProduit produit );
+
@POST("produit/save")
Call create_produit(@Body RetroProduit produit);
+ @DELETE("produit/delete/{id}")
+ Call deleteProduct(@Path("id") String id);
@Headers({"content-type: application/json"})
- @GET("category/getall")
+ @GET("category/getall/")
Call> getAllCategories();
+
+
+
+
+
//@Field("id") int id
}
diff --git a/src/main/java/com/example/gproduitfront/Network/RetrofitClientInstance.java b/src/main/java/com/example/gproduitfront/Network/RetrofitClientInstance.java
index e066ac2..81c725d 100644
--- a/src/main/java/com/example/gproduitfront/Network/RetrofitClientInstance.java
+++ b/src/main/java/com/example/gproduitfront/Network/RetrofitClientInstance.java
@@ -1,5 +1,6 @@
package com.example.gproduitfront.Network;
+import okhttp3.logging.HttpLoggingInterceptor;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
@@ -8,6 +9,8 @@ public class RetrofitClientInstance {
private static Retrofit retrofit;
private static final String BASE_URL = "http://192.168.1.102:8085/";
+
+
//http://localhost:8085/produit/getall
//https://jsonplaceholder.typicode.com/
//192.168.1.41
diff --git a/src/main/res/drawable-anydpi/ic_delete.xml b/src/main/res/drawable-anydpi/ic_delete.xml
new file mode 100644
index 0000000..0e93d2d
--- /dev/null
+++ b/src/main/res/drawable-anydpi/ic_delete.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
diff --git a/src/main/res/drawable-hdpi/ic_delete.png b/src/main/res/drawable-hdpi/ic_delete.png
new file mode 100644
index 0000000..564bd43
Binary files /dev/null and b/src/main/res/drawable-hdpi/ic_delete.png differ
diff --git a/src/main/res/drawable-mdpi/ic_delete.png b/src/main/res/drawable-mdpi/ic_delete.png
new file mode 100644
index 0000000..751efff
Binary files /dev/null and b/src/main/res/drawable-mdpi/ic_delete.png differ
diff --git a/src/main/res/drawable-xhdpi/ic_delete.png b/src/main/res/drawable-xhdpi/ic_delete.png
new file mode 100644
index 0000000..bfa8dcf
Binary files /dev/null and b/src/main/res/drawable-xhdpi/ic_delete.png differ
diff --git a/src/main/res/drawable-xxhdpi/ic_delete.png b/src/main/res/drawable-xxhdpi/ic_delete.png
new file mode 100644
index 0000000..b2d91a8
Binary files /dev/null and b/src/main/res/drawable-xxhdpi/ic_delete.png differ
diff --git a/src/main/res/drawable/ic_arrow_down.xml b/src/main/res/drawable/ic_arrow_down.xml
new file mode 100644
index 0000000..ce58346
--- /dev/null
+++ b/src/main/res/drawable/ic_arrow_down.xml
@@ -0,0 +1,10 @@
+
+
+
diff --git a/src/main/res/drawable/spinner_drawable.xml b/src/main/res/drawable/spinner_drawable.xml
new file mode 100644
index 0000000..ab1ba7d
--- /dev/null
+++ b/src/main/res/drawable/spinner_drawable.xml
@@ -0,0 +1,21 @@
+
+
+ -
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/res/layout/activity_main.xml b/src/main/res/layout/activity_main.xml
index ed578f6..e17e87b 100644
--- a/src/main/res/layout/activity_main.xml
+++ b/src/main/res/layout/activity_main.xml
@@ -32,7 +32,7 @@
android:layout_height="300dp"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
- android:layout_marginBottom="100dp"
+ android:layout_marginBottom="140dp"
android:background="#f1f1f1"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
@@ -81,15 +81,19 @@
android:textAlignment="center"
android:textSize="15dp"
android:textStyle="bold" />
-
+
+
+ >
+
+
+
@@ -99,7 +103,7 @@
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="30dp"
- android:layout_marginTop="148dp"
+ android:layout_marginTop="116dp"
android:layout_marginEnd="32dp"
android:background="#0074cc"
android:text="Ajouter"
@@ -108,8 +112,7 @@
android:textStyle="bold"
app:cornerRadius="8dp"
app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintTop_toTopOf="parent"
- />
+ app:layout_constraintTop_toTopOf="parent" />
+
+
+
+
+
+
+
+
diff --git a/src/main/res/layout/activity_main2.xml b/src/main/res/layout/activity_main2.xml
index c1ee642..386f487 100644
--- a/src/main/res/layout/activity_main2.xml
+++ b/src/main/res/layout/activity_main2.xml
@@ -23,14 +23,14 @@
android:id="@+id/text2"
android:layout_width="66dp"
android:layout_height="32dp"
- android:layout_marginStart="32dp"
- android:layout_marginTop="180dp"
+ android:layout_marginStart="24dp"
+ android:layout_marginTop="44dp"
android:text="Libellé "
android:textAppearance="@style/TextAppearance.AppCompat.Body2"
- android:textSize="18dp"
android:textColor="@color/teal_700"
+ android:textSize="18dp"
app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toTopOf="parent" />
+ app:layout_constraintTop_toBottomOf="@+id/textView8" />
-
-
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/textView3" />
+
+
\ No newline at end of file
diff --git a/src/main/res/layout/item_layout.xml b/src/main/res/layout/item_layout.xml
index 78bfa05..5764b21 100644
--- a/src/main/res/layout/item_layout.xml
+++ b/src/main/res/layout/item_layout.xml
@@ -1,9 +1,11 @@
+ android:layout_marginLeft="5dp"
+ android:background="#f1f1f1">
-
\ No newline at end of file