Search in sources :

Example 31 with AdapterView

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);
}
Also used : AudioManager(android.media.AudioManager) CardScrollView(com.google.android.glass.widget.CardScrollView) AdapterView(android.widget.AdapterView) CardAdapter(com.google.android.glass.sample.apidemo.card.CardAdapter) CardScrollView(com.google.android.glass.widget.CardScrollView) View(android.view.View) AdapterView(android.widget.AdapterView)

Example 32 with AdapterView

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;
}
Also used : Context(android.content.Context) AbsListView(android.widget.AbsListView) ListView(android.widget.ListView) OptionsQuizAdapter(com.google.samples.apps.topeka.adapter.OptionsQuizAdapter) AdapterView(android.widget.AdapterView) AbsListView(android.widget.AbsListView) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView) SuppressLint(android.annotation.SuppressLint)

Example 33 with AdapterView

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

Example 34 with AdapterView

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;
}
Also used : AbsListView(android.widget.AbsListView) ListView(android.widget.ListView) OptionsQuizAdapter(com.google.samples.apps.topeka.adapter.OptionsQuizAdapter) AdapterView(android.widget.AdapterView) AbsListView(android.widget.AbsListView) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView) SuppressLint(android.annotation.SuppressLint) CompoundButton(android.widget.CompoundButton)

Example 35 with AdapterView

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);
        }
    });
}
Also used : User(org.simple.eventbus.demo.bean.User) OnItemClickListener(android.widget.AdapterView.OnItemClickListener) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView)

Aggregations

AdapterView (android.widget.AdapterView)677 View (android.view.View)653 ListView (android.widget.ListView)412 TextView (android.widget.TextView)342 Intent (android.content.Intent)177 ImageView (android.widget.ImageView)174 OnItemClickListener (android.widget.AdapterView.OnItemClickListener)142 ArrayAdapter (android.widget.ArrayAdapter)75 ArrayList (java.util.ArrayList)71 ViewGroup (android.view.ViewGroup)63 AbsListView (android.widget.AbsListView)59 GridView (android.widget.GridView)58 Bundle (android.os.Bundle)53 Spinner (android.widget.Spinner)50 LinearLayout (android.widget.LinearLayout)49 OnClickListener (android.view.View.OnClickListener)46 RecyclerView (android.support.v7.widget.RecyclerView)42 DialogInterface (android.content.DialogInterface)41 SuppressLint (android.annotation.SuppressLint)38 LayoutInflater (android.view.LayoutInflater)34