Skip to content

Commit

Permalink
fix2
Browse files Browse the repository at this point in the history
  • Loading branch information
pavly-gerges committed Jul 2, 2021
1 parent 5a901f2 commit 2184351
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -190,20 +190,24 @@ public void forEachUiState(UiStatesLooper.Modifiable.Looper uiStatesLooper){
*/
public String[] search(String[] searchList, String[] searchKeyWords, ActionInjector injector) throws Exception {
synchronized(this) {
final String[] resultList = new String[searchList.length];
final String[][] resultList = {new String[0]};
return Executors.callable(() -> {
for (int pos = 0; pos < searchList.length; pos++) {
for (String keyword : searchKeyWords) {
if (searchList[pos].replaceAll(" ","").trim().toLowerCase().contains(keyword.replaceAll(" ","").trim().toLowerCase())) {
resultList[pos] = searchList[pos];
//dynamic array conception
if(pos > resultList[0].length){
resultList[0] = Arrays.copyOf(resultList[0], resultList[0].length+1);
}
resultList[0][pos] = searchList[pos];
if(injector != null){
injector.execute(getChildUiStateByIndex(pos), pos);
}
break;
}
}
}
}, resultList).call();
}, resultList[0]).call();
}
}

Expand Down Expand Up @@ -237,7 +241,7 @@ public void revertSearchEngine(@Nullable ActionInjector actionInjector) throws E
public String[] sort(String[] list, int sortAlgorithm) throws Exception {
synchronized(this) {
//to apply the sort change as an external final change on a list copy (warning : ->Internal List change(positions or items count or items values) = Malicious Activity
final String[] copy = list;
final String[] copy = Arrays.copyOf(list, list.length);
return Executors.callable(() -> {
String tempPointer = "";
//main String List looping
Expand Down

0 comments on commit 2184351

Please sign in to comment.