<commit_before>package de.htwdd.htwdresden.adapter;

import android.content.Context;
import androidx.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import de.htwdd.htwdresden.R;
import de.htwdd.htwdresden.types.canteen.Meal;
import io.realm.OrderedRealmCollection;
import io.realm.RealmBaseAdapter;

/**
 * Adapter für die Mensa Tagesübersicht
 *
 * @author <NAME>
 */
public class MensaOverviewDayAdapter extends RealmBaseAdapter<Meal> {

    public MensaOverviewDayAdapter(@Nullable final OrderedRealmCollection<Meal> data) {
        super(data);
    }

    @Override
    public View getView(final int i, @Nullable View view, final ViewGroup viewGroup) {
        final Context context = viewGroup.getContext();
        final ViewHolder viewHolder;
        if (view == null) {
            view = LayoutInflater.from(context).inflate(R.layout.fragment_mensa_detail_item_day, viewGroup, false);
            viewHolder = new ViewHolder();
            viewHolder.title = view.findViewById(R.id.mensa_title);
            viewHolder.price_student = view.findViewById(R.id.mensa_price_student);
            viewHolder.price_employee = view.findViewById(R.id.mensa_price_employee);
            viewHolder.imagePork = view.findViewById(R.id.mensa_layout_pork);
            viewHolder.imageBeef = view.findViewById(R.id.mensa_layout_beef);
            viewHolder.imageVegetarian = view.findViewById(R.id.mensa_layout_vegetarian);
            viewHolder.imageVegan = view.findViewById(R.id.mensa_layout_vegan);
            viewHolder.imageGarlic = view.findViewById(R.id.mensa_layout_garlic);
            viewHolder.imageAlcohol = view.findViewById(R.id.mensa_layout_alcohol);
            view.setTag(viewHolder);
        } else {
            viewHolder = (ViewHolder) view.getTag();
        }

        final Meal meal = getItem(i);
        if (meal == null) {
            return view;
        }

        viewHolder.title.setText(meal.getName());

        // Preis anzeigen
        final float priceStudent = (float) meal.getPrices().getStudents();
        final float priceEmployee = (float) meal.getPrices().getEmployees();
        viewHolder.price_student.setText(context.getString(R.string.mensa_price_student, priceStudent));
        viewHolder.price_employee.setText(context.getString(R.string.mensa_price_employee, priceEmployee));

        // Eigenschaften als Icon anzeigen
        viewHolder.imagePork.setVisibility(meal.getNotes().contains("enthält Schweinefleisch") ? View.VISIBLE : View.GONE);
        viewHolder.imageBeef.setVisibility(meal.getNotes().contains("enthält Rindfleisch") ? View.VISIBLE : View.GONE);
        viewHolder.imageVegetarian.setVisibility(meal.getNotes().contains("vegetarisch") ? View.VISIBLE : View.GONE);
        viewHolder.imageVegan.setVisibility(meal.getNotes().contains("vegan") ? View.VISIBLE : View.GONE);
        viewHolder.imageGarlic.setVisibility(meal.getNotes().contains("enthält Knoblauch") ? View.VISIBLE : View.GONE);
        viewHolder.imageAlcohol.setVisibility(meal.getNotes().contains("enthält Alkohol") ? View.VISIBLE : View.GONE);

        return view;
    }

    private static class ViewHolder {
        TextView title;
        TextView price_student;
        TextView price_employee;
        LinearLayout imagePork;
        LinearLayout imageBeef;
        LinearLayout imageVegetarian;
        LinearLayout imageVegan;
        LinearLayout imageGarlic;
        LinearLayout imageAlcohol;
    }
}
<commit_msg>Abfangen, wenn kein Preis vorhanden<commit_after>package de.htwdd.htwdresden.adapter;

import android.content.Context;
import androidx.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import de.htwdd.htwdresden.R;
import de.htwdd.htwdresden.types.canteen.Meal;
import io.realm.OrderedRealmCollection;
import io.realm.RealmBaseAdapter;

