OurPlay v5.5.9版本的 MD5 值为:d4e139798f4c2243a1145c8af5e21046
以下内容为反编译后的 c.java 源代码,内容仅作参考
package com.excelliance.kxqp.gs.ui.search.v2;
import android.content.Context;
import android.os.Handler;
import android.os.HandlerThread;
import android.text.TextUtils;
import android.util.Log;
import com.excelliance.kxqp.bean.AppStartedInfo;
import com.excelliance.kxqp.gs.bean.SearchKeyBean;
import com.excelliance.kxqp.gs.bean.SearchKeyResult;
import com.excelliance.kxqp.gs.discover.model.ResponseData;
import com.excelliance.kxqp.gs.provider.SearchProvider;
import com.excelliance.kxqp.gs.thpool.tp;
import com.excelliance.kxqp.gs.ui.search.SearchHotAndDiscover;
import com.excelliance.kxqp.gs.ui.search.v2.b;
import com.excelliance.kxqp.gs.util.az;
import com.excelliance.kxqp.gs.util.bf;
import com.excelliance.kxqp.gs.util.cd;
import com.excelliance.kxqp.gs.util.cn;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import java.util.ArrayList;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
public class c implements b.a {
private b.InterfaceC0454b f11188a;
private Context f11189b;
private List<com.excelliance.kxqp.gs.view.taglayout.a> c = new ArrayList();
private Handler d;
@Override
public void initData() {
}
public c(Context context, b.InterfaceC0454b interfaceC0454b) {
this.f11188a = interfaceC0454b;
this.f11189b = context;
HandlerThread handlerThread = new HandlerThread("SearchPresenterWorker", 10);
handlerThread.start();
this.d = new Handler(handlerThread.getLooper());
}
@Override
public void a() {
this.d.post(new Runnable() {
@Override
public void run() {
com.excelliance.kxqp.gs.c.b a2 = com.excelliance.kxqp.gs.c.b.a(c.this.f11189b);
c.this.c.clear();
List<String> query = a2.query("history");
for (int i = 0; i < query.size(); i++) {
com.excelliance.kxqp.gs.view.taglayout.a aVar = new com.excelliance.kxqp.gs.view.taglayout.a();
aVar.a(i);
aVar.a(true);
aVar.a(query.get(i));
c.this.c.add(aVar);
}
tp.i(new Runnable() {
@Override
public void run() {
c.this.f11188a.a(c.this.c);
}
});
}
});
}
@Override
public void b() {
com.excelliance.kxqp.gs.c.b.a(this.f11189b).d();
a();
}
@Override
public void a(final String str) {
this.d.post(new Runnable() {
@Override
public void run() {
com.excelliance.kxqp.gs.c.b.a(c.this.f11189b).a(str);
}
});
}
@Override
public boolean b(String str) {
return cd.d(str).toLowerCase().contains("vpn");
}
@Override
public void c() {
if (this.d == null) {
return;
}
this.d.post(new Runnable() {
@Override
public void run() {
List<AppStartedInfo> y = com.excelliance.kxqp.repository.a.a(c.this.f11189b).y();
int min = Math.min(y.size(), 3);
JSONArray jSONArray = new JSONArray();
if (min > 0) {
for (int i = 0; i < min; i++) {
AppStartedInfo appStartedInfo = y.get(i);
if (appStartedInfo != null && !TextUtils.isEmpty(appStartedInfo.packageName)) {
jSONArray.put(appStartedInfo.packageName);
}
}
}
com.excelliance.kxqp.gs.discover.bbs.c cVar = new com.excelliance.kxqp.gs.discover.bbs.c(c.this.f11189b);
JSONObject i2 = cn.i(c.this.f11189b);
try {
i2.put("controlapi", 1);
i2.put("isFromDomestic", 1);
i2.put("isnew", 1);
i2.put("startover_pkglist", jSONArray);
} catch (JSONException e) {
e.printStackTrace();
}
final ResponseData a2 = cVar.a(i2.toString(), "https://api.ourplay.com.cn/goneload/searchrecomd", new com.excelliance.kxqp.gs.discover.a.c<SearchHotAndDiscover>() {
@Override
public ResponseData<SearchHotAndDiscover> a(String str) {
try {
return (ResponseData) new Gson().a(str, new TypeToken<ResponseData<SearchHotAndDiscover>>() {
}.getType());
} catch (Exception e2) {
Log.e("SearchDiscoverPresenter", "getHotLabel/ex:" + e2);
return null;
}
}
});
if (a2 != null) {
tp.i(new Runnable() {
@Override
public void run() {
c.this.f11188a.a((SearchHotAndDiscover) a2.data);
}
});
}
}
});
}
@Override
public void d() {
this.d.getLooper().quit();
}
@Override
public void c(final String str) {
final SearchKeyResult searchKeyResult = new SearchKeyResult();
searchKeyResult.mKey = str;
if (bf.e(this.f11189b)) {
this.d.post(new Runnable() {
@Override
public void run() {
try {
String a2 = SearchProvider.a(c.this.f11189b, str, 5);
az.d("SearchDiscoverPresenter", "search result:" + a2);
ArrayList arrayList = new ArrayList();
if (!TextUtils.isEmpty(a2)) {
try {
JSONArray optJSONArray = new JSONObject(a2).optJSONArray("data");
if (optJSONArray != null && optJSONArray.length() > 0) {
for (int i = 0; i < optJSONArray.length(); i++) {
String optString = optJSONArray.optJSONObject(i).optString("title");
if (!TextUtils.isEmpty(optString)) {
SearchKeyBean searchKeyBean = new SearchKeyBean();
searchKeyBean.title = optString;
searchKeyBean.key = str;
arrayList.add(searchKeyBean);
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
searchKeyResult.mSearchKeyBeans = arrayList;
} catch (Exception e2) {
e2.printStackTrace();
}
if (c.this.f11188a != null) {
tp.i(new Runnable() {
@Override
public void run() {
c.this.f11188a.a(searchKeyResult);
}
});
}
}
});
} else if (this.f11188a != null) {
this.f11188a.a(searchKeyResult);
}
}
}