aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger/ui/text/DividerSpan.java
blob: 672a267bec6381d9c09e7ec6419846e80135b201 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package de.pixart.messenger.ui.text;

import android.text.TextPaint;
import android.text.style.MetricAffectingSpan;

public class DividerSpan extends MetricAffectingSpan {

    private static final float PROPORTION = 0.3f;

    private final boolean large;

    public DividerSpan(boolean large) {
        this.large = large;
    }

    public boolean isLarge() {
        return large;
    }

    @Override
    public void updateDrawState(TextPaint tp) {
        tp.setTextSize(tp.getTextSize() * PROPORTION);
    }

    @Override
    public void updateMeasureState(TextPaint p) {
        p.setTextSize(p.getTextSize() * PROPORTION);
    }
}