Example usage for android.widget AdapterView getId

List of usage examples for android.widget AdapterView getId

Introduction

In this page you can find the example usage for android.widget AdapterView getId.

Prototype

@IdRes
@ViewDebug.CapturedViewProperty
public int getId() 

Source Link

Document

Returns this view's identifier.

Usage

From source file:com.hybris.mobile.app.commerce.fragment.ProductDetailFragment.java

@Override
protected OnItemSelectedListener getVariantSpinnerListener() {

    return new OnItemSelectedListener() {
        @Override//from w  w w.  j  a  va2  s.c  o  m
        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {

            switch (parent.getId()) {
            case R.id.product_detail_variant_spinner_1:
                if (mVariantPopulated && position < mProductDetailVariantSpinner1.getAdapter().getCount()
                        && !StringUtils.equals(
                                ((VariantOption) mProductDetailVariantSpinner1.getSelectedItem()).getCode(),
                                mProduct.getCode())) {
                    mVariantPopulated = false;
                    mNbVariantLevelsInstantiated = 0;
                    selectVariant(((VariantOption) mProductDetailVariantSpinner1.getSelectedItem()).getCode());
                }
                break;

            case R.id.product_detail_variant_spinner_2:
                if (mVariantPopulated && position < mProductDetailVariantSpinner2.getAdapter().getCount()
                        && !StringUtils.equals(
                                ((VariantOption) mProductDetailVariantSpinner2.getSelectedItem()).getCode(),
                                mProduct.getCode())) {
                    mVariantPopulated = false;
                    mNbVariantLevelsInstantiated = 0;
                    selectVariant(((VariantOption) mProductDetailVariantSpinner2.getSelectedItem()).getCode());
                }
                break;
            }
            mNbVariantLevelsInstantiated++;
            if (mNbVariantLevelsInstantiated == mNbVariantLevels) {
                mVariantPopulated = true;
            }

        }

        @Override
        public void onNothingSelected(AdapterView<?> parent) {
        }
    };
}

From source file:am.project.x.business.drawables.cornerdrawable.CornerDrawableActivity.java

@SuppressLint("RtlHardcoded")
@Override//from w  w w  .  j av  a 2s  .c  o m
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
    switch (parent.getId()) {
    case R.id.cnd_sp_direction:
        switch (position) {
        default:
        case 0:
            drawable.setDirection(Gravity.TOP);
            break;
        case 1:
            drawable.setDirection(Gravity.LEFT);
            break;
        case 2:
            drawable.setDirection(Gravity.RIGHT);
            break;
        case 3:
            drawable.setDirection(Gravity.BOTTOM);
            break;
        }
        break;
    case R.id.cnd_sp_location:
        switch (position) {
        default:
        case 0:
            drawable.setLocation(Gravity.CENTER);
            break;
        case 1:
            drawable.setLocation(Gravity.LEFT);
            break;
        case 2:
            drawable.setLocation(Gravity.RIGHT);
            break;
        }
        break;
    }
}

From source file:com.mifos.mifosxdroid.online.loanaccountdisbursement.LoanAccountDisbursementFragment.java

@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
    if (parent.getId() == R.id.sp_loan_payment_type) {
        paymentTypeId = loanTransactionTemplate.getPaymentTypeOptions().get(position).getId();
    }/*w ww. j  av a2s.  c o  m*/
}

From source file:com.pickr.activities.FlickrActivity.java

@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    if (parent.getId() == R.id.flickrListDrawer) {
        Item<FlickrFragment> item = mDrawerListItems.get(position);
        if (mDrawerListItems == null || !item.getValue().equals(mCurrentFragment)) {
            showFragment(item);//from w  w  w  .j  a  v a  2  s . c  o m
        }
        mDrawerLayout.closeDrawers();
    }
}

From source file:com.fenlisproject.elf.core.base.BaseActivity.java

@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    ElfCaller.callOnItemClickListener(this, parent.getId(), position);
}

From source file:com.fenlisproject.elf.core.base.BaseActivity.java

@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
    ElfCaller.callOnItemSelectedListener(this, parent.getId(), position);
}

From source file:com.rappsantiago.weighttracker.profile.setup.WeightHeightFragment.java

@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
    final int viewId = parent.getId();

    switch (viewId) {
    case R.id.dropdown_weight_unit:
        mWeightUnitPos = position;//from   w  w w .  j a  v  a2 s  .  c o m
        mTxtWeightWrapper.setHint(mWeightUnitAdapter.getItem(position));
        break;

    case R.id.dropdown_height_unit:
        mHeightUnitPos = position;
        if (0 == position) {
            mTxtHeightWrapper.setHint(getString(R.string.centimeters));
            mTxtHeightInchesWrapper.setVisibility(View.GONE);
        } else if (1 == position) {
            mTxtHeightWrapper.setHint(getString(R.string.foot));
            mTxtHeightInchesWrapper.setVisibility(View.VISIBLE);
        }
        break;

    default:
        throw new IllegalArgumentException();
    }
}

From source file:com.fenlisproject.elf.core.base.BaseActivity.java

@Override
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
    return ElfCaller.callOnItemLongClickListener(this, parent.getId(), position);
}

From source file:li.barter.fragments.MyBooksFragment.java

@Override
public void onItemClick(final AdapterView<?> parent, final View view, final int position, final long id) {

    if (parent.getId() == R.id.grid_profile_books) {

        if (!mUserId.equals(UserInfo.INSTANCE.getId())) {
            GoogleAnalyticsManager.getInstance()
                    .sendEvent(new EventBuilder(Categories.USAGE, Actions.BOOK_PROFILE_CLICK));
        }/*  ww  w  .jav  a  2s. c  o m*/
        final Cursor cursor = (Cursor) mProfileBooksAdapter.getItem(position);

        final String bookId = cursor.getString(cursor.getColumnIndex(DatabaseColumns.ID));

        final Intent bookDetailIntent = new Intent(getActivity(), BookDetailActivity.class);
        bookDetailIntent.putExtra(Keys.ID, bookId);
        startActivity(bookDetailIntent);

        /*final Bundle showBooksArgs = Utils.cursorToBundle(cursor);
                
        loadFragment(R.id.frame_content, (AbstractBarterLiFragment) Fragment
                         .instantiate(getActivity(), BookDetailFragment.class
                                 .getName(), showBooksArgs),
                 FragmentTags.USER_BOOK_FROM_PROFILE, true,
                 FragmentTags.BS_EDIT_PROFILE
        );*/
    }
}

From source file:it.polimi.spf.app.fragments.contacts.PeopleFragment.java

@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    PersonInfo entry = (PersonInfo) parent.getItemAtPosition(position);
    switch (parent.getId()) {
    case R.id.contacts_people_listview:
        onFriendSelected(entry);/* w  ww  .  j  a  v  a 2 s. co m*/
        break;
    case R.id.contacts_people_requests_listview:
        onRequestReview(entry);
        break;
    }
}