use of android.widget.AdapterView in project gdk-apidemo-sample by googleglass.
the class SliderActivity method onCreate.
@Override
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
// Ensure screen stays on during demo.
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
mCardScroller = new CardScrollView(this);
mCardScroller.setAdapter(new CardAdapter(createCards(this)));
mCardScroller.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
// Plays sound.
AudioManager am = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
am.playSoundEffect(Sounds.TAP);
processSliderRequest(position);
}
});
setContentView(mCardScroller);
mSlider = Slider.from(mCardScroller);
}
use of android.widget.AdapterView in project android-topeka by googlesamples.
the class SelectItemQuizView method createQuizContentView.
@Override
protected View createQuizContentView() {
Context context = getContext();
mListView = new ListView(context);
mListView.setDivider(null);
mListView.setSelector(R.drawable.selector_button);
mListView.setAdapter(new OptionsQuizAdapter(getQuiz().getOptions(), R.layout.item_answer_start, context, true));
mListView.setChoiceMode(AbsListView.CHOICE_MODE_SINGLE);
mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
allowAnswer();
toggleAnswerFor(position);
}
});
return mListView;
}
use of android.widget.AdapterView 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);
}
}
use of android.widget.AdapterView in project android-topeka by googlesamples.
the class ToggleTranslateQuizView method createQuizContentView.
@Override
protected View createQuizContentView() {
mListView = new ListView(getContext());
mListView.setDivider(null);
mListView.setSelector(R.drawable.selector_button);
mListView.setAdapter(new OptionsQuizAdapter(getQuiz().getReadableOptions(), R.layout.item_answer));
mListView.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE);
mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
toggleAnswerFor(position);
if (view instanceof CompoundButton) {
((CompoundButton) view).setChecked(mAnswers[position]);
}
allowAnswer();
}
});
return mListView;
}
use of android.widget.AdapterView in project AndroidEventBus by hehonghui.
the class ConstactFragment method initListView.
private void initListView() {
mAdapter = new ArrayAdapter<User>(getActivity(), android.R.layout.simple_list_item_1, mConstacts);
mListView.setAdapter(mAdapter);
mListView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
// 点击用户,发布消息,
// tag为MenuFragment.CLICK_TAG,接收函数在MenuFragment的updateClickUserName中
EventBus.getDefault().post(mConstacts.get(position), MenuFragment.CLICK_TAG);
}
});
}
Aggregations