android.widget.CheckedTextView Java Examples

The following examples show how to use android.widget.CheckedTextView. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HideFoldersActivity.java    From LrcJaeger with Apache License 2.0 8 votes vote down vote up
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    if (convertView == null) {
        convertView = mInflater.inflate(R.layout.folder_item, parent, false);
    }

    String folder = getItem(position);

    CheckedTextView tv = (CheckedTextView) convertView.findViewById(R.id.cb_folder);
    tv.setText(folder);
    if (mHiddenFolders.contains(folder.hashCode())) {
        // this folder was set to be hidden
        tv.setChecked(false);
        tv.setTextColor(Color.LTGRAY);
    } else {
        // set default status
        tv.setChecked(true);
        tv.setTextColor(Color.BLACK);
    }

    return convertView;
}
 
Example #2
Source File: SelectPopupDialog.java    From android-chromium with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    if (position < 0 || position >= getCount()) {
        return null;
    }

    // Always pass in null so that we will get a new CheckedTextView. Otherwise, an item
    // which was previously used as an <optgroup> element (i.e. has no check), could get
    // used as an <option> element, which needs a checkbox/radio, but it would not have
    // one.
    convertView = super.getView(position, null, parent);
    if (mItemEnabled[position] != POPUP_ITEM_TYPE_ENABLED) {
        if (mItemEnabled[position] == POPUP_ITEM_TYPE_GROUP) {
            // Currently select_dialog_multichoice & select_dialog_multichoice use
            // CheckedTextViews. If that changes, the class cast will no longer be valid.
            ((CheckedTextView) convertView).setCheckMarkDrawable(null);
        } else {
            // Draw the disabled element in a disabled state.
            convertView.setEnabled(false);
        }
    }
    return convertView;
}
 
Example #3
Source File: ImageListPreference.java    From Identiconizer with Apache License 2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
public View getView(int position, View convertView, ViewGroup parent) {
    LayoutInflater inflater = ((Activity) getContext()).getLayoutInflater();
    View row = inflater.inflate(R.layout.image_list_item, parent, false);

    ImageView imageView = row.findViewById(R.id.image);
    imageView.setImageResource(resourceIds[position]);

    CheckedTextView checkedTextView = row.findViewById(R.id.check);

    checkedTextView.setText(getItem(position));
    checkedTextView.setCheckMarkDrawable(Resources.getSystem().getDrawable(mRadioDrawableId));

    if (position == index) {
        checkedTextView.setChecked(true);
    }

    return row;
}
 
Example #4
Source File: SettingsActivity.java    From PodEmu with GNU General Public License v3.0 6 votes vote down vote up
private void setToggleForceSimpleMode()
{
    int forceSimpleMode = sharedPref.getInt("ForceSimpleMode", 0);

    RelativeLayout layout = (RelativeLayout) findViewById(R.id.playlistCountLayout);

    CheckedTextView toggleForceSimpleModeView = (CheckedTextView) findViewById(R.id.forceSimpleModeHint);

    if( forceSimpleMode == 1 )
    {
        toggleForceSimpleModeView.setChecked(true);
        if ( enableListCountSelection ) layout.setVisibility(View.INVISIBLE);
    }
    else
    {
        toggleForceSimpleModeView.setChecked(false);
        if ( enableListCountSelection ) layout.setVisibility(View.VISIBLE);
    }
}
 
Example #5
Source File: ListPreference.java    From SuntimesWidget with GNU General Public License v3.0 6 votes vote down vote up
@NonNull
public View getView(int position, View convertView, @NonNull ViewGroup parent)
{
    View row = convertView;
    if (row == null)
    {
        LayoutInflater inflater = LayoutInflater.from(getContext());
        row = inflater.inflate(this.layoutID, parent, false);
    }

    CheckedTextView checkedText = (CheckedTextView)row.findViewById(android.R.id.text1);
    checkedText.setText(getItem(position));
    checkedText.setChecked((position == index));

    TextView summaryText = (TextView)row.findViewById(android.R.id.text2);
    if (summaryText != null)
    {
        summaryText.setText(getSummary(position));
    }

    return row;
}
 
