<commit_before>package io.github.deltajulio.pantrybank.ui;

import android.util.Log;
import android.view.View;
import android.widget.ToggleButton;

import com.firebase.ui.database.FirebaseRecyclerAdapter;
import com.google.firebase.database.Query;

import io.github.deltajulio.pantrybank.data.Database;
import io.github.deltajulio.pantrybank.data.FoodItem;

/**
 * The Firebase UI version of RecyclerAdapter. Also handles on click methods for items.
 */
public class PantryRecyclerAdapter extends FirebaseRecyclerAdapter<FoodItem, PantryFoodHolder> implements PantryOnClickListener
{
    private static final String TAG = "PantryRecycleAdapter";
    private final Database database;

    public PantryRecyclerAdapter(Class<FoodItem> modelClass, int modelLayout,
                                 Class<PantryFoodHolder> viewHolderClass, Query ref,
                                 MainFragmentListener onClickListener)
    {
        super(modelClass, modelLayout, viewHolderClass, ref);
        database = onClickListener.GetDatabase();
    }

    @Override
    public void onBindViewHolder(PantryFoodHolder viewHolder, int position)
    {
        super.onBindViewHolder(viewHolder, position);
        viewHolder.SetOnClickListener(this);
    }

    @Override
    protected void populateViewHolder(PantryFoodHolder viewHolder, FoodItem item, int position)
    {
        viewHolder.SetItemName(item.getName());
        viewHolder.SetIsPinned(item.getIsPinned());

        Log.d(TAG, item.getName());
        Log.d(TAG, item.getQuantityType().toString());
        if (item.getQuantityType() == FoodItem.QuantityType.NUMERICAL)
        {
            viewHolder.SetItemQuantity(String.valueOf(item.getQuantityNum()));
        } else
        {
            viewHolder.SetItemQuantity(item.getQuantityApprox().toString());
        }
    }

    @Override
    public void OnPinClicked(final int position)
    {
        FoodItem item = getItem(position);
        database.UpdateIsPinned(item.getName(), !item.getIsPinned());
    }

    @Override
    public void OnDropDownClicked(final int position, PantryFoodHolder holder)
    {
        ToggleButton dropDown = holder.GetDropDown();
        holder.SetDropDownChecked(!dropDown.isChecked());
        holder.SetActionListVisibility(dropDown.isChecked() ? View.VISIBLE : View.GONE);
    }

    @Override
    public void OnEditClicked(final int position)
    {

    }<commit_msg>fix action list not appearing<commit_after>package io.github.deltajulio.pantrybank.ui;

import android.util.Log;
import android.view.View;
import android.widget.ToggleButton;

import com.firebase.ui.database.FirebaseRecyclerAdapter;
import com.google.firebase.database.Query;

import io.github.deltajulio.pantrybank.data.Database;
import io.github.deltajulio.pantrybank.data.FoodItem;

/**
 * The Firebase UI version of RecyclerAdapter. Also handles on click methods for items.
 */
public class PantryRecyclerAdapter extends FirebaseRecyclerAdapter<FoodItem, PantryFoodHolder> implements PantryOnClickListener
{
    private static final String TAG = "PantryRecycleAdapter";
    private final Database database;

    public PantryRecyclerAdapter(Class<FoodItem> modelClass, int modelLayout,
                                 Class<PantryFoodHolder> viewHolderClass, Query ref,
                                 MainFragmentListener onClickListener)
    {
        super(modelClass, modelLayout, viewHolderClass, ref);
        database = onClickListener.GetDatabase();
    }

    @Override
    public void onBindViewHolder(PantryFoodHolder viewHolder, int position)
    {
        super.onBindViewHolder(viewHolder, position);
        viewHolder.SetOnClickListener(this);
    }

    @Override
    protected void populateViewHolder(PantryFoodHolder viewHolder, FoodItem item, int position)
    {
        viewHolder.SetItemName(item.getName());
        viewHolder.SetIsPinned(item.getIsPinned());

        Log.d(TAG, item.getName());
        Log.d(TAG, item.getQuantityType().toString());
        if (item.getQuantityType() == FoodItem.QuantityType.NUMERICAL)
        {
            viewHolder.SetItemQuantity(String.valueOf(item.getQuantityNum()));
        } else
        {
            viewHolder.SetItemQuantity(item.getQuantityApprox().toString());
        }
    }

    @Override
    public void OnPinClicked(final int position)
    {
        FoodItem item = getItem(position);
        database.UpdateIsPinned(item.getName(), !item.getIsPinned());
    }

    @Override
    public void OnDropDownClicked(final int position, PantryFoodHolder holder)
    {
        ToggleButton dropDown = holder.GetDropDown();
        holder.SetActionListVisibility(dropDown.isChecked() ? View.VISIBLE : View.GONE);
    }

    @Override
    public void OnEditClicked(final int position)
    {

    }
{'fraction_non_alphanumeric': 0.09144050104384134, 'fraction_numerical': 0.0, 'mean_word_length': 3.270053475935829, '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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6723467', 'n_tokens_mistral': 1362, 'n_tokens_neox': 1292, 'n_words': 257}