Code example for SortedSet

Methods: add, clear

0
				public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
					if (isChecked) {
						if (selectMode == ListView.CHOICE_MODE_SINGLE) {
							clearCheckedItems(); 
						} 
						checkedLooks.add(position);
					} else { 
						checkedLooks.remove(position);
					} 
					notifyDataSetChanged();
 
					if (onLookEditListener != null) {
						onLookEditListener.onLookChecked();
					} 
				} 
			}); 
 
			boolean checkboxIsVisible = false;
 
			if (selectMode != ListView.CHOICE_MODE_NONE) {
				holder.checkbox.setVisibility(View.VISIBLE);
				holder.lookArrowView.setVisibility(View.GONE);
				holder.lookElement.setBackgroundResource(R.drawable.button_background_shadowed);
				checkboxIsVisible = true;
			} else { 
				holder.checkbox.setVisibility(View.GONE);
				holder.checkbox.setChecked(false);
				holder.lookArrowView.setVisibility(View.VISIBLE);
				holder.lookElement.setBackgroundResource(R.drawable.button_background_selector);
				clearCheckedItems(); 
			} 
 
			if (checkedLooks.contains(position)) {
				holder.checkbox.setChecked(true);
			} else { 
				holder.checkbox.setChecked(false);
			} 
 
			if (showDetails) {
				if (lookData.getAbsolutePath() != null) {
					holder.lookFileSizeTextView.setText(UtilFile.getSizeAsString(new File(lookData.getAbsolutePath())));
				} 
				int[] measure = lookData.getMeasure();
				String measureString = measure[0] + " x " + measure[1];
 
				holder.lookMeasureTextView.setText(measureString);
				holder.lookDetailsLinearLayout.setVisibility(TextView.VISIBLE);
			} else { 
				holder.lookDetailsLinearLayout.setVisibility(TextView.GONE);
			} 
 
			// Disable ImageView on active ActionMode 
			if (checkboxIsVisible) {
				holder.lookImageView.setEnabled(false);
			} else { 
				holder.lookImageView.setEnabled(true);
			} 
			if (holder.lookElement.isClickable()) {
				holder.lookElement.setOnClickListener(new OnClickListener() {
					@Override 
					public void onClick(View view) {
						if (selectMode != ListView.CHOICE_MODE_NONE) {
							holder.checkbox.setChecked(!holder.checkbox.isChecked());
						} else if (onLookEditListener != null) {
							onLookEditListener.onLookEdit(view);
						} 
					} 
				}); 
			} else { 
				holder.lookElement.setOnClickListener(null);
			} 
		} 
		return convertView;
	} 
 
	@Override 
	public void setShowDetails(boolean showDetails) {
		this.showDetails = showDetails;
	} 
 
	@Override 
	public boolean getShowDetails() { 
		return showDetails;
	} 
 
	@Override 
	public void setSelectMode(int mode) {
		selectMode = mode;
	} 
 
	@Override 
	public int getSelectMode() { 
		return selectMode;
	} 
 
	@Override 
	public int getAmountOfCheckedItems() { 
		return checkedLooks.size();
	} 
 
	@Override 
	public SortedSet<Integer> getCheckedItems() {
		return checkedLooks;
	} 
 
	public void addCheckedItem(int position) {
		checkedLooks.add(position);
	} 
 
	@Override 
	public void clearCheckedItems() { 
		checkedLooks.clear();
	} 
 
	public interface OnLookEditListener { 
 
		public void onLookEdit(View view);