GoooBet v1.0版本的 MD5 值为:ff9748f16167bfd7735b669c0a9931c5
以下内容为反编译后的 SuggestionsClient.java 源代码,内容仅作参考
package com.appsgeyser.multiTabApp.suggestions;
import com.appsgeyser.multiTabApp.MainNavigationActivity;
import com.appsgeyser.multiTabApp.server.BaseServerClient;
import java.io.StringReader;
import java.net.URLEncoder;
import java.util.ArrayList;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.InputSource;
public class SuggestionsClient extends BaseServerClient {
private SuggestionsListener listener;
public SuggestionsClient(MainNavigationActivity mainNavigationActivity) {
super(mainNavigationActivity);
}
public void setListener(SuggestionsListener suggestionsListener) {
this.listener = suggestionsListener;
}
public void getSuggestionsAsync(final String str) {
if (str == null || str == "") {
return;
}
sendRequestAsync("http://google.com/complete/search?output=toolbar&q=" + URLEncoder.encode(str), 99999, new BaseServerClient.OnRequestDoneListener() {
@Override
public void onRequestDone(String str2, int i, String str3) {
ArrayList<RemoteSuggestionItem> arrayList;
if (i != 99999 || str3 == null) {
return;
}
try {
arrayList = SuggestionsClient.this.tryGetSuggestsFromXml(str3);
} catch (Exception unused) {
arrayList = new ArrayList<>();
}
SuggestionsClient.this.listener.onReceiveSuggestions(arrayList, str);
}
});
}
public ArrayList<RemoteSuggestionItem> tryGetSuggestsFromXml(String str) {
try {
SAXParser newSAXParser = SAXParserFactory.newInstance().newSAXParser();
SuggestionsHandler suggestionsHandler = new SuggestionsHandler();
newSAXParser.parse(new InputSource(new StringReader(str)), suggestionsHandler);
return suggestionsHandler.getResult();
} catch (Exception e) {
e.printStackTrace();
return new ArrayList<>();
}
}
}