Search in sources :

Example 1 with Truss

use of com.jakewharton.u2020.ui.misc.Truss in project u2020 by JakeWharton.

the class ExternalIntentActivity method fillExtras.

private void fillExtras() {
    Bundle extras = baseIntent.getExtras();
    if (extras == null) {
        extrasView.setText("None!");
    } else {
        Truss truss = new Truss();
        for (String key : extras.keySet()) {
            Object value = extras.get(key);
            String valueString;
            if (value.getClass().isArray()) {
                valueString = Arrays.toString((Object[]) value);
            } else {
                valueString = value.toString();
            }
            truss.pushSpan(new StyleSpan(Typeface.BOLD));
            truss.append(key).append(":\n");
            truss.popSpan();
            truss.append(valueString).append("\n\n");
        }
        extrasView.setText(truss.build());
    }
}
Also used : Truss(com.jakewharton.u2020.ui.misc.Truss) Bundle(android.os.Bundle) StyleSpan(android.text.style.StyleSpan)

Example 2 with Truss

use of com.jakewharton.u2020.ui.misc.Truss in project u2020 by JakeWharton.

the class TrendingItemView method bindTo.

public void bindTo(Repository repository, Picasso picasso) {
    picasso.load(repository.owner.avatar_url).placeholder(R.drawable.avatar).fit().transform(avatarTransformation).into(avatarView);
    nameView.setText(repository.name);
    starsView.setText(String.valueOf(repository.watchers));
    forksView.setText(String.valueOf(repository.forks));
    Truss description = new Truss();
    description.append(repository.owner.login);
    if (!TextUtils.isEmpty(repository.description)) {
        description.pushSpan(new ForegroundColorSpan(descriptionColor));
        description.append(" — ");
        description.append(repository.description);
        description.popSpan();
    }
    descriptionView.setText(description.build());
}
Also used : Truss(com.jakewharton.u2020.ui.misc.Truss) ForegroundColorSpan(android.text.style.ForegroundColorSpan)

Aggregations

Truss (com.jakewharton.u2020.ui.misc.Truss)2 Bundle (android.os.Bundle)1 ForegroundColorSpan (android.text.style.ForegroundColorSpan)1 StyleSpan (android.text.style.StyleSpan)1