use of com.google.samples.apps.topeka.adapter.AvatarAdapter in project android-topeka by googlesamples.
the class SignInFragment method setUpGridView.
private void setUpGridView(View container) {
mAvatarGrid = (GridView) container.findViewById(R.id.avatars);
mAvatarGrid.setAdapter(new AvatarAdapter(getActivity()));
mAvatarGrid.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
mSelectedAvatarView = view;
mSelectedAvatar = Avatar.values()[position];
// showing the floating action button if input data is valid
if (isInputDataValid()) {
mDoneFab.show();
}
}
});
mAvatarGrid.setNumColumns(calculateSpanCount());
if (mSelectedAvatar != null) {
mAvatarGrid.setItemChecked(mSelectedAvatar.ordinal(), true);
}
}
Aggregations