Browse Source

fix legwork suggestions parser

master
R4SAS 6 years ago
parent
commit
a880891cf2
  1. 6
      app/src/main/java/org/purplei2p/lightning/search/suggestions/LegworkSuggestionsModel.java

6
app/src/main/java/org/purplei2p/lightning/search/suggestions/LegworkSuggestionsModel.java

@ -35,11 +35,11 @@ public final class LegworkSuggestionsModel extends BaseSuggestionsModel {
@Override @Override
protected void parseResults(@NonNull InputStream inputStream, @NonNull List<HistoryItem> results) throws Exception { protected void parseResults(@NonNull InputStream inputStream, @NonNull List<HistoryItem> results) throws Exception {
String content = FileUtils.readStringFromStream(inputStream, ENCODING); String content = FileUtils.readStringFromStream(inputStream, ENCODING);
JSONArray jsonArray = new JSONArray(content); JSONArray respArray = new JSONArray(content);
JSONArray jsonArray = respArray.getJSONArray(1);
int counter = 0; int counter = 0;
for (int n = 0, size = jsonArray.length(); n < size; n++) { for (int n = 0, size = jsonArray.length(); n < size; n++) {
JSONObject object = jsonArray.getJSONObject(n); String suggestion = jsonArray.getString(n);
String suggestion = object.getString("phrase");
results.add(new HistoryItem(mSearchSubtitle + " \"" + suggestion + '"', results.add(new HistoryItem(mSearchSubtitle + " \"" + suggestion + '"',
suggestion, R.drawable.ic_search)); suggestion, R.drawable.ic_search));
counter++; counter++;

Loading…
Cancel
Save