Example #6
Source File: AppEditActivity.java    From smartcard-reader with GNU General Public License v3.0 6 votes vote down vote up
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
    final View itemView = super.getView(position, convertView, parent);
    if (itemView == null) {
        return null;
    }
    final CheckedTextView checkedTextView = (CheckedTextView)itemView;

    if (hasCheckbox(position)) {
        checkedTextView.setEnabled(isEnabled(position));
    } else {
        checkedTextView.setCheckMarkDrawable(null);
        checkedTextView.setTextColor(getResources().getColor(R.color.accent));
    }
    return checkedTextView;
}
 
Example #7
Source File: ImageArrayAdapter.java    From Androzic with GNU General Public License v3.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
public View getView(int position, View convertView, ViewGroup parent)
{
	LayoutInflater inflater = ((Activity) getContext()).getLayoutInflater();
	View row = inflater.inflate(R.layout.imagemultichoicelistitem, parent, false);

	ImageView imageView = (ImageView) row.findViewById(R.id.image);
	imageView.setImageResource(resourceIds[position]);

	CheckedTextView checkedTextView = (CheckedTextView) row.findViewById(R.id.check);

	checkedTextView.setText(getItem(position));

	if (position == index)
	{
		checkedTextView.setChecked(true);
	}
	return row;
}
 
Example #8
Source File: TimeLineFriendsCheckableListAdapter.java    From aptoide-client with GNU General Public License v2.0 6 votes vote down vote up
@Override
public View getView(final int position, View convertView, ViewGroup parent){
    final View v;
    ViewHolder holder;

    if(convertView == null){
        v = LayoutInflater.from(ctx).inflate(R.layout.row_facebook_invite_friends, parent, false);
        holder = new ViewHolder();
        holder.name = (CheckedTextView) v.findViewById(R.id.username);
        holder.avatarImage = (ImageView) v.findViewById(R.id.user_avatar);

        v.setTag(holder);
    } else {
        holder = (ViewHolder)convertView.getTag();
        v = convertView;
    }


    Friend friend = getItem(position);

    holder.name.setChecked(((ListView)parent).isItemChecked(position));
    holder.name.setText(friend.getUsername());
    Log.d("AptoideDebug", friend.getUsername());
    Glide.with(ctx).load(friend.getAvatar()).transform(new CircleTransform(ctx)).into(holder.avatarImage);
    return v;
}
 
Example #9
Source File: EmTintUtils.java    From AndroidTint with Apache License 2.0 6 votes vote down vote up
public static void setTint(@NonNull CheckedTextView textView, @ColorInt int color) {
    ColorStateList sl = new ColorStateList(new int[][]{
            new int[]{-android.R.attr.state_checked},
            new int[]{android.R.attr.state_checked}
    }, new int[]{
            ThemeHelper.resolveColor(textView.getContext(), R.attr.colorControlNormal),
            color
    });
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        textView.setCheckMarkTintList(sl);
    } else {
        Drawable d = DrawableCompat.wrap(ContextCompat.getDrawable(textView.getContext(), R.drawable.abc_btn_check_material));
        DrawableCompat.setTintList(d, sl);
        textView.setCheckMarkDrawable(d);
    }
}
 
Example #10
Source File: ViewFilterAdapter.java    From ViewInspector with Apache License 2.0 6 votes vote down vote up
@Override public View getView(final int position, View convertView, ViewGroup parent) {
  ViewHolder viewHolder;
  if (convertView == null) {
    convertView =
        mLayoutInflater.inflate(R.layout.view_inspector_set_view_filter_listitem, parent, false);
    viewHolder = new ViewHolder();
    viewHolder.text1 = (CheckedTextView) convertView.findViewById(R.id.text1);
    convertView.setTag(viewHolder);
  } else {
    viewHolder = (ViewHolder) convertView.getTag();
  }

  String viewClass = mViewClassList.get(position);
  viewHolder.text1.setText(viewClass);
  if (mViewFilter.contains(viewClass)) {
    mListView.setItemChecked(position, true);
    viewHolder.text1.setPaintFlags(
        viewHolder.text1.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
  } else {
    mListView.setItemChecked(position, false);
    viewHolder.text1.setPaintFlags(
        viewHolder.text1.getPaintFlags() & (~Paint.STRIKE_THRU_TEXT_FLAG));
  }
  return convertView;
}
 
Example #11
Source File: MDTintHelper.java    From NewsMe with Apache License 2.0 6 votes vote down vote up
public static void setTint(@NonNull CheckedTextView textView, @ColorInt int color) {
    ColorStateList sl = new ColorStateList(new int[][]{
            new int[]{-android.R.attr.state_checked},
            new int[]{android.R.attr.state_checked}
    }, new int[]{
            ThemeHelper.resolveColor(textView.getContext(), R.attr.colorControlNormal),
            color
    });
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        textView.setCheckMarkTintList(sl);
    } else {
        Drawable d = DrawableCompat.wrap(ContextCompat.getDrawable(textView.getContext(), R.drawable.abc_btn_radio_material));
        DrawableCompat.setTintList(d, sl);
        textView.setCheckMarkDrawable(d);
    }
}
 
Example #12
Source File: Solo.java    From AndroidRipper with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * Checks if the specified text is checked.
 *
 * @param text the text that the {@link CheckedTextView} or {@link CompoundButton} objects display, specified as a regular expression
 * @return {@code true} if the specified text is checked and {@code false} if it is not checked
 */

@SuppressWarnings("unchecked")
public boolean isTextChecked(String text){
	if(config.commandLogging){
		Log.d(config.commandLoggingTag, "isTextChecked(\""+text+"\")");
	}
	
	waiter.waitForViews(false, CheckedTextView.class, CompoundButton.class);

	if(viewFetcher.getCurrentViews(CheckedTextView.class, true).size() > 0 && checker.isCheckedTextChecked(text))
		return true;

	if(viewFetcher.getCurrentViews(CompoundButton.class, true).size() > 0 && checker.isButtonChecked(CompoundButton.class, text))
		return true;

	return false;
}
 
Example #13
Source File: ListAdapter.java    From ssj with GNU General Public License v3.0 6 votes vote down vote up
/**
 * @param groupPosition int
 * @param childPosition int
 * @param isLastChild   boolean
 * @param convertView   View
 * @param parent        ViewGroup
 * @return View
 */
@Override
public View getChildView(int groupPosition, final int childPosition, boolean isLastChild, View convertView, ViewGroup parent)
{
    final String childText = (String) getChild(groupPosition, childPosition);
    if (convertView == null)
    {
        LayoutInflater inflater = (LayoutInflater) this.context
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        convertView = inflater.inflate(android.R.layout.simple_list_item_multiple_choice, null);
    }
    CheckedTextView txtListChild = (CheckedTextView) convertView;
    txtListChild.setPadding(PADDING, PADDING, PADDING, PADDING);
    txtListChild.setText(childText);
    return convertView;
}
 
Example #14
Source File: TrackView.java    From android_maplibui with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void bindView(View view, Context context, Cursor cursor) {

    final Integer id = cursor.getInt(0);
    final ImageView visibility = (ImageView) view.findViewById(R.id.iv_visibility);
    visibility.setImageDrawable(cursor.getInt(2) != 0 ? mVisibilityOn : mVisibilityOff);
    visibility.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            boolean isVisible = visibility.getDrawable().equals(mVisibilityOn);
            updateRecord(id, !isVisible);
        }
    });

    CheckedTextView name = (CheckedTextView) view.findViewById(R.id.tv_name);
    name.setChecked(mSelectedIds.contains(id + ""));
    name.setText(cursor.getString(1));
}
 
Example #15
Source File: TrivialActivity.java    From OPFIab with Apache License 2.0 6 votes vote down vote up
public HeaderViewHolder(final DragSortAdapter<?> dragSortAdapter, final View itemView) {
    super(dragSortAdapter, itemView);
    spinHelper = (Spinner) itemView.findViewById(R.id.spin_helper);
    tvSetupStatus = (TextView) itemView.findViewById(R.id.tv_setup_status);
    tvSetupProvider = (TextView) itemView.findViewById(R.id.tv_setup_provider);
    pbSetup = (ProgressBar) itemView.findViewById(R.id.pb_setup);
    btnForget = (Button) itemView.findViewById(R.id.btn_forget);
    btnInit = (Button) itemView.findViewById(R.id.btn_init);
    btnSetup = (Button) itemView.findViewById(R.id.btn_setup);
    ctvAutoRecover = (CheckedTextView) itemView.findViewById(R.id.ctv_auto_recover);

    final HelpersAdapter adapter = new HelpersAdapter();
    spinHelper.setAdapter(adapter);
    spinHelper.setSelection(adapter.getPosition(TrivialBilling.getHelper()));
    spinHelper.setOnItemSelectedListener(this);

    btnForget.setOnClickListener(this);
    btnInit.setOnClickListener(this);
    btnSetup.setOnClickListener(this);
    ctvAutoRecover.setChecked(TrivialBilling.isAutoRecover());
    ctvAutoRecover.setOnClickListener(this);

    iabHelper.addSetupListener(this);
}
 
Example #16
Source File: SettingsStreamPlayerActivity.java    From Pocket-Plays-for-Twitch with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_settings_stream_player);

	settings = new Settings(getBaseContext());
	mShowNavigationBarView = (CheckedTextView) findViewById(R.id.player_show_navigation_title);
	mShowViewCountView = (CheckedTextView) findViewById(R.id.player_show_viewercount_title);
	mAutoPlaybackView = (CheckedTextView) findViewById(R.id.player_auto_continue_playback_title);

	mShowViewCountSummary = (TextView) findViewById(R.id.player_show_viewercount_title_summary);
	mShowNavigationBarSummary = (TextView) findViewById(R.id.player_show_navigation_summary);
	mAutoPlaybackSummary = (TextView) findViewById(R.id.player_auto_continue_playback_summary);

	final Toolbar toolbar = (Toolbar) findViewById(R.id.settings_player_toolbar);
	setSupportActionBar(toolbar);
	if (getSupportActionBar() != null) {
		getSupportActionBar().setDisplayHomeAsUpEnabled(true);
		getSupportActionBar().setTitle(getString(R.string.settings_stream_player_name));
	}

	updateSummaries();
}
 
Example #17
Source File: SettingsTwitchChatActivity.java    From Pocket-Plays-for-Twitch with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_settings_twitch_chat);
	settings = new Settings(getBaseContext());

	final Toolbar toolbar = (Toolbar) findViewById(R.id.settings_player_toolbar);
	setSupportActionBar(toolbar);
	if (getSupportActionBar() != null) {
		getSupportActionBar().setDisplayHomeAsUpEnabled(true);
	}

	emoteSizeSummary = (TextView) findViewById(R.id.chat_emote_size_summary);
	messageSizeSummary = (TextView) findViewById(R.id.message_size_summary);
	emoteStorageSummary = (TextView) findViewById(R.id.emote_storage_summary);
	chatLandscapeWidthSummary = (TextView) findViewById(R.id.chat_landscape_summary);
	chatLandscapeToggleSummary = (TextView) findViewById(R.id.chat_landscape_enable_summary);
	chatLandscapeSwipeToShowSummary = (TextView) findViewById(R.id.chat_landscape_swipe_summary);

	chatLandscapeToggle = (CheckedTextView) findViewById(R.id.chat_landscape_enable_title);
	chatSwipeToShowToggle = (CheckedTextView) findViewById(R.id.chat_landscape_swipe_title);
	updateSummaries();
}
 
Example #18
Source File: PassphraseTypeDialogFragment.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    CheckedTextView view = (CheckedTextView) super.getView(position, convertView, parent);
    PassphraseType positionType = getType(position);
    PassphraseType currentType = getCurrentTypeFromArguments();
    Set<PassphraseType> allowedTypes =
            currentType.getAllowedTypes(getIsEncryptEverythingAllowedFromArguments());

    // Set the item to checked it if it is the currently selected encryption type.
    view.setChecked(positionType == currentType);
    // Allow user to click on enabled types for the current type.
    view.setEnabled(allowedTypes.contains(positionType));
    return view;
}
 
