Guest User

Untitled

a guest
Feb 19th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.20 KB | None | 0 0
  1. package com.example.lenovo.jdstudio;
  2.  
  3. import java.util.Map;
  4.  
  5. /**
  6. * Created by LENOVO on 19-02-2018.
  7. */
  8.  
  9. public class new_customer {
  10. private String FName;
  11. private String LName;
  12. private String email;
  13. private String phone;
  14. private String photodesc;
  15. private String status;
  16. private Map time;
  17.  
  18. public new_customer(){
  19.  
  20. }
  21. public new_customer(String FName, String LName, String email, String phone, String photodesc, String status, Map<String, String> time) {
  22. this.FName = FName;
  23. this.LName = LName;
  24. this.email = email;
  25. this.phone = phone;
  26. this.photodesc = photodesc;
  27. this.status = status;
  28. this.time = time;
  29. }
  30.  
  31. public String getFName() {
  32. return FName;
  33. }
  34.  
  35. public void setFName(String FName) {
  36. this.FName = FName;
  37. }
  38.  
  39. public String getLName() {
  40. return LName;
  41. }
  42.  
  43. public void setLName(String LName) {
  44. this.LName = LName;
  45. }
  46.  
  47. public String getEmail() {
  48. return email;
  49. }
  50.  
  51. public void setEmail(String email) {
  52. this.email = email;
  53. }
  54.  
  55. public String getPhone() {
  56. return phone;
  57. }
  58.  
  59. public void setPhone(String phone) {
  60. this.phone = phone;
  61. }
  62.  
  63. public String getPhotodesc() {
  64. return photodesc;
  65. }
  66.  
  67. public void setPhotodesc(String photodesc) {
  68. this.photodesc = photodesc;
  69. }
  70.  
  71. public String getStatus() {
  72. return status;
  73. }
  74.  
  75. public void setStatus(String status) {
  76. this.status = status;
  77. }
  78.  
  79. public Map<String, String> getTime() {
  80. return time;
  81. }
  82.  
  83. public void setTime(Map<String, String> time) {
  84. this.time = time;
  85. }
  86. }
  87.  
  88. public class UpdateOrder extends Fragment {
  89.  
  90. private View mView;
  91. @BindView(R.id.customerDetailsRecyclerView)
  92. RecyclerView mCustmoerDetails;
  93.  
  94. private FirebaseDatabase mDatabase;
  95. private DatabaseReference mCustomerDatabase;
  96. private FirebaseRecyclerAdapter firebaseRecyclerAdapter;
  97. private LinearLayoutManager mManager;
  98. private static final String TAG = UpdateOrder.class.getSimpleName();
  99. public UpdateOrder() {
  100. // Required empty public constructor
  101. }
  102.  
  103.  
  104. @Override
  105. public View onCreateView(LayoutInflater inflater, ViewGroup container,
  106. Bundle savedInstanceState) {
  107. // Inflate the layout for this fragment
  108. mView = inflater.inflate(R.layout.fragment_update_order, container, false);
  109. ButterKnife.bind(this,mView);
  110.  
  111. mDatabase = FirebaseDatabase.getInstance();
  112. mCustomerDatabase = mDatabase.getReference("new_customer");
  113. mCustmoerDetails.setHasFixedSize(true);
  114. mManager = new LinearLayoutManager(getActivity());
  115. mCustmoerDetails.setLayoutManager(mManager);
  116. Log.e(TAG,"Before firebaseoption");
  117.  
  118. return mView;
  119. }
  120.  
  121. @Override
  122. public void onStart() {
  123. super.onStart();
  124.  
  125. FirebaseRecyclerOptions<new_customer> options =
  126. new FirebaseRecyclerOptions.Builder<new_customer>()
  127. .setQuery(mCustomerDatabase,new_customer.class)
  128. .build();
  129.  
  130. mCustomerDatabase.addListenerForSingleValueEvent(new ValueEventListener() {
  131. @Override
  132. public void onDataChange(DataSnapshot dataSnapshot) {
  133. new_customer cust = dataSnapshot.getValue(new_customer.class);
  134. Log.e(TAG,""+dataSnapshot);
  135. Log.e(TAG,""+cust.getStatus());
  136.  
  137.  
  138. }
  139.  
  140. @Override
  141. public void onCancelled(DatabaseError databaseError) {
  142.  
  143. }
  144. });
  145. firebaseRecyclerAdapter = new FirebaseRecyclerAdapter<new_customer,CustDetailHolder>(options){
  146. @Override
  147. protected void onBindViewHolder(@NonNull CustDetailHolder holder, int position, @NonNull new_customer model) {
  148. holder.setFname(model.getFName());
  149. holder.setLname(model.getLName());
  150. holder.setPhotoDetail(model.getPhotodesc());
  151. Log.e(TAG,""+model.getEmail());
  152. }
  153.  
  154.  
  155. @Override
  156. public CustDetailHolder onCreateViewHolder(ViewGroup parent, int viewType) {
  157. View view = LayoutInflater.from(parent.getContext())
  158. .inflate(R.layout.single_order_details, parent, false);
  159.  
  160. Log.e("ImageViewHolder","Oncreate is called");
  161.  
  162. return new CustDetailHolder(view);
  163.  
  164. }
  165. };
  166. firebaseRecyclerAdapter.startListening();
  167. mCustmoerDetails.setAdapter(firebaseRecyclerAdapter);
  168. }
  169.  
  170. @Override
  171. public void onStop() {
  172. super.onStop();
  173. //firebaseRecyclerAdapter.startListening();
  174. }
  175.  
  176. //ViewHolder class
  177. public static class CustDetailHolder extends RecyclerView.ViewHolder {
  178. View mView;
  179.  
  180. public CustDetailHolder(View itemView) {
  181. super(itemView);
  182. mView = itemView;
  183. }
  184.  
  185. public void setFname(String name) {
  186. TextView FName = (TextView) mView.findViewById(R.id.cust_Fname);
  187. FName.setText(name);
  188. }
  189.  
  190.  
  191. public void setLname(String name) {
  192. TextView LName = (TextView) mView.findViewById(R.id.cust_Lname);
  193. LName.setText(name);
  194. }
  195.  
  196. public void setPhotoDetail(String photoDetail) {
  197. TextView photo_details = (TextView) mView.findViewById(R.id.photo_Details);
  198. photo_details.setText(photoDetail);
  199. }
  200.  
  201. public void setOrderSpinner(String status){
  202.  
  203. }
  204. }
  205.  
  206. }
  207.  
  208. D/SQLiteDatabase: beginTransaction()
  209. D/OpenGLRenderer: prepareDirty (0.00, 0.00, 720.00, 1184.00) opaque 1 <0x6290f198>
  210. D/OpenGLRenderer: finish <0x6290f198>
  211. D/SQLiteDatabase: endTransaction()
  212. D/SQLiteDatabase: beginTransaction()
  213. D/OpenGLRenderer: prepareDirty (0.00, 0.00, 720.00, 1184.00) opaque 1 <0x6290f198>
  214. D/OpenGLRenderer: finish <0x6290f198>
  215. D/SQLiteDatabase: endTransaction()
  216. D/SQLiteDatabase: beginTransaction()
  217. D/SQLiteDatabase: endTransaction()
  218. W/ClassMapper: No setter/field for -L5h6ooG-p1LkYukY69- found on class com.example.lenovo.jdstudio.new_customer
  219. 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}} }
  220. E/UpdateOrder: null
  221. D/OpenGLRenderer: prepareDirty (0.00, 0.00, 720.00, 1184.00) opaque 1 <0x6290f198>
  222. D/OpenGLRenderer: finish <0x6290f198>
  223. D/OpenGLRenderer: prepareDirty (0.00, 0.00, 720.00, 1184.00) opaque 1 <0x6290f198>
  224. D/OpenGLRenderer: finish <0x6290f198>
  225. 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
  226. D/OpenGLRenderer: prepareDirty (0.00, 0.00, 720.00, 1184.00) opaque 1 <0x6290f198>
  227. D/OpenGLRenderer: finish <0x6290f198>
  228. D/NativeCrypto: ssl=0x62906950 sslRead buf=0x423b5a31 len=1,timeo=0
  229. D/NativeCrypto: ssl=0x62906950 sslRead buf=0x4246b088 len=43,timeo=0
  230. D/NativeCrypto: ssl=0x62906950 sslRead buf=0x423b5a30 len=1,timeo=0
  231. D/SQLiteDatabase: beginTransaction()
  232. D/SQLiteDatabase: endTransaction()
  233. D/dalvikvm: threadid=13: exiting
  234. D/dalvikvm: threadid=13: bye!
Add Comment
Please, Sign In to add comment