Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.example.lenovo.jdstudio;
- import java.util.Map;
- /**
- * Created by LENOVO on 19-02-2018.
- */
- public class new_customer {
- private String FName;
- private String LName;
- private String email;
- private String phone;
- private String photodesc;
- private String status;
- private Map time;
- public new_customer(){
- }
- public new_customer(String FName, String LName, String email, String phone, String photodesc, String status, Map<String, String> time) {
- this.FName = FName;
- this.LName = LName;
- this.email = email;
- this.phone = phone;
- this.photodesc = photodesc;
- this.status = status;
- this.time = time;
- }
- public String getFName() {
- return FName;
- }
- public void setFName(String FName) {
- this.FName = FName;
- }
- public String getLName() {
- return LName;
- }
- public void setLName(String LName) {
- this.LName = LName;
- }
- public String getEmail() {
- return email;
- }
- public void setEmail(String email) {
- this.email = email;
- }
- public String getPhone() {
- return phone;
- }
- public void setPhone(String phone) {
- this.phone = phone;
- }
- public String getPhotodesc() {
- return photodesc;
- }
- public void setPhotodesc(String photodesc) {
- this.photodesc = photodesc;
- }
- public String getStatus() {
- return status;
- }
- public void setStatus(String status) {
- this.status = status;
- }
- public Map<String, String> getTime() {
- return time;
- }
- public void setTime(Map<String, String> time) {
- this.time = time;
- }
- }
- public class UpdateOrder extends Fragment {
- private View mView;
- @BindView(R.id.customerDetailsRecyclerView)
- RecyclerView mCustmoerDetails;
- private FirebaseDatabase mDatabase;
- private DatabaseReference mCustomerDatabase;
- private FirebaseRecyclerAdapter firebaseRecyclerAdapter;
- private LinearLayoutManager mManager;
- private static final String TAG = UpdateOrder.class.getSimpleName();
- public UpdateOrder() {
- // Required empty public constructor
- }
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
- // Inflate the layout for this fragment
- mView = inflater.inflate(R.layout.fragment_update_order, container, false);
- ButterKnife.bind(this,mView);
- mDatabase = FirebaseDatabase.getInstance();
- mCustomerDatabase = mDatabase.getReference("new_customer");
- mCustmoerDetails.setHasFixedSize(true);
- mManager = new LinearLayoutManager(getActivity());
- mCustmoerDetails.setLayoutManager(mManager);
- Log.e(TAG,"Before firebaseoption");
- return mView;
- }
- @Override
- public void onStart() {
- super.onStart();
- FirebaseRecyclerOptions<new_customer> options =
- new FirebaseRecyclerOptions.Builder<new_customer>()
- .setQuery(mCustomerDatabase,new_customer.class)
- .build();
- mCustomerDatabase.addListenerForSingleValueEvent(new ValueEventListener() {
- @Override
- public void onDataChange(DataSnapshot dataSnapshot) {
- new_customer cust = dataSnapshot.getValue(new_customer.class);
- Log.e(TAG,""+dataSnapshot);
- Log.e(TAG,""+cust.getStatus());
- }
- @Override
- public void onCancelled(DatabaseError databaseError) {
- }
- });
- firebaseRecyclerAdapter = new FirebaseRecyclerAdapter<new_customer,CustDetailHolder>(options){
- @Override
- protected void onBindViewHolder(@NonNull CustDetailHolder holder, int position, @NonNull new_customer model) {
- holder.setFname(model.getFName());
- holder.setLname(model.getLName());
- holder.setPhotoDetail(model.getPhotodesc());
- Log.e(TAG,""+model.getEmail());
- }
- @Override
- public CustDetailHolder onCreateViewHolder(ViewGroup parent, int viewType) {
- View view = LayoutInflater.from(parent.getContext())
- .inflate(R.layout.single_order_details, parent, false);
- Log.e("ImageViewHolder","Oncreate is called");
- return new CustDetailHolder(view);
- }
- };
- firebaseRecyclerAdapter.startListening();
- mCustmoerDetails.setAdapter(firebaseRecyclerAdapter);
- }
- @Override
- public void onStop() {
- super.onStop();
- //firebaseRecyclerAdapter.startListening();
- }
- //ViewHolder class
- public static class CustDetailHolder extends RecyclerView.ViewHolder {
- View mView;
- public CustDetailHolder(View itemView) {
- super(itemView);
- mView = itemView;
- }
- public void setFname(String name) {
- TextView FName = (TextView) mView.findViewById(R.id.cust_Fname);
- FName.setText(name);
- }
- public void setLname(String name) {
- TextView LName = (TextView) mView.findViewById(R.id.cust_Lname);
- LName.setText(name);
- }
- public void setPhotoDetail(String photoDetail) {
- TextView photo_details = (TextView) mView.findViewById(R.id.photo_Details);
- photo_details.setText(photoDetail);
- }
- public void setOrderSpinner(String status){
- }
- }
- }
- D/SQLiteDatabase: beginTransaction()
- D/OpenGLRenderer: prepareDirty (0.00, 0.00, 720.00, 1184.00) opaque 1 <0x6290f198>
- D/OpenGLRenderer: finish <0x6290f198>
- D/SQLiteDatabase: endTransaction()
- D/SQLiteDatabase: beginTransaction()
- D/OpenGLRenderer: prepareDirty (0.00, 0.00, 720.00, 1184.00) opaque 1 <0x6290f198>
- D/OpenGLRenderer: finish <0x6290f198>
- D/SQLiteDatabase: endTransaction()
- D/SQLiteDatabase: beginTransaction()
- D/SQLiteDatabase: endTransaction()
- W/ClassMapper: No setter/field for -L5h6ooG-p1LkYukY69- found on class com.example.lenovo.jdstudio.new_customer
- E/UpdateOrder: DataSnapshot { key = new_customer, value = {-L5h6ooG-p1LkYukY69-={FName=AAKASH, time=1519027966132, photodesc=jhdjahjds, phone=9028847184, status=placed, email=aakashbidlan9@gmail.com, LName=BIDLAN}} }
- E/UpdateOrder: null
- D/OpenGLRenderer: prepareDirty (0.00, 0.00, 720.00, 1184.00) opaque 1 <0x6290f198>
- D/OpenGLRenderer: finish <0x6290f198>
- D/OpenGLRenderer: prepareDirty (0.00, 0.00, 720.00, 1184.00) opaque 1 <0x6290f198>
- D/OpenGLRenderer: finish <0x6290f198>
- V/InputMethodManager: START INPUT: android.support.v7.widget.RecyclerView{422da1e8 VFED.... .F...... 0,0-720,0 #7f0900bb app:id/customerDetailsRecyclerView} ic=null tba=android.view.inputmethod.EditorInfo@422953d8 controlFlags=#100
- D/OpenGLRenderer: prepareDirty (0.00, 0.00, 720.00, 1184.00) opaque 1 <0x6290f198>
- D/OpenGLRenderer: finish <0x6290f198>
- D/NativeCrypto: ssl=0x62906950 sslRead buf=0x423b5a31 len=1,timeo=0
- D/NativeCrypto: ssl=0x62906950 sslRead buf=0x4246b088 len=43,timeo=0
- D/NativeCrypto: ssl=0x62906950 sslRead buf=0x423b5a30 len=1,timeo=0
- D/SQLiteDatabase: beginTransaction()
- D/SQLiteDatabase: endTransaction()
- D/dalvikvm: threadid=13: exiting
- D/dalvikvm: threadid=13: bye!
Add Comment
Please, Sign In to add comment