Example #19
Source File: SelectPopupAdapter.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    if (position < 0 || position >= getCount()) return null;

    convertView = super.getView(position, convertView, parent);
    ((TextView) convertView).setText(mItems.get(position).getLabel());

    // Currently select_dialog_(single|multi)choice uses CheckedTextViews.
    // If that changes, the class cast will no longer be valid.
    // The WebView build cannot rely on this being the case, so
    // we must check.
    if (convertView instanceof CheckedTextView) {
        // <optgroup> elements do not have check marks. If an item previously used as an
        // <optgroup> gets reused for a non-<optgroup> element, we need to get the check mark
        // back. Inflating a new View from XML can be slow, for both the inflation part and GC
        // afterwards. Even creating a new Drawable can be tricky, considering getting the
        // check/radio type and theme right.
        // Saving the previously removed Drawables and reuse them when needed is faster,
        // and the memory implication should be fine.
        CheckedTextView view = (CheckedTextView) convertView;
        if (mItems.get(position).getType() == PopupItemType.GROUP) {
            if (view.getCheckMarkDrawable() != null) {
                view.setTag(view.getCheckMarkDrawable());
                view.setCheckMarkDrawable(null);
            }
        } else {
            if (view.getCheckMarkDrawable() == null) {
                view.setCheckMarkDrawable((Drawable) view.getTag());
            }
        }
    }
    // Draw the disabled element in a disabled state.
    convertView.setEnabled(mItems.get(position).getType() != PopupItemType.DISABLED);

    return convertView;
}
 
Example #20
Source File: BaseViewHolder.java    From basic-adapter with MIT License 5 votes vote down vote up
/**
 * Sets the checked status of a checkable.
 *
 * @param viewId  The view id.
 * @param checked The checked status;
 * @return The BaseViewHolder for chaining.
 */
public BaseViewHolder setChecked(int viewId, boolean checked) {
    View view = getView(viewId);
    // View unable cast to Checkable
    if (view instanceof CompoundButton) {
        ((CompoundButton) view).setChecked(checked);
    } else if (view instanceof CheckedTextView) {
        ((CheckedTextView) view).setChecked(checked);
    }
    return this;
}
 
Example #21
Source File: CameraDialog.java    From DeviceConnect-Android with MIT License 5 votes vote down vote up
@Override
public View getView(final int position, View convertView, final ViewGroup parent) {
	if (convertView == null) {
		convertView = mInflater.inflate(R.layout.listitem_device, parent, false);
	}
	if (convertView instanceof CheckedTextView) {
		final UsbDevice device = getItem(position);
		((CheckedTextView)convertView).setText(
			String.format("UVC Camera:(%x:%x:%s)", device.getVendorId(), device.getProductId(), device.getDeviceName()));
	}
	return convertView;
}
 
Example #22
Source File: CameraDialog.java    From AndroidUSBCamera with Apache License 2.0 5 votes vote down vote up
@Override
public View getView(final int position, View convertView, final ViewGroup parent) {
	if (convertView == null) {
		convertView = mInflater.inflate(R.layout.listitem_device, parent, false);
	}
	if (convertView instanceof CheckedTextView) {
		final UsbDevice device = getItem(position);
		((CheckedTextView)convertView).setText(
			String.format("UVC Camera:(%x:%x:%s)", device.getVendorId(), device.getProductId(), device.getDeviceName()));
	}
	return convertView;
}
 
Example #23
Source File: PostShare.java    From Klyph with MIT License 5 votes vote down vote up
@Override
public View getView(int position, View convertView, ViewGroup parent)
{
	if (convertView == null)
	{
		convertView = inflater.inflate(android.R.layout.simple_spinner_dropdown_item, parent, false);
	}

	CheckedTextView ct = (CheckedTextView) convertView.findViewById(android.R.id.text1);
	ct.setText(getItem(position).getName());

	return convertView;
}
 
Example #24
Source File: NetworkModeTile.java    From GravityBox with Apache License 2.0 5 votes vote down vote up
@SuppressLint("ViewHolder")
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    LayoutInflater inflater = LayoutInflater.from(mContext);
    CheckedTextView label = (CheckedTextView) inflater.inflate(
            android.R.layout.simple_list_item_single_choice, parent, false);
    NetworkMode nm = getItem(position);
    label.setText(mGbContext.getString(nm.labelRes));
    return label;
}
 
Example #25
Source File: ItemsAdapter.java    From sqlitemagic with Apache License 2.0 5 votes vote down vote up
@Override
void setItem(@NonNull Item item) {
  this.item = item;
  final CheckedTextView textView = (CheckedTextView) itemView;
  final boolean complete = item.complete();
  textView.setChecked(complete);
  CharSequence description = item.description();
  if (complete) {
    SpannableString spannable = new SpannableString(description);
    spannable.setSpan(new StrikethroughSpan(), 0, description.length(), 0);
    description = spannable;
  }
  textView.setText(description);
}
 
