List of usage examples for android.widget Checkable setChecked
void setChecked(boolean checked);
From source file:com.appunite.rx.android.MoreViewActions.java
@Nonnull public static Action1<? super Boolean> setChecked(@Nonnull final Checkable view) { checkNotNull(view);//from ww w . ja v a 2 s . co m return new Action1<Boolean>() { @Override public void call(final Boolean checked) { view.setChecked(checked); } }; }
From source file:com.xixicm.de.presentation.view.adapter.SentenceDetailPageAdapter.java
@Override public Object instantiateItem(ViewGroup container, int position) { View view = mInflater.inflate(R.layout.sentence_detail, null); final Sentence sentence = mSentences.get(position); JSONObject content = sentence.getJsonObjectContent(); final Checkable checkable = (Checkable) view.findViewById(R.id.content); checkable.setChecked(sentence.getIsStar()); final CheckableImageView favoriteBtn = (CheckableImageView) view.findViewById(R.id.favorite); favoriteBtn.setOnClickListener(new View.OnClickListener() { @Override/*from w w w .jav a 2s.c o m*/ public void onClick(View v) { checkable.toggle(); if (mFavoriteClickListener != null) { mFavoriteClickListener.onFavoriteClick(sentence, checkable.isChecked()); } } }); ((TextView) view.findViewById(R.id.day)).setText(sentence.getDateline()); ((TextView) view.findViewById(R.id.en_content)).setText(" " + sentence.getContent()); ((TextView) view.findViewById(R.id.cn_content)).setText(" " + content.optString("note")); loadImg(sentence, (NetworkImageView) view.findViewById(R.id.image)); container.addView(view); return view; }
From source file:org.jraf.android.bikey.common.widget.fragmentcycler.FragmentCycler.java
public void show(FragmentActivity activity) { String tag = mFragmentTags.get(mCurrentVisibleIndex); FragmentManager fragmentManager = activity.getSupportFragmentManager(); fragmentManager.executePendingTransactions(); Fragment fragment = fragmentManager.findFragmentByTag(tag); FragmentTransaction t = fragmentManager.beginTransaction(); t.show(fragment);/*from ww w . j av a 2s . co m*/ t.commit(); if (!mTabs.isEmpty()) { Checkable checkable = mTabs.get(mCurrentVisibleIndex); checkable.setChecked(true); } updateTitle(); }
From source file:org.jraf.android.bikey.common.widget.fragmentcycler.FragmentCycler.java
private void setCurrentVisibleIndex(FragmentActivity activity, int newIndex) { int previousVisibleIndex = mCurrentVisibleIndex; mCurrentVisibleIndex = newIndex;//from www .jav a 2s .c om String hideTag = mFragmentTags.get(previousVisibleIndex); String showTag = mFragmentTags.get(mCurrentVisibleIndex); FragmentManager fragmentManager = activity.getSupportFragmentManager(); Fragment showFragment = fragmentManager.findFragmentByTag(showTag); Fragment hideFragment = fragmentManager.findFragmentByTag(hideTag); FragmentTransaction t = fragmentManager.beginTransaction(); t.hide(hideFragment); t.show(showFragment); t.commit(); if (!mTabs.isEmpty()) { Checkable prevCheckable = mTabs.get(previousVisibleIndex); prevCheckable.setChecked(false); Checkable curCheckable = mTabs.get(mCurrentVisibleIndex); curCheckable.setChecked(true); } updateTitle(); }
From source file:com.justwayward.reader.view.recyclerview.adapter.BaseViewHolder.java
public BaseViewHolder setChecked(int viewId, boolean checked) { Checkable view = getView(viewId); view.setChecked(checked); return this; }
From source file:com.lillicoder.demo.carouselview.widget.CarouselView.java
/** * Inflates and initializes this view.//from ww w . ja va 2 s . c o m * @param context {@link Context} for this view. * @param attrs {@link AttributeSet} for this view. * @param defStyle Optional default style for this view. */ private void initialize(Context context, AttributeSet attrs, int defStyle) { setOrientation(LinearLayout.VERTICAL); LayoutInflater inflater = LayoutInflater.from(context); inflater.inflate(R.layout.view_carousel, this); mViewPager = (ViewPager) findViewById(R.id.CarouselView_viewPager); mIndicatorContainer = (ViewGroup) findViewById(R.id.CarouselView_indicatorContainer); if (attrs != null) { TypedArray attributes = context.obtainStyledAttributes(attrs, R.styleable.CarouselView, defStyle, 0); Resources resources = getResources(); mIndicatorDrawableResourceId = attributes.getResourceId(R.styleable.CarouselView_indicator, R.drawable.carousel_indicator); mIndicatorPadding = (int) attributes.getDimension(R.styleable.CarouselView_indicatorPadding, resources.getDimension(R.dimen.indicator_padding)); } mViewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageScrollStateChanged(int state) { } @Override public void onPageScrolled(int position, float floatOffset, int positionOffsetPixels) { } @Override public void onPageSelected(int position) { int childCount = mIndicatorContainer.getChildCount(); for (int childPosition = 0; childPosition < childCount; childPosition++) { Checkable child = (Checkable) mIndicatorContainer.getChildAt(childPosition); if (child != null) { child.setChecked(childPosition == position); } } } }); }
From source file:cn.bingoogolapple.androidcommon.adapter.BGAViewHolderHelper.java
/** * id?//from w w w. j a v a 2s . co m * * @param viewId * @param checked * @return */ public BGAViewHolderHelper setChecked(@IdRes int viewId, boolean checked) { Checkable view = getView(viewId); view.setChecked(checked); return this; }
From source file:xyz.yhsj.helper.ViewHolderHelper.java
/** * id?//from w w w .ja va 2s . c o m * * @param viewId * @param checked * @return */ public ViewHolderHelper setChecked(@IdRes int viewId, boolean checked) { Checkable view = getView(viewId); view.setChecked(checked); return this; }
From source file:com.hao.common.adapter.BaseViewHolderHelper.java
/** * id?/*from www. j ava 2 s.co m*/ * * @param viewId * @param checked * @return */ public BaseViewHolderHelper setChecked(@IdRes int viewId, boolean checked) { Checkable view = getView(viewId); view.setChecked(checked); return this; }
From source file:com.cicada.yuanxiaobao.common.BaseAdapterHelper.java
/** * Sets the checked status of a checkable. * /*from w ww. j a v a2s . c o m*/ * @param viewId * The view id. * @param checked * The checked status; * @return The BaseAdapterHelper for chaining. */ public BaseAdapterHelper setChecked(int viewId, boolean checked) { Checkable view = (Checkable) retrieveView(viewId); view.setChecked(checked); return this; }