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;
}
Aggregations