Commit c33045ee authored by Fabius's avatar Fabius

FIX: Bilder wechseln nicht mehr zufällig durch, wenn ein weiter Tag geöffnet wird. #16

parent 86ad4f28
......@@ -3,11 +3,14 @@ package de.bps.asist.module.canteen;
import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseExpandableListAdapter;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import java.text.NumberFormat;
......@@ -19,6 +22,7 @@ import java.util.Locale;
import de.bps.asist.R;
import de.bps.asist.core.manager.image.ASiSTImageManager;
import de.bps.asist.core.util.DownloadImageTask;
import de.bps.asist.module.canteen.model.CanteenMenu;
import de.bps.asist.module.canteen.model.MenuPriceDescription;
......@@ -132,19 +136,43 @@ public class ExpandableMensaListAdapter extends BaseExpandableListAdapter {
}
}
ViewHolder viewHolder;
if(convertView == null){
LayoutInflater inflater = (LayoutInflater) this.context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(R.layout.menu_list_item,null);
viewHolder = new ViewHolder();
viewHolder.titel = (TextView)convertView.findViewById(R.id.listItemTitle);
viewHolder.descText = (TextView)convertView.findViewById(R.id.listItemDescription);
viewHolder.prices = (TextView)convertView.findViewById(R.id.canteen_prices);
viewHolder.imageView = (ImageView)convertView.findViewById(R.id.listItemMainLogo);
viewHolder.linearLayout = (LinearLayout)convertView.findViewById(R.id.listItemMainLogoWrapper);
convertView.setTag(viewHolder);
}
else{
viewHolder = (ViewHolder) convertView.getTag();
}
TextView textView = (TextView)convertView.findViewById(R.id.listItemTitle);
/* textView = (TextView)convertView.findViewById(R.id.listItemTitle);
ImageView imageView = (ImageView)convertView.findViewById(R.id.listItemMainLogo);
TextView textView1 = (TextView)convertView.findViewById(R.id.listItemDescription);
TextView prices = (TextView)convertView.findViewById(R.id.canteen_prices);
textView.setText(childText);
textView1.setText(descript);
prices.setText(sb.toString());
ASiSTImageManager.getInstance().setImage(image,imageView);
*/
viewHolder.titel.setText(childText);
viewHolder.descText.setText(descript);
viewHolder.prices.setText(sb.toString());
if(image != null && !image.isEmpty()){
//new DownloadImageTask(viewHolder.imageView).execute(canteenMenu.getImgUrlBig());
viewHolder.linearLayout.setVisibility(View.VISIBLE);
ASiSTImageManager.getInstance().setImage(image, viewHolder.imageView);
}
else{
//new DownloadImageTask(viewHolder.imageView).execute(image);
viewHolder.linearLayout.setVisibility(View.GONE);
}
return convertView;
}
......@@ -154,4 +182,12 @@ public class ExpandableMensaListAdapter extends BaseExpandableListAdapter {
return true;
}
static class ViewHolder{
TextView titel;
TextView descText;
TextView prices;
ImageView imageView;
LinearLayout linearLayout;
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment