Skip to content
Snippets Groups Projects
Commit 0330711e authored by Francesco's avatar Francesco
Browse files

fixed a problem in "getNewLabel" method

parent f12ea7df
No related branches found
No related tags found
No related merge requests found
......@@ -276,26 +276,30 @@ public class AppsManager {
}
private String getNewLabel(String oldLabel, String packageName) {
try {
int firstDot = packageName.indexOf(".") + 1;
int secondDot = packageName.substring(firstDot).indexOf(".") + firstDot;
StringBuilder newLabel = new StringBuilder();
if (firstDot == -1) {
newLabel.append(packageName);
newLabel.append(" ");
newLabel.append(Tuils.SPACE);
newLabel.append(oldLabel);
} else if (secondDot == -1) {
newLabel.append(packageName.substring(firstDot, packageName.length()));
newLabel.append(" ");
newLabel.append(Tuils.SPACE);
newLabel.append(oldLabel);
} else {
newLabel.append(packageName.substring(firstDot, secondDot));
newLabel.append(" ");
newLabel.append(Tuils.SPACE);
newLabel.append(oldLabel);
}
String label = newLabel.toString();
return label.substring(0, 1).toUpperCase() + label.substring(1);
} catch (IndexOutOfBoundsException e) {
return packageName;
}
}
public void unregisterReceiver(Context context) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment