Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- public View getView(final int position, View convertView, ViewGroup parent) {
- boolean convertViewStatus = (convertView == null);
- if (clickedPos == position | convertViewStatus){
- View vi;
- if (convertViewStatus) {
- vi = inflater.inflate(R.layout.listview_products, null);
- } else {
- vi = convertView;
- }
- nazwaTxtList = (TextView) vi.findViewById(R.id.nazwaTxtList);
- dataOtwTxtList = (TextView) vi.findViewById(R.id.dataOtwTxtList);
- terminWazTxtList = (TextView) vi.findViewById(R.id.terminWazTxtList);
- pozostaloPrgsList = (ProgressBar) vi.findViewById(R.id.pozostaloPrgsList);
- expandImage = (ImageView) vi.findViewById(R.id.expandImage);
- obrazekImage = (ImageView) vi.findViewById(R.id.obrazekImage);
- detailsLay = (LinearLayout) vi.findViewById(R.id.detailsLay);
- basicLay = (LinearLayout) vi.findViewById(R.id.basicLay);
- deleteLay = (LinearLayout) vi.findViewById(R.id.deleteLay);
- showProdLay = (LinearLayout) vi.findViewById(R.id.showProdLay);
- final Product product = products.get(position);
- String nazwa = product.getNazwa();
- String dataOtw = product.getDataOtwarcia();
- String terminWaz = product.getTerminWaznosci();
- String image = product.getImage();
- int progress = utilities.getProgress(dataOtw, terminWaz);
- nazwaTxtList.setText(nazwa);
- dataOtwTxtList.setText(dataOtw);
- terminWazTxtList.setText(terminWaz);
- pozostaloPrgsList.setProgress(progress);
- if (!image.equals("")) {
- File imgFile = new File(image + "thumb");
- if(imgFile.exists()){
- Bitmap myBitmap = BitmapFactory.decodeFile(imgFile.getAbsolutePath());
- obrazekImage.setImageBitmap(myBitmap);
- }
- }
- initAnimations(position); // tutaj na podstawie isExpanded[position]
- // rozsuwa się lub chowa detailsLay
- basicLay.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View v) {
- boolean expanded = isExpanded[position];
- isExpanded[position] = !expanded;
- clickedPos = position;
- AdapterProductList.this.notifyDataSetChanged();
- }
- });
- deleteLay.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View v) {
- showChoiceDialog(product);
- }
- });
- showProdLay.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View v) {
- showProduct(position);
- }
- });
- return vi;
- } else {
- return convertView;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment