Search in sources :

Example 1 with TagChooseGridViewAdapter

use of com.nightonke.saver.adapter.TagChooseGridViewAdapter in project CoCoin by Nightonke.

the class TagChooseFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.tag_choose_fragment, container, false);
    myGridView = (MyGridView) view.findViewById(R.id.gridview);
    fragmentPosition = getArguments().getInt("position");
    if (fragmentPosition >= CoCoinFragmentManager.tagChooseFragments.size()) {
        while (fragmentPosition >= CoCoinFragmentManager.tagChooseFragments.size()) {
            CoCoinFragmentManager.tagChooseFragments.add(new TagChooseFragment());
        }
    }
    CoCoinFragmentManager.tagChooseFragments.set(fragmentPosition, this);
    tagAdapter = new TagChooseGridViewAdapter(getActivity(), fragmentPosition);
    myGridView.setAdapter(tagAdapter);
    myGridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            try {
                ((OnTagItemSelectedListener) activity).onTagItemPicked(position);
                ((OnTagItemSelectedListener) activity).onAnimationStart(RecordManager.TAGS.get(fragmentPosition * 8 + position + 2).getId());
            } catch (ClassCastException cce) {
                cce.printStackTrace();
            }
        }
    });
    return view;
}
Also used : TagChooseGridViewAdapter(com.nightonke.saver.adapter.TagChooseGridViewAdapter) AdapterView(android.widget.AdapterView) ImageView(android.widget.ImageView) TextView(android.widget.TextView) View(android.view.View) MyGridView(com.nightonke.saver.ui.MyGridView) AdapterView(android.widget.AdapterView)

Aggregations

View (android.view.View)1 AdapterView (android.widget.AdapterView)1 ImageView (android.widget.ImageView)1 TextView (android.widget.TextView)1 TagChooseGridViewAdapter (com.nightonke.saver.adapter.TagChooseGridViewAdapter)1 MyGridView (com.nightonke.saver.ui.MyGridView)1