public void setScale(final List<T> items, final Func2<Integer, T, String> labelMapper, final Func2<Integer, T, String> axisLabelMapper) {
        this.items.clear();
        if (items == null || items.isEmpty()) {
            this.items.add(null);
        } else {
            this.items.addAll(items);
        }
        this.itemToPosition.clear();
        int i = 0;
        for (T item : this.items) {
            this.itemToPosition.put(item, i++);
        }
        this.labelMapper = labelMapper;
        this.axisLabelMapper = axisLabelMapper;

        binding.sliderInternal.setValueFrom(0);
        binding.sliderInternal.setValueTo(this.items.size() - 1);
        binding.sliderInternal.setLabelFormatter(f -> {
            final String label = getLabel(Math.round(f), this.items.get(Math.round(f)));
            return label == null ? "" : label;
        });

        final LinearLayout.LayoutParams sliderLp = new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT);
        sliderLp.weight = this.items.size() * 2 - 2;
        binding.sliderInternal.setLayoutParams(sliderLp);
        if (ViewUtils.isDebugLayout()) {
            binding.sliderInternal.setBackgroundResource(R.drawable.mark_red);
        }

        buildScaleLegend();

        setRangeAll();
    }
View displays and maintains a slider where user can select single or range of items from a sorted item list.
main/src/main/java/cgeo/geocaching/ui/ItemRangeSlider.java