/**
 * Adapter für die Mensa Tagesübersicht
 *
 * @author <NAME>
 */
public class MensaOverviewDayAdapter extends RealmBaseAdapter<Meal> {

    public MensaOverviewDayAdapter(@Nullable final OrderedRealmCollection<Meal> data) {
        super(data);
    }

    @Override
    public View getView(final int i, @Nullable View view, final ViewGroup viewGroup) {
        final Context context = viewGroup.getContext();
        final ViewHolder viewHolder;
        if (view == null) {
            view = LayoutInflater.from(context).inflate(R.layout.fragment_mensa_detail_item_day, viewGroup, false);
            viewHolder = new ViewHolder();
            viewHolder.title = view.findViewById(R.id.mensa_title);
            viewHolder.price_student = view.findViewById(R.id.mensa_price_student);
            viewHolder.price_employee = view.findViewById(R.id.mensa_price_employee);
            viewHolder.imagePork = view.findViewById(R.id.mensa_layout_pork);
            viewHolder.imageBeef = view.findViewById(R.id.mensa_layout_beef);
            viewHolder.imageVegetarian = view.findViewById(R.id.mensa_layout_vegetarian);
            viewHolder.imageVegan = view.findViewById(R.id.mensa_layout_vegan);
            viewHolder.imageGarlic = view.findViewById(R.id.mensa_layout_garlic);
            viewHolder.imageAlcohol = view.findViewById(R.id.mensa_layout_alcohol);
            view.setTag(viewHolder);
        } else {
            viewHolder = (ViewHolder) view.getTag();
        }

        final Meal meal = getItem(i);
        if (meal == null) {
            return view;
        }

        viewHolder.title.setText(meal.getName());

        // Preis anzeigen
        final float priceStudent = (float) meal.getPrices().getStudents();
        final float priceEmployee = (float) meal.getPrices().getEmployees();

        if(priceStudent == 0){
            viewHolder.price_student.setText(context.getString(R.string.mensa_price_student_no_price));
        }
        else {
            viewHolder.price_student.setText(context.getString(R.string.mensa_price_student, priceStudent));
        }
        if(priceEmployee == 0){
            viewHolder.price_employee.setText(context.getString(R.string.mensa_price_employee_no_price));
        }
        else
        {
            viewHolder.price_employee.setText(context.getString(R.string.mensa_price_employee, priceEmployee));
        }

        // Eigenschaften als Icon anzeigen
        viewHolder.imagePork.setVisibility(meal.getNotes().contains("enthält Schweinefleisch") ? View.VISIBLE : View.GONE);
        viewHolder.imageBeef.setVisibility(meal.getNotes().contains("enthält Rindfleisch") ? View.VISIBLE : View.GONE);
        viewHolder.imageVegetarian.setVisibility(meal.getNotes().contains("vegetarisch") ? View.VISIBLE : View.GONE);
        viewHolder.imageVegan.setVisibility(meal.getNotes().contains("vegan") ? View.VISIBLE : View.GONE);
        viewHolder.imageGarlic.setVisibility(meal.getNotes().contains("enthält Knoblauch") ? View.VISIBLE : View.GONE);
        viewHolder.imageAlcohol.setVisibility(meal.getNotes().contains("enthält Alkohol") ? View.VISIBLE : View.GONE);

        return view;
    }

    private static class ViewHolder {
        TextView title;
        TextView price_student;
        TextView price_employee;
        LinearLayout imagePork;
        LinearLayout imageBeef;
        LinearLayout imageVegetarian;
        LinearLayout imageVegan;
        LinearLayout imageGarlic;
        LinearLayout imageAlcohol;
    }
}

{'fraction_non_alphanumeric': 0.1021983773881183, 'fraction_numerical': 0.00026171159382360636, 'mean_word_length': 3.2890011223344557, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6037447', 'n_tokens_mistral': 2384, 'n_tokens_neox': 2202, 'n_words': 356}