StringSegmenter { public String getsegmenthtml(int tick) { int r1 = Color.red(textcolor); int g1 = Color.green(textcolor); int b1 = Color.blue(textcolor); int r2 = Color.red(emphasiscolor); int g2 = Color.green(emphasiscolor); int b2 = Color.blue(emphasiscolor); String hextextcolor = "#" + Integer.toHexString(r1) + Integer.toHexString(g1) + Integer.toHexString(b1); StringBuilder allhtml = new StringBuilder(); int ihelper = 0; int mind = tick - radius; if (mind < 0){mind = 0;} ihelper = mind; String anteriore = tokenizedstring.substring(0,mind); anteriore = anteriore.replaceAll("◜", ""); anteriore = "<font color=\""+hextextcolor + "\" >" + anteriore + "</font>"; allhtml.append(anteriore); int max = tick + radius; if (max > tokenizedstring.length()-2){max = tokenizedstring.length()-2;} int rest = tokenizedstring.length()-2 - max; String posteriore = tokenizedstring.substring(max,max + rest); posteriore = posteriore.replaceAll("◜", ""); posteriore = "<font color=\""+hextextcolor + "\" >" + posteriore + "</font>"; int feinheitsgrad = 1; for (int numberi = mind; numberi < max; numberi=numberi+feinheitsgrad) { String obj = tokenizedstring.substring(numberi,numberi+feinheitsgrad); boolean zeilenumbruch = false; if (obj.contains("◜")){ zeilenumbruch = true; obj = obj.replaceAll("◜", ""); } String prehtml = ""; String backhtml = ""; int abstand = ihelper - tick; if (abstand < 0){abstand = (abstand)*(-1);} if (abstand < radius + 1){ try { prehtml = loadedprehtmlstrings.get(abstand); } catch (Exception ex) { prehtml = "<span style=\"font-size:"+17+"px ; color:white"+";\">"; } backhtml = "</font>"; } allhtml.append(prehtml); allhtml.append(obj); allhtml.append(backhtml); ihelper = ihelper + 1; } ihelper = ihelper + rest; allhtml.append(posteriore); maxticks = ihelper; String result = allhtml.toString(); String prefixdiv = ""; String backgroundimagename = ""; String anfang; anfang = ""; String colorstandart = "rgb(" + r1 +"," + g1 + "," + b1 + ")"; String packagedpreviewnext = ""; String packagedpreviewlast = ""; if (helplinesinhtml){ packagedpreviewnext = "<br><font color=\""+ previewcolorhex + "\" >"+previewnextString+"</font>"; packagedpreviewlast = "<font color=\""+ previewcolorhex + "\" >"+previewlastString+"</font><br>";} result = anfang + "<body><div style=\"color:"+ hextextcolor +";" +"px ;text-align: center ;" + prefixdiv + "\">"+ packagedpreviewlast + result +""+ packagedpreviewnext +"</div>"+ "</body></html>"; return result; } StringSegmenter(StringSegmenter point);  StringSegmenter(); Object clone(); void loadallticks(); String loadsegmentoutput(int tick); String getsegmenthtml(int tick); public int backgroundcolor; public int textcolor; public int emphasiscolor; public String previewcolorhex; public int r1; public int g1; public int b1; public int r2; public int g2; public int b2; public int fontnumber; public boolean helplinesinhtml; public int minblocksize; public int maxblocksize; public int brighttheme; public int globalpositionoffset; public boolean loaded; public int radius; public String previewnextString; public String previewlastString; public ArrayList<String> loadedprehtmlstrings; public String tokenizedstring; public int maxticks; }
@Test public void getsegmenthtml() throws Exception { TextView contentView = (TextView) mActivity.findViewById(R.id.fullscreen_content); String first = contentView.getText().toString(); mActivity.nextButtonClicked(contentView); String second = contentView.getText().toString(); assertNotEquals(first,second); assertEquals(2,2); }