Guest User

Untitled

a guest
Dec 5th, 2013
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.96 KB | None | 0 0
  1. @Override
  2.         public View getView(final int position, View convertView, ViewGroup parent) {          
  3.                 boolean convertViewStatus = (convertView == null);
  4.  
  5.                 if (clickedPos == position | convertViewStatus){
  6.                         View vi;
  7.                         if (convertViewStatus) {
  8.                                 vi = inflater.inflate(R.layout.listview_products, null);
  9.                         } else {
  10.                                 vi = convertView;
  11.                         }
  12.        
  13.                 nazwaTxtList = (TextView) vi.findViewById(R.id.nazwaTxtList);
  14.                 dataOtwTxtList = (TextView) vi.findViewById(R.id.dataOtwTxtList);
  15.                 terminWazTxtList = (TextView) vi.findViewById(R.id.terminWazTxtList);
  16.                 pozostaloPrgsList = (ProgressBar) vi.findViewById(R.id.pozostaloPrgsList);
  17.                 expandImage = (ImageView) vi.findViewById(R.id.expandImage);
  18.                 obrazekImage = (ImageView) vi.findViewById(R.id.obrazekImage);
  19.                 detailsLay = (LinearLayout) vi.findViewById(R.id.detailsLay);
  20.                 basicLay = (LinearLayout) vi.findViewById(R.id.basicLay);
  21.                 deleteLay = (LinearLayout) vi.findViewById(R.id.deleteLay);
  22.                 showProdLay = (LinearLayout) vi.findViewById(R.id.showProdLay);
  23.                  
  24.                 final Product product = products.get(position);
  25.                 String nazwa = product.getNazwa();
  26.                 String dataOtw = product.getDataOtwarcia();
  27.                 String terminWaz = product.getTerminWaznosci();
  28.                 String image = product.getImage();
  29.                 int progress = utilities.getProgress(dataOtw, terminWaz);
  30.                
  31.                 nazwaTxtList.setText(nazwa);
  32.                 dataOtwTxtList.setText(dataOtw);
  33.                 terminWazTxtList.setText(terminWaz);
  34.                 pozostaloPrgsList.setProgress(progress);
  35.                
  36.                 if (!image.equals("")) {
  37.                         File imgFile = new  File(image + "thumb");
  38.                         if(imgFile.exists()){
  39.                             Bitmap myBitmap = BitmapFactory.decodeFile(imgFile.getAbsolutePath());
  40.                             obrazekImage.setImageBitmap(myBitmap);
  41.                         }        
  42.                         }
  43.                
  44.                 initAnimations(position); // tutaj na podstawie isExpanded[position]
  45.                                         // rozsuwa się lub chowa detailsLay
  46.                        
  47.                 basicLay.setOnClickListener(new OnClickListener() {
  48.                                
  49.                                 @Override
  50.                                 public void onClick(View v) {
  51.                                         boolean expanded = isExpanded[position];
  52.                                         isExpanded[position] = !expanded;
  53.                                         clickedPos = position;
  54.                                         AdapterProductList.this.notifyDataSetChanged();
  55.                                 }
  56.                         });
  57.                
  58.                 deleteLay.setOnClickListener(new OnClickListener() {
  59.                                
  60.                                 @Override
  61.                                 public void onClick(View v) {
  62.                                         showChoiceDialog(product);
  63.                                 }
  64.                         });
  65.                 showProdLay.setOnClickListener(new OnClickListener() {
  66.                                
  67.                                 @Override
  68.                                 public void onClick(View v) {
  69.                                         showProduct(position);                                
  70.                                 }
  71.                         });
  72.                
  73.                 return vi;
  74.                 } else {
  75.                         return convertView;                        
  76.                 }
  77.         }
Advertisement
Add Comment
Please, Sign In to add comment