Search in sources :

Example 1 with AvatarAdapter

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);
    }
}
Also used : AvatarAdapter(com.google.samples.apps.topeka.adapter.AvatarAdapter) AdapterView(android.widget.AdapterView) GridView(android.widget.GridView) View(android.view.View) AdapterView(android.widget.AdapterView)

Aggregations

View (android.view.View)1 AdapterView (android.widget.AdapterView)1 GridView (android.widget.GridView)1 AvatarAdapter (com.google.samples.apps.topeka.adapter.AvatarAdapter)1