// Path: app/src/main/java/studio/androiddev/puzzle/adapter/ChoosePicGridViewAdapter.java
// public class ChoosePicGridViewAdapter extends ArrayAdapter<Integer> {
// 
//     int resourceId;
// 
//     public ChoosePicGridViewAdapter(Context context, int resourceId){
//         super(context, resourceId);
//         this.resourceId = resourceId;
//     }
// 
//     @Override
//     public int getCount(){
//         return ChoosePicActivity.icons.length;
//     }
// 
//     @Override
//     public View getView(int position, View convertView, ViewGroup parent){
//         ViewHolder holder = null;
//         View view;
//         if(convertView == null){
//             view = LayoutInflater.from(getContext()).inflate(resourceId, null);
//             holder = new ViewHolder();
//             holder.imageView = (ImageView) view.findViewById(R.id.imageItem);
//             view.setTag(holder);
//         }else{
//             view = convertView;
//             holder = (ViewHolder) view.getTag();
//         }
// 
//         holder.imageView.setImageBitmap(BitmapUtils.decodeSampledBitmapFromResources(
//                 getContext().getResources(),
//                 ChoosePicActivity.icons[position],
//                 300,
//                 300
//         ));
// 
//         return view;
//     }
// 
//     class ViewHolder{
//         ImageView imageView;
//     }
// }


import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.GridView;
import butterknife.Bind;
import butterknife.ButterKnife;
import studio.androiddev.puzzle.R;
import studio.androiddev.puzzle.adapter.ChoosePicGridViewAdapter;
package studio.androiddev.puzzle.activity;



public class ChoosePicActivity extends BaseActivity {

    @Bind(R.id.toolbar)
    Toolbar toolbar;
    @Bind(R.id.picContainer)
    GridView picContainer;

    public static final int [] icons={
            R.drawable.default1,
            R.drawable.default2,
            R.drawable.default3,
            R.drawable.default4,
            R.drawable.default5,
            R.drawable.default6
    };

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_choose_pic);
        ButterKnife.bind(this);
        setSupportActionBar(toolbar);
        initView();

    }

    private void initView() {

        toolbar.setNavigationIcon(R.drawable.ic_arrow_back_white_24dp);

// Path: app/src/main/java/studio/androiddev/puzzle/adapter/ChoosePicGridViewAdapter.java
// public class ChoosePicGridViewAdapter extends ArrayAdapter<Integer> {
// 
//     int resourceId;
// 
//     public ChoosePicGridViewAdapter(Context context, int resourceId){
//         super(context, resourceId);
//         this.resourceId = resourceId;
//     }
// 
//     @Override
//     public int getCount(){
//         return ChoosePicActivity.icons.length;
//     }
// 
//     @Override
//     public View getView(int position, View convertView, ViewGroup parent){
//         ViewHolder holder = null;
//         View view;
//         if(convertView == null){
//             view = LayoutInflater.from(getContext()).inflate(resourceId, null);
//             holder = new ViewHolder();
//             holder.imageView = (ImageView) view.findViewById(R.id.imageItem);
//             view.setTag(holder);
//         }else{
//             view = convertView;
//             holder = (ViewHolder) view.getTag();
//         }
// 
//         holder.imageView.setImageBitmap(BitmapUtils.decodeSampledBitmapFromResources(
//                 getContext().getResources(),
//                 ChoosePicActivity.icons[position],
//                 300,
//                 300
//         ));
// 
//         return view;
//     }
// 
//     class ViewHolder{
//         ImageView imageView;
//     }
// }


// Path: app/src/main/java/studio/androiddev/puzzle/activity/ChoosePicActivity.java
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.GridView;
import butterknife.Bind;
import butterknife.ButterKnife;
import studio.androiddev.puzzle.R;
import studio.androiddev.puzzle.adapter.ChoosePicGridViewAdapter;

package studio.androiddev.puzzle.activity;



public class ChoosePicActivity extends BaseActivity {

    @Bind(R.id.toolbar)
    Toolbar toolbar;
    @Bind(R.id.picContainer)
    GridView picContainer;

    public static final int [] icons={
            R.drawable.default1,
            R.drawable.default2,
            R.drawable.default3,
            R.drawable.default4,
            R.drawable.default5,
            R.drawable.default6
    };

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_choose_pic);
        ButterKnife.bind(this);
        setSupportActionBar(toolbar);
        initView();

    }

    private void initView() {

        toolbar.setNavigationIcon(R.drawable.ic_arrow_back_white_24dp);

        picContainer.setAdapter(new ChoosePicGridViewAdapter(ChoosePicActivity.this, R.layout.choose_pic_gridview_item));