Example #26
Source File: MainActivity.java    From pybbsMD with Apache License 2.0 5 votes vote down vote up
@Override
public void onDrawerClosed(View drawerView) {
    TabType tab = TabType.all;
    for (CheckedTextView navItem : navMainItemList) {
        if (navItem.isChecked()) {
            switch (navItem.getId()) {
                case cn.tomoya.android.md.R.id.btn_nav_all:
                    tab = TabType.all;
                    break;
                case cn.tomoya.android.md.R.id.btn_nav_good:
                    tab = TabType.good;
                    break;
                case cn.tomoya.android.md.R.id.btn_nav_share:
                    tab = TabType.share;
                    break;
                case cn.tomoya.android.md.R.id.btn_nav_ask:
                    tab = TabType.ask;
                    break;
                case cn.tomoya.android.md.R.id.btn_nav_pybbs:
                    tab = TabType.pybbs;
                    break;
                default:
                    throw new AssertionError("Unknow tab.");
            }
            break;
        }
    }
    mainPresenter.switchTab(tab);
}
 
Example #27
Source File: StayAwakeTile.java    From GravityBox with Apache License 2.0 5 votes vote down vote up
@SuppressLint("ViewHolder")
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    LayoutInflater inflater = LayoutInflater.from(mContext);
    CheckedTextView label = (CheckedTextView) inflater.inflate(
            android.R.layout.simple_list_item_single_choice, parent, false);
    ScreenTimeout st = getItem(position);
    label.setText(mGbContext.getString(st.mLabelResId));
    return label;
}
 
Example #28
Source File: IconCheckListAdapter.java    From GravityBox with Apache License 2.0 5 votes vote down vote up
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    View row = convertView;
    ViewHolder holder = null;

    if(row == null) {
        LayoutInflater inflater = 
                (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        row = inflater.inflate(R.layout.simple_list_item_2_multiple_choice, parent, false);

        holder = new ViewHolder();
        holder.text = (CheckedTextView) row.findViewById(R.id.text1);
        holder.text.setCompoundDrawablePadding(10);
        holder.subText = (TextView) row.findViewById(R.id.text2);
        if (!mSubtextEnabled) {
            holder.subText.setVisibility(View.GONE);
        }
        row.setTag(holder);
    } else {
        holder = (ViewHolder) row.getTag();
    }

    IIconCheckListAdapterItem item = mData.get(position);

    holder.text.setText(item.getText());
    holder.text.setCompoundDrawablesWithIntrinsicBounds(
            item.getIconLeft(), null, item.getIconRight(), null);
    holder.text.setChecked(item.isChecked());
    holder.subText.setText(item.getSubText());

    return row;
}
 
Example #29
Source File: BaseAdapterHelper.java    From CommonAdapter with MIT License 5 votes vote down vote up
/**
 * Sets the checked status of a checkable.
 *
 * @param viewId The view id.
 * @param checked The checked status;
 * @return The BaseAdapterHelper for chaining.
 */
public BaseAdapterHelper setChecked(@IdRes int viewId, boolean checked) {
    View view = retrieveView(viewId);
    if (view instanceof CompoundButton) {
        ((CompoundButton) view).setChecked(checked);
    } else if (view instanceof CheckedTextView) {
        ((CheckedTextView) view).setChecked(checked);
    }
    return this;
}
 
Example #30
Source File: MainActivity.java    From pybbsMD with Apache License 2.0 5 votes vote down vote up
/**
 * 主导航项单击事件
 */
@OnClick({
        cn.tomoya.android.md.R.id.btn_nav_all,
        cn.tomoya.android.md.R.id.btn_nav_good,
        cn.tomoya.android.md.R.id.btn_nav_share,
        cn.tomoya.android.md.R.id.btn_nav_ask,
        cn.tomoya.android.md.R.id.btn_nav_pybbs
})
public void onNavigationMainItemClick(CheckedTextView itemView) {
    for (CheckedTextView navItem : navMainItemList) {
        navItem.setChecked(navItem.getId() == itemView.getId());
    }
    drawerLayout.closeDrawers();
}