Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.text.SpannableString;
import android.text.Spanned;

import android.text.style.RelativeSizeSpan;

import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {
    private static List<String> emotions;

    public static CharSequence scaleEmotions(String text) {
        SpannableString spannableString = new SpannableString(text);
        for (String emotion : emotions) {
            Pattern pattern = Pattern.compile(emotion);
            Matcher matcher = pattern.matcher(text);
            while (matcher.find()) {
                int start = matcher.start();
                int end = matcher.end();
                spannableString.setSpan(new RelativeSizeSpan(1.2f), start, end, Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
            }
        }
        return spannableString;
    }
}