Example usage for android.text BidiFormatter unicodeWrap

List of usage examples for android.text BidiFormatter unicodeWrap

Introduction

In this page you can find the example usage for android.text BidiFormatter unicodeWrap.

Prototype

public CharSequence unicodeWrap(CharSequence str) 

Source Link

Document

Operates like #unicodeWrap(CharSequence,TextDirectionHeuristic,boolean) , but uses the formatter's default direction estimation algorithm and assumes isolate is true.

Usage

From source file:com.androidinspain.deskclock.timer.TimerSetupView.java

public TimerSetupView(Context context, AttributeSet attrs) {
    super(context, attrs);

    final BidiFormatter bf = BidiFormatter.getInstance(false /* rtlContext */);
    final String hoursLabel = bf.unicodeWrap(context.getString(R.string.hours_label));
    final String minutesLabel = bf.unicodeWrap(context.getString(R.string.minutes_label));
    final String secondsLabel = bf.unicodeWrap(context.getString(R.string.seconds_label));

    // Create a formatted template for "00h 00m 00s".
    mTimeTemplate = TextUtils.expandTemplate("^1^4 ^2^5 ^3^6", bf.unicodeWrap("^1"), bf.unicodeWrap("^2"),
            bf.unicodeWrap("^3"), FormattedTextUtils.formatText(hoursLabel, new RelativeSizeSpan(0.5f)),
            FormattedTextUtils.formatText(minutesLabel, new RelativeSizeSpan(0.5f)),
            FormattedTextUtils.formatText(secondsLabel, new RelativeSizeSpan(0.5f)));

    LayoutInflater.from(context).inflate(R.layout.timer_setup_container, this);
}