2020-03-01 20:56:07
package com.xbsaykat.easy24admin.ProductRevew;
 
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
 
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
 
import com.firebase.ui.database.FirebaseRecyclerAdapter;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.jsibbold.zoomage.ZoomageView;
import com.squareup.picasso.Picasso;
import com.xbsaykat.easy24admin.R;
 
import static com.xbsaykat.easy24admin.ProductRevew.BuySellShow.Key;
import static com.xbsaykat.easy24admin.ProductRevew.BuySellShow.PhNumber;
import static com.xbsaykat.easy24admin.ProductRevew.BuySellShow.ProType;
import static com.xbsaykat.easy24admin.ProductRevew.BuySellShow.ProdDetails;
import static com.xbsaykat.easy24admin.ProductRevew.BuySellShow.ProdImage;
import static com.xbsaykat.easy24admin.ProductRevew.BuySellShow.ProdImage2;
import static com.xbsaykat.easy24admin.ProductRevew.BuySellShow.ProdImage3;
import static com.xbsaykat.easy24admin.ProductRevew.BuySellShow.ProdLocation;
import static com.xbsaykat.easy24admin.ProductRevew.BuySellShow.ProdName;
import static com.xbsaykat.easy24admin.ProductRevew.BuySellShow.ProdPrice;
import static com.xbsaykat.easy24admin.ProductRevew.BuySellShow.Prodcategory;
import static com.xbsaykat.easy24admin.ProductRevew.BuySellShow.Proddivition;
import static com.xbsaykat.easy24admin.ProductRevew.BuySellShow.Produpzila;
import static com.xbsaykat.easy24admin.ProductRevew.BuySellShow.Prodzila;
import static com.xbsaykat.easy24admin.ProductRevew.BuySellShow.SellName;
 
 
public class ShowAllProducts extends AppCompatActivity {
    private RecyclerView mRecyclerView;
    private FirebaseDatabase mFirebaseDatabase;
    private DatabaseReference mRef;
    private TextView Approve,Description,Location,UName,Price,Name,Delete,UserPhone;
    ZoomageView myImageView;
    ImageView myImageView2,myImageView3;
    String PKey;
 
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.productshow);
 
        Approve=findViewById(R.id.approve);
        Delete=findViewById(R.id.delete);
 
        Description=findViewById(R.id.ProDescrip);
        UserPhone=findViewById(R.id.Phone);
        Location=findViewById(R.id.ProductLocation);
        UName=findViewById(R.id.UserName);
        Price=findViewById(R.id.ProductPrice);
        Name=findViewById(R.id.ProductName);
        myImageView=findViewById(R.id.myZoomageView1);
        myImageView2=findViewById(R.id.myZoomageView2);
        myImageView3=findViewById(R.id.myZoomageView3);
        Bundle bundle=getIntent().getExtras();
 
        if(bundle!=null){
            final String PN=bundle.getString(ProdName);
            final String PL=bundle.getString(ProdLocation);
            final String PI=bundle.getString(ProdImage);
            final String PII=bundle.getString(ProdImage2);
            final String PIII=bundle.getString(ProdImage3);
            final String PP=bundle.getString(ProdPrice);
            final String SN=bundle.getString(SellName);
            final String PNUM=bundle.getString(PhNumber);
            final String PD=bundle.getString(ProdDetails);
 
            final String divition=bundle.getString(Proddivition);
            final String zila=bundle.getString(Prodzila);
            final String upzila=bundle.getString(Produpzila);
            final String category=bundle.getString(Prodcategory);
            final String Type=bundle.getString(ProType);
 
            final String Convertzila=zila.substring(0, zila.indexOf('('));
            final String ConvertUpzila=upzila.substring(0, upzila.indexOf('('));
 
            PKey=bundle.getString(Key);
 
            Name.setText("Product Name : "+PN);
            Location.setText("Location : "+PL);
            Picasso.get().load(PI).resize(1440, 620).centerCrop().into(myImageView);
            Picasso.get().load(PII).resize(1440, 620).centerCrop().into(myImageView2);
            Picasso.get().load(PIII).resize(1440, 620).centerCrop().into(myImageView3);
            Price.setText("BDT. "+PP);
            UserPhone.setText("Number : "+PNUM);
            UName.setText("Seller Name : "+SN);
            Description.setText(PD);
 
            Approve.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    DatabaseReference BuySell= FirebaseDatabase.getInstance().getReference().child("BuySell");
                    BuySell.child(PKey).child("prodetails").setValue(PD);
                    BuySell.child(PKey).child("proimg").setValue(PI);
                    BuySell.child(PKey).child("proimg2").setValue(PII);
                    BuySell.child(PKey).child("proimg3").setValue(PIII);
                    BuySell.child(PKey).child("proloc").setValue(PL);
                    BuySell.child(PKey).child("proname").setValue(PN);
                    BuySell.child(PKey).child("proprice").setValue(PP);
                    BuySell.child(PKey).child("proselname").setValue(SN);
                    BuySell.child(PKey).child("proselphn").setValue(PNUM);
                    BuySell.child(PKey).child("upzila").setValue(ConvertUpzila);
                    BuySell.child(PKey).child("Convertzila").setValue(Convertzila);
                    BuySell.child(PKey).child("category").setValue(category);
                    BuySell.child(PKey).child("protype").setValue(Type);
                    BuySell.child(PKey).child("key").setValue(PKey);
 
                    DatabaseReference SelectCategory= FirebaseDatabase.getInstance().getReference().child("zSearchCategortwise");
                    SelectCategory.child(ConvertUpzila).child(category).child(PKey).child("prodetails").setValue(PD);
                    SelectCategory.child(ConvertUpzila).child(category).child(PKey).child("proimg").setValue(PI);
                    SelectCategory.child(ConvertUpzila).child(category).child(PKey).child("proimg2").setValue(PII);
                    SelectCategory.child(ConvertUpzila).child(category).child(PKey).child("proimg3").setValue(PIII);
                    SelectCategory.child(ConvertUpzila).child(category).child(PKey).child("proloc").setValue(PL);
                    SelectCategory.child(ConvertUpzila).child(category).child(PKey).child("proname").setValue(PN);
                    SelectCategory.child(ConvertUpzila).child(category).child(PKey).child("proprice").setValue(PP);
                    SelectCategory.child(ConvertUpzila).child(category).child(PKey).child("proselname").setValue(SN);
                    SelectCategory.child(ConvertUpzila).child(category).child(PKey).child("proselphn").setValue(PNUM);
                    SelectCategory.child(ConvertUpzila).child(category).child(PKey).child("protype").setValue(Type);
                    SelectCategory.child(ConvertUpzila).child(category).child(PKey).child("key").setValue(PKey);
 
                    DatabaseReference SelectLocation= FirebaseDatabase.getInstance().getReference().child("zSearchLocationwise");
                    SelectLocation.child(ConvertUpzila).child(PKey).child("prodetails").setValue(PD);
                    SelectLocation.child(ConvertUpzila).child(PKey).child("proimg").setValue(PI);
                    SelectLocation.child(ConvertUpzila).child(PKey).child("proimg2").setValue(PII);
                    SelectLocation.child(ConvertUpzila).child(PKey).child("proimg3").setValue(PIII);
                    SelectLocation.child(ConvertUpzila).child(PKey).child("proloc").setValue(PL);
                    SelectLocation.child(ConvertUpzila).child(PKey).child("proname").setValue(PN);
                    SelectLocation.child(ConvertUpzila).child(PKey).child("proprice").setValue(PP);
                    SelectLocation.child(ConvertUpzila).child(PKey).child("proselname").setValue(SN);
                    SelectLocation.child(ConvertUpzila).child(PKey).child("proselphn").setValue(PNUM);
                    SelectLocation.child(ConvertUpzila).child(PKey).child("protype").setValue(Type);
                    SelectLocation.child(ConvertUpzila).child(PKey).child("key").setValue(PKey);
 
                    DatabaseReference SelectLocationDistric= FirebaseDatabase.getInstance().getReference().child("zSearchLocationDistricwise");
                    SelectLocationDistric.child(Convertzila).child(PKey).child("prodetails").setValue(PD);
                    SelectLocationDistric.child(Convertzila).child(PKey).child("proimg").setValue(PI);
                    SelectLocationDistric.child(Convertzila).child(PKey).child("proimg2").setValue(PII);
                    SelectLocationDistric.child(Convertzila).child(PKey).child("proimg3").setValue(PIII);
                    SelectLocationDistric.child(Convertzila).child(PKey).child("proloc").setValue(PL);
                    SelectLocationDistric.child(Convertzila).child(PKey).child("proname").setValue(PN);
                    SelectLocationDistric.child(Convertzila).child(PKey).child("proprice").setValue(PP);
                    SelectLocationDistric.child(Convertzila).child(PKey).child("proselname").setValue(SN);
                    SelectLocationDistric.child(Convertzila).child(PKey).child("proselphn").setValue(PNUM);
                    SelectLocationDistric.child(Convertzila).child(PKey).child("protype").setValue(Type);
                    SelectLocationDistric.child(Convertzila).child(PKey).child("key").setValue(PKey);
 
                    DatabaseReference SelectOnlyCategory= FirebaseDatabase.getInstance().getReference().child("zOnlyCategory");
                    SelectOnlyCategory.child(category).child(PKey).child("prodetails").setValue(PD);
                    SelectOnlyCategory.child(category).child(PKey).child("proimg").setValue(PI);
                    SelectOnlyCategory.child(category).child(PKey).child("proimg2").setValue(PII);
                    SelectOnlyCategory.child(category).child(PKey).child("proimg3").setValue(PIII);
                    SelectOnlyCategory.child(category).child(PKey).child("proloc").setValue(PL);
                    SelectOnlyCategory.child(category).child(PKey).child("proname").setValue(PN);
                    SelectOnlyCategory.child(category).child(PKey).child("proprice").setValue(PP);
                    SelectOnlyCategory.child(category).child(PKey).child("proselname").setValue(SN);
                    SelectOnlyCategory.child(category).child(PKey).child("proselphn").setValue(PNUM);
                    SelectOnlyCategory.child(category).child(PKey).child("protype").setValue(Type);
                    SelectOnlyCategory.child(category).child(PKey).child("key").setValue(PKey);
 
                    DatabaseReference Revew = FirebaseDatabase.getInstance().getReference().child("Revewproduct").child(PKey);
                    Revew.removeValue();
 
                    finish();
                }
            });
            Delete.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    DatabaseReference Revew = FirebaseDatabase.getInstance().getReference().child("Revewproduct").child(PKey);
                    Revew.removeValue();
                    finish();
                }
            });
        }
    }
}
 
Invalid Email or Password