// Path: JoanZapata-android-iconify-95083c5/android-iconify-sample/src/main/java/com/joanzapata/iconify/sample/utils/AndroidUtils.java
// public final class AndroidUtils {
// 
//     // Prevent instantiation
//     private AndroidUtils() {}
// 
//     /** Returns the available screensize, including status bar and navigation bar */
//     public static Size getScreenSize(Activity context) {
//         Display display = context.getWindowManager().getDefaultDisplay();
//         int realWidth;
//         int realHeight;
// 
//         if (Build.VERSION.SDK_INT >= 17) {
//             DisplayMetrics realMetrics = new DisplayMetrics();
//             display.getRealMetrics(realMetrics);
//             realWidth = realMetrics.widthPixels;
//             realHeight = realMetrics.heightPixels;
// 
//         } else if (Build.VERSION.SDK_INT >= 14) {
//             try {
//                 Method mGetRawH = Display.class.getMethod("getRawHeight");
//                 Method mGetRawW = Display.class.getMethod("getRawWidth");
//                 realWidth = (Integer) mGetRawW.invoke(display);
//                 realHeight = (Integer) mGetRawH.invoke(display);
//             } catch (Exception e) {
//                 //this may not be 100% accurate, but it's all we've got
//                 realWidth = display.getWidth();
//                 realHeight = display.getHeight();
//                 Log.e("Display Info", "Couldn't use reflection to get the real display metrics.");
//             }
// 
//         } else {
//             //This should be close, as lower API devices should not have window navigation bars
//             realWidth = display.getWidth();
//             realHeight = display.getHeight();
//         }
// 
//         return new Size(realWidth, realHeight);
//     }
// 
//     public static class Size {
//         public final int width;
//         public final int height;
// 
//         public Size(int width, int height) {
//             this.width = width;
//             this.height = height;
//         }
//     }
// }


import android.app.Activity;
import android.content.Context;
import android.support.v4.view.PagerAdapter;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.joanzapata.iconify.IconFontDescriptor;
import com.joanzapata.iconify.sample.utils.AndroidUtils;

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

    @Override
    public Object instantiateItem(ViewGroup container, int position) {
        Context context = container.getContext();
        LayoutInflater inflater = LayoutInflater.from(context);
        View view = inflater.inflate(R.layout.item_font, container, false);
        RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.recyclerView);
        int nbColumns = AndroidUtils.getScreenSize((Activity) context).width /
                context.getResources().getDimensionPixelSize(R.dimen.item_width);
        recyclerView.setLayoutManager(new GridLayoutManager(context, nbColumns));
        recyclerView.setAdapter(new IconAdapter(fonts[position].getFont().characters()));
        container.addView(view);
        return view;
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return fonts[position].getTitle();
    }

    @Override
    public boolean isViewFromObject(View view, Object object) {
        return view == object;
    }

// Path: JoanZapata-android-iconify-95083c5/android-iconify-sample/src/main/java/com/joanzapata/iconify/sample/utils/AndroidUtils.java
// public final class AndroidUtils {
// 
//     // Prevent instantiation
//     private AndroidUtils() {}
// 
//     /** Returns the available screensize, including status bar and navigation bar */
//     public static Size getScreenSize(Activity context) {
//         Display display = context.getWindowManager().getDefaultDisplay();
//         int realWidth;
//         int realHeight;
// 
//         if (Build.VERSION.SDK_INT >= 17) {
//             DisplayMetrics realMetrics = new DisplayMetrics();
//             display.getRealMetrics(realMetrics);
//             realWidth = realMetrics.widthPixels;
//             realHeight = realMetrics.heightPixels;
// 
//         } else if (Build.VERSION.SDK_INT >= 14) {
//             try {
//                 Method mGetRawH = Display.class.getMethod("getRawHeight");
//                 Method mGetRawW = Display.class.getMethod("getRawWidth");
//                 realWidth = (Integer) mGetRawW.invoke(display);
//                 realHeight = (Integer) mGetRawH.invoke(display);
//             } catch (Exception e) {
//                 //this may not be 100% accurate, but it's all we've got
//                 realWidth = display.getWidth();
//                 realHeight = display.getHeight();
//                 Log.e("Display Info", "Couldn't use reflection to get the real display metrics.");
//             }
// 
//         } else {
//             //This should be close, as lower API devices should not have window navigation bars
//             realWidth = display.getWidth();
//             realHeight = display.getHeight();
//         }
// 
//         return new Size(realWidth, realHeight);
//     }
// 
//     public static class Size {
//         public final int width;
//         public final int height;
// 
//         public Size(int width, int height) {
//             this.width = width;
//             this.height = height;
//         }
//     }
// }


// Path: JoanZapata-android-iconify-95083c5/android-iconify-sample/src/main/java/com/joanzapata/iconify/sample/FontIconsViewPagerAdapter.java
import android.app.Activity;
import android.content.Context;
import android.support.v4.view.PagerAdapter;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.joanzapata.iconify.IconFontDescriptor;
import com.joanzapata.iconify.sample.utils.AndroidUtils;


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

    @Override
    public Object instantiateItem(ViewGroup container, int position) {
        Context context = container.getContext();
        LayoutInflater inflater = LayoutInflater.from(context);
        View view = inflater.inflate(R.layout.item_font, container, false);
        RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.recyclerView);
        int nbColumns = AndroidUtils.getScreenSize((Activity) context).width /
                context.getResources().getDimensionPixelSize(R.dimen.item_width);
        recyclerView.setLayoutManager(new GridLayoutManager(context, nbColumns));
        recyclerView.setAdapter(new IconAdapter(fonts[position].getFont().characters()));
        container.addView(view);
        return view;
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return fonts[position].getTitle();
    }

    @Override
    public boolean isViewFromObject(View view, Object object) {
        return view == object;
    }

    @Override