// Path: material-life-android/src/main/java/com/juankysoriano/materiallife/ContextRetriever.java
// public enum ContextRetriever {
//     INSTANCE;
// 
//     private Application application;
//     private FragmentActivity activity;
// 
//     public void inject(Application application) {
//         this.application = application;
//     }
// 
//     public void inject(FragmentActivity activity) {
//         this.activity = activity;
//     }
// 
//     public Context getApplicationContext() {
//         return application.getApplicationContext();
//     }
// 
//     public FragmentActivity getActivity() {
//         return activity;
//     }
// 
//     public Resources getResources() {
//         return application.getResources();
//     }
// 
// }
// 
// Path: material-life-android/src/main/java/com/juankysoriano/materiallife/menu/MenuItem.java
// public enum MenuItem {
//     EDIT_WORLD("Edit World"),
//     LOAD_WORLD("Load World"),
//     INFO("Info");
// 
//     private final String value;
// 
//     MenuItem(String value) {
//         this.value = value;
//     }
// 
//     public String value() {
//         return value;
//     }
// }
// 
// Path: material-life-android/src/main/java/com/juankysoriano/materiallife/ui/sketch/PixelTextView.java
// public class PixelTextView extends TextView {
// 
//     private static final String FONT_PATH = "fonts/pixel.ttf";
// 
//     public PixelTextView(Context context, AttributeSet attrs) {
//         super(context, attrs);
//         initFonts();
//     }
// 
//     public PixelTextView(Context context, AttributeSet attrs, int defStyleAttr) {
//         super(context, attrs, defStyleAttr);
//         initFonts();
//     }
// 
//     private void initFonts() {
//         Typeface typeface = Typeface.createFromAsset(getContext().getAssets(), FONT_PATH);
//         setTypeface(typeface);
//     }
// }


import android.content.Context;
import androidx.annotation.VisibleForTesting;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import com.juankysoriano.materiallife.ContextRetriever;
import com.juankysoriano.materiallife.R;
import com.juankysoriano.materiallife.menu.MenuItem;
import com.juankysoriano.materiallife.ui.sketch.PixelTextView;
import com.novoda.notils.caster.Views;
package com.juankysoriano.materiallife.ui.sketch.menu;



public class MenuItemAdapter extends BaseAdapter {

    private final Context context;

    public static MenuItemAdapter newInstance() {
        return new MenuItemAdapter(ContextRetriever.INSTANCE.getApplicationContext());
    }

    @VisibleForTesting
    protected MenuItemAdapter(Context context) {
        this.context = context;
    }

    @Override
    public int getCount() {
        return MenuItem.values().length;
    }

    @Override
    public MenuItem getItem(int position) {
        return MenuItem.values()[position];
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        View view = convertView;

        if (convertView == null) {
            LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            view = inflater.inflate(R.layout.list_item, parent, false);
        }

        PixelTextView menuItemTextView = Views.findById(view, R.id.menu_item);
// Path: material-life-android/src/main/java/com/juankysoriano/materiallife/ContextRetriever.java
// public enum ContextRetriever {
//     INSTANCE;
// 
//     private Application application;
//     private FragmentActivity activity;
// 
//     public void inject(Application application) {
//         this.application = application;
//     }
// 
//     public void inject(FragmentActivity activity) {
//         this.activity = activity;
//     }
// 
//     public Context getApplicationContext() {
//         return application.getApplicationContext();
//     }
// 
//     public FragmentActivity getActivity() {
//         return activity;
//     }
// 
//     public Resources getResources() {
//         return application.getResources();
//     }
// 
// }
// 
// Path: material-life-android/src/main/java/com/juankysoriano/materiallife/menu/MenuItem.java
// public enum MenuItem {
//     EDIT_WORLD("Edit World"),
//     LOAD_WORLD("Load World"),
//     INFO("Info");
// 
//     private final String value;
// 
//     MenuItem(String value) {
//         this.value = value;
//     }
// 
//     public String value() {
//         return value;
//     }
// }
// 
// Path: material-life-android/src/main/java/com/juankysoriano/materiallife/ui/sketch/PixelTextView.java
// public class PixelTextView extends TextView {
// 
//     private static final String FONT_PATH = "fonts/pixel.ttf";
// 
//     public PixelTextView(Context context, AttributeSet attrs) {
//         super(context, attrs);
//         initFonts();
//     }
// 
//     public PixelTextView(Context context, AttributeSet attrs, int defStyleAttr) {
//         super(context, attrs, defStyleAttr);
//         initFonts();
//     }
// 
//     private void initFonts() {
//         Typeface typeface = Typeface.createFromAsset(getContext().getAssets(), FONT_PATH);
//         setTypeface(typeface);
//     }
// }


// Path: material-life-android/src/main/java/com/juankysoriano/materiallife/ui/sketch/menu/MenuItemAdapter.java
import android.content.Context;
import androidx.annotation.VisibleForTesting;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import com.juankysoriano.materiallife.ContextRetriever;
import com.juankysoriano.materiallife.R;
import com.juankysoriano.materiallife.menu.MenuItem;
import com.juankysoriano.materiallife.ui.sketch.PixelTextView;
import com.novoda.notils.caster.Views;

package com.juankysoriano.materiallife.ui.sketch.menu;



public class MenuItemAdapter extends BaseAdapter {

    private final Context context;

    public static MenuItemAdapter newInstance() {
        return new MenuItemAdapter(ContextRetriever.INSTANCE.getApplicationContext());
    }

    @VisibleForTesting
    protected MenuItemAdapter(Context context) {
        this.context = context;
    }

    @Override
    public int getCount() {
        return MenuItem.values().length;
    }

    @Override
    public MenuItem getItem(int position) {
        return MenuItem.values()[position];
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        View view = convertView;

        if (convertView == null) {
            LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            view = inflater.inflate(R.layout.list_item, parent, false);
        }

        PixelTextView menuItemTextView = Views.findById(view, R.id.menu_item);
        MenuItem menuItem = getItem(position);