Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.50 KB | None | 0 0
  1. package com.nykkos.myaccount;
  2.  
  3. import java.io.Serializable;
  4. import java.util.List;
  5.  
  6. import android.app.Activity;
  7. import android.content.Context;
  8. import android.content.Intent;
  9. import android.view.LayoutInflater;
  10. import android.view.View;
  11. import android.view.ViewGroup;
  12. import android.view.View.OnClickListener;
  13. import android.widget.BaseAdapter;
  14. import android.widget.Button;
  15. import android.widget.ImageView;
  16. import android.widget.TextView;
  17.  
  18. import com.nykkos.myaccount.Youtube.Video;
  19.  
  20. public class UploadAdapter extends BaseAdapter implements Serializable{
  21. private Context context;
  22. private ImageLoader imageLoader;
  23. private Activity activity;
  24. List<Video> items;
  25. public UploadAdapter(Activity activity, List<Video> items) {
  26. System.out.println("Inside constructorrrrrrrrrrrrrrrrrr");
  27. // TODO Auto-generated constructor stub
  28. this.context = activity;
  29. imageLoader = new ImageLoader(context);
  30. this.items = items;
  31. this.activity = activity;
  32. }
  33.  
  34. @Override
  35. public int getCount() {
  36. // TODO Auto-generated method stub
  37. System.out.println("Size isssssssssssssssssssssssssssssss"
  38. + items.size());
  39. return items.size();
  40. }
  41.  
  42. @Override
  43. public Object getItem(int position) {
  44. // TODO Auto-generated method stub
  45.  
  46. return items.get(position);
  47. }
  48.  
  49. @Override
  50. public long getItemId(int position) {
  51. // TODO Auto-generated method stub
  52. return position;
  53. }
  54.  
  55. public static class ViewHolder {
  56. public TextView tvTitle;
  57. public TextView tvDescription;
  58. public ImageView image;
  59. public Button infoButton;
  60. // public TextView tvDescription;
  61. // public TextView tvViewCount;
  62. /*
  63. * public ImageView image; public TextView des;
  64. */
  65. }
  66.  
  67. @Override
  68. public View getView(final int position, View convertView, ViewGroup parent) {
  69. // TODO Auto-generated method stub
  70. ViewHolder holder;
  71. System.out.println("inside view holderrrrrrrrrrrr");
  72.  
  73. if (convertView == null) {
  74. holder = new ViewHolder();
  75. LayoutInflater inflator = (LayoutInflater) context
  76. .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  77. convertView = inflator.inflate(R.layout.myaccount_row, null);
  78.  
  79. holder.tvTitle = (TextView) convertView.findViewById(R.id.txtDesc);
  80. holder.image = (ImageView) convertView.findViewById(R.id.imgPlate);
  81. holder.tvDescription = (TextView) convertView.findViewById(R.id.txtType);
  82. holder.infoButton = (Button)convertView.findViewById(R.id.infoButton);
  83.  
  84. convertView.setTag(holder);
  85.  
  86. } else
  87. holder = (ViewHolder) convertView.getTag();
  88.  
  89. // Set the ID
  90. convertView.setId(position);
  91.  
  92. System.out.println("Thumbnail urlllllllllllll"
  93. + items.get(position).GetThumbnail());
  94.  
  95. holder.tvTitle.setText(""+items.get(position).title);
  96. System.out.println("Title is" + items.get(position).title);
  97.  
  98. holder.image.setTag(items.get(position).GetThumbnail());
  99. imageLoader.DisplayImage(items.get(position).GetThumbnail(), activity, holder.image);
  100.  
  101.  
  102. holder.tvDescription.setText(""+items.get(position).description);
  103. System.out.println("Title is" + items.get(position).title);
  104.  
  105. holder.infoButton.setFocusable(false);
  106.  
  107. holder.infoButton.setOnClickListener(new OnClickListener() {
  108.  
  109. @Override
  110. public void onClick(View v) {Intent i = new Intent(v.getContext(),Simple.class);
  111. i.putExtra("position", position);
  112. i.putExtra("videoid", items.get(position).GetId());
  113. i.putExtra("duration", items.get(position).GetDuration());
  114. v.getContext().startActivity(i);}
  115. });
  116.  
  117. return convertView;
  118. }
  119. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement