Skip to content

Instantly share code, notes, and snippets.

View Sirelon's full-sized avatar
👀
Who are you?

Oleksandr Sirelon

👀
Who are you?
View GitHub Profile
@Sirelon
Sirelon / Spannable.kt
Last active December 16, 2019 10:02 — forked from rlac/Spannable.kt
Adaptive for new Kotlin Version. A simple Kotlin builder for creating SpannableStrings. Original idea from https://gist.github.com/JakeWharton/11274467.
// Copyright 2014 Robert Carr
// Copyright 2016 Alexandr Romanishin
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
@Sirelon
Sirelon / Truss.java
Created November 2, 2016 15:53 — forked from JakeWharton/Truss.java
Extremely simple wrapper around SpannableStringBuilder to make the API more logical and less awful. Apache 2 licensed.
import android.text.SpannableStringBuilder;
import java.util.ArrayDeque;
import java.util.Deque;
import static android.text.Spanned.SPAN_INCLUSIVE_EXCLUSIVE;
/** A {@link SpannableStringBuilder} wrapper whose API doesn't make me want to stab my eyes out. */
public class Truss {
private final SpannableStringBuilder builder;
private final Deque<Span> stack;