Example usage for android.text TextUtils expandTemplate

List of usage examples for android.text TextUtils expandTemplate

Introduction

In this page you can find the example usage for android.text TextUtils expandTemplate.

Prototype

public static CharSequence expandTemplate(CharSequence template, CharSequence... values) 

Source Link

Document

Replace instances of "^1", "^2", etc.

Usage

From source file:com.android.incallui.CallCardFragment.java

public void dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {
    if (event.getEventType() == AccessibilityEvent.TYPE_ANNOUNCEMENT) {
        // Indicate this call is in active if no label is provided. The label is empty when
        // the call is in active, not in other status such as onhold or dialing etc.
        if (!mCallStateLabel.isShown() || TextUtils.isEmpty(mCallStateLabel.getText())) {
            event.getText().add(TextUtils.expandTemplate(
                    getResources().getText(R.string.accessibility_call_is_active), mPrimaryName.getText()));
        } else {//from   w  w w. j  a  v a  2s.  co m
            dispatchPopulateAccessibilityEvent(event, mCallStateLabel);
            dispatchPopulateAccessibilityEvent(event, mPrimaryName);
            dispatchPopulateAccessibilityEvent(event, mCallTypeLabel);
            dispatchPopulateAccessibilityEvent(event, mPhoneNumber);
        }
        return;
    }
    dispatchPopulateAccessibilityEvent(event, mCallStateLabel);
    dispatchPopulateAccessibilityEvent(event, mPrimaryName);
    dispatchPopulateAccessibilityEvent(event, mPhoneNumber);
    dispatchPopulateAccessibilityEvent(event, mCallTypeLabel);
    dispatchPopulateAccessibilityEvent(event, mSecondaryCallName);
    dispatchPopulateAccessibilityEvent(event, mSecondaryCallProviderLabel);

    return;
}